summaryrefslogtreecommitdiff
path: root/libopie2/opiepim/core/opimnotifymanager.cpp
Side-by-side diff
Diffstat (limited to 'libopie2/opiepim/core/opimnotifymanager.cpp') (more/less context) (show whitespace changes)
-rw-r--r--libopie2/opiepim/core/opimnotifymanager.cpp120
1 files changed, 88 insertions, 32 deletions
diff --git a/libopie2/opiepim/core/opimnotifymanager.cpp b/libopie2/opiepim/core/opimnotifymanager.cpp
index 1771fad..a54d597 100644
--- a/libopie2/opiepim/core/opimnotifymanager.cpp
+++ b/libopie2/opiepim/core/opimnotifymanager.cpp
@@ -28,9 +28,13 @@
*/
-#include <opie2/opimnotifymanager.h>
+#include "opimnotifymanager.h"
+
+/* OPIE */
#include <opie2/oconversion.h>
+/* QT */
#include <qstringlist.h>
-namespace Opie {
+namespace Opie
+{
@@ -39,10 +43,18 @@ OPimNotifyManager::OPimNotifyManager( const Reminders& rem, const Alarms& al)
{}
-OPimNotifyManager::~OPimNotifyManager() {
-}
+
+
+OPimNotifyManager::~OPimNotifyManager()
+{}
+
+
/* use static_cast and type instead of dynamic... */
-void OPimNotifyManager::add( const OPimNotify& noti) {
- if ( noti.type() == QString::fromLatin1("OPimReminder") ) {
+void OPimNotifyManager::add( const OPimNotify& noti )
+{
+ if ( noti.type() == QString::fromLatin1( "OPimReminder" ) )
+ {
const OPimReminder& rem = static_cast<const OPimReminder&>(noti);
m_rem.append( rem );
- }else if ( noti.type() == QString::fromLatin1("OPimAlarm") ) {
+ }
+ else if ( noti.type() == QString::fromLatin1( "OPimAlarm" ) )
+ {
const OPimAlarm& al = static_cast<const OPimAlarm&>(noti);
@@ -51,7 +63,13 @@ void OPimNotifyManager::add( const OPimNotify& noti) {
}
-void OPimNotifyManager::remove( const OPimNotify& noti) {
- if ( noti.type() == QString::fromLatin1("OPimReminder") ) {
+
+
+void OPimNotifyManager::remove( const OPimNotify& noti )
+{
+ if ( noti.type() == QString::fromLatin1( "OPimReminder" ) )
+ {
const OPimReminder& rem = static_cast<const OPimReminder&>(noti);
m_rem.remove( rem );
- }else if ( noti.type() == QString::fromLatin1("OPimAlarm") ) {
+ }
+ else if ( noti.type() == QString::fromLatin1( "OPimAlarm" ) )
+ {
const OPimAlarm& al = static_cast<const OPimAlarm&>(noti);
@@ -60,4 +78,8 @@ void OPimNotifyManager::remove( const OPimNotify& noti) {
}
-void OPimNotifyManager::replace( const OPimNotify& noti) {
- if ( noti.type() == QString::fromLatin1("OPimReminder") ) {
+
+
+void OPimNotifyManager::replace( const OPimNotify& noti )
+{
+ if ( noti.type() == QString::fromLatin1( "OPimReminder" ) )
+ {
const OPimReminder& rem = static_cast<const OPimReminder&>(noti);
@@ -65,3 +87,5 @@ void OPimNotifyManager::replace( const OPimNotify& noti) {
m_rem.append( rem );
- }else if ( noti.type() == QString::fromLatin1("OPimAlarm") ) {
+ }
+ else if ( noti.type() == QString::fromLatin1( "OPimAlarm" ) )
+ {
const OPimAlarm& al = static_cast<const OPimAlarm&>(noti);
@@ -71,9 +95,18 @@ void OPimNotifyManager::replace( const OPimNotify& noti) {
}
-OPimNotifyManager::Reminders OPimNotifyManager::reminders()const {
+
+
+OPimNotifyManager::Reminders OPimNotifyManager::reminders() const
+{
return m_rem;
}
-OPimNotifyManager::Alarms OPimNotifyManager::alarms()const {
+
+
+OPimNotifyManager::Alarms OPimNotifyManager::alarms() const
+{
return m_al;
}
-OPimAlarm OPimNotifyManager::alarmAtDateTime( const QDateTime& when, bool& found ) const {
+
+
+OPimAlarm OPimNotifyManager::alarmAtDateTime( const QDateTime& when, bool& found ) const
+{
Alarms::ConstIterator it;
@@ -81,3 +114,4 @@ OPimAlarm OPimNotifyManager::alarmAtDateTime( const QDateTime& when, bool& found
- for ( it = m_al.begin(); it != m_al.end(); ++it ){
+ for ( it = m_al.begin(); it != m_al.end(); ++it )
+ {
if ( (*it).dateTime() == when )
@@ -93,8 +127,14 @@ OPimAlarm OPimNotifyManager::alarmAtDateTime( const QDateTime& when, bool& found
-void OPimNotifyManager::setAlarms( const Alarms& al) {
+void OPimNotifyManager::setAlarms( const Alarms& al )
+{
m_al = al;
}
-void OPimNotifyManager::setReminders( const Reminders& rem) {
+
+
+void OPimNotifyManager::setReminders( const Reminders& rem )
+{
m_rem = rem;
}
+
+
/* FIXME!!! */
@@ -107,5 +147,7 @@ void OPimNotifyManager::setReminders( const Reminders& rem) {
*/
-void OPimNotifyManager::registerNotify( const OPimNotify& ) {
-
+void OPimNotifyManager::registerNotify( const OPimNotify& )
+{
}
+
+
/* FIXME!!! */
@@ -116,7 +158,9 @@ void OPimNotifyManager::registerNotify( const OPimNotify& ) {
*/
-void OPimNotifyManager::deregister( const OPimNotify& ) {
-
+void OPimNotifyManager::deregister( const OPimNotify& )
+{
}
-bool OPimNotifyManager::isEmpty()const {
+
+bool OPimNotifyManager::isEmpty() const
+{
qWarning("is Empty called on OPimNotifyManager %d %d", m_rem.count(), m_al.count() );
@@ -126,3 +170,4 @@ bool OPimNotifyManager::isEmpty()const {
-// Taken from otodoaccessxml..
+
+// Taken from otodoaccessxml.. code duplication bad. any alternative?
QString OPimNotifyManager::alarmsToString() const
@@ -132,8 +177,11 @@ QString OPimNotifyManager::alarmsToString() const
OPimNotifyManager::Alarms alarms = m_al;
- if ( !alarms.isEmpty() ) {
+ if ( !alarms.isEmpty() )
+ {
QStringList als;
OPimNotifyManager::Alarms::Iterator it = alarms.begin();
- for ( ; it != alarms.end(); ++it ) {
+ for ( ; it != alarms.end(); ++it )
+ {
/* only if time is valid */
- if ( (*it).dateTime().isValid() ) {
+ if ( ( *it ).dateTime().isValid() )
+ {
als << OConversion::dateTimeToString( (*it).dateTime() )
@@ -151,2 +199,4 @@ QString OPimNotifyManager::alarmsToString() const
}
+
+
QString OPimNotifyManager::remindersToString() const
@@ -156,6 +206,8 @@ QString OPimNotifyManager::remindersToString() const
OPimNotifyManager::Reminders reminders = m_rem;
- if (!reminders.isEmpty() ) {
+ if ( !reminders.isEmpty() )
+ {
OPimNotifyManager::Reminders::Iterator it = reminders.begin();
QStringList records;
- for ( ; it != reminders.end(); ++it ) {
+ for ( ; it != reminders.end(); ++it )
+ {
records << QString::number( (*it).recordUid() );
@@ -168,2 +220,3 @@ QString OPimNotifyManager::remindersToString() const
+
void OPimNotifyManager::alarmsFromString( const QString& str )
@@ -171,3 +224,4 @@ void OPimNotifyManager::alarmsFromString( const QString& str )
QStringList als = QStringList::split(";", str );
- for (QStringList::Iterator it = als.begin(); it != als.end(); ++it ) {
+ for ( QStringList::Iterator it = als.begin(); it != als.end(); ++it )
+ {
QStringList alarm = QStringList::split(":", (*it), TRUE ); // allow empty
@@ -182,2 +236,3 @@ void OPimNotifyManager::alarmsFromString( const QString& str )
+
void OPimNotifyManager::remindersFromString( const QString& str )
@@ -186,3 +241,4 @@ void OPimNotifyManager::remindersFromString( const QString& str )
QStringList rems = QStringList::split(";", str );
- for (QStringList::Iterator it = rems.begin(); it != rems.end(); ++it ) {
+ for ( QStringList::Iterator it = rems.begin(); it != rems.end(); ++it )
+ {
OPimReminder rem( (*it).toInt() );