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(KPilotDeviceLink *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: 00109 void queueInit(bool checkUser = false); 00110 void queueConduits(const QStringList &conduits,const SyncAction::SyncMode &e, bool local=false); 00111 void queueInstaller(const QString &dir); 00112 void queueCleanup(); 00113 00114 00115 protected: 00116 virtual bool exec(); 00117 00118 protected slots: 00122 void actionCompleted(SyncAction *); 00123 }; 00124 00129 class WelcomeAction : public SyncAction 00130 { 00131 public: 00132 WelcomeAction(KPilotDeviceLink *); 00133 00134 protected: 00135 virtual bool exec(); 00136 } ; 00137 00143 class SorryAction : public SyncAction 00144 { 00145 public: 00146 SorryAction(KPilotDeviceLink *, const QString &s=QString::null); 00147 00148 protected: 00149 virtual bool exec(); 00150 QString fMessage; 00151 } ; 00152 00160 class LocalBackupAction : public SyncAction 00161 { 00162 public: 00163 LocalBackupAction(KPilotDeviceLink *, const QString &); 00164 protected: 00165 virtual bool exec(); 00166 QString fDir; 00167 } ; 00168 00175 class ConduitProxy : public ConduitAction 00176 { 00177 Q_OBJECT 00178 00179 public: 00180 ConduitProxy(KPilotDeviceLink *, 00181 const QString &desktopName, 00182 const SyncAction::SyncMode &m); 00183 00184 protected: 00185 virtual bool exec(); 00186 protected slots: 00187 void execDone(SyncAction *); 00188 00189 protected: 00190 QString fDesktopName; 00191 QString fLibraryName; 00192 ConduitAction *fConduit; 00193 } ; 00194 00195 00196 #endif