kpilot Library API Documentation

syncAction.h

00001 #ifndef _KPILOT_SYNCACTION_H
00002 #define _KPILOT_SYNCACTION_H
00003 /* syncAction.h         KPilot
00004 **
00005 ** Copyright (C) 1998-2001 by Dan Pilone
00006 **
00007 */
00008 
00009 /*
00010 ** This program is free software; you can redistribute it and/or modify
00011 ** it under the terms of the GNU Lesser General Public License as published by
00012 ** the Free Software Foundation; either version 2.1 of the License, or
00013 ** (at your option) any later version.
00014 **
00015 ** This program is distributed in the hope that it will be useful,
00016 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
00017 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
00018 ** GNU Lesser General Public License for more details.
00019 **
00020 ** You should have received a copy of the GNU Lesser General Public License
00021 ** along with this program in a file called COPYING; if not, write to
00022 ** the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston,
00023 ** MA 02111-1307, USA.
00024 */
00025 
00026 /*
00027 ** Bug reports and questions can be sent to kde-pim@kde.org
00028 */
00029 
00030 #include <time.h>
00031 
00032 #include <pi-dlp.h>
00033 
00034 
00035 #include <qobject.h>
00036 #include <qstring.h>
00037 
00038 #include "kpilotlink.h"
00039 
00040 class QTimer;
00041 class QSocketNotifier;
00042 class KPilotUser;
00043 class SyncAction;
00044 
00045 
00046 class SyncAction : public QObject
00047 {
00048 Q_OBJECT
00049 
00050 public:
00051     SyncAction(KPilotDeviceLink *p,
00052         const char *name=0L);
00053 
00054     typedef enum { Error=-1 } Status;
00055 
00056     int status() const { return fStatus; } ;
00057     virtual QString statusString() const;
00058 
00059 protected:
00073     virtual bool exec() = 0;
00074 
00075 public slots:
00080     void execConduit();
00081 
00082 signals:
00083     void syncDone(SyncAction *);
00084     void logMessage(const QString &);
00085     void logError(const QString &);
00086     void logProgress(const QString &,int);
00087 
00097 protected slots:
00098     void delayedDoneSlot();
00099 protected:
00100     bool delayDone();
00101 
00102 protected:
00103     KPilotDeviceLink *fHandle;
00104     int fStatus;
00105 
00106     void addSyncLogEntry(const QString &e,bool log=true)
00107         { fHandle->addSyncLogEntry(e,log); } ;
00108     int pilotSocket() const { return fHandle->pilotSocket(); } ;
00109 
00110     int openConduit() { return fHandle->openConduit(); } ;
00111 public:
00112     enum eSyncMode
00113     {
00114         eFastSync=0,
00115         eHotSync,
00116         eFullSync,
00117         eCopyPCToHH,
00118         eCopyHHToPC,
00119         eSyncModeLastRadiobutton=eFullSync
00120     };
00121     enum eConflictResolution
00122     {
00123         eUseGlobalSetting=-1,
00124         eAskUser=0,
00125         eDoNothing,
00126         eHHOverrides,
00127         ePCOverrides,
00128         ePreviousSyncOverrides,
00129         eDuplicate,
00130         eDelete,
00131         eCROffset=-1
00132     };
00133 } ;
00134 
00135 
00136 
00137 class InteractiveAction : public SyncAction
00138 {
00139 Q_OBJECT
00140 public:
00141     // Note that this takes a QWidget as additional parameter,
00142     // so that it can display windows relative to that if necessary.
00143     //
00144     //
00145     InteractiveAction(KPilotDeviceLink *p,
00146         QWidget *visibleparent=0L,
00147         const char *name=0L);
00148     virtual ~InteractiveAction();
00149 
00150     // Reminder that the whole point of the class is to implement
00151     // the pure virtual function exec().
00152     //
00153     // virtual void exec()=0;
00154 
00155 protected slots:
00160     void tickle();
00161 
00162 signals:
00163     void timeout();
00164 
00165 protected:
00166     QWidget *fParent;
00167     QTimer *fTickleTimer;
00168     unsigned fTickleCount,fTickleTimeout;
00169 
00181     void startTickle(unsigned count=0);
00182     void stopTickle();
00183 
00196     int questionYesNo(const QString &question ,
00197         const QString &caption = QString::null,
00198         const QString &key = QString::null,
00199         unsigned timeout = 20000);
00200 } ;
00201 
00202 #endif
KDE Logo
This file is part of the documentation for kpilot Library Version 3.2.2.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Sat May 1 11:36:49 2004 by doxygen 1.2.15 written by Dimitri van Heesch, © 1997-2003