kpilot Library API Documentation

todo-factory.cc

00001 /* todo-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 todo-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 "todo-setup.h"
00036 #include "todo-conduit.h"
00037 #include "todo-factory.moc"
00038 
00039 
00040 extern "C"
00041 {
00042 
00043 void *init_conduit_todo()
00044 {
00045     return new ToDoConduitFactory;
00046 }
00047 
00048 }
00049 
00050 
00051 ToDoConduitFactory::ToDoConduitFactory(QObject *p, const char *n) :
00052     VCalConduitFactoryBase(p,n)
00053 {
00054     FUNCTIONSETUP;
00055 
00056     fInstance = new KInstance("todoconduit");
00057     fAbout = new KAboutData("todoConduit",
00058         I18N_NOOP("ToDo Conduit for KPilot"),
00059         KPILOT_VERSION,
00060         I18N_NOOP("Configures the ToDo Conduit for KPilot"),
00061         KAboutData::License_GPL,
00062         "(C) 2001, Adriaan de Groot\n(C) 2002-2003, Reinhold Kainhofer");
00063     fAbout->addAuthor("Dan Pilone",
00064         I18N_NOOP("Original Author"));
00065     fAbout->addAuthor("Preston Brown",
00066         I18N_NOOP("Original Author"));
00067     fAbout->addAuthor("Herwin-Jan Steehouwer",
00068         I18N_NOOP("Original Author"));
00069     fAbout->addAuthor("Adriaan de Groot",
00070         I18N_NOOP("Maintainer"),
00071         "groot@kde.org",
00072         "http://www.cs.kun.nl/~adridg/kpilot");
00073     fAbout->addAuthor("Reinhold Kainhofer",
00074         I18N_NOOP("Maintainer"),
00075         "reinhold@kainhofer.com",
00076         "http://reinhold.kainhofer.com/Linux/");
00077     group="todoOptions";
00078 }
00079 
00080 ToDoConduitFactory::~ToDoConduitFactory()
00081 {
00082     FUNCTIONSETUP;
00083 
00084     KPILOT_DELETE(fInstance);
00085     KPILOT_DELETE(fAbout);
00086 }
00087 
00088 /* virtual */ QObject *ToDoConduitFactory::createObject( QObject *p,
00089     const char *n,
00090     const char *c,
00091     const QStringList &a)
00092 {
00093     FUNCTIONSETUP;
00094 
00095 #ifdef DEBUG
00096     DEBUGCONDUIT << fname
00097         << ": Creating object of class "
00098         << c
00099         << endl;
00100 #endif
00101 
00102     if (qstrcmp(c,"ConduitConfigBase")==0)
00103     {
00104         QWidget *w = dynamic_cast<QWidget *>(p);
00105 
00106         if (w)
00107         {
00108             return new ToDoWidgetSetup(w,n);
00109         }
00110         else
00111         {
00112 #ifdef DEBUG
00113             DEBUGCONDUIT << fname
00114                 << ": Couldn't cast parent to widget."
00115                 << endl;
00116 #endif
00117             return 0L;
00118         }
00119     }
00120 
00121     if (qstrcmp(c,"ConduitConfig")==0)
00122     {
00123         QWidget *w = dynamic_cast<QWidget *>(p);
00124 
00125         if (w)
00126         {
00127             return new ConduitConfigImplementation(w,n,a,
00128                 ToDoWidgetSetup::create);
00129         }
00130         else
00131         {
00132 #ifdef DEBUG
00133             DEBUGCONDUIT << fname
00134                 << ": Couldn't cast parent to widget."
00135                 << endl;
00136 #endif
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 TodoConduit(d,n,a);
00148         }
00149         else
00150         {
00151             kdError() << k_funcinfo
00152                 << ": Couldn't cast to KPilotDeviceLink."
00153                 << endl;
00154         }
00155     }
00156 
00157     return 0L;
00158 }
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