kpilot Library API Documentation

sysinfo-factory.cc

00001 /* SysInfo-factory.cc                      KPilot
00002 **
00003 ** Copyright (C) 2003 by Reinhold Kainhofer
00004 **
00005 ** This file defines the factory for the SysInfo-conduit plugin.
00006 */
00007 
00008 /*
00009 ** This program is free software; you can redistribute it and/or modify
00010 ** it under the terms of the GNU General Public License as published by
00011 ** the Free Software Foundation; either version 2 of the License, or
00012 ** (at your option) any later version.
00013 **
00014 ** This program is distributed in the hope that it will be useful,
00015 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
00016 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
00017 ** GNU General Public License for more details.
00018 **
00019 ** You should have received a copy of the GNU General Public License
00020 ** along with this program in a file called COPYING; if not, write to
00021 ** the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston,
00022 ** MA 02111-1307, USA.
00023 */
00024 
00025 /*
00026 ** Bug reports and questions can be sent to kde-pim@kde.org
00027 */
00028 
00029 #include "options.h"
00030 
00031 #include <kapplication.h>
00032 #include <kinstance.h>
00033 #include <kaboutdata.h>
00034 
00035 #include "sysinfo-conduit.h"
00036 #include "sysinfo-setup.h"
00037 
00038 #include "sysinfo-factory.moc"
00039 
00040 
00041 extern "C"
00042 {
00043 
00044 void *init_conduit_sysinfo()
00045 {
00046     return new SysInfoConduitFactory;
00047 }
00048 
00049 }
00050 
00051 
00052 // A number of static variables; except for fAbout, they're
00053 // all KConfig group or entry keys.
00054 //
00055 //
00056 KAboutData *SysInfoConduitFactory::fAbout = 0L;
00057 const char *SysInfoConduitFactory::fGroup = "SysInfo-conduit";
00058 const char *SysInfoConduitFactory::fOutputFile = "Output file";
00059 const char *SysInfoConduitFactory::fTemplateFile = "Template file";
00060 const char *SysInfoConduitFactory::fOutputType = "Output format";
00061 const char *SysInfoConduitFactory::fHardwareInfo = "Hardware Info";
00062 const char *SysInfoConduitFactory::fUserInfo = "User Info";
00063 const char *SysInfoConduitFactory::fMemoryInfo = "Memory Info";
00064 const char *SysInfoConduitFactory::fStorageInfo = "Storage Info";
00065 const char *SysInfoConduitFactory::fDBList = "Database List";
00066 const char *SysInfoConduitFactory::fRecordNumber = "Record Numbers";
00067 const char *SysInfoConduitFactory::fSyncInfo = "Sync Info";
00068 const char *SysInfoConduitFactory::fKDEVersion = "KDE Version";
00069 const char *SysInfoConduitFactory::fPalmOSVersion = "PalmOS Version";
00070 const char *SysInfoConduitFactory::fDebugInfo = "Debug Information";
00071 
00072 
00073 SysInfoConduitFactory::SysInfoConduitFactory(QObject *p, const char *n) :
00074     KLibFactory(p,n)
00075 {
00076     FUNCTIONSETUP;
00077 
00078     fInstance = new KInstance("SysInfoConduit");
00079     fAbout = new KAboutData("SysInfoConduit",
00080         I18N_NOOP("KPilot System Information conduit"),
00081         KPILOT_VERSION,
00082         I18N_NOOP("Retrieves System, Hardware, and User Info from the Handheld and stores them to a file."),
00083         KAboutData::License_GPL,
00084         "(C) 2003, Reinhold Kainhofer");
00085     fAbout->addAuthor("Reinhold Kainhofer",
00086         I18N_NOOP("Primary Author"), "reinhold@kainhofer.com", "http://reinhold.kainhofer.com/");
00087 }
00088 
00089 SysInfoConduitFactory::~SysInfoConduitFactory()
00090 {
00091     FUNCTIONSETUP;
00092 
00093     KPILOT_DELETE(fInstance);
00094     KPILOT_DELETE(fAbout);
00095 }
00096 
00097 /* virtual */ QObject *SysInfoConduitFactory::createObject( QObject *p,
00098     const char *n,
00099     const char *c,
00100     const QStringList &a)
00101 {
00102     FUNCTIONSETUP;
00103 
00104 #ifdef DEBUG
00105     DEBUGCONDUIT << fname
00106         << ": Creating object of class "
00107         << c
00108         << endl;
00109 #endif
00110 
00111     if (qstrcmp(c,"ConduitConfigBase")==0)
00112     {
00113         QWidget *w = dynamic_cast<QWidget *>(p);
00114         if (w)
00115         {
00116             return new SysInfoWidgetConfig(w,"ConduitConfigBase");
00117         }
00118         else
00119         {
00120             return 0L;
00121         }
00122     }
00123     else
00124     if (qstrcmp(c,"ConduitConfig")==0)
00125     {
00126         QWidget *w = dynamic_cast<QWidget *>(p);
00127 
00128         if (w)
00129         {
00130             return new SysInfoWidgetSetup(w,n,a);
00131         }
00132         else
00133         {
00134             kdError() << k_funcinfo
00135                 << ": Couldn't cast parent to widget."
00136                 << endl;
00137             return 0L;
00138         }
00139     }
00140 
00141     if (qstrcmp(c,"SyncAction")==0)
00142     {
00143         KPilotDeviceLink *d = dynamic_cast<KPilotDeviceLink *>(p);
00144 
00145         if (d)
00146         {
00147             return new SysInfoConduit(d,n,a);
00148         }
00149         else
00150         {
00151             kdError() << k_funcinfo
00152                 << ": Couldn't cast parent to KPilotDeviceLink"
00153                 << endl;
00154             return 0L;
00155         }
00156     }
00157 
00158     return 0L;
00159 }
00160 
KDE Logo
This file is part of the documentation for kpilot Library Version 3.2.2.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Sat May 1 11:36:49 2004 by doxygen 1.2.15 written by Dimitri van Heesch, © 1997-2003