kalarmd Library API Documentation

alarmdaemon.h

00001 /*
00002     KDE Alarm Daemon.
00003 
00004     This file is part of the KDE alarm daemon.
00005     Copyright (c) 2001 David Jarvie <software@astrojar.org.uk>
00006     Based on the original, (c) 1998, 1999 Preston Brown
00007 
00008     This program is free software; you can redistribute it and/or modify
00009     it under the terms of the GNU General Public License as published by
00010     the Free Software Foundation; either version 2 of the License, or
00011     (at your option) any later version.
00012 
00013     This program is distributed in the hope that it will be useful,
00014     but WITHOUT ANY WARRANTY; without even the implied warranty of
00015     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
00016     GNU General Public License for more details.
00017 
00018     You should have received a copy of the GNU General Public License
00019     along with this program; if not, write to the Free Software
00020     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00021 
00022     As a special exception, permission is given to link this program
00023     with any edition of Qt, and distribute the resulting executable,
00024     without including the source code for Qt in the source distribution.
00025 */
00026 
00027 #ifndef _ALARMDAEMON_H
00028 #define _ALARMDAEMON_H
00029 
00030 #include <ksimpleconfig.h>
00031 
00032 #include <libkcal/calendarlocal.h>
00033 
00034 #include "alarmdaemoniface.h"
00035 #include "clientinfo.h"
00036 #include "adcalendar.h"
00037 #include "adconfigdatarw.h"
00038 
00039 class AlarmDaemon : public QObject, public ADConfigDataRW, virtual public AlarmDaemonIface
00040 {
00041     Q_OBJECT
00042   public:
00043     AlarmDaemon(QObject *parent = 0L, const char *name = 0L);
00044     virtual ~AlarmDaemon();
00045 
00046   private slots:
00047     void    checkAlarmsSlot();
00048     void    checkIfSessionStarted();
00049 
00050     void    checkAlarms();
00051 
00052   private:
00053     // DCOP interface
00054     void    enableAutoStart(bool enable);
00055     void    enableCal(const QString& urlString, bool enable)
00056                        { enableCal_(expandURL(urlString), enable); }
00057     void    reloadCal(const QCString& appname, const QString& urlString)
00058                        { reloadCal_(appname, expandURL(urlString), false); }
00059     void    reloadMsgCal(const QCString& appname, const QString& urlString)
00060                        { reloadCal_(appname, expandURL(urlString), true); }
00061     void    addCal(const QCString& appname, const QString& urlString)
00062                        { addCal_(appname, expandURL(urlString), false); }
00063     void    addMsgCal(const QCString& appname, const QString& urlString)
00064                        { addCal_(appname, expandURL(urlString), true); }
00065     void    removeCal(const QString& urlString)
00066                        { removeCal_(expandURL(urlString)); }
00067     void    resetMsgCal(const QCString& appname, const QString& urlString)
00068                        { resetMsgCal_(appname, expandURL(urlString)); }
00069     void    registerApp(const QCString& appName, const QString& appTitle,
00070                         const QCString& dcopObject, int notificationType,
00071                         bool displayCalendarName)
00072                        { registerApp_(appName, appTitle, dcopObject, notificationType,
00073                                       displayCalendarName, false); }
00074     void    reregisterApp(const QCString& appName, const QString& appTitle,
00075                         const QCString& dcopObject, int notificationType,
00076                         bool displayCalendarName)
00077                        { registerApp_(appName, appTitle, dcopObject, notificationType,
00078                                       displayCalendarName, true); }
00079     void    registerGui(const QCString& appName, const QCString& dcopObject);
00080     void    readConfig();
00081     void    quit();
00082     void    forceAlarmCheck() { checkAlarms(); }
00083     void    dumpDebug();
00084     QStringList    dumpAlarms();
00085 
00086   private:
00087 
00088     struct GuiInfo
00089     {
00090       GuiInfo()  { }
00091       explicit GuiInfo(const QCString &dcopObj) : dcopObject(dcopObj) { }
00092       QCString  dcopObject;     // DCOP object name
00093     };
00094     typedef QMap<QCString, GuiInfo> GuiMap;  // maps GUI client names against their data
00095 
00096     void        registerApp_(const QCString& appName, const QString& appTitle,
00097                         const QCString& dcopObject, int notificationType,
00098                         bool displayCalendarName, bool reregister);
00099     void        enableCal_(const QString& urlString, bool enable);
00100     void        addCal_(const QCString& appname, const QString& urlString, bool msgCal);
00101     void        reloadCal_(const QCString& appname, const QString& urlString, bool msgCal);
00102     void        reloadCal_(ADCalendarBase*);
00103     void        resetMsgCal_(const QCString& appname, const QString& urlString);
00104     void        removeCal_(const QString& urlString);
00105     bool        checkAlarms(ADCalendarBase*);
00106     void        checkAlarms(const QCString& appName);
00107     void        checkEventAlarms(const Event& event, QValueList<QDateTime>& alarmtimes);
00108     bool        notifyEvent(ADCalendarBase*, const QString& eventID);
00109     void        notifyGuiCalStatus(const ADCalendarBase*);
00110     void        notifyGui(AlarmGuiChangeType, const QString& calendarURL = QString::null);
00111     void        notifyGui(AlarmGuiChangeType, const QString& calendarURL, const QCString &appname);
00112 //    void        writeConfigClientGui(const QCString& appName, const QString& dcopObject);
00113     const GuiInfo* getGuiInfo(const QCString &appName) const;
00114     void        addConfigClient(KSimpleConfig&, const QCString& appName, const QString& key);
00115     void        readCheckInterval();
00116     bool        isSessionStarted();
00117     void        setTimerStatus();
00118 
00119     GuiMap            mGuis;                // client GUI application names and data
00120     QTimer*           mAlarmTimer;
00121     QTimer*           mSessionStartTimer;   // timer waiting for session startup to complete
00122     QString           mClientDataFile;      // path of file containing client data
00123     int               mCheckInterval;       // alarm check interval (minutes)
00124     bool              mEnabled;             // true if the alarm daemon is enabled
00125     bool              mAlarmTimerSyncing;   // true while alarm timer interval < 1 minute
00126     bool              mSessionStarted;      // true once session startup is complete
00127 };
00128 
00129 #endif
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:21 2003 by doxygen 1.3.4 written by Dimitri van Heesch, © 1997-2001