kpilot/kpilot

hotSync.h

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 **
00008 ** This file defines SyncActions, which are used to perform some specific
00009 ** task during a HotSync. Conduits are not included here, nor are
00010 ** sync actions requiring user interaction. Those can be found in the
00011 ** conduits subdirectory or interactiveSync.h.
00012 */
00013 
00014 /*
00015 ** This program is free software; you can redistribute it and/or modify
00016 ** it under the terms of the GNU General Public License as published by
00017 ** the Free Software Foundation; either version 2 of the License, or
00018 ** (at your option) any later version.
00019 **
00020 ** This program is distributed in the hope that it will be useful,
00021 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
00022 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
00023 ** GNU General Public License for more details.
00024 **
00025 ** You should have received a copy of the GNU General Public License
00026 ** along with this program in a file called COPYING; if not, write to
00027 ** the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
00028 ** MA 02110-1301, USA.
00029 */
00030 
00031 /*
00032 ** Bug reports and questions can be sent to kde-pim@kde.org
00033 */
00034 
00035 
00036 class QTimer;
00037 
00038 #include "syncAction.h"
00039 #include "syncStack.h"
00040 
00041 class TestLink : public SyncAction
00042 {
00043 Q_OBJECT
00044 
00045 public:
00046     TestLink(KPilotDeviceLink *);
00047 
00048 protected:
00049     virtual bool exec();
00050 } ;
00051 
00052 class BackupAction : public SyncAction
00053 {
00054 Q_OBJECT
00055 
00056 public:
00057     BackupAction(KPilotDeviceLink *, bool full);
00058 
00059     enum Status { Init,
00060         Error,
00061         FastBackup,
00062         FullBackup,
00063         BackupIncomplete,
00064         BackupEnded,
00065         BackupComplete
00066         } ;
00067     virtual QString statusString() const;
00068 
00069 protected:
00070     virtual bool exec();
00071 
00072 private:
00076     void endBackup();
00077     bool createLocalDatabase(DBInfo *);
00078     bool checkBackupDirectory(QString backupDir);
00079 
00080 private slots:
00081     void backupOneDB();
00082 
00083 private:
00084     QTimer *fTimer;
00085     int fDBIndex;
00086     QString fBackupDir, fDatabaseDir;
00087     bool fFullBackup;
00088     QStringList fNoBackupDBs;
00089     QValueList<unsigned long> fNoBackupCreators;
00090     QStringList mDeviceDBs;
00091 } ;
00092 
00093 class FileInstallAction : public SyncAction
00094 {
00095 Q_OBJECT
00096 public:
00097     FileInstallAction(KPilotDeviceLink *,
00098         const QString &fileDir);
00099     virtual ~FileInstallAction();
00100 
00101     virtual QString statusString() const;
00102 
00103 protected:
00104     virtual bool exec();
00105 
00106 protected slots:
00107     void installNextFile();
00108 
00109 private:
00110     int fDBIndex;
00111     QTimer *fTimer;
00112     QString fDir;
00113     QStringList fList;
00114 
00115     // TODO: not const because it calls logError(), which is
00116     // non-const (but might be - can signals be const, anyway?)
00117     bool resourceOK(const QString &, const QString &) /* const */ ;
00118 } ;
00119 
00120 class CleanupAction : public SyncAction
00121 {
00122 public:
00123     CleanupAction(KPilotDeviceLink * p);
00124     virtual ~CleanupAction();
00125 
00126 protected:
00127     virtual bool exec();
00128 } ;
00129 
00130 #endif
KDE Home | KDE Accessibility Home | Description of Access Keys