pilotDaemon.h
00001 #ifndef _KPILOT_PILOTDAEMON_H
00002 #define _KPILOT_PILOTDAEMON_H
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032 #include <qpixmap.h>
00033 #include <ksystemtray.h>
00034
00035 #include "kpilotlink.h"
00036 #include "pilotDaemonDCOP.h"
00037
00038 class QDragEnterEvent;
00039 class QDropEvent;
00040
00041 class KServerSocket;
00042 class KConfig;
00043 class KSocket;
00044 class KProcess;
00045 class KAboutApplication;
00046
00047 class PilotRecord;
00048 class KPilotDCOP_stub;
00049 class LoggerDCOP_stub;
00050
00051
00052 class PilotDaemon;
00053 class FileInstaller;
00054 class ActionQueue;
00055
00056 class PilotDaemonTray : public KSystemTray
00057 {
00058 Q_OBJECT
00059
00060 public:
00061 PilotDaemonTray(PilotDaemon *p);
00062
00063 typedef enum { Normal,Busy } IconShape ;
00064 void changeIcon(IconShape);
00065
00066 void enableRunKPilot(bool);
00067
00068 virtual void dragEnterEvent(QDragEnterEvent *);
00069 virtual void dropEvent(QDropEvent *);
00070
00071
00072 protected:
00073 void setupWidget();
00074
00075 protected slots:
00076 void slotShowAbout();
00077 void slotShowBusy();
00078 void slotShowNormal();
00079
00080
00081
00082
00083 virtual void mousePressEvent(QMouseEvent* e);
00084 virtual void closeEvent(QCloseEvent *e);
00085
00086 private:
00087 QPixmap icon,busyicon;
00088 PilotDaemon *daemon;
00089
00095 int menuKPilotItem;
00096
00102 int menuConfigureConduitsItem;
00103
00107 KAboutApplication *kap;
00108
00109 } ;
00110
00111 class PilotDaemon : public QObject, virtual public PilotDaemonDCOP
00112 {
00113 Q_OBJECT
00114
00115
00116 friend class PilotDaemonTray;
00117
00118
00119 public:
00120 PilotDaemon();
00121 ~PilotDaemon();
00122
00123 enum DaemonStatus
00124 {
00125 HOTSYNC_START,
00126 HOTSYNC_END,
00127 FILE_INSTALL_REQ,
00128 ERROR,
00129 READY,
00130 INIT
00131 };
00132
00133 DaemonStatus status() const { return fStatus; } ;
00134 virtual QString statusString();
00135 QString syncTypeString(int i) const;
00136
00142 void showTray();
00143 void addInstallFiles(const QStringList &);
00144
00145
00146
00147
00148 virtual ASYNC requestSync(int);
00149 virtual ASYNC requestFastSyncNext();
00150 virtual ASYNC requestRegularSyncNext();
00151 virtual int nextSyncType() const;
00152 virtual ASYNC quitNow();
00153 virtual ASYNC reloadSettings();
00154
00155 protected:
00156 DaemonStatus fStatus;
00157
00158 enum postSyncActions {
00159 None=0,
00160 ReloadSettings = 1,
00161 Quit = 2
00162 } ;
00163 int fPostSyncAction;
00164
00165 protected slots:
00166 void startHotSync();
00167 void endHotSync();
00168
00169 void logMessage(const QString &);
00170 void logError(const QString &);
00171 void logProgress(const QString &,int);
00172
00173 private:
00174 int getPilotSpeed(KPilotConfigSettings &);
00175
00176 bool setupPilotLink();
00177
00178 KPilotDeviceLink &getPilotLink() { return *fPilotLink; }
00179 KPilotDeviceLink *fPilotLink;
00180
00181 QString fPilotDevice;
00182 KPilotDeviceLink::DeviceType fPilotType;
00183 int fNextSyncType;
00184
00185 ActionQueue *fSyncStack;
00186
00191 PilotDaemonTray *fTray;
00192
00196 void updateTrayStatus(const QString &s=QString::null);
00197
00198 FileInstaller *fInstaller;
00199
00200 protected slots:
00207 void slotFilesChanged();
00208
00212 void slotRunKPilot();
00213
00217 void slotRunConduitConfig();
00218
00222 protected:
00223 LoggerDCOP_stub &getLogger() { return *fLogStub; } ;
00224 KPilotDCOP_stub &getKPilot() { return *fKPilotStub; } ;
00225
00226 private:
00227 LoggerDCOP_stub *fLogStub;
00228 KPilotDCOP_stub *fKPilotStub;
00229 };
00230
00231
00232 #endif
This file is part of the documentation for kpilot Library Version 3.2.2.