00001
#ifndef _KPILOT_SYNCSTACK_H
00002
#define _KPILOT_SYNCSTACK_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
00033
#include <qptrqueue.h>
00034
00035
#include "plugin.h"
00036
00059
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070
00071
00072
00073
00074
00075
00076
00077
00078
00079
00080
00081
00082
00083
00084
00085
00086
00087
00088
00089
00090
00097 class ActionQueue :
public SyncAction
00098 {
00099 Q_OBJECT
00100
public:
00101
ActionQueue(KPilotDeviceLink *device);
00102
#if 0
00103
00104
ActionQueue(KPilotDeviceLink *device,
00105 KConfig *config,
00106
const QStringList &conduits = QStringList(),
00107
const QString &installDir = QString::null,
00108
const QStringList &installFiles = QStringList());
00109
#endif
00110
00111
virtual ~
ActionQueue();
00112
00113
private:
00114 QPtrQueue < SyncAction > SyncActionQueue;
00115
00116
public:
00117
bool isEmpty()
const {
return SyncActionQueue.isEmpty(); };
00122 void addAction(SyncAction * a) { SyncActionQueue.enqueue(a); };
00123
00124
protected:
00125
void clear() { SyncActionQueue.clear(); };
00126 SyncAction *nextAction() {
return SyncActionQueue.dequeue(); };
00127
00128
bool fReady;
00129 KConfig *fConfig;
00130
00131 QString fInstallerDir;
00132 QStringList fInstallerFiles;
00133 QStringList fConduits;
00134
00135
public:
00136
enum SyncModes {
00137
00138
00139
00140 Test=0,
00141 Backup=1,
00142 Restore=2,
00143 HotSync=4,
00144
00145
00146
00147
00148 WithBackup=0x10,
00149 WithUserCheck=0x20,
00150 WithInstaller=0x40,
00151 WithConduits=0x80,
00152
00153
00154 FlagPCToHH=0x100,
00155 FlagHHToPC=0x200,
00156 FlagLocal=0x1000,
00157 FlagFull=0x2000,
00158
00159 FlagTest=0x4000,
00160
00161
00162
00163
00164
00165
00166
00167 ActionMask=0xf,
00168 MixinMask=0xf0,
00169 FlagMask=0xff00,
00170
00171
00172
00173
00174 TestMode = Test | WithUserCheck | WithConduits | FlagTest,
00175 BackupMode = Backup | WithUserCheck | WithConduits | WithBackup,
00176 RestoreMode = Restore | WithUserCheck,
00177 HotSyncMode = HotSync | WithUserCheck | WithConduits
00178 } ;
00179
00180
#if 0
00181
00190
00191
void prepare(
int m);
00192
void prepareBackup() { prepare(BackupMode); } ;
00193
void prepareRestore() { prepare(RestoreMode); } ;
00194
void prepareSync() { prepare(HotSyncMode); } ;
00195
#endif
00196
00213
void queueInit(
int mode=WithUserCheck);
00214
void queueConduits(KConfig *,
const QStringList &conduits,
int mode=0);
00215
void queueInstaller(
const QString &dir,
const QStringList &files);
00216
void queueCleanup();
00217
00218
00219
protected:
00220
virtual bool exec();
00221
00222
protected slots:
00226
void actionCompleted(SyncAction *);
00227 };
00228
00233 class WelcomeAction :
public SyncAction
00234 {
00235 Q_OBJECT
00236
00237
public:
00238
WelcomeAction(KPilotDeviceLink *);
00239
00240
protected:
00241
virtual bool exec();
00242 } ;
00243
00249 class SorryAction :
public SyncAction
00250 {
00251 Q_OBJECT
00252
00253
public:
00254
SorryAction(KPilotDeviceLink *);
00255
00256
protected:
00257
virtual bool exec();
00258 } ;
00259
00266 class ConduitProxy :
public ConduitAction
00267 {
00268 Q_OBJECT
00269
00270
public:
00271
ConduitProxy(KPilotDeviceLink *,
00272
const QString &desktopName,
00273
int m);
00274
00275
protected:
00276
virtual bool exec();
00277
protected slots:
00278
void execDone(SyncAction *);
00279
00280
protected:
00281 QString fDesktopName;
00282 QString fLibraryName;
00283
ConduitAction *fConduit;
00284
int fMode;
00285 } ;
00286
00287
00288
#endif