summaryrefslogtreecommitdiff
path: root/libopie2
Side-by-side diff
Diffstat (limited to 'libopie2') (more/less context) (show whitespace changes)
-rw-r--r--libopie2/opiepim/core/opimnotifymanager.cpp16
-rw-r--r--libopie2/opiepim/core/opimnotifymanager.h15
-rw-r--r--libopie2/opiepim/core/orecur.h5
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
@@ -36,24 +36,40 @@ void OPimNotifyManager::replace( const OPimNotify& noti) {
}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...
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
@@ -13,26 +13,41 @@ 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..
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
@@ -2,24 +2,29 @@
* 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 );