summaryrefslogtreecommitdiff
path: root/libopie2/opiepim/core
authormickeyl <mickeyl>2004-02-23 13:15:42 (UTC)
committer mickeyl <mickeyl>2004-02-23 13:15:42 (UTC)
commitf9f0c26d9ac94586ffc36efa1b582ece3dbc43cf (patch) (side-by-side diff)
tree4044006e676c78370fdeccf960ea4214f13eabd2 /libopie2/opiepim/core
parent2d37d653310da0a9d6e2e2e6c9f5bf092e54cbbb (diff)
downloadopie-f9f0c26d9ac94586ffc36efa1b582ece3dbc43cf.zip
opie-f9f0c26d9ac94586ffc36efa1b582ece3dbc43cf.tar.gz
opie-f9f0c26d9ac94586ffc36efa1b582ece3dbc43cf.tar.bz2
cosmetics
Diffstat (limited to 'libopie2/opiepim/core') (more/less context) (ignore whitespace changes)
-rw-r--r--libopie2/opiepim/core/opimnotify.cpp251
-rw-r--r--libopie2/opiepim/core/opimnotify.h67
-rw-r--r--libopie2/opiepim/core/opimnotifymanager.cpp240
-rw-r--r--libopie2/opiepim/core/opimnotifymanager.h40
-rw-r--r--libopie2/opiepim/core/opimrecord.cpp141
-rw-r--r--libopie2/opiepim/core/opimrecord.h66
6 files changed, 528 insertions, 277 deletions
diff --git a/libopie2/opiepim/core/opimnotify.cpp b/libopie2/opiepim/core/opimnotify.cpp
index c61f9da..43858f0 100644
--- a/libopie2/opiepim/core/opimnotify.cpp
+++ b/libopie2/opiepim/core/opimnotify.cpp
@@ -28,11 +28,15 @@
*/
-#include <qshared.h>
-#include <opie2/opimnotify.h>
+#include "opimnotify.h"
-namespace Opie {
+/* QT */
+#include <qshared.h>
-struct OPimNotify::Data : public QShared {
- Data() : QShared(),dur(-1),parent(0) {
+namespace Opie
+{
+struct OPimNotify::Data : public QShared
+{
+ Data() : QShared(), dur( -1 ), parent( 0 )
+ {
}
@@ -44,3 +48,4 @@ struct OPimNotify::Data : public QShared {
-OPimNotify::OPimNotify( const QDateTime& start, int duration, int parent ) {
+OPimNotify::OPimNotify( const QDateTime& start, int duration, int parent )
+{
data = new Data;
@@ -50,4 +55,6 @@ OPimNotify::OPimNotify( const QDateTime& start, int duration, int parent ) {
}
-OPimNotify::OPimNotify( const OPimNotify& noti)
- : data( noti.data )
+
+
+OPimNotify::OPimNotify( const OPimNotify& noti )
+ : data( noti.data )
{
@@ -55,4 +62,8 @@ OPimNotify::OPimNotify( const OPimNotify& noti)
}
-OPimNotify::~OPimNotify() {
- if ( data->deref() ) {
+
+
+OPimNotify::~OPimNotify()
+{
+ if ( data->deref() )
+ {
delete data;
@@ -62,3 +73,5 @@ OPimNotify::~OPimNotify() {
-OPimNotify &OPimNotify::operator=( const OPimNotify& noti) {
+
+OPimNotify &OPimNotify::operator=( const OPimNotify& noti )
+{
noti.data->ref();
@@ -69,3 +82,6 @@ OPimNotify &OPimNotify::operator=( const OPimNotify& noti) {
}
-bool OPimNotify::operator==( const OPimNotify& noti ) {
+
+
+bool OPimNotify::operator==( const OPimNotify& noti )
+{
if ( data == noti.data ) return true;
@@ -78,18 +94,36 @@ bool OPimNotify::operator==( const OPimNotify& noti ) {
}
-QDateTime OPimNotify::dateTime()const {
+
+
+QDateTime OPimNotify::dateTime() const
+{
return data->start;
}
-QString OPimNotify::service()const {
+
+
+QString OPimNotify::service() const
+{
return data->application;
}
-int OPimNotify::parent()const {
+
+
+int OPimNotify::parent() const
+{
return data->parent;
}
-int OPimNotify::duration()const {
+
+
+int OPimNotify::duration() const
+{
return data->dur;
}
-QDateTime OPimNotify::endTime()const {
- return QDateTime( data->start.date(), data->start.time().addSecs( data->dur) );
+
+
+QDateTime OPimNotify::endTime() const
+{
+ return QDateTime( data->start.date(), data->start.time().addSecs( data->dur ) );
}
-void OPimNotify::setDateTime( const QDateTime& time ) {
+
+
+void OPimNotify::setDateTime( const QDateTime& time )
+{
copyIntern();
@@ -97,3 +131,6 @@ void OPimNotify::setDateTime( const QDateTime& time ) {
}
-void OPimNotify::setDuration( int dur ) {
+
+
+void OPimNotify::setDuration( int dur )
+{
copyIntern();
@@ -101,3 +138,6 @@ void OPimNotify::setDuration( int dur ) {
}
-void OPimNotify::setParent( int uid ) {
+
+
+void OPimNotify::setParent( int uid )
+{
copyIntern();
@@ -105,3 +145,6 @@ void OPimNotify::setParent( int uid ) {
}
-void OPimNotify::setService( const QString& str ) {
+
+
+void OPimNotify::setService( const QString& str )
+{
copyIntern();
@@ -109,4 +152,8 @@ void OPimNotify::setService( const QString& str ) {
}
-void OPimNotify::copyIntern() {
- if ( data->count != 1 ) {
+
+
+void OPimNotify::copyIntern()
+{
+ if ( data->count != 1 )
+ {
data->deref();
@@ -114,3 +161,3 @@ void OPimNotify::copyIntern() {
dat->start = data->start;
- dat->dur = data->dur;
+ dat->dur = data->dur;
dat->application = data->application;
@@ -120,4 +167,8 @@ void OPimNotify::copyIntern() {
}
-void OPimNotify::deref() {
- if ( data->deref() ) {
+
+
+void OPimNotify::deref()
+{
+ if ( data->deref() )
+ {
delete data;
@@ -127,5 +178,8 @@ void OPimNotify::deref() {
+
/***********************************************************/
-struct OPimAlarm::Data : public QShared {
- Data() : QShared() {
+struct OPimAlarm::Data : public QShared
+{
+ Data() : QShared()
+ {
sound = 1;
@@ -135,4 +189,6 @@ struct OPimAlarm::Data : public QShared {
};
+
+
OPimAlarm::OPimAlarm( int sound, const QDateTime& start, int duration, int parent )
- : OPimNotify( start, duration, parent )
+ : OPimNotify( start, duration, parent )
{
@@ -141,4 +197,6 @@ OPimAlarm::OPimAlarm( int sound, const QDateTime& start, int duration, int paren
}
-OPimAlarm::OPimAlarm( const OPimAlarm& al)
- : OPimNotify(al), data( al.data )
+
+
+OPimAlarm::OPimAlarm( const OPimAlarm& al )
+ : OPimNotify( al ), data( al.data )
{
@@ -146,4 +204,8 @@ OPimAlarm::OPimAlarm( const OPimAlarm& al)
}
-OPimAlarm::~OPimAlarm() {
- if ( data->deref() ) {
+
+
+OPimAlarm::~OPimAlarm()
+{
+ if ( data->deref() )
+ {
delete data;
@@ -152,3 +214,5 @@ OPimAlarm::~OPimAlarm() {
}
-OPimAlarm &OPimAlarm::operator=( const OPimAlarm& al)
+
+
+OPimAlarm &OPimAlarm::operator=( const OPimAlarm& al )
{
@@ -163,3 +227,6 @@ OPimAlarm &OPimAlarm::operator=( const OPimAlarm& al)
}
-bool OPimAlarm::operator==( const OPimAlarm& al) {
+
+
+bool OPimAlarm::operator==( const OPimAlarm& al )
+{
if ( data->sound != al.data->sound ) return false;
@@ -170,12 +237,24 @@ bool OPimAlarm::operator==( const OPimAlarm& al) {
}
-QString OPimAlarm::type()const {
- return QString::fromLatin1("OPimAlarm");
+
+
+QString OPimAlarm::type() const
+{
+ return QString::fromLatin1( "OPimAlarm" );
}
-int OPimAlarm::sound()const {
+
+
+int OPimAlarm::sound() const
+{
return data->sound;
}
-QString OPimAlarm::file()const {
+
+
+QString OPimAlarm::file() const
+{
return data->file;
}
-void OPimAlarm::setSound( int snd) {
+
+
+void OPimAlarm::setSound( int snd )
+{
copyIntern();
@@ -183,3 +262,6 @@ void OPimAlarm::setSound( int snd) {
}
-void OPimAlarm::setFile( const QString& sound ) {
+
+
+void OPimAlarm::setFile( const QString& sound )
+{
copyIntern();
@@ -187,4 +269,8 @@ void OPimAlarm::setFile( const QString& sound ) {
}
-void OPimAlarm::deref() {
- if ( data->deref() ) {
+
+
+void OPimAlarm::deref()
+{
+ if ( data->deref() )
+ {
delete data;
@@ -193,4 +279,8 @@ void OPimAlarm::deref() {
}
-void OPimAlarm::copyIntern() {
- if ( data->count != 1 ) {
+
+
+void OPimAlarm::copyIntern()
+{
+ if ( data->count != 1 )
+ {
data->deref();
@@ -198,3 +288,3 @@ void OPimAlarm::copyIntern() {
newDat->sound = data->sound;
- newDat->file = data->file;
+ newDat->file = data->file;
data = newDat;
@@ -202,6 +292,9 @@ void OPimAlarm::copyIntern() {
}
+
+
/************************/
-struct OPimReminder::Data : public QShared {
- Data() : QShared(), record( 0) {
- }
+struct OPimReminder::Data : public QShared
+{
+ Data() : QShared(), record( 0 )
+ {}
int record;
@@ -209,4 +302,6 @@ struct OPimReminder::Data : public QShared {
};
-OPimReminder::OPimReminder( int uid, const QDateTime& start, int dur, int parent )
- : OPimNotify( start, dur, parent )
+
+
+OPimReminder::OPimReminder( int uid, const QDateTime& start, int dur, int parent )
+ : OPimNotify( start, dur, parent )
{
@@ -215,4 +310,6 @@ OPimReminder::OPimReminder( int uid, const QDateTime& start, int dur, int paren
}
+
+
OPimReminder::OPimReminder( const OPimReminder& rem )
- : OPimNotify( rem ), data( rem.data )
+ : OPimNotify( rem ), data( rem.data )
{
@@ -220,4 +317,7 @@ OPimReminder::OPimReminder( const OPimReminder& rem )
}
-OPimReminder& OPimReminder::operator=( const OPimReminder& rem) {
- OPimNotify::operator=(rem );
+
+
+OPimReminder& OPimReminder::operator=( const OPimReminder& rem )
+{
+ OPimNotify::operator=( rem );
@@ -229,3 +329,6 @@ OPimReminder& OPimReminder::operator=( const OPimReminder& rem) {
}
-bool OPimReminder::operator==( const OPimReminder& rem) {
+
+
+bool OPimReminder::operator==( const OPimReminder& rem )
+{
if ( data->record != rem.data->record ) return false;
@@ -234,9 +337,18 @@ bool OPimReminder::operator==( const OPimReminder& rem) {
}
-QString OPimReminder::type()const {
- return QString::fromLatin1("OPimReminder");
+
+
+QString OPimReminder::type() const
+{
+ return QString::fromLatin1( "OPimReminder" );
}
-int OPimReminder::recordUid()const {
+
+
+int OPimReminder::recordUid() const
+{
return data->record;
}
-void OPimReminder::setRecordUid( int uid ) {
+
+
+void OPimReminder::setRecordUid( int uid )
+{
copyIntern();
@@ -244,4 +356,8 @@ void OPimReminder::setRecordUid( int uid ) {
}
-void OPimReminder::deref() {
- if ( data->deref() ) {
+
+
+void OPimReminder::deref()
+{
+ if ( data->deref() )
+ {
delete data;
@@ -250,5 +366,9 @@ void OPimReminder::deref() {
}
-void OPimReminder::copyIntern() {
- if ( data->count != 1 ) {
- Data* da = new Data;
+
+
+void OPimReminder::copyIntern()
+{
+ if ( data->count != 1 )
+ {
+ Data * da = new Data;
da->record = data->record;
@@ -257,2 +377,3 @@ void OPimReminder::copyIntern() {
}
+
}
diff --git a/libopie2/opiepim/core/opimnotify.h b/libopie2/opiepim/core/opimnotify.h
index fed3970..d0e40ca 100644
--- a/libopie2/opiepim/core/opimnotify.h
+++ b/libopie2/opiepim/core/opimnotify.h
@@ -28,5 +28,7 @@
*/
-#ifndef OPIE_PIM_NOTIFY_H
-#define OPIE_PIM_NOTIFY_H
+#ifndef OPIMNOTIFY_H
+#define OPIMNOTIFY_H
+
+/* QT */
#include <qdatetime.h>
@@ -34,4 +36,4 @@
-
-namespace Opie {
+namespace Opie
+{
/**
@@ -49,4 +51,6 @@ namespace Opie {
*/
-class OPimNotify {
-public:
+class OPimNotify
+{
+
+ public:
typedef QValueList<OPimNotify> ValueList;
@@ -56,10 +60,10 @@ public:
- OPimNotify &operator=(const OPimNotify& );
+ OPimNotify &operator=( const OPimNotify& );
bool operator==( const OPimNotify& );
- virtual QString type()const = 0;
+ virtual QString type() const = 0;
/** start date */
- QDateTime dateTime()const;
- QString service()const;
+ QDateTime dateTime() const;
+ QString service() const;
@@ -68,3 +72,3 @@ public:
*/
- int parent()const;
+ int parent() const;
@@ -73,3 +77,3 @@ public:
*/
- int duration()const;
+ int duration() const;
@@ -78,3 +82,3 @@ public:
*/
- QDateTime endTime()const;
+ QDateTime endTime() const;
@@ -82,3 +86,3 @@ public:
void setDuration( int dur );
- void setParent(int uid );
+ void setParent( int uid );
void setService( const QString& );
@@ -86,3 +90,3 @@ public:
-private:
+ private:
inline void copyIntern();
@@ -102,5 +106,6 @@ private:
*/
-class OPimAlarm : public OPimNotify {
-public:
- enum Sound{Loud=1, Silent=0, Custom=2 };
+class OPimAlarm : public OPimNotify
+{
+ public:
+ enum Sound{Loud = 1, Silent = 0, Custom = 2 };
OPimAlarm( int sound = Silent, const QDateTime& start = QDateTime(), int duration = 0, int parent = 0 );
@@ -111,6 +116,6 @@ public:
bool operator==( const OPimAlarm& );
- QString type()const;
+ QString type() const;
- int sound()const;
- QString file()const;
+ int sound() const;
+ QString file() const;
@@ -120,3 +125,3 @@ public:
-private:
+ private:
void deref();
@@ -137,5 +142,5 @@ private:
*/
-class OPimReminder : public OPimNotify {
-public:
-
+class OPimReminder : public OPimNotify
+{
+ public:
/**
@@ -147,8 +152,8 @@ public:
*/
- OPimReminder( int uid = 0, const QDateTime& start = QDateTime(),
- int duration = 0, int parent = 0 );
+ OPimReminder( int uid = 0, const QDateTime& start = QDateTime(),
+ int duration = 0, int parent = 0 );
OPimReminder( const OPimReminder& );
- OPimReminder &operator=(const OPimReminder& );
+ OPimReminder &operator=( const OPimReminder& );
- QString type()const;
+ QString type() const;
@@ -160,6 +165,6 @@ public:
*/
- int recordUid()const;
+ int recordUid() const;
void setRecordUid( int uid );
-private:
+ private:
void deref();
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,22 +28,34 @@
*/
-#include <opie2/opimnotifymanager.h>
+#include "opimnotifymanager.h"
+
+/* OPIE */
#include <opie2/oconversion.h>
+/* QT */
#include <qstringlist.h>
-namespace Opie {
+namespace Opie
+{
-OPimNotifyManager::OPimNotifyManager( const Reminders& rem, const Alarms& al)
- : m_rem( rem ), m_al( al )
+OPimNotifyManager::OPimNotifyManager( const Reminders& rem, const Alarms& al )
+ : m_rem( rem ), m_al( 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") ) {
- const OPimReminder& rem = static_cast<const OPimReminder&>(noti);
+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") ) {
- const OPimAlarm& al = static_cast<const OPimAlarm&>(noti);
+ }
+ else if ( noti.type() == QString::fromLatin1( "OPimAlarm" ) )
+ {
+ const OPimAlarm & al = static_cast<const OPimAlarm&>( noti );
m_al.append( al );
@@ -51,8 +63,14 @@ void OPimNotifyManager::add( const OPimNotify& noti) {
}
-void OPimNotifyManager::remove( const OPimNotify& noti) {
- if ( noti.type() == QString::fromLatin1("OPimReminder") ) {
- const OPimReminder& rem = static_cast<const OPimReminder&>(noti);
+
+
+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") ) {
- const OPimAlarm& al = static_cast<const OPimAlarm&>(noti);
+ }
+ else if ( noti.type() == QString::fromLatin1( "OPimAlarm" ) )
+ {
+ const OPimAlarm & al = static_cast<const OPimAlarm&>( noti );
m_al.remove( al );
@@ -60,9 +78,15 @@ void OPimNotifyManager::remove( const OPimNotify& noti) {
}
-void OPimNotifyManager::replace( const OPimNotify& noti) {
- if ( noti.type() == QString::fromLatin1("OPimReminder") ) {
- const OPimReminder& rem = static_cast<const OPimReminder&>(noti);
+
+
+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);
+ }
+ else if ( noti.type() == QString::fromLatin1( "OPimAlarm" ) )
+ {
+ const OPimAlarm & al = static_cast<const OPimAlarm&>( noti );
m_al.remove( al );
@@ -71,21 +95,31 @@ 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 {
- 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;
+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;
}
@@ -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,8 +158,10 @@ void OPimNotifyManager::registerNotify( const OPimNotify& ) {
*/
-void OPimNotifyManager::deregister( const OPimNotify& ) {
-
+void OPimNotifyManager::deregister( const OPimNotify& )
+{
}
-bool OPimNotifyManager::isEmpty()const {
- qWarning("is Empty called on OPimNotifyManager %d %d", m_rem.count(), m_al.count() );
+
+bool OPimNotifyManager::isEmpty() const
+{
+ qWarning( "is Empty called on OPimNotifyManager %d %d", m_rem.count(), m_al.count() );
if ( m_rem.isEmpty() && m_al.isEmpty() ) return true;
@@ -126,58 +170,69 @@ bool OPimNotifyManager::isEmpty()const {
-// Taken from otodoaccessxml..
+
+// Taken from otodoaccessxml.. code duplication bad. any alternative?
QString OPimNotifyManager::alarmsToString() const
{
- QString str;
-
- OPimNotifyManager::Alarms alarms = m_al;
- if ( !alarms.isEmpty() ) {
- QStringList als;
- OPimNotifyManager::Alarms::Iterator it = alarms.begin();
- for ( ; it != alarms.end(); ++it ) {
- /* only if time is valid */
- if ( (*it).dateTime().isValid() ) {
- als << OConversion::dateTimeToString( (*it).dateTime() )
- + ":" + QString::number( (*it).duration() )
- + ":" + QString::number( (*it).sound() )
- + ":";
- }
- }
- // now write the list
- qWarning("als: %s", als.join("____________").latin1() );
- str = als.join(";");
- }
-
- return str;
+ QString str;
+
+ OPimNotifyManager::Alarms alarms = m_al;
+ if ( !alarms.isEmpty() )
+ {
+ QStringList als;
+ OPimNotifyManager::Alarms::Iterator it = alarms.begin();
+ for ( ; it != alarms.end(); ++it )
+ {
+ /* only if time is valid */
+ if ( ( *it ).dateTime().isValid() )
+ {
+ als << OConversion::dateTimeToString( ( *it ).dateTime() )
+ + ":" + QString::number( ( *it ).duration() )
+ + ":" + QString::number( ( *it ).sound() )
+ + ":";
+ }
+ }
+ // now write the list
+ qWarning( "als: %s", als.join( "____________" ).latin1() );
+ str = als.join( ";" );
+ }
+
+ return str;
}
+
+
QString OPimNotifyManager::remindersToString() const
{
- QString str;
-
- OPimNotifyManager::Reminders reminders = m_rem;
- if (!reminders.isEmpty() ) {
- OPimNotifyManager::Reminders::Iterator it = reminders.begin();
- QStringList records;
- for ( ; it != reminders.end(); ++it ) {
- records << QString::number( (*it).recordUid() );
- }
- str = records.join(";");
- }
+ QString str;
+
+ OPimNotifyManager::Reminders reminders = m_rem;
+ if ( !reminders.isEmpty() )
+ {
+ OPimNotifyManager::Reminders::Iterator it = reminders.begin();
+ QStringList records;
+ for ( ; it != reminders.end(); ++it )
+ {
+ records << QString::number( ( *it ).recordUid() );
+ }
+ str = records.join( ";" );
+ }
- return str;
+ return str;
}
+
void OPimNotifyManager::alarmsFromString( const QString& str )
{
- QStringList als = QStringList::split(";", str );
- for (QStringList::Iterator it = als.begin(); it != als.end(); ++it ) {
- QStringList alarm = QStringList::split(":", (*it), TRUE ); // allow empty
- qWarning("alarm: %s", alarm.join("___").latin1() );
- qWarning("alarm[0]: %s %s", alarm[0].latin1(),
- OConversion::dateTimeFromString( alarm[0] ).toString().latin1() );
- OPimAlarm al( alarm[2].toInt(), OConversion::dateTimeFromString( alarm[0] ),
- alarm[1].toInt() );
- add( al );
- }
+ QStringList als = QStringList::split( ";", str );
+ for ( QStringList::Iterator it = als.begin(); it != als.end(); ++it )
+ {
+ QStringList alarm = QStringList::split( ":", ( *it ), TRUE ); // allow empty
+ qWarning( "alarm: %s", alarm.join( "___" ).latin1() );
+ qWarning( "alarm[0]: %s %s", alarm[ 0 ].latin1(),
+ OConversion::dateTimeFromString( alarm[ 0 ] ).toString().latin1() );
+ OPimAlarm al( alarm[ 2 ].toInt(), OConversion::dateTimeFromString( alarm[ 0 ] ),
+ alarm[ 1 ].toInt() );
+ add( al );
+ }
}
+
void OPimNotifyManager::remindersFromString( const QString& str )
@@ -185,8 +240,9 @@ void OPimNotifyManager::remindersFromString( const QString& str )
- QStringList rems = QStringList::split(";", str );
- for (QStringList::Iterator it = rems.begin(); it != rems.end(); ++it ) {
- OPimReminder rem( (*it).toInt() );
- add( rem );
- }
-
+ QStringList rems = QStringList::split( ";", str );
+ for ( QStringList::Iterator it = rems.begin(); it != rems.end(); ++it )
+ {
+ OPimReminder rem( ( *it ).toInt() );
+ add( rem );
+ }
+
}
diff --git a/libopie2/opiepim/core/opimnotifymanager.h b/libopie2/opiepim/core/opimnotifymanager.h
index 0272e5d..9241ea2 100644
--- a/libopie2/opiepim/core/opimnotifymanager.h
+++ b/libopie2/opiepim/core/opimnotifymanager.h
@@ -28,10 +28,13 @@
*/
-#ifndef OPIE_PIM_NOTIFY_MANAGER_H
-#define OPIE_PIM_NOTIFY_MANAGER_H
-
-#include <qvaluelist.h>
+#ifndef OPIMNOTIFYMANAGER_H
+#define OPIMNOTIFYMANAGER_H
+/* OPIE */
#include <opie2/opimnotify.h>
-namespace Opie {
+/* QT */
+#include <qvaluelist.h>
+
+namespace Opie
+{
/**
@@ -39,6 +42,7 @@ namespace Opie {
*/
-class OPimNotifyManager {
-public:
+class OPimNotifyManager
+{
+ public:
typedef QValueList<OPimReminder> Reminders;
- typedef QValueList<OPimAlarm> Alarms;
+ typedef QValueList<OPimAlarm> Alarms;
OPimNotifyManager( const Reminders& rems = Reminders(), const Alarms& alarms = Alarms() );
@@ -52,8 +56,8 @@ public:
- Reminders reminders()const;
+ Reminders reminders() const;
/**
- * Return
+ * Return
*/
- Alarms alarms()const;
+ Alarms alarms() const;
@@ -65,3 +69,3 @@ public:
* @param found Returns true if anything was found.
- * @return Returns the found alarm at given DateTime. It is empty if found is false
+ * @return Returns the found alarm at given DateTime. It is empty if found is false
* (nothing could be found at given date and time)
@@ -85,5 +89,5 @@ public:
- bool isEmpty()const;
+ bool isEmpty() const;
- /**
+ /**
* Return all alarms as string
@@ -91,3 +95,3 @@ public:
QString alarmsToString() const;
- /**
+ /**
* Return all notifiers as string
@@ -97,3 +101,3 @@ public:
/**
- * Convert string to alarms
+ * Convert string to alarms
* @param str String created by alarmsToString()
@@ -108,5 +112,3 @@ public:
-
-
-private:
+ private:
Reminders m_rem;
diff --git a/libopie2/opiepim/core/opimrecord.cpp b/libopie2/opiepim/core/opimrecord.cpp
index 72bb372..c603f44 100644
--- a/libopie2/opiepim/core/opimrecord.cpp
+++ b/libopie2/opiepim/core/opimrecord.cpp
@@ -28,4 +28,6 @@
*/
-#include <qarray.h>
+#include "opimrecord.h"
+
+/* OPIE */
#include <qpe/categories.h>
@@ -33,5 +35,7 @@
-#include <opie2/opimrecord.h>
+/* QT */
+#include <qarray.h>
-namespace Opie {
+namespace Opie
+{
Qtopia::UidGen OPimRecord::m_uidGen( Qtopia::UidGen::Qtopia );
@@ -40,3 +44,4 @@ Qtopia::UidGen OPimRecord::m_uidGen( Qtopia::UidGen::Qtopia );
OPimRecord::OPimRecord( int uid )
- : Qtopia::Record() {
+ : Qtopia::Record()
+{
@@ -45,12 +50,18 @@ OPimRecord::OPimRecord( int uid )
}
-OPimRecord::~OPimRecord() {
-}
+
+
+OPimRecord::~OPimRecord()
+{}
+
+
OPimRecord::OPimRecord( const OPimRecord& rec )
- : Qtopia::Record( rec )
+ : Qtopia::Record( rec )
{
- (*this) = rec;
+ ( *this ) = rec;
}
-OPimRecord &OPimRecord::operator=( const OPimRecord& rec) {
- if ( this == &rec ) return *this;
+
+OPimRecord &OPimRecord::operator=( const OPimRecord& rec )
+{
+ if ( this == &rec ) return * this;
@@ -60,4 +71,6 @@ OPimRecord &OPimRecord::operator=( const OPimRecord& rec) {
- return *this;
+ return *this;
}
+
+
/*
@@ -65,3 +78,4 @@ OPimRecord &OPimRecord::operator=( const OPimRecord& rec) {
*/
-QStringList OPimRecord::categoryNames( const QString& appname ) const {
+QStringList OPimRecord::categoryNames( const QString& appname ) const
+{
QStringList list;
@@ -71,4 +85,5 @@ QStringList OPimRecord::categoryNames( const QString& appname ) const {
- for (uint i = 0; i < cats.count(); i++ ) {
- list << catDB.label( appname, cats[i] );
+ for ( uint i = 0; i < cats.count(); i++ )
+ {
+ list << catDB.label( appname, cats[ i ] );
}
@@ -77,6 +92,11 @@ QStringList OPimRecord::categoryNames( const QString& appname ) const {
}
-void OPimRecord::setCategoryNames( const QStringList& ) {
+
+void OPimRecord::setCategoryNames( const QStringList& )
+{
}
-void OPimRecord::addCategoryName( const QString& ) {
+
+
+void OPimRecord::addCategoryName( const QString& )
+{
Categories catDB;
@@ -86,5 +106,10 @@ void OPimRecord::addCategoryName( const QString& ) {
}
-bool OPimRecord::isEmpty()const {
+
+
+bool OPimRecord::isEmpty() const
+{
return ( uid() == 0 );
}
+
+
/*QString OPimRecord::crossToString()const {
@@ -104,4 +129,5 @@ bool OPimRecord::isEmpty()const {
/* if uid = 1 assign a new one */
-void OPimRecord::setUid( int uid ) {
- if ( uid == 1)
+void OPimRecord::setUid( int uid )
+{
+ if ( uid == 1 )
uid = uidGen().generate();
@@ -110,9 +136,18 @@ void OPimRecord::setUid( int uid ) {
};
-Qtopia::UidGen &OPimRecord::uidGen() {
+
+
+Qtopia::UidGen &OPimRecord::uidGen()
+{
return m_uidGen;
}
-OPimXRefManager &OPimRecord::xrefmanager() {
+
+
+OPimXRefManager &OPimRecord::xrefmanager()
+{
return m_xrefman;
}
-int OPimRecord::rtti(){
+
+
+int OPimRecord::rtti()
+{
return 0;
@@ -128,3 +163,4 @@ int OPimRecord::rtti(){
*/
-bool OPimRecord::loadFromStream( QDataStream& stream ) {
+bool OPimRecord::loadFromStream( QDataStream& stream )
+{
int Int;
@@ -132,3 +168,3 @@ bool OPimRecord::loadFromStream( QDataStream& stream ) {
stream >> Int;
- setUid(Int);
+ setUid( Int );
@@ -136,5 +172,6 @@ bool OPimRecord::loadFromStream( QDataStream& stream ) {
stream >> UInt;
- QArray<int> array(UInt);
- for (uint i = 0; i < UInt; i++ ) {
- stream >> array[i];
+ QArray<int> array( UInt );
+ for ( uint i = 0; i < UInt; i++ )
+ {
+ stream >> array[ i ];
}
@@ -147,3 +184,4 @@ bool OPimRecord::loadFromStream( QDataStream& stream ) {
stream >> UInt;
- for ( uint i = 0; i < UInt; i++ ) {
+ for ( uint i = 0; i < UInt; i++ )
+ {
xref.setPartner( OPimXRef::One, partner( stream ) );
@@ -155,3 +193,6 @@ bool OPimRecord::loadFromStream( QDataStream& stream ) {
}
-bool OPimRecord::saveToStream( QDataStream& stream )const {
+
+
+bool OPimRecord::saveToStream( QDataStream& stream ) const
+{
/** UIDs */
@@ -162,4 +203,5 @@ bool OPimRecord::saveToStream( QDataStream& stream )const {
stream << categories().count();
- for ( uint i = 0; i < categories().count(); i++ ) {
- stream << categories()[i];
+ for ( uint i = 0; i < categories().count(); i++ )
+ {
+ stream << categories() [ i ];
}
@@ -172,5 +214,6 @@ bool OPimRecord::saveToStream( QDataStream& stream )const {
for ( OPimXRef::ValueList::ConstIterator it = m_xrefman.list().begin();
- it != m_xrefman.list().end(); ++it ) {
- flush( (*it).partner( OPimXRef::One), stream );
- flush( (*it).partner( OPimXRef::Two), stream );
+ it != m_xrefman.list().end(); ++it )
+ {
+ flush( ( *it ).partner( OPimXRef::One ), stream );
+ flush( ( *it ).partner( OPimXRef::Two ), stream );
}
@@ -178,3 +221,6 @@ bool OPimRecord::saveToStream( QDataStream& stream )const {
}
-void OPimRecord::flush( const OPimXRefPartner& par, QDataStream& str ) const{
+
+
+void OPimRecord::flush( const OPimXRefPartner& par, QDataStream& str ) const
+{
str << par.service();
@@ -183,3 +229,6 @@ void OPimRecord::flush( const OPimXRefPartner& par, QDataStream& str ) const{
}
-OPimXRefPartner OPimRecord::partner( QDataStream& stream ) {
+
+
+OPimXRefPartner OPimRecord::partner( QDataStream& stream )
+{
OPimXRefPartner par;
@@ -199,12 +248,24 @@ OPimXRefPartner OPimRecord::partner( QDataStream& stream ) {
}
-void OPimRecord::setLastHitField( int lastHit )const {
+
+
+void OPimRecord::setLastHitField( int lastHit ) const
+{
m_lastHit = lastHit;
}
-int OPimRecord::lastHitField()const{
+
+
+int OPimRecord::lastHitField() const
+{
return m_lastHit;
}
-QMap<QString, QString> OPimRecord::toExtraMap()const {
+
+
+QMap<QString, QString> OPimRecord::toExtraMap() const
+{
return customMap;
}
-void OPimRecord::setExtraMap( const QMap<QString, QString>& map) {
+
+
+void OPimRecord::setExtraMap( const QMap<QString, QString>& map )
+{
customMap = map;
diff --git a/libopie2/opiepim/core/opimrecord.h b/libopie2/opiepim/core/opimrecord.h
index 63a3a98..4981a41 100644
--- a/libopie2/opiepim/core/opimrecord.h
+++ b/libopie2/opiepim/core/opimrecord.h
@@ -28,10 +28,8 @@
*/
-#ifndef OPIE_PIM_RECORD_H
-#define OPIE_PIM_RECORD_H
-#include <qdatastream.h>
-#include <qmap.h>
-#include <qstring.h>
-#include <qstringlist.h>
+#ifndef OPIMRECORD_H
+#define OPIMRECORD_H
+/* OPIE */
+#include <opie2/opimxrefmanager.h>
/*
@@ -43,5 +41,10 @@
-#include <opie2/opimxrefmanager.h>
+/* QT */
+#include <qdatastream.h>
+#include <qmap.h>
+#include <qstring.h>
+#include <qstringlist.h>
-namespace Opie {
+namespace Opie
+{
/**
@@ -51,4 +54,5 @@ namespace Opie {
*/
-class OPimRecord : public Qtopia::Record {
-public:
+class OPimRecord : public Qtopia::Record
+{
+ public:
/**
@@ -58,3 +62,3 @@ public:
*/
- OPimRecord(int uid = 0);
+ OPimRecord( int uid = 0 );
~OPimRecord();
@@ -74,3 +78,3 @@ public:
*/
- QStringList categoryNames( const QString& appname )const;
+ QStringList categoryNames( const QString& appname ) const;
@@ -91,3 +95,3 @@ public:
*/
- virtual bool isEmpty()const;
+ virtual bool isEmpty() const;
@@ -96,3 +100,3 @@ public:
*/
- virtual QString toRichText()const = 0;
+ virtual QString toRichText() const = 0;
@@ -101,3 +105,3 @@ public:
*/
- virtual QString toShortText()const = 0;
+ virtual QString toShortText() const = 0;
@@ -106,3 +110,3 @@ public:
*/
- virtual QString type()const = 0;
+ virtual QString type() const = 0;
@@ -112,4 +116,6 @@ public:
virtual bool match( const QString &regexp ) const
- {setLastHitField( -1 );
- return Qtopia::Record::match(QRegExp(regexp));};
+ {
+ setLastHitField( -1 );
+ return Qtopia::Record::match( QRegExp( regexp ) );
+ };
@@ -120,3 +126,3 @@ public:
*/
- int lastHitField()const;
+ int lastHitField() const;
@@ -125,3 +131,3 @@ public:
*/
- virtual QMap<int, QString> toMap()const = 0;
+ virtual QMap<int, QString> toMap() const = 0;
// virtual fromMap( const <int, QString>& map ) = 0; // Should be added in the future (eilers)
@@ -131,3 +137,3 @@ public:
*/
- QMap<QString, QString> toExtraMap()const;
+ QMap<QString, QString> toExtraMap() const;
void setExtraMap( const QMap<QString, QString>& );
@@ -137,3 +143,3 @@ public:
*/
- virtual QString recordField(int)const = 0;
+ virtual QString recordField( int ) const = 0;
@@ -163,13 +169,13 @@ public:
*/
- virtual bool loadFromStream(QDataStream& );
- virtual bool saveToStream( QDataStream& stream )const;
+ virtual bool loadFromStream( QDataStream& );
+ virtual bool saveToStream( QDataStream& stream ) const;
-protected:
+ protected:
// need to be const cause it is called from const methods
mutable int m_lastHit;
- void setLastHitField( int lastHit )const;
+ void setLastHitField( int lastHit ) const;
Qtopia::UidGen &uidGen();
-// QString crossToString()const;
+ // QString crossToString()const;
-private:
+ private:
class OPimRecordPrivate;
@@ -179,4 +185,4 @@ private:
-private:
- void flush( const OPimXRefPartner&, QDataStream& stream )const;
+ private:
+ void flush( const OPimXRefPartner&, QDataStream& stream ) const;
OPimXRefPartner partner( QDataStream& );