kpilot Library API Documentation

expense-factory.cc

00001 /* expense-factory.cc                      KPilot
00002 **
00003 ** Copyright (C) 2001 by Dan Pilone
00004 **
00005 ** This file defines the factory for the expense-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 <qtabwidget.h>
00032 #include <qlineedit.h>
00033 #include <qbuttongroup.h>
00034 #include <qradiobutton.h>
00035 #include <qspinbox.h>
00036 
00037 #include <kconfig.h>
00038 #include <kinstance.h>
00039 #include <kaboutdata.h>
00040 
00041 #include "expense.h"
00042 #include "setupDialog.h"
00043 
00044 #include "expense-factory.moc"
00045 
00046 
00047 extern "C"
00048 {
00049 
00050 void *init_libexpenseconduit()
00051 {
00052         return new ExpenseConduitFactory;
00053 }
00054 
00055 } ;
00056 
00057 
00058 const char *ExpenseConduitFactory::fGroup="Expense-conduit";
00059 KAboutData *ExpenseConduitFactory::fAbout = 0L;
00060 ExpenseConduitFactory::ExpenseConduitFactory(QObject *p, const char *n) :
00061         KLibFactory(p,n)
00062 {
00063         FUNCTIONSETUP;
00064 
00065         fInstance = new KInstance("expenseconduit");
00066         fAbout = new KAboutData("expenseConduit",
00067                 I18N_NOOP("Expense Conduit for KPilot"),
00068                 KPILOT_VERSION,
00069                 I18N_NOOP("Configures the Expense Conduit for KPilot"),
00070                 KAboutData::License_GPL,
00071                 "(C) 2001, Adriaan de Groot and Chris Molnar");
00072         fAbout->addAuthor("Christopher Molnar",
00073                 I18N_NOOP("Primary Author"));
00074         fAbout->addAuthor("Adriaan de Groot",
00075                 I18N_NOOP("Maintainer"),
00076                 "groot@kde.org",
00077                 "http://www.cs.kun.nl/~adridg/kpilot");
00078 }
00079 
00080 ExpenseConduitFactory::~ExpenseConduitFactory()
00081 {
00082         FUNCTIONSETUP;
00083 
00084         KPILOT_DELETE(fAbout);
00085         KPILOT_DELETE(fInstance);
00086 }
00087 
00088 /* virtual */ QObject *ExpenseConduitFactory::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,"ConduitConfig")==0)
00103         {
00104                 QWidget *w = dynamic_cast<QWidget *>(p);
00105 
00106                 if (w)
00107                 {
00108                         return new ExpenseWidgetSetup(w,n,a);
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,"SyncAction")==0)
00122         {
00123                 KPilotDeviceLink *d = dynamic_cast<KPilotDeviceLink *>(p);
00124 
00125                 if (d)
00126                 {
00127                         return new ExpenseConduit(d,n,a);
00128                 }
00129                 else
00130                 {
00131                         kdError() << k_funcinfo
00132                                 << ": Couldn't cast to KPilotDeviceLink"
00133                                 << endl;
00134                         return 0L;
00135                 }
00136         }
00137         return 0L;
00138 }
KDE Logo
This file is part of the documentation for kdelibs Version 3.1.4.
Documentation copyright © 1996-2002 the KDE developers.
Generated on Sat Oct 18 02:47:14 2003 by doxygen 1.3.4 written by Dimitri van Heesch, © 1997-2001