kpilot Library API Documentation

MultiDB-factory.h

00001 #ifndef _KPILOT_MultiDB_FACTORY_H
00002 #define _KPILOT_MultiDB_FACTORY_H
00003 /* MultiDB-factory.h                       KPilot
00004 **
00005 ** Copyright (C) 2001 by Dan Pilone
00006 ** Copyright (C) 2002 by Reinhold Kainhofer
00007 **
00008 ** This file defines the factory for the MultiDB-conduit plugin.
00009 ** It also defines the class for the behavior of the setup dialog.
00010 */
00011 
00012 /*
00013 ** This program is free software; you can redistribute it and/or modify
00014 ** it under the terms of the GNU General Public License as published by
00015 ** the Free Software Foundation; either version 2 of the License, or
00016 ** (at your option) any later version.
00017 **
00018 ** This program is distributed in the hope that it will be useful,
00019 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
00020 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
00021 ** GNU General Public License for more details.
00022 **
00023 ** You should have received a copy of the GNU General Public License
00024 ** along with this program in a file called COPYING; if not, write to
00025 ** the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston,
00026 ** MA 02111-1307, USA.
00027 */
00028 
00029 /*
00030 ** Bug reports and questions can be sent to kde-pim@kde.org
00031 */
00032 
00033 #include <qlistview.h>
00034 #include <klibloader.h>
00035 #include <kinstance.h>
00036 #include <kaboutdata.h>
00037 #include <klistview.h>
00038 #include "options.h"
00039 #include "kpilotlink.h"
00040 #include "plugin.h"
00041 //#include "MultiDB-factory.h"
00042 
00043 #ifdef KDE2
00044 #include <qlist.h>
00045 #define SyncTypeList_t QList<KPilotSyncType>
00046 #define SyncTypeIterator_t QListIterator<KPilotSyncType>
00047 #else
00048 #include <qptrlist.h>
00049 #define SyncTypeList_t QPtrList<KPilotSyncType>
00050 #define SyncTypeIterator_t QPtrListIterator<KPilotSyncType>
00051 #endif
00052 
00053 #define RES_PALMOVERRIDES 0
00054 #define RES_PCOVERRIDES 1
00055 #define RES_ASK 2
00056 
00057 #define SYNC_FIRST 0
00058 #define SYNC_FAST 1
00059 #define SYNC_FULL 2
00060 #define SYNC_MAX SYNC_FULL
00061 
00062 
00063 typedef enum synctps {
00064         st_ask, st_ignore, st_backup, st_pdb, st_vcal, st_ldap, st_sql, st_csv
00065 };
00066 
00067 class DBSyncInfo{
00068 public:
00069         DBSyncInfo(QListViewItem*item) {dbname=item->text(0); syncaction=item->text(1).toInt(); filename=item->text(2);};
00070         DBSyncInfo(){dbname=QString::null; syncaction=0; filename=QString::null; synctype=SYNC_FAST;}
00071         DBSyncInfo(char*db, int act, char*fn, int st=SYNC_FAST) {dbname=QString(db); syncaction=act; filename=QString(fn); synctype=st;};
00072         DBSyncInfo(QString db, int act, QString fn, int st=SYNC_FAST) {dbname=db; syncaction=act; filename=fn; synctype=st;};
00073         bool set(QString name, int act, QString fn, int st=SYNC_FAST) {dbname=name; syncaction=act; filename=fn; synctype=st; return true;}
00074         ~DBSyncInfo() {};
00075 public:
00076         QString dbname;
00077         int syncaction;
00078         int synctype;
00079         QString filename;
00080 };
00081 
00082 
00083 
00084 #define SYNC_NEEDSFILE 1
00085 #define SYNC_MAXFLAG SYNC_NEEDSFILE
00086 
00087 class KPilotSyncType {
00088 public:
00089         KPilotSyncType();
00090         KPilotSyncType(QString sn="", QString ln="", int i=st_ask, int flg=0);
00091         KPilotSyncType(KPilotSyncType*tp);
00092         virtual ~KPilotSyncType() {};
00093         virtual bool getFlag(int flg) const { return (flags & flg); }
00094         virtual int setFlag(int flg, bool on) { if (on) {flags|=flg;} else {flags&=(!flg);} return flags;}
00095 
00096 public:
00097         QString ShortName;
00098         QString LongName;
00099         int id;
00100         int flags;
00101 };
00102 
00103 class MultiDBConduitFactory : public KLibFactory {
00104 Q_OBJECT
00105 
00106 public:
00107         MultiDBConduitFactory(QObject * = 0L,const char * = 0L) ;
00108         virtual ~MultiDBConduitFactory();
00109 
00110         static KAboutData *about() { return fAbout; } ;
00111 
00112         virtual QObject*createSetupWidget(QWidget*, const char*, const QStringList &)=0;
00113         virtual QObject*createConduit(KPilotDeviceLink *, const char *n=0L, const QStringList &l=QStringList())=0;
00114         virtual void buildConduitInfo();
00115         virtual void customConduitInfo() {};    
00116 
00117 protected:
00118         virtual QObject* createObject( QObject* parent = 0,
00119                 const char* name = 0,
00120                 const char* classname = "QObject",
00121                 const QStringList &args = QStringList() ) ;
00122 private:
00123         KInstance *fInstance;
00124 public:
00125         static KAboutData *fAbout;
00126         static SyncTypeList_t *synctypes;
00127         static QString conflictResolution;
00128         static QString archive;
00129         static QString fullSyncOnPCChange;
00130 } ;
00131 
00132 
00133 // $Log: MultiDB-factory.h,v $
00134 // Revision 1.2.4.1  2003/03/12 23:31:10  adridg
00135 // CVS_SILENT: FSF address change
00136 //
00137 // Revision 1.2  2002/07/05 00:15:22  kainhofe
00138 // Added KPilotDeviceLink::tickle(), Changelog update, compile fixes
00139 //
00140 // Revision 1.1  2002/04/07 12:09:42  kainhofe
00141 // Initial checkin of the conduit. The gui works mostly, but syncing crashes KPilot...
00142 //
00143 // Revision 1.1  2002/04/07 01:03:52  reinhold
00144 // the list of possible actions is now created dynamically
00145 //
00146 // Revision 1.8  2002/04/05 21:17:00  reinhold
00147 // *** empty log message ***
00148 //
00149 // Revision 1.7  2002/03/28 13:47:53  reinhold
00150 // Added the list of synctypes, aboutbox is now directly passed on to the setup dlg (instead of being a static var)
00151 //
00152 // Revision 1.5  2002/03/23 21:46:42  reinhold
00153 // config  dlg works, but the last changes crash the plugin itself
00154 //
00155 // Revision 1.4  2002/03/23 18:21:14  reinhold
00156 // Cleaned up the structure. Works with QTimer instead of loops.
00157 //
00158 // Revision 1.3  2002/03/15 20:43:17  reinhold
00159 // Fixed the crash on loading (member function not defined)...
00160 //
00161 // Revision 1.2  2002/03/10 23:58:32  reinhold
00162 // Made the conduit compile...
00163 //
00164 // Revision 1.1.1.1  2002/03/09 15:38:45  reinhold
00165 // Initial checin of the  project manager / List manager conduit.
00166 //
00167 //
00168 
00169 
00170 #endif
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