kpilot Library API Documentation

time-factory.cc

00001 /* Time-factory.cc                      KPilot
00002 **
00003 ** Copyright (C) 2002 by Reinhold Kainhofer
00004 **
00005 ** This file defines the factory for the Time-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 <time.h> // Needed by pilot-link include
00036 #include "time-conduit.h"
00037 #include "time-setup.h"
00038 
00039 #include "time-factory.moc"
00040 
00041 
00042 extern "C"
00043 {
00044 
00045 void *init_conduit_time()
00046 {
00047     return new TimeConduitFactory;
00048 }
00049 
00050 }
00051 
00052 
00053 // A number of static variables; except for fAbout, they're 
00054 // all KConfig group or entry keys.
00055 //
00056 //
00057 KAboutData *TimeConduitFactory::fAbout = 0L;
00058 const char *TimeConduitFactory::fGroup = "Time-conduit";
00059 const char *TimeConduitFactory::fDirection = "Direction";
00060 
00061 
00062 TimeConduitFactory::TimeConduitFactory(QObject *p, const char *n) :
00063     KLibFactory(p,n)
00064 {
00065     FUNCTIONSETUP;
00066 
00067     fInstance = new KInstance("Timeconduit");
00068     fAbout = new KAboutData("Timeconduit",
00069         I18N_NOOP("Time Synchronization Conduit for KPilot"),
00070         KPILOT_VERSION,
00071         I18N_NOOP("Synchronizes the Time on the Handheld and the PC"),
00072         KAboutData::License_GPL,
00073         "(C) 2002, Reinhold Kainhofer");
00074     fAbout->addAuthor("Reinhold Kainhofer",
00075         I18N_NOOP("Primary Author"), "reinhold@kainhofer.com", "http://reinhold.kainhofer.com/");
00076 }
00077 
00078 TimeConduitFactory::~TimeConduitFactory()
00079 {
00080     FUNCTIONSETUP;
00081 
00082     KPILOT_DELETE(fInstance);
00083     KPILOT_DELETE(fAbout);
00084 }
00085 
00086 /* virtual */ QObject *TimeConduitFactory::createObject( QObject *p,
00087     const char *n,
00088     const char *c,
00089     const QStringList &a)
00090 {
00091     FUNCTIONSETUP;
00092 
00093 #ifdef DEBUG
00094     DEBUGCONDUIT << fname
00095         << ": Creating object of class "
00096         << c
00097         << endl;
00098 #endif
00099 
00100     if (qstrcmp(c,"ConduitConfigBase")==0)
00101     {
00102         QWidget *w = dynamic_cast<QWidget *>(p);
00103         if (w)
00104         {
00105             return new TimeWidgetConfig(w,"ConduitConfigBase");
00106         }
00107         else
00108         {
00109             return 0L;
00110         }
00111     }
00112     else
00113     if (qstrcmp(c,"ConduitConfig")==0)
00114     {
00115         QWidget *w = dynamic_cast<QWidget *>(p);
00116 
00117         if (w)
00118         {
00119             return new TimeWidgetSetup(w,n,a);
00120         }
00121         else 
00122         {
00123             kdError() << k_funcinfo
00124                 << ": Couldn't cast parent to widget."
00125                 << endl;
00126             return 0L;
00127         }
00128     }
00129 
00130     if (qstrcmp(c,"SyncAction")==0)
00131     {
00132         KPilotDeviceLink *d = dynamic_cast<KPilotDeviceLink *>(p);
00133 
00134         if (d)
00135         {
00136             return new TimeConduit(d,n,a);
00137         }
00138         else
00139         {
00140             kdError() << k_funcinfo
00141                 << ": Couldn't cast parent to KPilotDeviceLink"
00142                 << endl;
00143             return 0L;
00144         }
00145     }
00146 
00147     return 0L;
00148 }
00149 
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