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
00100 KAboutApplication *kap;
00101
00102 } ;
00103
00104 class PilotDaemon : public QObject, virtual public PilotDaemonDCOP
00105 {
00106 Q_OBJECT
00107
00108
00109 friend class PilotDaemonTray;
00110
00111
00112 public:
00113 PilotDaemon();
00114 ~PilotDaemon();
00115
00116 enum DaemonStatus
00117 {
00118 HOTSYNC_START,
00119 HOTSYNC_END,
00120 FILE_INSTALL_REQ,
00121 ERROR,
00122 READY,
00123 INIT
00124 };
00125
00126 DaemonStatus status() const { return fStatus; } ;
00127 virtual QString statusString();
00128 QString syncTypeString(int i) const;
00129
00135 void showTray();
00136 void addInstallFiles(QStrList);
00137
00138
00139
00140
00141 virtual ASYNC requestSync(int);
00142 virtual ASYNC requestFastSyncNext();
00143 virtual ASYNC requestRegularSyncNext();
00144 virtual int nextSyncType() const;
00145 virtual ASYNC quitNow();
00146 virtual ASYNC reloadSettings();
00147
00148 protected:
00149 DaemonStatus fStatus;
00150
00151 enum postSyncActions {
00152 None=0,
00153 ReloadSettings = 1,
00154 Quit = 2
00155 } ;
00156 int fPostSyncAction;
00157
00158 protected slots:
00159 void startHotSync();
00160 void endHotSync();
00161
00162 void logMessage(const QString &);
00163 void logError(const QString &);
00164 void logProgress(const QString &,int);
00165
00166 private:
00167 int getPilotSpeed(KPilotConfigSettings &);
00168
00169 bool setupPilotLink();
00170
00171 KPilotDeviceLink &getPilotLink() { return *fPilotLink; }
00172 KPilotDeviceLink *fPilotLink;
00173
00174 QString fPilotDevice;
00175 KPilotDeviceLink::DeviceType fPilotType;
00176 int fNextSyncType;
00177
00178 ActionQueue *fSyncStack;
00179
00184 PilotDaemonTray *fTray;
00185
00189 void updateTrayStatus(const QString &s=QString::null);
00190
00191 FileInstaller *fInstaller;
00192
00193 protected slots:
00200 void slotFilesChanged();
00201
00205 void slotRunKPilot();
00206
00207
00211 protected:
00212 LoggerDCOP_stub &getLogger() { return *fLogStub; } ;
00213 KPilotDCOP_stub &getKPilot() { return *fKPilotStub; } ;
00214
00215 private:
00216 LoggerDCOP_stub *fLogStub;
00217 KPilotDCOP_stub *fKPilotStub;
00218 };
00219
00220
00221 #endif
This file is part of the documentation for kdelibs Version 3.1.5.