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., 59 Temple Place - Suite 330, Boston, MA  02111-1307, 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    calendarLoaded( ADCalendarBase *, bool success );
00048     void    checkAlarmsSlot();
00049     void    checkAlarms();
00050 
00051   private:
00052     // DCOP interface
00053     void    enableAutoStart(bool enable);
00054     void    enableCal(const QString& urlString, bool enable)
00055                        { enableCal_(expandURL(urlString), enable); }
00056     void    reloadCal(const QCString& appname, const QString& urlString)
00057                        { reloadCal_(appname, expandURL(urlString), false); }
00058     void    reloadMsgCal(const QCString& appname, const QString& urlString)
00059                        { reloadCal_(appname, expandURL(urlString), true); }
00060     void    addCal(const QCString& appname, const QString& urlString)
00061                        { addCal_(appname, expandURL(urlString), false); }
00062     void    addMsgCal(const QCString& appname, const QString& urlString)
00063                        { addCal_(appname, expandURL(urlString), true); }
00064     void    removeCal(const QString& urlString)
00065                        { removeCal_(expandURL(urlString)); }
00066     void    resetMsgCal(const QCString& appname, const QString& urlString)
00067                        { resetMsgCal_(appname, expandURL(urlString)); }
00068     void    registerApp(const QCString& appName, const QString& appTitle,
00069                         const QCString& dcopObject, int notificationType,
00070                         bool displayCalendarName)
00071                        { registerApp_(appName, appTitle, dcopObject, notificationType,
00072                                       displayCalendarName, false); }
00073     void    reregisterApp(const QCString& appName, const QString& appTitle,
00074                         const QCString& dcopObject, int notificationType,
00075                         bool displayCalendarName)
00076                        { registerApp_(appName, appTitle, dcopObject, notificationType,
00077                                       displayCalendarName, true); }
00078     void    registerGui(const QCString& appName, const QCString& dcopObject);
00079     void    readConfig();
00080     void    quit();
00081     void    forceAlarmCheck() { checkAlarms(); }
00082     void    dumpDebug();
00083     QStringList    dumpAlarms();
00084 
00085   private:
00086 
00087     struct GuiInfo
00088     {
00089       GuiInfo()  { }
00090       explicit GuiInfo(const QCString &dcopObj) : dcopObject(dcopObj) { }
00091       QCString  dcopObject;     // DCOP object name
00092     };
00093     typedef QMap<QCString, GuiInfo> GuiMap;  // maps GUI client names against their data
00094 
00095     void        registerApp_(const QCString& appName, const QString& appTitle,
00096                         const QCString& dcopObject, int notificationType,
00097                         bool displayCalendarName, bool reregister);
00098     void        enableCal_(const QString& urlString, bool enable);
00099     void        addCal_(const QCString& appname, const QString& urlString, bool msgCal);
00100     void        reloadCal_(const QCString& appname, const QString& urlString, bool msgCal);
00101     void        reloadCal_(ADCalendarBase*);
00102     void        resetMsgCal_(const QCString& appname, const QString& urlString);
00103     void        removeCal_(const QString& urlString);
00104     bool        checkAlarms(ADCalendarBase*);
00105     void        checkAlarms(const QCString& appName);
00106     void        checkEventAlarms(const Event& event, QValueList<QDateTime>& alarmtimes);
00107     bool        notifyEvent(ADCalendarBase*, const QString& eventID);
00108     void        notifyGuiCalStatus(const ADCalendarBase*);
00109     void        notifyGui(AlarmGuiChangeType, const QString& calendarURL = QString::null);
00110     void        notifyGui(AlarmGuiChangeType, const QString& calendarURL, const QCString &appname);
00111 //    void        writeConfigClientGui(const QCString& appName, const QString& dcopObject);
00112     const GuiInfo* getGuiInfo(const QCString &appName) const;
00113     void        addConfigClient(KSimpleConfig&, const QCString& appName, const QString& key);
00114     void        readCheckInterval();
00115     void        setTimerStatus();
00116 
00117     GuiMap            mGuis;                // client GUI application names and data
00118     QTimer*           mAlarmTimer;
00119     QString           mClientDataFile;      // path of file containing client data
00120     int               mCheckInterval;       // alarm check interval (minutes)
00121     bool              mAlarmTimerSyncing;   // true while alarm timer interval < 1 minute
00122 };
00123 
00124 #endif
KDE Logo
This file is part of the documentation for kalarmd Library Version 3.2.2.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Sat May 1 11:38:04 2004 by doxygen 1.2.15 written by Dimitri van Heesch, © 1997-2003