kalarmd Library API Documentation

adcalendarbase.h

00001 /* 00002 Calendar access for KDE Alarm Daemon and KDE Alarm Daemon GUI. 00003 00004 This file is part of the KDE alarm daemon. 00005 Copyright (c) 2001 David Jarvie <software@astrojar.org.uk> 00006 00007 This program is free software; you can redistribute it and/or modify 00008 it under the terms of the GNU General Public License as published by 00009 the Free Software Foundation; either version 2 of the License, or 00010 (at your option) any later version. 00011 00012 This program is distributed in the hope that it will be useful, 00013 but WITHOUT ANY WARRANTY; without even the implied warranty of 00014 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00015 GNU General Public License for more details. 00016 00017 You should have received a copy of the GNU General Public License 00018 along with this program; if not, write to the Free Software 00019 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 00020 00021 As a special exception, permission is given to link this program 00022 with any edition of Qt, and distribute the resulting executable, 00023 without including the source code for Qt in the source distribution. 00024 */ 00025 00026 #ifndef ADCALENDARBASE_H 00027 #define ADCALENDARBASE_H 00028 00029 #include <libkcal/calendarlocal.h> 00030 namespace KIO { 00031 class Job; 00032 } 00033 class AlarmDaemon; 00034 00035 using namespace KCal; 00036 00037 // Base class for Alarm Daemon calendar access 00038 class ADCalendarBase : public CalendarLocal 00039 { 00040 Q_OBJECT 00041 public: 00042 enum Type { KORGANIZER = 0, KALARM = 1 }; 00043 ADCalendarBase(const QString& url, const QCString& appname, Type); 00044 ~ADCalendarBase() { } 00045 00046 const QString& urlString() const { return mUrlString; } 00047 const QCString& appName() const { return mAppName; } 00048 int rcIndex() const { return mRcIndex; } 00049 const QDateTime& lastCheck() const { return mLastCheck; } 00050 bool loaded() const { return mLoaded; } 00051 Type actionType() const { return mActionType; } 00052 00053 virtual void setEnabled( bool ) = 0; 00054 virtual bool enabled() const = 0; 00055 00056 virtual void setAvailable( bool ) = 0; 00057 virtual bool available() const = 0; 00058 00059 // client has registered since calendar was 00060 // constructed, but has not since added the 00061 // calendar. Monitoring is disabled. 00062 void setUnregistered( bool u ) { mUnregistered = u; } 00063 bool unregistered() const { return mUnregistered; } 00064 00065 virtual bool loadFile() = 0; 00066 bool downloading() const { return !mTempFileName.isNull(); } 00067 00068 void setRcIndex(int i) { mRcIndex = i; } 00069 void setLastCheck(const QDateTime& dt) { mLastCheck = dt; } 00070 00071 virtual void setEventHandled(const Event*, const QValueList<QDateTime> &) = 0; 00072 virtual bool eventHandled(const Event*, const QValueList<QDateTime> &) = 0; 00073 00074 // Check status of mLoadedConnected and set it to true 00075 bool setLoadedConnected(); 00076 00077 void dump() const; 00078 00079 signals: 00080 void loaded(ADCalendarBase*, bool success); 00081 00082 protected: 00083 bool loadFile_(); 00084 00085 private: 00086 ADCalendarBase(const ADCalendarBase&); // prohibit copying 00087 ADCalendarBase& operator=(const ADCalendarBase&); // prohibit copying 00088 void loadLocalFile( const QString& filename ); 00089 00090 private slots: 00091 void slotDownloadJobResult( KIO::Job * ); 00092 00093 protected: 00094 struct EventItem 00095 { 00096 EventItem() : eventSequence(0) { } 00097 EventItem(const QString& url, int seqno, const QValueList<QDateTime>& alarmtimes) 00098 : calendarURL(url), eventSequence(seqno), alarmTimes(alarmtimes) {} 00099 00100 QString calendarURL; 00101 int eventSequence; 00102 QValueList<QDateTime> alarmTimes; 00103 }; 00104 00105 typedef QMap<QString, EventItem> EventsMap; // event ID, calendar URL/event sequence num 00106 static EventsMap eventsHandled_; // IDs of displayed KALARM type events 00107 00108 private: 00109 QString mUrlString; // calendar file URL 00110 QCString mAppName; // name of application owning this calendar 00111 Type mActionType; // action to take on event 00112 QDateTime mLastCheck; // time at which calendar was last checked for alarms 00113 QString mTempFileName; // temporary file used if currently downloading, else null 00114 int mRcIndex; // index within 'clients' RC file for this calendar's entry 00115 bool mLoaded; // true if calendar file is currently loaded 00116 bool mLoadedConnected; // true if the loaded() signal has been connected to AlarmDaemon 00117 bool mUnregistered; // client has registered, but has not since added the calendar 00118 }; 00119 00120 typedef QPtrList<ADCalendarBase> CalendarList; 00121 00122 class ADCalendarBaseFactory 00123 { 00124 public: 00125 virtual ADCalendarBase *create(const QString& url, const QCString& appname, ADCalendarBase::Type) = 0; 00126 }; 00127 00128 00129 #endif
KDE Logo
This file is part of the documentation for kalarmd Library Version 3.3.0.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Fri Aug 27 12:50:36 2004 by doxygen 1.3.8 written by Dimitri van Heesch, © 1997-2003