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 
00102     int menuConfigureConduitsItem;
00103 
00107     KAboutApplication *kap;
00108 
00109 } ;
00110 
00111 class PilotDaemon : public QObject, virtual public PilotDaemonDCOP
00112 {
00113 Q_OBJECT
00114 
00115 // The tray must be our friend so that we can let it stop the daemon.
00116 friend class PilotDaemonTray;
00117 
00118 
00119 public:
00120     PilotDaemon();
00121     ~PilotDaemon();
00122 
00123     enum DaemonStatus
00124     {
00125         HOTSYNC_START,    // Hotsync is running
00126         HOTSYNC_END,      // Hotsync is cleaning up
00127         FILE_INSTALL_REQ, // A file is being saved for installation
00128         ERROR,
00129         READY,            // Connected to device and ready for Sync
00130         INIT
00131     };
00132 
00133     DaemonStatus status() const { return fStatus; } ;
00134     /* DCOP */ virtual QString statusString();
00135     QString  syncTypeString(int i) const;
00136 
00142     void showTray();
00143     void addInstallFiles(const QStringList &);
00144 
00145     // The next few functions are the DCOP interface
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
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:48 2004 by doxygen 1.2.15 written by Dimitri van Heesch, © 1997-2003