kpilot/kpilot
syncStack.h
Go to the documentation of this file.00001 #ifndef _KPILOT_SYNCSTACK_H 00002 #define _KPILOT_SYNCSTACK_H 00003 /* syncStack.h KPilot 00004 ** 00005 ** Copyright (C) 1998-2001,2003 by Dan Pilone 00006 ** Copyright (C) 2003-2004 Reinhold Kainhofer <reinhold@kainhofer.com> 00007 ** 00008 ** This defines the "ActionQueue", which is the sequence of actions 00009 ** that will occur during a HotSync. There's also two fairly 00010 ** unimportant SyncActions defined. 00011 */ 00012 00013 /* 00014 ** This program is free software; you can redistribute it and/or modify 00015 ** it under the terms of the GNU General Public License as published by 00016 ** the Free Software Foundation; either version 2 of the License, or 00017 ** (at your option) any later version. 00018 ** 00019 ** This program is distributed in the hope that it will be useful, 00020 ** but WITHOUT ANY WARRANTY; without even the implied warranty of 00021 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00022 ** GNU General Public License for more details. 00023 ** 00024 ** You should have received a copy of the GNU General Public License 00025 ** along with this program in a file called COPYING; if not, write to 00026 ** the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 00027 ** MA 02110-1301, USA. 00028 */ 00029 00030 /* 00031 ** Bug reports and questions can be sent to kde-pim@kde.org 00032 */ 00033 00034 #include <qptrqueue.h> 00035 00036 #include "plugin.h" 00037 00061 class ActionQueue : public SyncAction 00062 { 00063 Q_OBJECT 00064 public: 00068 ActionQueue(KPilotLink *device); 00069 00070 virtual ~ActionQueue(); 00071 00072 private: 00073 QPtrQueue < SyncAction > SyncActionQueue; 00074 00075 public: 00076 bool isEmpty() const { return SyncActionQueue.isEmpty(); }; 00081 void addAction(SyncAction * a) { SyncActionQueue.enqueue(a); }; 00082 00083 protected: 00084 void clear() { SyncActionQueue.clear(); }; 00085 SyncAction *nextAction() { return SyncActionQueue.dequeue(); }; 00086 00087 bool fReady; 00088 00089 QString fInstallerDir; 00090 QStringList fInstallerFiles; 00091 QStringList fConduits; 00092 00093 public: 00097 enum InitFlags { 00098 queueNone=0, 00099 queueCheckUser 00100 } ; 00101 00117 void queueInit( InitFlags checkUser = queueNone ); 00118 void queueConduits(const QStringList &conduits,const SyncAction::SyncMode &e, bool local=false); 00119 void queueInstaller(const QString &dir); 00120 void queueCleanup(); 00121 00122 00123 protected: 00124 virtual bool exec(); 00125 00126 protected slots: 00130 void actionCompleted(SyncAction *); 00131 }; 00132 00137 class WelcomeAction : public SyncAction 00138 { 00139 public: 00140 WelcomeAction(KPilotLink *); 00141 00142 protected: 00143 virtual bool exec(); 00144 } ; 00145 00151 class SorryAction : public SyncAction 00152 { 00153 public: 00154 SorryAction(KPilotLink *, const QString &s=QString::null); 00155 00156 protected: 00157 virtual bool exec(); 00158 QString fMessage; 00159 } ; 00160 00168 class LocalBackupAction : public SyncAction 00169 { 00170 public: 00171 LocalBackupAction(KPilotLink *, const QString &); 00172 protected: 00173 virtual bool exec(); 00174 QString fDir; 00175 } ; 00176 00183 class ConduitProxy : public ConduitAction 00184 { 00185 Q_OBJECT 00186 00187 public: 00188 ConduitProxy(KPilotLink *, 00189 const QString &desktopName, 00190 const SyncAction::SyncMode &m); 00191 00192 protected: 00193 virtual bool exec(); 00194 protected slots: 00195 void execDone(SyncAction *); 00196 00197 protected: 00198 QString fDesktopName; 00199 QString fLibraryName; 00200 ConduitAction *fConduit; 00201 } ; 00202 00203 00204 #endif