kpilot Library API Documentation

doc-factory.cc

00001 /* doc-factory.cc KPilot 00002 ** 00003 ** Copyright (C) 2002 by Reinhold Kainhofer 00004 ** 00005 ** This file defines the factory for the doc-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 #include "doc-factory.moc" 00031 #include "doc-factory.h" 00032 00033 #include <kinstance.h> 00034 #include <kaboutdata.h> 00035 #include <kpilotlink.h> 00036 00037 #include "doc-conduit.h" 00038 #include "doc-setup.h" 00039 00040 00041 extern "C" { 00042 void *init_conduit_doc() { 00043 return new DOCConduitFactory; 00044 } 00045 } 00046 00047 00048 00049 // A number of static variables; except for fAbout, they're 00050 // all KConfig group or entry keys. 00051 // 00052 // 00053 KAboutData * DOCConduitFactory::fAbout = 0L; 00054 00055 const char *DOCConduitFactory::fGroup = "DOC-conduit"; 00056 const char *DOCConduitFactory::fTXTDir = "TXT Directory"; 00057 const char *DOCConduitFactory::fPDBDir = "PDB Directory"; 00058 const char *DOCConduitFactory::fKeepPDBLocally = "Keep PDBs locally"; 00059 const char *DOCConduitFactory::fConflictResolution = "Conflict Resolution"; 00060 const char *DOCConduitFactory::fConvertBookmarks = "Convert Bookmarks"; 00061 const char *DOCConduitFactory::fBookmarksBmk = "Bmk file bookmarks"; 00062 const char *DOCConduitFactory::fBookmarksInline = "Inline bookmarks"; 00063 const char *DOCConduitFactory::fBookmarksEndtags = "Endtag bookmarks"; 00064 const char *DOCConduitFactory::fCompress = "Compress"; 00065 const char *DOCConduitFactory::fSyncDirection = "Sync Direction"; 00066 const char *DOCConduitFactory::fDOCList = "Converted PalmDOCs"; 00067 const char *DOCConduitFactory::fIgnoreBmkChanges = "Ignore only bookmark changes"; 00068 const char *DOCConduitFactory::fAlwaysUseResolution = "Always show resolution dialog"; 00069 const char *DOCConduitFactory::fPCBookmarks = "Bookmarks to PC"; 00070 00071 const char *DOCConduitFactory::fLocalSync = "Sync only locally"; 00072 00073 const char *DOCConduitFactory::dbDOCtype = "TEXt"; 00074 const char *DOCConduitFactory::dbDOCcreator = "REAd"; 00075 00076 00077 00078 DOCConduitFactory::DOCConduitFactory(QObject * p, const char *n): 00079 KLibFactory(p, n) 00080 { 00081 FUNCTIONSETUP; 00082 fInstance = new KInstance("docconduit"); 00083 fAbout =new KAboutData("docconduit", 00084 I18N_NOOP("Palm DOC Conduit for KPilot"), KPILOT_VERSION, 00085 I18N_NOOP("Configures the DOC Conduit for KPilot"), 00086 KAboutData::License_GPL, "(C) 2002, Reinhold Kainhofer"); 00087 00088 fAbout->addAuthor("Reinhold Kainhofer", 00089 I18N_NOOP("Maintainer"), "reinhold@kainhofer.com", 00090 "http://reinhold.kainhofer.com"); 00091 } 00092 00093 DOCConduitFactory::~DOCConduitFactory() 00094 { 00095 FUNCTIONSETUP; 00096 KPILOT_DELETE(fInstance); 00097 KPILOT_DELETE(fAbout); 00098 } 00099 00100 00101 /* virtual */ QObject * DOCConduitFactory::createObject(QObject * p, 00102 const char *n, const char *c, const QStringList & a) 00103 { 00104 FUNCTIONSETUP; 00105 00106 #ifdef DEBUG 00107 DEBUGCONDUIT << fname <<": Creating object of class " <<c <<endl; 00108 #endif 00109 if (qstrcmp(c, "ConduitConfigBase") == 0) 00110 { 00111 QWidget *w = dynamic_cast<QWidget *>(p); 00112 if (w) 00113 { 00114 return new DOCWidgetConfig(w,n); 00115 } 00116 else 00117 { 00118 kdError() << k_funcinfo 00119 << ": Couldn't cast parent to widget." << endl; 00120 return 0L; 00121 } 00122 } 00123 if (qstrcmp(c, "ConduitConfig") == 0) 00124 { 00125 QWidget * w = dynamic_cast < QWidget * >(p); 00126 if (w) 00127 { 00128 return new DOCWidgetSetup(w, n, a); 00129 } 00130 else 00131 { 00132 kdError() << k_funcinfo 00133 <<": Couldn't cast parent to widget." <<endl; 00134 return 0L; 00135 } 00136 } 00137 if (qstrcmp(c, "SyncAction") == 0) 00138 { 00139 KPilotDeviceLink * d = dynamic_cast < KPilotDeviceLink * >(p); 00140 if (d) 00141 { 00142 return new DOCConduit(d, n, a); 00143 } 00144 else 00145 { 00146 kdError() << k_funcinfo 00147 <<": Couldn't cast parent to KPilotDeviceLink" <<endl; 00148 return 0L; 00149 } 00150 } 00151 return 0L; 00152 } 00153
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 Wed Jul 28 23:57:48 2004 by doxygen 1.3.7 written by Dimitri van Heesch, © 1997-2003