kpilot Library API Documentation

vcal-factory.cc

00001 /* vcal-factory.cc                      KPilot
00002 **
00003 ** Copyright (C) 2002-2003 Reinhold Kainhofer
00004 ** Copyright (C) 2001 by Dan Pilone
00005 **
00006 ** This file defines the factory for the vcal-conduit plugin.
00007 */
00008 
00009 /*
00010 ** This program is free software; you can redistribute it and/or modify
00011 ** it under the terms of the GNU General Public License as published by
00012 ** the Free Software Foundation; either version 2 of the License, or
00013 ** (at your option) any later version.
00014 **
00015 ** This program is distributed in the hope that it will be useful,
00016 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
00017 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
00018 ** GNU General Public License for more details.
00019 **
00020 ** You should have received a copy of the GNU General Public License
00021 ** along with this program in a file called COPYING; if not, write to
00022 ** the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston,
00023 ** MA 02111-1307, USA.
00024 */
00025 
00026 /*
00027 ** Bug reports and questions can be sent to kde-pim@kde.org
00028 */
00029 
00030 #include "options.h"
00031 
00032 #include <kinstance.h>
00033 #include <kaboutdata.h>
00034 
00035 #include "vcal-setup.h"
00036 #include "vcal-conduit.h"
00037 #include "vcal-factory.moc"
00038 
00039 
00040 extern "C"
00041 {
00042 
00043 void *init_conduit_vcal()
00044 {
00045     return new VCalConduitFactory;
00046 }
00047 
00048 }
00049 
00050 // Configuration keys
00051 //
00052 //
00053 VCalConduitFactory::VCalConduitFactory(QObject *p, const char *n) :
00054     VCalConduitFactoryBase(p,n)
00055 {
00056     FUNCTIONSETUP;
00057 
00058     fInstance = new KInstance("vcalconduit");
00059     fAbout = new KAboutData("vcalConduit",
00060         I18N_NOOP("VCal Conduit for KPilot"),
00061         KPILOT_VERSION,
00062         I18N_NOOP("Configures the VCal Conduit for KPilot"),
00063         KAboutData::License_GPL,
00064         "(C) 2001, Adriaan de Groot\n(C) 2002-2003, Reinhold Kainhofer");
00065     fAbout->addAuthor("Adriaan de Groot",
00066         I18N_NOOP("Maintainer"),
00067         "groot@kde.org",
00068         "http://www.cs.kun.nl/~adridg/kpilot");
00069     fAbout->addAuthor("Reinhold Kainhofer",
00070         I18N_NOOP("Maintainer"),
00071         "reinhold@kainhofer.com",
00072         "http://reinhold.kainhofer.com/Linux/");
00073     fAbout->addAuthor("Dan Pilone",
00074         I18N_NOOP("Original Author"));
00075     fAbout->addAuthor("Preston Brown",
00076         I18N_NOOP("Original Author"));
00077     fAbout->addAuthor("Herwin-Jan Steehouwer",
00078         I18N_NOOP("Original Author"));
00079     fAbout->addCredit("Cornelius Schumacher",
00080         I18N_NOOP("iCalendar port"));
00081     fAbout->addCredit("Philipp Hullmann",
00082         I18N_NOOP("Bugfixer"));
00083     group="vcalOptions";
00084 }
00085 
00086 VCalConduitFactory::~VCalConduitFactory()
00087 {
00088     FUNCTIONSETUP;
00089 
00090     KPILOT_DELETE(fInstance);
00091 }
00092 
00093 /* virtual */ QObject *VCalConduitFactory::createObject( QObject *p,
00094     const char *n,
00095     const char *c,
00096     const QStringList &a)
00097 {
00098     FUNCTIONSETUP;
00099 
00100 #ifdef DEBUG
00101     DEBUGCONDUIT << fname
00102         << ": Creating object of class "
00103         << c
00104         << endl;
00105 #endif
00106 
00107     if (qstrcmp(c,"ConduitConfigBase")==0)
00108     {
00109         QWidget *w = dynamic_cast<QWidget *>(p);
00110 
00111         if (w)
00112         {
00113             return new VCalWidgetSetup(w,n);
00114         }
00115         else
00116         {
00117 #ifdef DEBUG
00118             DEBUGCONDUIT << fname
00119                 << ": Couldn't cast parent to widget."
00120                 << endl;
00121 #endif
00122             return 0L;
00123         }
00124     }
00125     if (qstrcmp(c,"ConduitConfig")==0)
00126     {
00127         QWidget *w = dynamic_cast<QWidget *>(p);
00128 
00129         if (w)
00130         {
00131             return new ConduitConfigImplementation(w,n,a,
00132                 VCalWidgetSetup::create);
00133         }
00134         else
00135         {
00136 #ifdef DEBUG
00137             DEBUGCONDUIT << fname
00138                 << ": Couldn't cast parent to widget."
00139                 << endl;
00140 #endif
00141             return 0L;
00142         }
00143     }
00144 
00145     if (qstrcmp(c,"SyncAction")==0)
00146     {
00147         KPilotDeviceLink *d = dynamic_cast<KPilotDeviceLink *>(p);
00148 
00149         if (d)
00150         {
00151             return new VCalConduit(d,n,a);
00152         }
00153         else
00154         {
00155             kdError() << k_funcinfo
00156                 << ": Couldn't cast to KPilotDeviceLink."
00157                 << endl;
00158         }
00159     }
00160 
00161     return 0L;
00162 }
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:50 2004 by doxygen 1.2.15 written by Dimitri van Heesch, © 1997-2003