kalarm Library API Documentation

daemongui.h

00001 /*
00002  *  daemongui.h  -  handler for the alarm daemon GUI interface
00003  *  Program:  kalarm
00004  *  (C) 2002 by David Jarvie  software@astrojar.org.uk
00005  *
00006  *  This program is free software; you can redistribute it and/or modify
00007  *  it under the terms of the GNU General Public License as published by
00008  *  the Free Software Foundation; either version 2 of the License, or
00009  *  (at your option) any later version.
00010  *
00011  *  This program is distributed in the hope that it will be useful,
00012  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
00014  *  GNU General Public License for more details.
00015  *
00016  *  You should have received a copy of the GNU General Public License
00017  *  along with this program; if not, write to the Free Software
00018  *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00019  */
00020 #ifndef DAEMONGUIHANDLER_H
00021 #define DAEMONGUIHANDLER_H
00022 
00023 #include <qtimer.h>
00024 #include <kaction.h>
00025 
00026 #include <kalarmd/alarmguiiface.h>
00027 class ActionAlarmsEnabled;
00028 
00029 
00030 /*=============================================================================
00031 =  Class: DaemonGuiHandler
00032 =  Handles the the alarm daemon's GUI client DCOP interface,
00033 =  and keeps track of the alarm daemon's alarm monitoring status.
00034 =============================================================================*/
00035 
00036 class DaemonGuiHandler : public QObject, virtual public AlarmGuiIface
00037 {
00038                 Q_OBJECT
00039         public:
00040                 explicit DaemonGuiHandler(const char *name = 0L);
00041 
00042                 bool                 monitoringAlarms();
00043                 void                 checkStatus()                 { checkIfDaemonRunning(); }
00044                 void                 setAlarmsEnabled(bool enable);
00045 
00046         private slots:
00047                 void                 timerCheckDaemonRunning();
00048                 void                 slotSettingsChanged();
00049 
00050         private:
00051                 static QString       expandURL(const QString& urlString);
00052                 void                 registerGuiWithDaemon();
00053                 void                 daemonEnableCalendar(bool enable);
00054                 bool                 checkIfDaemonRunning();
00055                 void                 setFastDaemonCheck();
00056                 // DCOP interface
00057                 void                 alarmDaemonUpdate(int alarmGuiChangeType,
00058                                                        const QString& calendarURL, const QCString& appName);
00059                 void                 handleEvent(const QString& calendarURL, const QString& eventID);
00060                 void                 handleEvent(const QString& iCalendarString) ;
00061 
00062                 QTimer               mDaemonStatusTimer;         // timer for checking daemon status
00063                 int                  mDaemonStatusTimerCount;    // countdown for fast status checking
00064                 int                  mDaemonStatusTimerInterval; // timer interval (seconds) for checking daemon status
00065                 bool                 mDaemonRunning;             // whether the alarm daemon is currently running
00066                 bool                 mCalendarDisabled;          // monitoring of calendar is currently disabled by daemon
00067                 bool                 mEnableCalPending;          // waiting to tell daemon to enable calendar
00068 };
00069 
00070 /*=============================================================================
00071 =  Class: ActionAlarmsEnabled
00072 =============================================================================*/
00073 
00074 class ActionAlarmsEnabled : public KAction
00075 {
00076                 Q_OBJECT
00077         public:
00078                 ActionAlarmsEnabled(int accel, const QObject* receiver, const char* slot, QObject* parent, const char* name = 0);
00079                 bool    alarmsEnabled() const           { return mAlarmsEnabled; }
00080                 void    setAlarmsEnabled(bool enable);
00081         signals:
00082                 void    alarmsEnabledChange(bool enabled);
00083         private:
00084                 bool    mAlarmsEnabled;
00085 };
00086 
00087 #endif // DAEMONGUIHANDLER_H
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:26 2003 by doxygen 1.3.4 written by Dimitri van Heesch, © 1997-2001