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 } ;
00112 
00113 
00114 
00115 class InteractiveAction : public SyncAction
00116 {
00117 Q_OBJECT
00118 public:
00119         // Note that this takes a QWidget as additional parameter,
00120         // so that it can display windows relative to that if necessary.
00121         //
00122         //
00123         InteractiveAction(KPilotDeviceLink *p,
00124                 QWidget *visibleparent=0L,
00125                 const char *name=0L);
00126         virtual ~InteractiveAction();
00127 
00128         // Reminder that the whole point of the class is to implement
00129         // the pure virtual function exec().
00130         //
00131         // virtual void exec()=0;
00132 
00133 protected slots:
00138         void tickle();
00139 
00140 signals:
00141         void timeout();
00142 
00143 protected:
00144         QWidget *fParent;
00145         QTimer *fTickleTimer;
00146         unsigned fTickleCount,fTickleTimeout;
00147 
00159         void startTickle(unsigned count=0);
00160         void stopTickle();
00161 
00174         int questionYesNo(const QString &question ,
00175                 const QString &caption = QString::null,
00176                 const QString &key = QString::null,
00177                 unsigned timeout = 20000);
00178 } ;
00179 
00180 #endif
KDE Logo
This file is part of the documentation for kdelibs Version 3.1.4.
Documentation copyright © 1996-2002 the KDE developers.
Generated on Sat Oct 18 02:47:15 2003 by doxygen 1.3.4 written by Dimitri van Heesch, © 1997-2001