-rw-r--r-- | libopie2/opiepim/core/opimnotifymanager.cpp | 16 | ||||
-rw-r--r-- | libopie2/opiepim/core/opimnotifymanager.h | 15 | ||||
-rw-r--r-- | libopie2/opiepim/core/orecur.h | 5 |
3 files changed, 36 insertions, 0 deletions
diff --git a/libopie2/opiepim/core/opimnotifymanager.cpp b/libopie2/opiepim/core/opimnotifymanager.cpp index 53ad4c3..d6f0ead 100644 --- a/libopie2/opiepim/core/opimnotifymanager.cpp +++ b/libopie2/opiepim/core/opimnotifymanager.cpp @@ -24,48 +24,64 @@ void OPimNotifyManager::remove( const OPimNotify& noti) { const OPimReminder& rem = static_cast<const OPimReminder&>(noti); m_rem.remove( rem ); }else if ( noti.type() == QString::fromLatin1("OPimAlarm") ) { const OPimAlarm& al = static_cast<const OPimAlarm&>(noti); m_al.remove( al ); } } void OPimNotifyManager::replace( const OPimNotify& noti) { if ( noti.type() == QString::fromLatin1("OPimReminder") ) { const OPimReminder& rem = static_cast<const OPimReminder&>(noti); m_rem.remove( rem ); m_rem.append( rem ); }else if ( noti.type() == QString::fromLatin1("OPimAlarm") ) { const OPimAlarm& al = static_cast<const OPimAlarm&>(noti); m_al.remove( al ); m_al.append( al ); } } OPimNotifyManager::Reminders OPimNotifyManager::reminders()const { return m_rem; } OPimNotifyManager::Alarms OPimNotifyManager::alarms()const { return m_al; } +OPimAlarm OPimNotifyManager::alarmAtDateTime( const QDateTime& when, bool& found ) const { + Alarms::ConstIterator it; + found = true; + + for ( it = m_al.begin(); it != m_al.end(); ++it ){ + if ( (*it).dateTime() == when ) + return (*it); + } + + // Fall through if nothing could be found + found = false; + OPimAlarm empty; + return empty; +} + + void OPimNotifyManager::setAlarms( const Alarms& al) { m_al = al; } void OPimNotifyManager::setReminders( const Reminders& rem) { m_rem = rem; } /* FIXME!!! */ /** * The idea is to check if the provider for our service * is online * if it is we will use QCOP * if not the Factory to get the backend... * Qtopia1.6 services would be kewl to have here.... */ void OPimNotifyManager::registerNotify( const OPimNotify& ) { } /* FIXME!!! */ /** * same as above... * Also implement Url model * have a MainWindow.... */ void OPimNotifyManager::deregister( const OPimNotify& ) { diff --git a/libopie2/opiepim/core/opimnotifymanager.h b/libopie2/opiepim/core/opimnotifymanager.h index 48410e7..f3c22f9 100644 --- a/libopie2/opiepim/core/opimnotifymanager.h +++ b/libopie2/opiepim/core/opimnotifymanager.h @@ -1,50 +1,65 @@ #ifndef OPIE_PIM_NOTIFY_MANAGER_H #define OPIE_PIM_NOTIFY_MANAGER_H #include <qvaluelist.h> #include <opie/opimnotify.h> /** * The notify manager keeps track of the Notifiers.... */ class OPimNotifyManager { public: typedef QValueList<OPimReminder> Reminders; typedef QValueList<OPimAlarm> Alarms; OPimNotifyManager( const Reminders& rems = Reminders(), const Alarms& alarms = Alarms() ); ~OPimNotifyManager(); /* we will cast it for you ;) */ void add( const OPimNotify& ); void remove( const OPimNotify& ); /* replaces all with this one! */ void replace( const OPimNotify& ); Reminders reminders()const; + + /** + * Return + */ Alarms alarms()const; + /** + * Return alarm at DateTime "when". If more than one is registered at this + * DateTime, the first one is returned. + * If none was found, an empty Alarm is returned. + * @param when The date and time of the returned alarm + * @param found Returns true if anything was found. + * @return Returns the found alarm at given DateTime. It is empty if found is false + * (nothing could be found at given date and time) + */ + OPimAlarm alarmAtDateTime( const QDateTime& when, bool& found ) const; + void setAlarms( const Alarms& ); void setReminders( const Reminders& ); /* register is a Ansi C keyword... */ /** * This function will register the Notify to the Alarm Server * or datebook depending on the type of the notify */ void registerNotify( const OPimNotify& ); /** * this will do the opposite.. */ void deregister( const OPimNotify& ); bool isEmpty()const; /** * Return all alarms as string */ QString alarmsToString() const; /** * Return all notifiers as string */ diff --git a/libopie2/opiepim/core/orecur.h b/libopie2/opiepim/core/orecur.h index 7750c12..d7ecd90 100644 --- a/libopie2/opiepim/core/orecur.h +++ b/libopie2/opiepim/core/orecur.h @@ -1,37 +1,42 @@ /* * GPL from TT */ #ifndef OPIE_RECUR_H #define OPIE_RECUR_H #include <sys/types.h> #include <qdatetime.h> #include <qvaluelist.h> #include <qmap.h> + +/** + * Class to handle Recurrencies.. + */ + class ORecur { public: typedef QValueList<QDate> ExceptionList; enum RepeatType{ NoRepeat = -1, Daily, Weekly, MonthlyDay, MonthlyDate, Yearly }; enum Days { MON = 0x01, TUE = 0x02, WED = 0x04, THU = 0x08, FRI = 0x10, SAT = 0x20, SUN = 0x40 }; enum Fields{ RType = 0, RWeekdays, RPosition, RFreq, RHasEndDate, EndDate, Created, Exceptions }; ORecur(); ORecur( const QMap<int, QString>& map ); ORecur( const ORecur& ); ~ORecur(); ORecur &operator=( const ORecur& ); bool operator==(const ORecur& )const; bool doesRecur()const; /* if it recurrs on that day */ bool doesRecur( const QDate& ); RepeatType type()const; int frequency()const; int position()const; |