kpilot

hotSync.h

Go to the documentation of this file.
00001 #ifndef _KPILOT_HOTSYNC_H
00002 #define _KPILOT_HOTSYNC_H
00003 /* hotSync.h                            KPilot
00004 **
00005 ** Copyright (C) 2001 by Dan Pilone
00006 ** Copyright (C) 2003-2004 Reinhold Kainhofer <reinhold@kainhofer.com>
00007 ** Copyright (C) 2006 Adriaan de Groot <groot@kde.org>
00008 **
00009 ** This file defines SyncActions, which are used to perform some specific
00010 ** task during a HotSync. Conduits are not included here, nor are
00011 ** sync actions requiring user interaction. Those can be found in the
00012 ** conduits subdirectory or interactiveSync.h.
00013 */
00014 
00015 /*
00016 ** This program is free software; you can redistribute it and/or modify
00017 ** it under the terms of the GNU General Public License as published by
00018 ** the Free Software Foundation; either version 2 of the License, or
00019 ** (at your option) any later version.
00020 **
00021 ** This program is distributed in the hope that it will be useful,
00022 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
00023 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
00024 ** GNU General Public License for more details.
00025 **
00026 ** You should have received a copy of the GNU General Public License
00027 ** along with this program in a file called COPYING; if not, write to
00028 ** the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
00029 ** MA 02110-1301, USA.
00030 */
00031 
00032 /*
00033 ** Bug reports and questions can be sent to kde-pim@kde.org
00034 */
00035 
00036 
00037 class QTimer;
00038 
00039 #include "syncAction.h"
00040 
00041 class CheckUser : public SyncAction
00042 {
00043 public:
00044     CheckUser(KPilotLink *p,QWidget *w=0L);
00045     virtual ~CheckUser();
00046 
00047 protected:
00048     virtual bool exec();
00049 } ;
00050 
00051 
00052 class BackupAction : public SyncAction
00053 {
00054 Q_OBJECT
00055 
00056 public:
00065     BackupAction(KPilotLink *, bool full);
00066 
00067     enum Status { Init,
00068         Error,
00069         FastBackup,
00070         FullBackup,
00071         BackupIncomplete,
00072         BackupEnded,
00073         BackupComplete
00074         } ;
00075     virtual QString statusString() const;
00076 
00086     void setDirectory( const QString &path );
00087 
00088     // Reimplemented to support threaded backup.
00089     virtual bool event( QEvent *e );
00090 
00091 protected:
00092     virtual bool exec();
00093 
00094 private:
00096     void endBackup();
00097 
00101     bool startBackupThread(DBInfo *info);
00102 
00103 private slots:
00108     void backupOneDB();
00109 
00110 private:
00111     class Private;
00112     Private *fP;
00113     class Thread;
00114     Thread *fBackupThread;
00115 } ;
00116 
00117 class FileInstallAction : public SyncAction
00118 {
00119 Q_OBJECT
00120 public:
00121     FileInstallAction(KPilotLink *,
00122         const QString &fileDir);
00123     virtual ~FileInstallAction();
00124 
00125     virtual QString statusString() const;
00126 
00127 protected:
00128     virtual bool exec();
00129 
00130 protected slots:
00131     void installNextFile();
00132 
00133 private:
00134     int fDBIndex;
00135     QTimer *fTimer;
00136     QString fDir;
00137     QStringList fList;
00138 
00139     // TODO: not const because it calls logError(), which is
00140     // non-const (but might be - can signals be const, anyway?)
00141     bool resourceOK(const QString &, const QString &) /* const */ ;
00142 } ;
00143 
00144 class RestoreAction : public SyncAction
00145 {
00146 Q_OBJECT
00147 public:
00148     RestoreAction(KPilotLink *,QWidget *w=0L);
00149 
00150     typedef enum { InstallingFiles, GettingFileInfo,Done } Status;
00151     virtual QString statusString() const;
00152 
00162     void setDirectory( const QString &path );
00163 
00164 protected:
00165     virtual bool exec();
00166 
00167 protected slots:
00168     void installNextFile();
00169 
00170 private:
00171     class Private;
00172     Private *fP;
00173 } ;
00174 
00175 #endif