kpilot Library API Documentation

pilotDaemon.h

00001 #ifndef _KPILOT_PILOTDAEMON_H
00002 #define _KPILOT_PILOTDAEMON_H
00003 /* pilotDaemon.h                        KPilot
00004 **
00005 ** Copyright (C) 1998-2001 by Dan Pilone
00006 **
00007 ** See the .cc file for an explanation of what this file is for.
00008 */
00009 
00010 /*
00011 ** This program is free software; you can redistribute it and/or modify
00012 ** it under the terms of the GNU General Public License as published by
00013 ** the Free Software Foundation; either version 2 of the License, or
00014 ** (at your option) any later version.
00015 **
00016 ** This program is distributed in the hope that it will be useful,
00017 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
00018 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
00019 ** GNU General Public License for more details.
00020 **
00021 ** You should have received a copy of the GNU General Public License
00022 ** along with this program in a file called COPYING; if not, write to
00023 ** the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, 
00024 ** MA 02111-1307, USA.
00025 */
00026 
00027 /*
00028 ** Bug reports and questions can be sent to kde-pim@kde.org
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         // "Regular" QT actions
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 // The tray must be our friend so that we can let it stop the daemon.
00109 friend class PilotDaemonTray;
00110 
00111 
00112 public:
00113         PilotDaemon();
00114         ~PilotDaemon();
00115 
00116         enum DaemonStatus
00117         {
00118                 HOTSYNC_START,    // Hotsync is running
00119                 HOTSYNC_END,      // Hotsync is cleaning up
00120                 FILE_INSTALL_REQ, // A file is being saved for installation
00121                 ERROR,
00122                 READY,            // Connected to device and ready for Sync
00123                 INIT
00124         };
00125 
00126         DaemonStatus status() const { return fStatus; } ;
00127         /* DCOP */ virtual QString statusString();
00128         QString  syncTypeString(int i) const;
00129 
00135         void showTray();
00136         void addInstallFiles(QStrList);
00137 
00138         // The next few functions are the DCOP interface
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
KDE Logo
This file is part of the documentation for kdelibs Version 3.1.5.
Documentation copyright © 1996-2002 the KDE developers.
Generated on Sun Feb 15 11:40:44 2004 by doxygen 1.3.5 written by Dimitri van Heesch, © 1997-2001