kpilot
plugin.hGo to the documentation of this file.00001 #ifndef _KPILOT_PLUGIN_H
00002 #define _KPILOT_PLUGIN_H
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032 #include <qstringlist.h>
00033
00034 #include "syncAction.h"
00035
00045 class QTabWidget;
00046 class KAboutData;
00047 class KLibrary;
00048
00049 class PilotDatabase;
00050
00051 namespace Pilot
00052 {
00059 static const unsigned int PLUGIN_API = 20061118;
00060 }
00061
00078 class KDE_EXPORT ConduitConfigBase : public QObject
00079 {
00080 Q_OBJECT
00081 public:
00086 ConduitConfigBase(QWidget *parent=0L, const char *n=0L);
00087
00089 virtual ~ConduitConfigBase();
00090
00097 virtual bool isModified() const
00098 {
00099 return fModified;
00100 } ;
00101
00103 QWidget *widget() const
00104 {
00105 return fWidget;
00106 } ;
00107
00114 virtual void commit() = 0;
00115 virtual void load() = 0;
00125 virtual bool maybeSave();
00126
00127 QString conduitName() const { return fConduitName; } ;
00128
00142 static void addAboutPage(QTabWidget *w,
00143 KAboutData *data=0L);
00144
00157 static QWidget *aboutPage(QWidget *parent, KAboutData *data=0L);
00158
00159 protected:
00164 virtual QString maybeSaveText() const;
00165
00166 void unmodified() { fModified=false; } ;
00167
00168 bool fModified;
00169 QWidget *fWidget;
00170 QString fConduitName;
00171
00172
00173 protected slots:
00174 void modified();
00175 signals:
00176 void changed(bool);
00177
00178 } ;
00179
00180
00194 class KDE_EXPORT CUDCounter
00195 {
00196 public:
00199 CUDCounter(QString s);
00200
00202 void created(unsigned int c=1);
00204 void updated(unsigned int u=1);
00206 void deleted(unsigned int d=1);
00208 void setStartCount(unsigned int t);
00210 void setEndCount(unsigned int t);
00211
00212 unsigned int countCreated() { return fC; }
00213 unsigned int countUpdated() { return fU; }
00214 unsigned int countDeleted() { return fD; }
00215 unsigned int countStart() { return fStart; }
00216 unsigned int countEnd() { return fEnd; }
00217
00222 unsigned int percentCreated() { return (fEnd > 0 ? fC/fEnd : 0); }
00223 unsigned int percentUpdated() { return (fEnd > 0 ? fU/fEnd : 0); }
00224 unsigned int percentDeleted() { return (fStart > 0 ? fD/fStart : 0); }
00225
00230 QString moo() const;
00231
00235 QString type() const { return fType; }
00236 private:
00241 unsigned int fC,fU,fD,fStart,fEnd;
00242
00246 QString fType;
00247 } ;
00248
00249
00260 class KDE_EXPORT ConduitAction : public SyncAction
00261 {
00262 Q_OBJECT
00263
00264 public:
00265 ConduitAction(KPilotLink *,
00266 const char *name=0L,
00267 const QStringList &args = QStringList());
00268 virtual ~ConduitAction();
00269
00273 void finished();
00274
00275 QString conduitName() const { return fConduitName; } ;
00276
00278 const SyncMode &syncMode() const { return fSyncDirection; };
00279
00285 bool isFullSync() const
00286 {
00287 return fFirstSync || fSyncDirection.isFullSync() ;
00288 }
00289
00297 bool isFirstSync() const
00298 {
00299 return fFirstSync || fSyncDirection.isFirstSync() ;
00300 }
00301
00302 protected:
00304 ConflictResolution getConflictResolution() const
00305 { return fConflictResolution; };
00306
00311 bool changeSync(SyncMode::Mode m);
00312
00313
00314
00315
00316
00317
00318 void setConflictResolution(ConflictResolution res)
00319 {
00320 if (SyncAction::eUseGlobalSetting != res)
00321 fConflictResolution=res;
00322 }
00323
00324 void setFirstSync(bool first) { fFirstSync=first; } ;
00325
00326 PilotDatabase *fDatabase;
00327 PilotDatabase *fLocalDatabase;
00328
00341 bool openDatabases(const QString &dbName, bool*retrieved=0L);
00342
00347 QString fConduitName;
00348
00351 CUDCounter *fCtrHH;
00352 CUDCounter *fCtrPC;
00353
00354 private:
00355 SyncMode fSyncDirection;
00356 ConflictResolution fConflictResolution;
00357
00358 bool fFirstSync;
00359 } ;
00360
00367 class ConduitProxy : public ConduitAction
00368 {
00369 Q_OBJECT
00370
00371 public:
00372 ConduitProxy(KPilotLink *,
00373 const QString &desktopName,
00374 const SyncAction::SyncMode &m);
00375
00376 protected:
00377 virtual bool exec();
00378 protected slots:
00379 void execDone(SyncAction *);
00380
00381 protected:
00382 QString fDesktopName;
00383 QString fLibraryName;
00384 ConduitAction *fConduit;
00385 } ;
00386
00388 namespace PluginUtility
00389 {
00392 QString findArgument(const QStringList &a, const QString argname);
00393
00402 bool isRunning(const QCString &appName);
00403
00408 unsigned long pluginVersion(const KLibrary *);
00409 QString pluginVersionString(const KLibrary *);
00410 }
00411
00476 #endif
|