summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (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
-rw-r--r--libopie2/opiepim/ocontact.cpp749
-rw-r--r--libopie2/opiepim/ocontact.h43
-rw-r--r--libopie2/opiepim/ocontactfields.cpp496
-rw-r--r--libopie2/opiepim/ocontactfields.h32
-rw-r--r--libopie2/opiepim/oevent.cpp870
-rw-r--r--libopie2/opiepim/oevent.h165
-rw-r--r--libopie2/opiepim/orecordlist.h230
-rw-r--r--libopie2/opiepim/otodo.cpp602
-rw-r--r--libopie2/opiepim/otodo.h147
15 files changed, 2491 insertions, 1648 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& );
diff --git a/libopie2/opiepim/ocontact.cpp b/libopie2/opiepim/ocontact.cpp
index f1a22a7..fa5313f 100644
--- a/libopie2/opiepim/ocontact.cpp
+++ b/libopie2/opiepim/ocontact.cpp
@@ -2,3 +2,3 @@
This file is part of the Opie Project
- Copyright (C) The Main Author <main-author@whereever.org>
+ Copyright (C) Stefan Eilers <eilers.stefan@epost.de>
=. Copyright (C) The Opie Team <opie-devel@handhelds.org>
@@ -29,27 +29,9 @@
-/**********************************************************************
-** Copyright (C) 2000-2002 Trolltech AS. All rights reserved.
-** Copyright (C) 2002-2003 by Stefan Eilers (eilers.stefan@epost.de)
-**
-** This file may be distributed and/or modified under the terms of the
-** GNU General Public License version 2 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file.
-**
-** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
-** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
-**
-** See http://www.trolltech.com/gpl/ for GPL licensing information.
-**
-** Contact info@trolltech.com if any conditions of this licensing are
-** not clear to you.
-**
-**********************************************************************/
-
#define QTOPIA_INTERNAL_CONTACT_MRE
-#include <opie2/ocontact.h>
+#include "ocontact.h"
+
+/* OPIE */
#include <opie2/opimresolver.h>
#include <opie2/oconversion.h>
-
#include <qpe/stringutil.h>
@@ -58,2 +40,3 @@
+/* QT */
#include <qobject.h>
@@ -64,2 +47,3 @@
+/* STD */
#include <stdio.h>
@@ -78,3 +62,4 @@
-namespace Opie {
+namespace Opie
+{
/*!
@@ -82,6 +67,4 @@ namespace Opie {
*/
-OContact::OContact()
- : OPimRecord(), mMap(), d( 0 )
-{
-}
+OContact::OContact():OPimRecord(), mMap(), d( 0 )
+{}
@@ -92,4 +75,3 @@ OContact::OContact()
*/
-OContact::OContact( const QMap<int, QString> &fromMap ) :
- OPimRecord(), mMap( fromMap ), d( 0 )
+OContact::OContact( const QMap<int, QString> &fromMap ):OPimRecord(), mMap( fromMap ), d( 0 )
{
@@ -97,3 +79,3 @@ OContact::OContact( const QMap<int, QString> &fromMap ) :
if ( !cats.isEmpty() )
- setCategories( idsFromString( cats ) );
+ setCategories( idsFromString( cats ) );
@@ -101,10 +83,12 @@ OContact::OContact( const QMap<int, QString> &fromMap ) :
- if ( uidStr.isEmpty() || (uidStr.toInt() == 0) ){
- qWarning( "Invalid UID found. Generate new one.." );
- setUid( uidGen().generate() );
- }else
- setUid( uidStr.toInt() );
+ if ( uidStr.isEmpty() || ( uidStr.toInt() == 0 ) )
+ {
+ qWarning( "Invalid UID found. Generate new one.." );
+ setUid( uidGen().generate() );
+ }
+ else
+ setUid( uidStr.toInt() );
-// if ( !uidStr.isEmpty() )
-// setUid( uidStr.toInt() );
+ // if ( !uidStr.isEmpty() )
+ // setUid( uidStr.toInt() );
}
@@ -115,4 +99,3 @@ OContact::OContact( const QMap<int, QString> &fromMap ) :
OContact::~OContact()
-{
-}
+{}
@@ -457,3 +440,3 @@ QMap<int, QString> OContact::toMap() const
if ( !cats.isEmpty() )
- map.insert( Qtopia::AddressCategory, cats );
+ map.insert( Qtopia::AddressCategory, cats );
return map;
@@ -471,4 +454,4 @@ QString OContact::toRichText() const
- Config cfg("qpe");
- cfg.setGroup("Appearance");
+ Config cfg( "qpe" );
+ cfg.setGroup( "Appearance" );
int addressformat = cfg.readNumEntry( "AddressFormat", Zip_City_State );
@@ -476,15 +459,17 @@ QString OContact::toRichText() const
// name, jobtitle and company
- if ( !(value = fullName()).isEmpty() )
- text += "<b><h3><img src=\"addressbook/AddressBook\"> " + Qtopia::escapeString(value) + "</h3></b>";
-
- if ( !(value = jobTitle()).isEmpty() )
- text += Qtopia::escapeString(value) + " ";
+ if ( !( value = fullName() ).isEmpty() )
+ text += "<b><h3><img src=\"addressbook/AddressBook\"> " + Qtopia::escapeString( value ) + "</h3></b>";
+
+ if ( !( value = jobTitle() ).isEmpty() )
+ text += Qtopia::escapeString( value ) + " ";
comp = company();
- if ( !(value = department()).isEmpty() ) {
- text += Qtopia::escapeString(value);
- if ( comp )
- text += ", " + Qtopia::escapeString(comp);
- }else if ( comp )
- text += "<br>" + Qtopia::escapeString(comp);
+ if ( !( value = department() ).isEmpty() )
+ {
+ text += Qtopia::escapeString( value );
+ if ( comp )
+ text += ", " + Qtopia::escapeString( comp );
+ }
+ else if ( comp )
+ text += "<br>" + Qtopia::escapeString( comp );
text += "<br><hr>";
@@ -493,6 +478,7 @@ QString OContact::toRichText() const
QString defEmail = defaultEmail();
- if ( !defEmail.isEmpty() ){
- text += "<b><img src=\"addressbook/email\"> " + QObject::tr("Default Email: ") + "</b>"
- + Qtopia::escapeString(defEmail);
- marker = true;
+ if ( !defEmail.isEmpty() )
+ {
+ text += "<b><img src=\"addressbook/email\"> " + QObject::tr( "Default Email: " ) + "</b>"
+ + Qtopia::escapeString( defEmail );
+ marker = true;
}
@@ -501,55 +487,69 @@ QString OContact::toRichText() const
if ( !businessStreet().isEmpty() || !businessCity().isEmpty() ||
- !businessZip().isEmpty() || !businessCountry().isEmpty() ) {
- text += QObject::tr( "<br><b>Work Address:</b>" );
- marker = true;
+ !businessZip().isEmpty() || !businessCountry().isEmpty() )
+ {
+ text += QObject::tr( "<br><b>Work Address:</b>" );
+ marker = true;
}
- if ( !(value = businessStreet()).isEmpty() ){
- text += "<br>" + Qtopia::escapeString(value);
- marker = true;
+ if ( !( value = businessStreet() ).isEmpty() )
+ {
+ text += "<br>" + Qtopia::escapeString( value );
+ marker = true;
}
- switch( addressformat ){
- case Zip_City_State:{ // Zip_Code City, State
- state = businessState();
- if ( !(value = businessZip()).isEmpty() ){
- text += "<br>" + Qtopia::escapeString(value) + " ";
- marker = true;
-
- }
- if ( !(value = businessCity()).isEmpty() ) {
- marker = true;
- if ( businessZip().isEmpty() && !businessStreet().isEmpty() )
- text += "<br>";
- text += Qtopia::escapeString(value);
- if ( state )
- text += ", " + Qtopia::escapeString(state);
- } else if ( !state.isEmpty() ){
- text += "<br>" + Qtopia::escapeString(state);
- marker = true;
- }
- break;
- }
- case City_State_Zip:{ // City, State Zip_Code
- state = businessState();
- if ( !(value = businessCity()).isEmpty() ) {
- marker = true;
- text += "<br>" + Qtopia::escapeString(value);
- if ( state )
- text += ", " + Qtopia::escapeString(state);
- } else if ( !state.isEmpty() ){
- text += "<br>" + Qtopia::escapeString(state);
- marker = true;
- }
- if ( !(value = businessZip()).isEmpty() ){
- text += " " + Qtopia::escapeString(value);
- marker = true;
- }
- break;
- }
+ switch ( addressformat )
+ {
+ case Zip_City_State:
+ { // Zip_Code City, State
+ state = businessState();
+ if ( !( value = businessZip() ).isEmpty() )
+ {
+ text += "<br>" + Qtopia::escapeString( value ) + " ";
+ marker = true;
+
+ }
+ if ( !( value = businessCity() ).isEmpty() )
+ {
+ marker = true;
+ if ( businessZip().isEmpty() && !businessStreet().isEmpty() )
+ text += "<br>";
+ text += Qtopia::escapeString( value );
+ if ( state )
+ text += ", " + Qtopia::escapeString( state );
+ }
+ else if ( !state.isEmpty() )
+ {
+ text += "<br>" + Qtopia::escapeString( state );
+ marker = true;
+ }
+ break;
+ }
+ case City_State_Zip:
+ { // City, State Zip_Code
+ state = businessState();
+ if ( !( value = businessCity() ).isEmpty() )
+ {
+ marker = true;
+ text += "<br>" + Qtopia::escapeString( value );
+ if ( state )
+ text += ", " + Qtopia::escapeString( state );
+ }
+ else if ( !state.isEmpty() )
+ {
+ text += "<br>" + Qtopia::escapeString( state );
+ marker = true;
+ }
+ if ( !( value = businessZip() ).isEmpty() )
+ {
+ text += " " + Qtopia::escapeString( value );
+ marker = true;
+ }
+ break;
+ }
}
- if ( !(value = businessCountry()).isEmpty() ){
- text += "<br>" + Qtopia::escapeString(value);
- marker = true;
+ if ( !( value = businessCountry() ).isEmpty() )
+ {
+ text += "<br>" + Qtopia::escapeString( value );
+ marker = true;
}
@@ -558,36 +558,42 @@ QString OContact::toRichText() const
str = office();
- if ( !str.isEmpty() ){
- text += "<br><b>" + QObject::tr("Office: ") + "</b>"
- + Qtopia::escapeString(str);
- marker = true;
+ if ( !str.isEmpty() )
+ {
+ text += "<br><b>" + QObject::tr( "Office: " ) + "</b>"
+ + Qtopia::escapeString( str );
+ marker = true;
}
str = businessWebpage();
- if ( !str.isEmpty() ){
- text += "<br><b><img src=\"addressbook/webpagework\"> " + QObject::tr("Business Web Page: ") + "</b>"
- + Qtopia::escapeString(str);
- marker = true;
+ if ( !str.isEmpty() )
+ {
+ text += "<br><b><img src=\"addressbook/webpagework\"> " + QObject::tr( "Business Web Page: " ) + "</b>"
+ + Qtopia::escapeString( str );
+ marker = true;
}
str = businessPhone();
- if ( !str.isEmpty() ){
- text += "<br><b><img src=\"addressbook/phonework\"> " + QObject::tr("Business Phone: ") + "</b>"
- + Qtopia::escapeString(str);
- marker = true;
+ if ( !str.isEmpty() )
+ {
+ text += "<br><b><img src=\"addressbook/phonework\"> " + QObject::tr( "Business Phone: " ) + "</b>"
+ + Qtopia::escapeString( str );
+ marker = true;
}
str = businessFax();
- if ( !str.isEmpty() ){
- text += "<br><b><img src=\"addressbook/faxwork\"> " + QObject::tr("Business Fax: ") + "</b>"
- + Qtopia::escapeString(str);
- marker = true;
+ if ( !str.isEmpty() )
+ {
+ text += "<br><b><img src=\"addressbook/faxwork\"> " + QObject::tr( "Business Fax: " ) + "</b>"
+ + Qtopia::escapeString( str );
+ marker = true;
}
str = businessMobile();
- if ( !str.isEmpty() ){
- text += "<br><b><img src=\"addressbook/mobilework\"> " + QObject::tr("Business Mobile: ") + "</b>"
- + Qtopia::escapeString(str);
- marker = true;
+ if ( !str.isEmpty() )
+ {
+ text += "<br><b><img src=\"addressbook/mobilework\"> " + QObject::tr( "Business Mobile: " ) + "</b>"
+ + Qtopia::escapeString( str );
+ marker = true;
}
str = businessPager();
- if ( !str.isEmpty() ){
- text += "<br><b>" + QObject::tr("Business Pager: ") + "</b>"
- + Qtopia::escapeString(str);
- marker = true;
+ if ( !str.isEmpty() )
+ {
+ text += "<br><b>" + QObject::tr( "Business Pager: " ) + "</b>"
+ + Qtopia::escapeString( str );
+ marker = true;
}
@@ -598,54 +604,68 @@ QString OContact::toRichText() const
if ( !homeStreet().isEmpty() || !homeCity().isEmpty() ||
- !homeZip().isEmpty() || !homeCountry().isEmpty() ) {
- text += QObject::tr( "<br><b>Home Address:</b>" );
- marker = true;
+ !homeZip().isEmpty() || !homeCountry().isEmpty() )
+ {
+ text += QObject::tr( "<br><b>Home Address:</b>" );
+ marker = true;
}
- if ( !(value = homeStreet()).isEmpty() ){
- text += "<br>" + Qtopia::escapeString(value);
- marker = true;
+ if ( !( value = homeStreet() ).isEmpty() )
+ {
+ text += "<br>" + Qtopia::escapeString( value );
+ marker = true;
}
- switch( addressformat ){
- case Zip_City_State:{ // Zip_Code City, State
- state = homeState();
- if ( !(value = homeZip()).isEmpty() ){
- text += "<br>" + Qtopia::escapeString(value) + " ";
- marker = true;
- }
- if ( !(value = homeCity()).isEmpty() ) {
- marker = true;
- if ( homeZip().isEmpty() && !homeStreet().isEmpty() )
- text += "<br>";
- text += Qtopia::escapeString(value);
- if ( !state.isEmpty() )
- text += ", " + Qtopia::escapeString(state);
- } else if (!state.isEmpty()) {
- text += "<br>" + Qtopia::escapeString(state);
- marker = true;
- }
- break;
- }
- case City_State_Zip:{ // City, State Zip_Code
- state = homeState();
- if ( !(value = homeCity()).isEmpty() ) {
- marker = true;
- text += "<br>" + Qtopia::escapeString(value);
- if ( state )
- text += ", " + Qtopia::escapeString(state);
- } else if ( !state.isEmpty() ){
- text += "<br>" + Qtopia::escapeString(state);
- marker = true;
- }
- if ( !(value = homeZip()).isEmpty() ){
- text += " " + Qtopia::escapeString(value);
- marker = true;
- }
- break;
- }
+ switch ( addressformat )
+ {
+ case Zip_City_State:
+ { // Zip_Code City, State
+ state = homeState();
+ if ( !( value = homeZip() ).isEmpty() )
+ {
+ text += "<br>" + Qtopia::escapeString( value ) + " ";
+ marker = true;
+ }
+ if ( !( value = homeCity() ).isEmpty() )
+ {
+ marker = true;
+ if ( homeZip().isEmpty() && !homeStreet().isEmpty() )
+ text += "<br>";
+ text += Qtopia::escapeString( value );
+ if ( !state.isEmpty() )
+ text += ", " + Qtopia::escapeString( state );
+ }
+ else if ( !state.isEmpty() )
+ {
+ text += "<br>" + Qtopia::escapeString( state );
+ marker = true;
+ }
+ break;
+ }
+ case City_State_Zip:
+ { // City, State Zip_Code
+ state = homeState();
+ if ( !( value = homeCity() ).isEmpty() )
+ {
+ marker = true;
+ text += "<br>" + Qtopia::escapeString( value );
+ if ( state )
+ text += ", " + Qtopia::escapeString( state );
+ }
+ else if ( !state.isEmpty() )
+ {
+ text += "<br>" + Qtopia::escapeString( state );
+ marker = true;
+ }
+ if ( !( value = homeZip() ).isEmpty() )
+ {
+ text += " " + Qtopia::escapeString( value );
+ marker = true;
+ }
+ break;
+ }
}
-
- if ( !(value = homeCountry()).isEmpty() ){
- text += "<br>" + Qtopia::escapeString(value);
- marker = true;
+
+ if ( !( value = homeCountry() ).isEmpty() )
+ {
+ text += "<br>" + Qtopia::escapeString( value );
+ marker = true;
}
@@ -654,24 +674,28 @@ QString OContact::toRichText() const
str = homeWebpage();
- if ( !str.isEmpty() ){
- text += "<br><b><img src=\"addressbook/webpagehome\"> " + QObject::tr("Home Web Page: ") + "</b>"
- + Qtopia::escapeString(str);
- marker = true;
+ if ( !str.isEmpty() )
+ {
+ text += "<br><b><img src=\"addressbook/webpagehome\"> " + QObject::tr( "Home Web Page: " ) + "</b>"
+ + Qtopia::escapeString( str );
+ marker = true;
}
str = homePhone();
- if ( !str.isEmpty() ){
- text += "<br><b><img src=\"addressbook/phonehome\"> " + QObject::tr("Home Phone: ") + "</b>"
- + Qtopia::escapeString(str);
- marker = true;
+ if ( !str.isEmpty() )
+ {
+ text += "<br><b><img src=\"addressbook/phonehome\"> " + QObject::tr( "Home Phone: " ) + "</b>"
+ + Qtopia::escapeString( str );
+ marker = true;
}
str = homeFax();
- if ( !str.isEmpty() ){
- text += "<br><b><img src=\"addressbook/faxhome\"> " + QObject::tr("Home Fax: ") + "</b>"
- + Qtopia::escapeString(str);
- marker = true;
+ if ( !str.isEmpty() )
+ {
+ text += "<br><b><img src=\"addressbook/faxhome\"> " + QObject::tr( "Home Fax: " ) + "</b>"
+ + Qtopia::escapeString( str );
+ marker = true;
}
str = homeMobile();
- if ( !str.isEmpty() ){
- text += "<br><b><img src=\"addressbook/mobilehome\"> " + QObject::tr("Home Mobile: ") + "</b>"
- + Qtopia::escapeString(str);
- marker = true;
+ if ( !str.isEmpty() )
+ {
+ text += "<br><b><img src=\"addressbook/mobilehome\"> " + QObject::tr( "Home Mobile: " ) + "</b>"
+ + Qtopia::escapeString( str );
+ marker = true;
}
@@ -679,3 +703,3 @@ QString OContact::toRichText() const
if ( marker )
- text += "<br><hr>";
+ text += "<br><hr>";
@@ -684,24 +708,25 @@ QString OContact::toRichText() const
if ( !str.isEmpty() && ( str != defEmail ) )
- text += "<br><b>" + QObject::tr("All Emails: ") + "</b>"
- + Qtopia::escapeString(str);
+ text += "<br><b>" + QObject::tr( "All Emails: " ) + "</b>"
+ + Qtopia::escapeString( str );
str = profession();
if ( !str.isEmpty() )
- text += "<br><b>" + QObject::tr("Profession: ") + "</b>"
- + Qtopia::escapeString(str);
+ text += "<br><b>" + QObject::tr( "Profession: " ) + "</b>"
+ + Qtopia::escapeString( str );
str = assistant();
if ( !str.isEmpty() )
- text += "<br><b>" + QObject::tr("Assistant: ") + "</b>"
- + Qtopia::escapeString(str);
+ text += "<br><b>" + QObject::tr( "Assistant: " ) + "</b>"
+ + Qtopia::escapeString( str );
str = manager();
if ( !str.isEmpty() )
- text += "<br><b>" + QObject::tr("Manager: ") + "</b>"
- + Qtopia::escapeString(str);
+ text += "<br><b>" + QObject::tr( "Manager: " ) + "</b>"
+ + Qtopia::escapeString( str );
str = gender();
- if ( !str.isEmpty() && str.toInt() != 0 ) {
- text += "<br>";
- if ( str.toInt() == 1 )
- str = QObject::tr( "Male" );
- else if ( str.toInt() == 2 )
- str = QObject::tr( "Female" );
- text += "<b>" + QObject::tr("Gender: ") + "</b>" + str;
+ if ( !str.isEmpty() && str.toInt() != 0 )
+ {
+ text += "<br>";
+ if ( str.toInt() == 1 )
+ str = QObject::tr( "Male" );
+ else if ( str.toInt() == 2 )
+ str = QObject::tr( "Female" );
+ text += "<b>" + QObject::tr( "Gender: " ) + "</b>" + str;
}
@@ -709,13 +734,15 @@ QString OContact::toRichText() const
if ( !str.isEmpty() )
- text += "<br><b>" + QObject::tr("Spouse: ") + "</b>"
- + Qtopia::escapeString(str);
- if ( birthday().isValid() ){
- str = TimeString::numberDateString( birthday() );
- text += "<br><b>" + QObject::tr("Birthday: ") + "</b>"
- + Qtopia::escapeString(str);
+ text += "<br><b>" + QObject::tr( "Spouse: " ) + "</b>"
+ + Qtopia::escapeString( str );
+ if ( birthday().isValid() )
+ {
+ str = TimeString::numberDateString( birthday() );
+ text += "<br><b>" + QObject::tr( "Birthday: " ) + "</b>"
+ + Qtopia::escapeString( str );
}
- if ( anniversary().isValid() ){
- str = TimeString::numberDateString( anniversary() );
- text += "<br><b>" + QObject::tr("Anniversary: ") + "</b>"
- + Qtopia::escapeString(str);
+ if ( anniversary().isValid() )
+ {
+ str = TimeString::numberDateString( anniversary() );
+ text += "<br><b>" + QObject::tr( "Anniversary: " ) + "</b>"
+ + Qtopia::escapeString( str );
}
@@ -723,4 +750,4 @@ QString OContact::toRichText() const
if ( !str.isEmpty() )
- text += "<br><b>" + QObject::tr("Children: ") + "</b>"
- + Qtopia::escapeString(str);
+ text += "<br><b>" + QObject::tr( "Children: " ) + "</b>"
+ + Qtopia::escapeString( str );
@@ -728,9 +755,10 @@ QString OContact::toRichText() const
if ( !str.isEmpty() )
- text += "<br><b>" + QObject::tr("Nickname: ") + "</b>"
- + Qtopia::escapeString(str);
+ text += "<br><b>" + QObject::tr( "Nickname: " ) + "</b>"
+ + Qtopia::escapeString( str );
// categories
- if ( categoryNames("Contacts").count() ){
- text += "<br><b>" + QObject::tr( "Category:") + "</b> ";
- text += categoryNames("Contacts").join(", ");
+ if ( categoryNames( "Contacts" ).count() )
+ {
+ text += "<br><b>" + QObject::tr( "Category:" ) + "</b> ";
+ text += categoryNames( "Contacts" ).join( ", " );
}
@@ -738,10 +766,11 @@ QString OContact::toRichText() const
// notes last
- if ( !(value = notes()).isEmpty() ) {
- text += "<br><hr><b>" + QObject::tr( "Notes:") + "</b> ";
- QRegExp reg("\n");
-
- //QString tmp = Qtopia::escapeString(value);
- QString tmp = QStyleSheet::convertFromPlainText(value);
- //tmp.replace( reg, "<br>" );
- text += "<br>" + tmp + "<br>";
+ if ( !( value = notes() ).isEmpty() )
+ {
+ text += "<br><hr><b>" + QObject::tr( "Notes:" ) + "</b> ";
+ QRegExp reg( "\n" );
+
+ //QString tmp = Qtopia::escapeString(value);
+ QString tmp = QStyleSheet::convertFromPlainText( value );
+ //tmp.replace( reg, "<br>" );
+ text += "<br>" + tmp + "<br>";
}
@@ -757,5 +786,5 @@ void OContact::insert( int key, const QString &v )
if ( value.isEmpty() )
- mMap.remove( key );
+ mMap.remove( key );
else
- mMap.insert( key, value );
+ mMap.insert( key, value );
}
@@ -769,5 +798,5 @@ void OContact::replace( int key, const QString & v )
if ( value.isEmpty() )
- mMap.remove( key );
+ mMap.remove( key );
else
- mMap.replace( key, value );
+ mMap.replace( key, value );
}
@@ -779,3 +808,3 @@ QString OContact::find( int key ) const
{
- return mMap[key];
+ return mMap[ key ];
}
@@ -786,6 +815,6 @@ QString OContact::find( int key ) const
QString OContact::displayAddress( const QString &street,
- const QString &city,
- const QString &state,
- const QString &zip,
- const QString &country ) const
+ const QString &city,
+ const QString &state,
+ const QString &zip,
+ const QString &country ) const
{
@@ -793,12 +822,12 @@ QString OContact::displayAddress( const QString &street,
if ( !street.isEmpty() )
- s+= "\n";
+ s += "\n";
s += city;
if ( !city.isEmpty() && !state.isEmpty() )
- s += ", ";
+ s += ", ";
s += state;
if ( !state.isEmpty() && !zip.isEmpty() )
- s += " ";
+ s += " ";
s += zip;
if ( !country.isEmpty() && !s.isEmpty() )
- s += "\n";
+ s += "\n";
s += country;
@@ -813,4 +842,4 @@ QString OContact::displayBusinessAddress() const
return displayAddress( businessStreet(), businessCity(),
- businessState(), businessZip(),
- businessCountry() );
+ businessState(), businessZip(),
+ businessCountry() );
}
@@ -823,4 +852,4 @@ QString OContact::displayHomeAddress() const
return displayAddress( homeStreet(), homeCity(),
- homeState(), homeZip(),
- homeCountry() );
+ homeState(), homeZip(),
+ homeCountry() );
}
@@ -839,21 +868,25 @@ QString OContact::fullName() const
QString name = title;
- if ( !firstName.isEmpty() ) {
- if ( !name.isEmpty() )
- name += " ";
- name += firstName;
+ if ( !firstName.isEmpty() )
+ {
+ if ( !name.isEmpty() )
+ name += " ";
+ name += firstName;
}
- if ( !middleName.isEmpty() ) {
- if ( !name.isEmpty() )
- name += " ";
- name += middleName;
+ if ( !middleName.isEmpty() )
+ {
+ if ( !name.isEmpty() )
+ name += " ";
+ name += middleName;
}
- if ( !lastName.isEmpty() ) {
- if ( !name.isEmpty() )
- name += " ";
- name += lastName;
+ if ( !lastName.isEmpty() )
+ {
+ if ( !name.isEmpty() )
+ name += " ";
+ name += lastName;
}
- if ( !suffix.isEmpty() ) {
- if ( !name.isEmpty() )
- name += " ";
- name += suffix;
+ if ( !suffix.isEmpty() )
+ {
+ if ( !name.isEmpty() )
+ name += " ";
+ name += suffix;
}
@@ -902,7 +935,8 @@ QStringList OContact::emailList() const
QStringList r;
- if ( !emailStr.isEmpty() ) {
- qDebug(" emailstr ");
- QStringList l = QStringList::split( emailSeparator(), emailStr );
- for ( QStringList::ConstIterator it = l.begin();it != l.end();++it )
- r += (*it).simplifyWhiteSpace();
+ if ( !emailStr.isEmpty() )
+ {
+ qDebug( " emailstr " );
+ QStringList l = QStringList::split( emailSeparator(), emailStr );
+ for ( QStringList::ConstIterator it = l.begin();it != l.end();++it )
+ r += ( *it ).simplifyWhiteSpace();
}
@@ -926,11 +960,11 @@ void OContact::setFileAs()
if ( !lastName.isEmpty() && !firstName.isEmpty()
- && !middleName.isEmpty() )
- fileas = lastName + ", " + firstName + " " + middleName;
+ && !middleName.isEmpty() )
+ fileas = lastName + ", " + firstName + " " + middleName;
else if ( !lastName.isEmpty() && !firstName.isEmpty() )
- fileas = lastName + ", " + firstName;
+ fileas = lastName + ", " + firstName;
else if ( !lastName.isEmpty() || !firstName.isEmpty() ||
- !middleName.isEmpty() )
- fileas = firstName + ( firstName.isEmpty() ? "" : " " )
- + middleName + ( middleName.isEmpty() ? "" : " " )
- + lastName;
+ !middleName.isEmpty() )
+ fileas = firstName + ( firstName.isEmpty() ? "" : " " )
+ + middleName + ( middleName.isEmpty() ? "" : " " )
+ + lastName;
@@ -948,13 +982,15 @@ void OContact::save( QString &buf ) const
for ( QMap<int, QString>::ConstIterator it = mMap.begin();
- it != mMap.end(); ++it ) {
- const QString &value = it.data();
- int key = it.key();
- if ( !value.isEmpty() ) {
- if ( key == Qtopia::AddressCategory || key == Qtopia::AddressUid)
- continue;
-
- key -= Qtopia::AddressCategory+1;
- buf += SLFIELDS[key];
- buf += "=\"" + Qtopia::escapeString(value) + "\" ";
- }
+ it != mMap.end(); ++it )
+ {
+ const QString &value = it.data();
+ int key = it.key();
+ if ( !value.isEmpty() )
+ {
+ if ( key == Qtopia::AddressCategory || key == Qtopia::AddressUid )
+ continue;
+
+ key -= Qtopia::AddressCategory + 1;
+ buf += SLFIELDS[ key ];
+ buf += "=\"" + Qtopia::escapeString( value ) + "\" ";
+ }
}
@@ -962,3 +998,3 @@ void OContact::save( QString &buf ) const
if ( categories().count() > 0 )
- buf += "Categories=\"" + idsToString( categories() ) + "\" ";
+ buf += "Categories=\"" + idsToString( categories() ) + "\" ";
buf += "Uid=\"" + QString::number( uid() ) + "\" ";
@@ -1063,8 +1099,10 @@ bool OContact::match( const QRegExp &r ) const
QMap<int, QString>::ConstIterator it;
- for ( it = mMap.begin(); it != mMap.end(); ++it ) {
- if ( (*it).find( r ) > -1 ) {
+ for ( it = mMap.begin(); it != mMap.end(); ++it )
+ {
+ if ( ( *it ).find( r ) > -1 )
+ {
setLastHitField( it.key() );
- match = true;
- break;
- }
+ match = true;
+ break;
+ }
}
@@ -1076,7 +1114,9 @@ QString OContact::toShortText() const
{
- return ( fullName() );
+ return ( fullName() );
}
+
+
QString OContact::type() const
{
- return QString::fromLatin1( "OContact" );
+ return QString::fromLatin1( "OContact" );
}
@@ -1084,7 +1124,6 @@ QString OContact::type() const
-
class QString OContact::recordField( int pos ) const
{
- QStringList SLFIELDS = fields(); // ?? why this ? (se)
- return SLFIELDS[pos];
+ QStringList SLFIELDS = fields(); // ?? why this ? (se)
+ return SLFIELDS[ pos ];
}
@@ -1101,10 +1140,11 @@ void OContact::setBirthday( const QDate &v )
{
- if ( v.isNull() ){
- qWarning( "Remove Birthday");
- replace( Qtopia::Birthday, QString::null );
- return;
- }
+ if ( v.isNull() )
+ {
+ qWarning( "Remove Birthday" );
+ replace( Qtopia::Birthday, QString::null );
+ return ;
+ }
- if ( v.isValid() )
- replace( Qtopia::Birthday, OConversion::dateToString( v ) );
+ if ( v.isValid() )
+ replace( Qtopia::Birthday, OConversion::dateToString( v ) );
@@ -1119,12 +1159,14 @@ void OContact::setAnniversary( const QDate &v )
{
- if ( v.isNull() ){
- qWarning( "Remove Anniversary");
- replace( Qtopia::Anniversary, QString::null );
- return;
- }
-
- if ( v.isValid() )
- replace( Qtopia::Anniversary, OConversion::dateToString( v ) );
+ if ( v.isNull() )
+ {
+ qWarning( "Remove Anniversary" );
+ replace( Qtopia::Anniversary, QString::null );
+ return ;
+ }
+
+ if ( v.isValid() )
+ replace( Qtopia::Anniversary, OConversion::dateToString( v ) );
}
+
/*! \fn QDate OContact::birthday() const
@@ -1134,8 +1176,8 @@ QDate OContact::birthday() const
{
- QString str = find( Qtopia::Birthday );
- // qWarning ("Birthday %s", str.latin1() );
- if ( !str.isEmpty() )
- return OConversion::dateFromString ( str );
- else
- return QDate();
+ QString str = find( Qtopia::Birthday );
+ // qWarning ("Birthday %s", str.latin1() );
+ if ( !str.isEmpty() )
+ return OConversion::dateFromString ( str );
+ else
+ return QDate();
}
@@ -1148,9 +1190,9 @@ QDate OContact::anniversary() const
{
- QDate empty;
- QString str = find( Qtopia::Anniversary );
- // qWarning ("Anniversary %s", str.latin1() );
- if ( !str.isEmpty() )
- return OConversion::dateFromString ( str );
- else
- return empty;
+ QDate empty;
+ QString str = find( Qtopia::Anniversary );
+ // qWarning ("Anniversary %s", str.latin1() );
+ if ( !str.isEmpty() )
+ return OConversion::dateFromString ( str );
+ else
+ return empty;
}
@@ -1165,5 +1207,6 @@ void OContact::insertEmail( const QString &v )
// if no default, set it as the default email and don't insert
- if ( def.isEmpty() ) {
- setDefaultEmail( e ); // will insert into the list for us
- return;
+ if ( def.isEmpty() )
+ {
+ setDefaultEmail( e ); // will insert into the list for us
+ return ;
}
@@ -1172,6 +1215,6 @@ void OContact::insertEmail( const QString &v )
QString emailsStr = find( Qtopia::Emails );
- if ( emailsStr.contains( e ))
- return;
+ if ( emailsStr.contains( e ) )
+ return ;
if ( !emailsStr.isEmpty() )
- emailsStr += emailSeparator();
+ emailsStr += emailSeparator();
emailsStr += e;
@@ -1180,3 +1223,4 @@ void OContact::insertEmail( const QString &v )
-void OContact::removeEmail( const QString &v )
+
+ void OContact::removeEmail( const QString &v )
{
@@ -1189,3 +1233,3 @@ void OContact::removeEmail( const QString &v )
if ( !emailsStr.contains( e ) )
- return;
+ return ;
@@ -1195,3 +1239,3 @@ void OContact::removeEmail( const QString &v )
// reset the string
- emailsStr = emails.join(emailSeparator()); // Sharp's brain dead separator
+ emailsStr = emails.join( emailSeparator() ); // Sharp's brain dead separator
replace( Qtopia::Emails, emailsStr );
@@ -1199,10 +1243,13 @@ void OContact::removeEmail( const QString &v )
// if default, then replace the default email with the first one
- if ( def == e ) {
- //qDebug("removeEmail is default; setting new default");
- if ( !emails.count() )
- clearEmails();
- else // setDefaultEmail will remove e from the list
- setDefaultEmail( emails.first() );
+ if ( def == e )
+ {
+ //qDebug("removeEmail is default; setting new default");
+ if ( !emails.count() )
+ clearEmails();
+ else // setDefaultEmail will remove e from the list
+ setDefaultEmail( emails.first() );
}
}
+
+
void OContact::clearEmails()
@@ -1212,2 +1259,4 @@ void OContact::clearEmails()
}
+
+
void OContact::setDefaultEmail( const QString &v )
@@ -1220,3 +1269,3 @@ void OContact::setDefaultEmail( const QString &v )
if ( !e.isEmpty() )
- insertEmail( e );
+ insertEmail( e );
@@ -1224,2 +1273,3 @@ void OContact::setDefaultEmail( const QString &v )
+
void OContact::insertEmails( const QStringList &v )
@@ -1227,11 +1277,16 @@ void OContact::insertEmails( const QStringList &v )
for ( QStringList::ConstIterator it = v.begin(); it != v.end(); ++it )
- insertEmail( *it );
+ insertEmail( *it );
}
-int OContact::rtti() {
+
+
+int OContact::rtti()
+{
return OPimResolver::AddressBook;
}
+
+
void OContact::setUid( int i )
{
- OPimRecord::setUid(i);
- replace( Qtopia::AddressUid , QString::number(i));
+ OPimRecord::setUid( i );
+ replace( Qtopia::AddressUid , QString::number( i ) );
}
diff --git a/libopie2/opiepim/ocontact.h b/libopie2/opiepim/ocontact.h
index 34888dc..445fd7d 100644
--- a/libopie2/opiepim/ocontact.h
+++ b/libopie2/opiepim/ocontact.h
@@ -28,5 +28,7 @@
*/
-#ifndef __OCONTACT_H__
-#define __OCONTACT_H__
+#ifndef OCONTACT_H
+#define OCONTACT_H
+
+/* OPIE */
#include <opie2/opimrecord.h>
@@ -34,2 +36,3 @@
+/* QT */
#include <qdatetime.h>
@@ -43,3 +46,4 @@ QPC_TEMPLATEEXTERN template class QPC_EXPORT QMap<int, QString>;
-namespace Opie {
+namespace Opie
+{
class OContactPrivate;
@@ -56,3 +60,4 @@ class QPC_EXPORT OContact : public OPimRecord
friend class DataSet;
-public:
+
+ public:
OContact();
@@ -62,4 +67,4 @@ public:
enum DateFormat{
- Zip_City_State = 0,
- City_State_Zip
+ Zip_City_State = 0,
+ City_State_Zip
};
@@ -126,3 +131,3 @@ public:
// other
- void setNotes( const QString &v ) { replace( Qtopia::Notes, v); }
+ void setNotes( const QString &v ) { replace( Qtopia::Notes, v ); }
@@ -130,5 +135,5 @@ public:
-// // custom
-// void setCustomField( const QString &key, const QString &v )
-// { replace(Custom- + key, v ); }
+ // // custom
+ // void setCustomField( const QString &key, const QString &v )
+ // { replace(Custom- + key, v ); }
@@ -187,3 +192,3 @@ public:
QString manager() const { return find( Qtopia::Manager ); }
- /** Multi line string containing all non-empty address info in the form
+ /** Multi line string containing all non-empty address info in the form
* Street
@@ -215,5 +220,5 @@ public:
- QString toShortText()const;
- QString type()const;
- class QString recordField(int) const;
+ QString toShortText() const;
+ QString type() const;
+ class QString recordField( int ) const;
@@ -227,3 +232,3 @@ public:
-private:
+ private:
// The XML Backend needs some access to the private functions
@@ -239,6 +244,6 @@ private:
QString displayAddress( const QString &street,
- const QString &city,
- const QString &state,
- const QString &zip,
- const QString &country ) const;
+ const QString &city,
+ const QString &state,
+ const QString &zip,
+ const QString &country ) const;
diff --git a/libopie2/opiepim/ocontactfields.cpp b/libopie2/opiepim/ocontactfields.cpp
index deaa1e5..bec00f7 100644
--- a/libopie2/opiepim/ocontactfields.cpp
+++ b/libopie2/opiepim/ocontactfields.cpp
@@ -2,3 +2,3 @@
This file is part of the Opie Project
- Copyright (C) The Main Author <main-author@whereever.org>
+ Copyright (C) Stefan Eilers <eilers.stefan@epost.de>
=. Copyright (C) The Opie Team <opie-devel@handhelds.org>
@@ -29,13 +29,16 @@
-#include <opie2/ocontactfields.h>
+#include "ocontactfields.h"
-#include <qstringlist.h>
+/* OPIE */
+#include <opie2/ocontact.h>
+#include <qpe/recordfields.h> // We should use our own enum in the future ..
+#include <qpe/config.h>
+
+/* QT */
#include <qobject.h>
+#include <qstringlist.h>
-// We should use our own enum in the future ..
-#include <qpe/recordfields.h>
-#include <qpe/config.h>
-#include <opie2/ocontact.h>
-namespace Opie {
+namespace Opie
+{
/*!
@@ -49,5 +52,5 @@ QStringList OContactFields::personalfields( bool sorted, bool translated )
if ( translated )
- mapIdToStr = idToTrFields();
+ mapIdToStr = idToTrFields();
else
- mapIdToStr = idToUntrFields();
+ mapIdToStr = idToUntrFields();
@@ -70,3 +73,3 @@ QStringList OContactFields::personalfields( bool sorted, bool translated )
- if (sorted) list.sort();
+ if ( sorted ) list.sort();
return list;
@@ -83,5 +86,5 @@ QStringList OContactFields::detailsfields( bool sorted, bool translated )
if ( translated )
- mapIdToStr = idToTrFields();
+ mapIdToStr = idToTrFields();
else
- mapIdToStr = idToUntrFields();
+ mapIdToStr = idToUntrFields();
@@ -99,3 +102,3 @@ QStringList OContactFields::detailsfields( bool sorted, bool translated )
- if (sorted) list.sort();
+ if ( sorted ) list.sort();
return list;
@@ -112,22 +115,22 @@ QStringList OContactFields::phonefields( bool sorted, bool translated )
if ( translated )
- mapIdToStr = idToTrFields();
+ mapIdToStr = idToTrFields();
else
- mapIdToStr = idToUntrFields();
+ mapIdToStr = idToUntrFields();
- list.append( mapIdToStr[Qtopia::BusinessPhone] );
- list.append( mapIdToStr[Qtopia::BusinessFax] );
- list.append( mapIdToStr[Qtopia::BusinessMobile] );
- list.append( mapIdToStr[Qtopia::BusinessPager] );
- list.append( mapIdToStr[Qtopia::BusinessWebPage] );
+ list.append( mapIdToStr[ Qtopia::BusinessPhone ] );
+ list.append( mapIdToStr[ Qtopia::BusinessFax ] );
+ list.append( mapIdToStr[ Qtopia::BusinessMobile ] );
+ list.append( mapIdToStr[ Qtopia::BusinessPager ] );
+ list.append( mapIdToStr[ Qtopia::BusinessWebPage ] );
- list.append( mapIdToStr[Qtopia::DefaultEmail] );
- list.append( mapIdToStr[Qtopia::Emails] );
+ list.append( mapIdToStr[ Qtopia::DefaultEmail ] );
+ list.append( mapIdToStr[ Qtopia::Emails ] );
- list.append( mapIdToStr[Qtopia::HomePhone] );
- list.append( mapIdToStr[Qtopia::HomeFax] );
- list.append( mapIdToStr[Qtopia::HomeMobile] );
+ list.append( mapIdToStr[ Qtopia::HomePhone ] );
+ list.append( mapIdToStr[ Qtopia::HomeFax ] );
+ list.append( mapIdToStr[ Qtopia::HomeMobile ] );
// list.append( mapIdToStr[Qtopia::HomePager] );
- list.append( mapIdToStr[Qtopia::HomeWebPage] );
+ list.append( mapIdToStr[ Qtopia::HomeWebPage ] );
- if (sorted) list.sort();
+ if ( sorted ) list.sort();
@@ -145,5 +148,5 @@ QStringList OContactFields::fields( bool sorted, bool translated )
if ( translated )
- mapIdToStr = idToTrFields();
+ mapIdToStr = idToTrFields();
else
- mapIdToStr = idToUntrFields();
+ mapIdToStr = idToUntrFields();
@@ -153,13 +156,13 @@ QStringList OContactFields::fields( bool sorted, bool translated )
- list.append( mapIdToStr[Qtopia::BusinessStreet] );
- list.append( mapIdToStr[Qtopia::BusinessCity] );
- list.append( mapIdToStr[Qtopia::BusinessState] );
- list.append( mapIdToStr[Qtopia::BusinessZip] );
- list.append( mapIdToStr[Qtopia::BusinessCountry] );
+ list.append( mapIdToStr[ Qtopia::BusinessStreet ] );
+ list.append( mapIdToStr[ Qtopia::BusinessCity ] );
+ list.append( mapIdToStr[ Qtopia::BusinessState ] );
+ list.append( mapIdToStr[ Qtopia::BusinessZip ] );
+ list.append( mapIdToStr[ Qtopia::BusinessCountry ] );
- list.append( mapIdToStr[Qtopia::HomeStreet] );
- list.append( mapIdToStr[Qtopia::HomeCity] );
- list.append( mapIdToStr[Qtopia::HomeState] );
- list.append( mapIdToStr[Qtopia::HomeZip] );
- list.append( mapIdToStr[Qtopia::HomeCountry] );
+ list.append( mapIdToStr[ Qtopia::HomeStreet ] );
+ list.append( mapIdToStr[ Qtopia::HomeCity ] );
+ list.append( mapIdToStr[ Qtopia::HomeState ] );
+ list.append( mapIdToStr[ Qtopia::HomeZip ] );
+ list.append( mapIdToStr[ Qtopia::HomeCountry ] );
@@ -167,3 +170,3 @@ QStringList OContactFields::fields( bool sorted, bool translated )
- if (sorted) list.sort();
+ if ( sorted ) list.sort();
@@ -179,3 +182,3 @@ QStringList OContactFields::untrpersonalfields( bool sorted )
{
- return personalfields( sorted, false );
+ return personalfields( sorted, false );
}
@@ -189,3 +192,3 @@ QStringList OContactFields::trpersonalfields( bool sorted )
{
- return personalfields( sorted, true );
+ return personalfields( sorted, true );
}
@@ -199,3 +202,3 @@ QStringList OContactFields::untrdetailsfields( bool sorted )
{
- return detailsfields( sorted, false );
+ return detailsfields( sorted, false );
}
@@ -209,3 +212,3 @@ QStringList OContactFields::trdetailsfields( bool sorted )
{
- return detailsfields( sorted, true );
+ return detailsfields( sorted, true );
}
@@ -219,3 +222,3 @@ QStringList OContactFields::trphonefields( bool sorted )
{
- return phonefields( sorted, true );
+ return phonefields( sorted, true );
}
@@ -228,3 +231,3 @@ QStringList OContactFields::untrphonefields( bool sorted )
{
- return phonefields( sorted, false );
+ return phonefields( sorted, false );
}
@@ -238,3 +241,3 @@ QStringList OContactFields::trfields( bool sorted )
{
- return fields( sorted, true );
+ return fields( sorted, true );
}
@@ -252,64 +255,64 @@ QMap<int, QString> OContactFields::idToTrFields()
{
- QMap<int, QString> ret_map;
-
- ret_map.insert( Qtopia::AddressUid, QObject::tr( "User Id" ) );
- ret_map.insert( Qtopia::AddressCategory, QObject::tr( "Categories" ) );
-
- ret_map.insert( Qtopia::Title, QObject::tr( "Name Title") );
- ret_map.insert( Qtopia::FirstName, QObject::tr( "First Name" ) );
- ret_map.insert( Qtopia::MiddleName, QObject::tr( "Middle Name" ) );
- ret_map.insert( Qtopia::LastName, QObject::tr( "Last Name" ) );
- ret_map.insert( Qtopia::Suffix, QObject::tr( "Suffix" ));
- ret_map.insert( Qtopia::FileAs, QObject::tr( "File As" ) );
-
- ret_map.insert( Qtopia::JobTitle, QObject::tr( "Job Title" ) );
- ret_map.insert( Qtopia::Department, QObject::tr( "Department" ) );
- ret_map.insert( Qtopia::Company, QObject::tr( "Company" ) );
- ret_map.insert( Qtopia::BusinessPhone, QObject::tr( "Business Phone" ) );
- ret_map.insert( Qtopia::BusinessFax, QObject::tr( "Business Fax" ) );
- ret_map.insert( Qtopia::BusinessMobile, QObject::tr( "Business Mobile" ));
-
- // email
- ret_map.insert( Qtopia::DefaultEmail, QObject::tr( "Default Email" ) );
- ret_map.insert( Qtopia::Emails, QObject::tr( "Emails" ) );
-
- ret_map.insert( Qtopia::HomePhone, QObject::tr( "Home Phone" ) );
- ret_map.insert( Qtopia::HomeFax, QObject::tr( "Home Fax" ) );
- ret_map.insert( Qtopia::HomeMobile, QObject::tr( "Home Mobile" ) );
-
- // business
- ret_map.insert( Qtopia::BusinessStreet, QObject::tr( "Business Street" ) );
- ret_map.insert( Qtopia::BusinessCity, QObject::tr( "Business City" ) );
- ret_map.insert( Qtopia::BusinessState, QObject::tr( "Business State" ) );
- ret_map.insert( Qtopia::BusinessZip, QObject::tr( "Business Zip" ) );
- ret_map.insert( Qtopia::BusinessCountry, QObject::tr( "Business Country" ) );
- ret_map.insert( Qtopia::BusinessPager, QObject::tr( "Business Pager" ) );
- ret_map.insert( Qtopia::BusinessWebPage, QObject::tr( "Business WebPage" ) );
-
- ret_map.insert( Qtopia::Office, QObject::tr( "Office" ) );
- ret_map.insert( Qtopia::Profession, QObject::tr( "Profession" ) );
- ret_map.insert( Qtopia::Assistant, QObject::tr( "Assistant" ) );
- ret_map.insert( Qtopia::Manager, QObject::tr( "Manager" ) );
-
- // home
- ret_map.insert( Qtopia::HomeStreet, QObject::tr( "Home Street" ) );
- ret_map.insert( Qtopia::HomeCity, QObject::tr( "Home City" ) );
- ret_map.insert( Qtopia::HomeState, QObject::tr( "Home State" ) );
- ret_map.insert( Qtopia::HomeZip, QObject::tr( "Home Zip" ) );
- ret_map.insert( Qtopia::HomeCountry, QObject::tr( "Home Country" ) );
- ret_map.insert( Qtopia::HomeWebPage, QObject::tr( "Home Web Page" ) );
-
- //personal
- ret_map.insert( Qtopia::Spouse, QObject::tr( "Spouse" ) );
- ret_map.insert( Qtopia::Gender, QObject::tr( "Gender" ) );
- ret_map.insert( Qtopia::Birthday, QObject::tr( "Birthday" ) );
- ret_map.insert( Qtopia::Anniversary, QObject::tr( "Anniversary" ) );
- ret_map.insert( Qtopia::Nickname, QObject::tr( "Nickname" ) );
- ret_map.insert( Qtopia::Children, QObject::tr( "Children" ) );
-
- // other
- ret_map.insert( Qtopia::Notes, QObject::tr( "Notes" ) );
-
-
- return ret_map;
+ QMap<int, QString> ret_map;
+
+ ret_map.insert( Qtopia::AddressUid, QObject::tr( "User Id" ) );
+ ret_map.insert( Qtopia::AddressCategory, QObject::tr( "Categories" ) );
+
+ ret_map.insert( Qtopia::Title, QObject::tr( "Name Title" ) );
+ ret_map.insert( Qtopia::FirstName, QObject::tr( "First Name" ) );
+ ret_map.insert( Qtopia::MiddleName, QObject::tr( "Middle Name" ) );
+ ret_map.insert( Qtopia::LastName, QObject::tr( "Last Name" ) );
+ ret_map.insert( Qtopia::Suffix, QObject::tr( "Suffix" ) );
+ ret_map.insert( Qtopia::FileAs, QObject::tr( "File As" ) );
+
+ ret_map.insert( Qtopia::JobTitle, QObject::tr( "Job Title" ) );
+ ret_map.insert( Qtopia::Department, QObject::tr( "Department" ) );
+ ret_map.insert( Qtopia::Company, QObject::tr( "Company" ) );
+ ret_map.insert( Qtopia::BusinessPhone, QObject::tr( "Business Phone" ) );
+ ret_map.insert( Qtopia::BusinessFax, QObject::tr( "Business Fax" ) );
+ ret_map.insert( Qtopia::BusinessMobile, QObject::tr( "Business Mobile" ) );
+
+ // email
+ ret_map.insert( Qtopia::DefaultEmail, QObject::tr( "Default Email" ) );
+ ret_map.insert( Qtopia::Emails, QObject::tr( "Emails" ) );
+
+ ret_map.insert( Qtopia::HomePhone, QObject::tr( "Home Phone" ) );
+ ret_map.insert( Qtopia::HomeFax, QObject::tr( "Home Fax" ) );
+ ret_map.insert( Qtopia::HomeMobile, QObject::tr( "Home Mobile" ) );
+
+ // business
+ ret_map.insert( Qtopia::BusinessStreet, QObject::tr( "Business Street" ) );
+ ret_map.insert( Qtopia::BusinessCity, QObject::tr( "Business City" ) );
+ ret_map.insert( Qtopia::BusinessState, QObject::tr( "Business State" ) );
+ ret_map.insert( Qtopia::BusinessZip, QObject::tr( "Business Zip" ) );
+ ret_map.insert( Qtopia::BusinessCountry, QObject::tr( "Business Country" ) );
+ ret_map.insert( Qtopia::BusinessPager, QObject::tr( "Business Pager" ) );
+ ret_map.insert( Qtopia::BusinessWebPage, QObject::tr( "Business WebPage" ) );
+
+ ret_map.insert( Qtopia::Office, QObject::tr( "Office" ) );
+ ret_map.insert( Qtopia::Profession, QObject::tr( "Profession" ) );
+ ret_map.insert( Qtopia::Assistant, QObject::tr( "Assistant" ) );
+ ret_map.insert( Qtopia::Manager, QObject::tr( "Manager" ) );
+
+ // home
+ ret_map.insert( Qtopia::HomeStreet, QObject::tr( "Home Street" ) );
+ ret_map.insert( Qtopia::HomeCity, QObject::tr( "Home City" ) );
+ ret_map.insert( Qtopia::HomeState, QObject::tr( "Home State" ) );
+ ret_map.insert( Qtopia::HomeZip, QObject::tr( "Home Zip" ) );
+ ret_map.insert( Qtopia::HomeCountry, QObject::tr( "Home Country" ) );
+ ret_map.insert( Qtopia::HomeWebPage, QObject::tr( "Home Web Page" ) );
+
+ //personal
+ ret_map.insert( Qtopia::Spouse, QObject::tr( "Spouse" ) );
+ ret_map.insert( Qtopia::Gender, QObject::tr( "Gender" ) );
+ ret_map.insert( Qtopia::Birthday, QObject::tr( "Birthday" ) );
+ ret_map.insert( Qtopia::Anniversary, QObject::tr( "Anniversary" ) );
+ ret_map.insert( Qtopia::Nickname, QObject::tr( "Nickname" ) );
+ ret_map.insert( Qtopia::Children, QObject::tr( "Children" ) );
+
+ // other
+ ret_map.insert( Qtopia::Notes, QObject::tr( "Notes" ) );
+
+
+ return ret_map;
}
@@ -318,65 +321,65 @@ QMap<int, QString> OContactFields::idToUntrFields()
{
- QMap<int, QString> ret_map;
-
- ret_map.insert( Qtopia::AddressUid, "User Id" );
- ret_map.insert( Qtopia::AddressCategory, "Categories" );
-
- ret_map.insert( Qtopia::Title, "Name Title" );
- ret_map.insert( Qtopia::FirstName, "First Name" );
- ret_map.insert( Qtopia::MiddleName, "Middle Name" );
- ret_map.insert( Qtopia::LastName, "Last Name" );
- ret_map.insert( Qtopia::Suffix, "Suffix" );
- ret_map.insert( Qtopia::FileAs, "File As" );
-
- ret_map.insert( Qtopia::JobTitle, "Job Title" );
- ret_map.insert( Qtopia::Department, "Department" );
- ret_map.insert( Qtopia::Company, "Company" );
- ret_map.insert( Qtopia::BusinessPhone, "Business Phone" );
- ret_map.insert( Qtopia::BusinessFax, "Business Fax" );
- ret_map.insert( Qtopia::BusinessMobile, "Business Mobile" );
-
- // email
- ret_map.insert( Qtopia::DefaultEmail, "Default Email" );
- ret_map.insert( Qtopia::Emails, "Emails" );
-
- ret_map.insert( Qtopia::HomePhone, "Home Phone" );
- ret_map.insert( Qtopia::HomeFax, "Home Fax" );
- ret_map.insert( Qtopia::HomeMobile, "Home Mobile" );
-
- // business
- ret_map.insert( Qtopia::BusinessStreet, "Business Street" );
- ret_map.insert( Qtopia::BusinessCity, "Business City" );
- ret_map.insert( Qtopia::BusinessState, "Business State" );
- ret_map.insert( Qtopia::BusinessZip, "Business Zip" );
- ret_map.insert( Qtopia::BusinessCountry, "Business Country" );
- ret_map.insert( Qtopia::BusinessPager, "Business Pager" );
- ret_map.insert( Qtopia::BusinessWebPage, "Business WebPage" );
-
- ret_map.insert( Qtopia::Office, "Office" );
- ret_map.insert( Qtopia::Profession, "Profession" );
- ret_map.insert( Qtopia::Assistant, "Assistant" );
- ret_map.insert( Qtopia::Manager, "Manager" );
-
- // home
- ret_map.insert( Qtopia::HomeStreet, "Home Street" );
- ret_map.insert( Qtopia::HomeCity, "Home City" );
- ret_map.insert( Qtopia::HomeState, "Home State" );
- ret_map.insert( Qtopia::HomeZip, "Home Zip" );
- ret_map.insert( Qtopia::HomeCountry, "Home Country" );
- ret_map.insert( Qtopia::HomeWebPage, "Home Web Page" );
-
- //personal
- ret_map.insert( Qtopia::Spouse, "Spouse" );
- ret_map.insert( Qtopia::Gender, "Gender" );
- ret_map.insert( Qtopia::Birthday, "Birthday" );
- ret_map.insert( Qtopia::Anniversary, "Anniversary" );
- ret_map.insert( Qtopia::Nickname, "Nickname" );
- ret_map.insert( Qtopia::Children, "Children" );
-
- // other
- ret_map.insert( Qtopia::Notes, "Notes" );
- ret_map.insert( Qtopia::Groups, "Groups" );
-
-
- return ret_map;
+ QMap<int, QString> ret_map;
+
+ ret_map.insert( Qtopia::AddressUid, "User Id" );
+ ret_map.insert( Qtopia::AddressCategory, "Categories" );
+
+ ret_map.insert( Qtopia::Title, "Name Title" );
+ ret_map.insert( Qtopia::FirstName, "First Name" );
+ ret_map.insert( Qtopia::MiddleName, "Middle Name" );
+ ret_map.insert( Qtopia::LastName, "Last Name" );
+ ret_map.insert( Qtopia::Suffix, "Suffix" );
+ ret_map.insert( Qtopia::FileAs, "File As" );
+
+ ret_map.insert( Qtopia::JobTitle, "Job Title" );
+ ret_map.insert( Qtopia::Department, "Department" );
+ ret_map.insert( Qtopia::Company, "Company" );
+ ret_map.insert( Qtopia::BusinessPhone, "Business Phone" );
+ ret_map.insert( Qtopia::BusinessFax, "Business Fax" );
+ ret_map.insert( Qtopia::BusinessMobile, "Business Mobile" );
+
+ // email
+ ret_map.insert( Qtopia::DefaultEmail, "Default Email" );
+ ret_map.insert( Qtopia::Emails, "Emails" );
+
+ ret_map.insert( Qtopia::HomePhone, "Home Phone" );
+ ret_map.insert( Qtopia::HomeFax, "Home Fax" );
+ ret_map.insert( Qtopia::HomeMobile, "Home Mobile" );
+
+ // business
+ ret_map.insert( Qtopia::BusinessStreet, "Business Street" );
+ ret_map.insert( Qtopia::BusinessCity, "Business City" );
+ ret_map.insert( Qtopia::BusinessState, "Business State" );
+ ret_map.insert( Qtopia::BusinessZip, "Business Zip" );
+ ret_map.insert( Qtopia::BusinessCountry, "Business Country" );
+ ret_map.insert( Qtopia::BusinessPager, "Business Pager" );
+ ret_map.insert( Qtopia::BusinessWebPage, "Business WebPage" );
+
+ ret_map.insert( Qtopia::Office, "Office" );
+ ret_map.insert( Qtopia::Profession, "Profession" );
+ ret_map.insert( Qtopia::Assistant, "Assistant" );
+ ret_map.insert( Qtopia::Manager, "Manager" );
+
+ // home
+ ret_map.insert( Qtopia::HomeStreet, "Home Street" );
+ ret_map.insert( Qtopia::HomeCity, "Home City" );
+ ret_map.insert( Qtopia::HomeState, "Home State" );
+ ret_map.insert( Qtopia::HomeZip, "Home Zip" );
+ ret_map.insert( Qtopia::HomeCountry, "Home Country" );
+ ret_map.insert( Qtopia::HomeWebPage, "Home Web Page" );
+
+ //personal
+ ret_map.insert( Qtopia::Spouse, "Spouse" );
+ ret_map.insert( Qtopia::Gender, "Gender" );
+ ret_map.insert( Qtopia::Birthday, "Birthday" );
+ ret_map.insert( Qtopia::Anniversary, "Anniversary" );
+ ret_map.insert( Qtopia::Nickname, "Nickname" );
+ ret_map.insert( Qtopia::Children, "Children" );
+
+ // other
+ ret_map.insert( Qtopia::Notes, "Notes" );
+ ret_map.insert( Qtopia::Groups, "Groups" );
+
+
+ return ret_map;
}
@@ -385,12 +388,12 @@ QMap<QString, int> OContactFields::trFieldsToId()
{
- QMap<int, QString> idtostr = idToTrFields();
- QMap<QString, int> ret_map;
+ QMap<int, QString> idtostr = idToTrFields();
+ QMap<QString, int> ret_map;
- QMap<int, QString>::Iterator it;
- for( it = idtostr.begin(); it != idtostr.end(); ++it )
- ret_map.insert( *it, it.key() );
+ QMap<int, QString>::Iterator it;
+ for ( it = idtostr.begin(); it != idtostr.end(); ++it )
+ ret_map.insert( *it, it.key() );
- return ret_map;
+ return ret_map;
}
@@ -401,12 +404,12 @@ QMap<QString, int> OContactFields::untrFieldsToId()
{
- QMap<int, QString> idtostr = idToUntrFields();
- QMap<QString, int> ret_map;
+ QMap<int, QString> idtostr = idToUntrFields();
+ QMap<QString, int> ret_map;
- QMap<int, QString>::Iterator it;
- for( it = idtostr.begin(); it != idtostr.end(); ++it )
- ret_map.insert( *it, it.key() );
+ QMap<int, QString>::Iterator it;
+ for ( it = idtostr.begin(); it != idtostr.end(); ++it )
+ ret_map.insert( *it, it.key() );
- return ret_map;
+ return ret_map;
}
@@ -414,22 +417,24 @@ QMap<QString, int> OContactFields::untrFieldsToId()
-OContactFields::OContactFields():
- fieldOrder( DEFAULT_FIELD_ORDER ),
- changedFieldOrder( false )
+OContactFields::OContactFields() :
+ fieldOrder( DEFAULT_FIELD_ORDER ),
+ changedFieldOrder( false )
{
- // Get the global field order from the config file and
- // use it as a start pattern
- Config cfg ( "AddressBook" );
- cfg.setGroup( "ContactFieldOrder" );
- globalFieldOrder = cfg.readEntry( "General", DEFAULT_FIELD_ORDER );
+ // Get the global field order from the config file and
+ // use it as a start pattern
+ Config cfg ( "AddressBook" );
+ cfg.setGroup( "ContactFieldOrder" );
+ globalFieldOrder = cfg.readEntry( "General", DEFAULT_FIELD_ORDER );
}
-OContactFields::~OContactFields(){
+OContactFields::~OContactFields()
+{
- // We will store the fieldorder into the config file
- // to reuse it for the future..
- if ( changedFieldOrder ){
- Config cfg ( "AddressBook" );
- cfg.setGroup( "ContactFieldOrder" );
- cfg.writeEntry( "General", globalFieldOrder );
- }
+ // We will store the fieldorder into the config file
+ // to reuse it for the future..
+ if ( changedFieldOrder )
+ {
+ Config cfg ( "AddressBook" );
+ cfg.setGroup( "ContactFieldOrder" );
+ cfg.writeEntry( "General", globalFieldOrder );
+ }
}
@@ -438,11 +443,12 @@ OContactFields::~OContactFields(){
-void OContactFields::saveToRecord( OContact &cnt ){
+void OContactFields::saveToRecord( OContact &cnt )
+{
- qDebug("ocontactfields saveToRecord: >%s<",fieldOrder.latin1());
+ qDebug( "ocontactfields saveToRecord: >%s<", fieldOrder.latin1() );
- // Store fieldorder into this contact.
- cnt.setCustomField( CONTACT_FIELD_ORDER_NAME, fieldOrder );
+ // Store fieldorder into this contact.
+ cnt.setCustomField( CONTACT_FIELD_ORDER_NAME, fieldOrder );
- globalFieldOrder = fieldOrder;
- changedFieldOrder = true;
+ globalFieldOrder = fieldOrder;
+ changedFieldOrder = true;
@@ -450,56 +456,60 @@ void OContactFields::saveToRecord( OContact &cnt ){
-void OContactFields::loadFromRecord( const OContact &cnt ){
- qDebug("ocontactfields loadFromRecord");
- qDebug("loading >%s<",cnt.fullName().latin1());
+void OContactFields::loadFromRecord( const OContact &cnt )
+{
+ qDebug( "ocontactfields loadFromRecord" );
+ qDebug( "loading >%s<", cnt.fullName().latin1() );
- // Get fieldorder for this contact. If none is defined,
- // we will use the global one from the config file..
+ // Get fieldorder for this contact. If none is defined,
+ // we will use the global one from the config file..
- fieldOrder = cnt.customField( CONTACT_FIELD_ORDER_NAME );
+ fieldOrder = cnt.customField( CONTACT_FIELD_ORDER_NAME );
- qDebug("fieldOrder from contact>%s<",fieldOrder.latin1());
+ qDebug( "fieldOrder from contact>%s<", fieldOrder.latin1() );
- if (fieldOrder.isEmpty()){
- fieldOrder = globalFieldOrder;
- }
+ if ( fieldOrder.isEmpty() )
+ {
+ fieldOrder = globalFieldOrder;
+ }
- qDebug("effective fieldOrder in loadFromRecord >%s<",fieldOrder.latin1());
+ qDebug( "effective fieldOrder in loadFromRecord >%s<", fieldOrder.latin1() );
}
-void OContactFields::setFieldOrder( int num, int index ){
- qDebug("qcontactfields setfieldorder pos %i -> %i",num,index);
+void OContactFields::setFieldOrder( int num, int index )
+{
+ qDebug( "qcontactfields setfieldorder pos %i -> %i", num, index );
- fieldOrder[num] = QString::number( index, 16 )[0];
+ fieldOrder[ num ] = QString::number( index, 16 ) [ 0 ];
- // We will store this new fieldorder globally to
- // remember it for contacts which have none
- globalFieldOrder = fieldOrder;
- changedFieldOrder = true;
+ // We will store this new fieldorder globally to
+ // remember it for contacts which have none
+ globalFieldOrder = fieldOrder;
+ changedFieldOrder = true;
- qDebug("fieldOrder >%s<",fieldOrder.latin1());
+ qDebug( "fieldOrder >%s<", fieldOrder.latin1() );
}
-int OContactFields::getFieldOrder( int num, int defIndex ){
- qDebug("ocontactfields getFieldOrder");
- qDebug("fieldOrder >%s<",fieldOrder.latin1());
+int OContactFields::getFieldOrder( int num, int defIndex )
+{
+ qDebug( "ocontactfields getFieldOrder" );
+ qDebug( "fieldOrder >%s<", fieldOrder.latin1() );
- // Get index of combo as char..
- QChar poschar = fieldOrder[num];
+ // Get index of combo as char..
+ QChar poschar = fieldOrder[ num ];
- bool ok;
- int ret = 0;
- // Convert char to number..
- if ( !( poschar == QChar::null ) )
- ret = QString( poschar ).toInt(&ok, 16);
- else
- ok = false;
+ bool ok;
+ int ret = 0;
+ // Convert char to number..
+ if ( !( poschar == QChar::null ) )
+ ret = QString( poschar ).toInt( &ok, 16 );
+ else
+ ok = false;
- // Return default value if index for
- // num was not set or if anything else happened..
- if ( !ok ) ret = defIndex;
+ // Return default value if index for
+ // num was not set or if anything else happened..
+ if ( !ok ) ret = defIndex;
- qDebug("returning >%i<",ret);
+ qDebug( "returning >%i<", ret );
- return ret;
+ return ret;
diff --git a/libopie2/opiepim/ocontactfields.h b/libopie2/opiepim/ocontactfields.h
index 993ce3b..9e89532 100644
--- a/libopie2/opiepim/ocontactfields.h
+++ b/libopie2/opiepim/ocontactfields.h
@@ -28,4 +28,5 @@
*/
-#ifndef OPIE_CONTACTS_FIELDS
-#define OPIE_CONTACTS_FIELDS
+
+#ifndef OCONTACTFIELDS_H
+#define OCONTACTFIELDS_H
@@ -33,5 +34,8 @@ class QStringList;
+/* OPIE */
+#include <opie2/ocontact.h>
+
+/* QT */
#include <qmap.h>
#include <qstring.h>
-#include <opie2/ocontact.h>
@@ -39,7 +43,9 @@ class QStringList;
#define DEFAULT_FIELD_ORDER "__________"
-
-namespace Opie {
-class OContactFields{
- public:
+namespace Opie
+{
+class OContactFields
+{
+
+ public:
OContactFields();
@@ -57,7 +63,7 @@ class OContactFields{
* @param num Selects the number of the combo
- * @param defIndex will be returned if none was defined (either
- * globally in the config file, nor by the contact which was used
+ * @param defIndex will be returned if none was defined (either
+ * globally in the config file, nor by the contact which was used
* by loadFromRecord() )
*/
- int getFieldOrder( int num, int defIndex);
+ int getFieldOrder( int num, int defIndex );
@@ -68,3 +74,3 @@ class OContactFields{
- private:
+ private:
QString fieldOrder;
@@ -73,3 +79,3 @@ class OContactFields{
- public:
+ public:
static QStringList personalfields( bool sorted = true, bool translated = false );
@@ -78,3 +84,3 @@ class OContactFields{
static QStringList fields( bool sorted = true, bool translated = false );
-
+
static QStringList trpersonalfields( bool sorted = true );
diff --git a/libopie2/opiepim/oevent.cpp b/libopie2/opiepim/oevent.cpp
index de5e30b..d9cee2b 100644
--- a/libopie2/opiepim/oevent.cpp
+++ b/libopie2/opiepim/oevent.cpp
@@ -2,3 +2,3 @@
This file is part of the Opie Project
- Copyright (C) Stefan Eilers (Eilers.Stefan@epost.de)
+ Copyright (C) Stefan Eilers <Eilers.Stefan@epost.de>
=. Copyright (C) The Opie Team <opie-devel@handhelds.org>
@@ -28,9 +28,6 @@
*/
-#include <qshared.h>
-#include <qarray.h>
-#include <qpe/palmtopuidgen.h>
-#include <qpe/categories.h>
-#include <qpe/stringutil.h>
+#include "oevent.h"
+/* OPIE */
#include <opie2/orecur.h>
@@ -38,8 +35,15 @@
#include <opie2/opimnotifymanager.h>
+#include <qpe/categories.h>
+#include <qpe/palmtopuidgen.h>
+#include <qpe/stringutil.h>
-#include <opie2/oevent.h>
+/* QT */
+#include <qshared.h>
+#include <qarray.h>
-namespace Opie {
+namespace Opie
+{
-int OCalendarHelper::week( const QDate& date) {
+int OCalendarHelper::week( const QDate& date )
+{
// Calculates the week this date is in within that
@@ -55,3 +59,6 @@ int OCalendarHelper::week( const QDate& date) {
}
-int OCalendarHelper::ocurrence( const QDate& date) {
+
+
+int OCalendarHelper::ocurrence( const QDate& date )
+{
// calculates the number of occurrances of this day of the
@@ -60,6 +67,10 @@ int OCalendarHelper::ocurrence( const QDate& date) {
}
-int OCalendarHelper::dayOfWeek( char day ) {
+
+
+int OCalendarHelper::dayOfWeek( char day )
+{
int dayOfWeek = 1;
char i = ORecur::MON;
- while ( !( i & day ) && i <= ORecur::SUN ) {
+ while ( !( i & day ) && i <= ORecur::SUN )
+ {
i <<= 1;
@@ -69,9 +80,15 @@ int OCalendarHelper::dayOfWeek( char day ) {
}
-int OCalendarHelper::monthDiff( const QDate& first, const QDate& second ) {
+
+
+int OCalendarHelper::monthDiff( const QDate& first, const QDate& second )
+{
return ( second.year() - first.year() ) * 12 +
- second.month() - first.month();
+ second.month() - first.month();
}
-struct OEvent::Data : public QShared {
- Data() : QShared() {
+
+struct OEvent::Data : public QShared
+{
+ Data() : QShared()
+ {
child = 0;
@@ -82,3 +99,4 @@ struct OEvent::Data : public QShared {
}
- ~Data() {
+ ~Data()
+ {
delete manager;
@@ -94,3 +112,3 @@ struct OEvent::Data : public QShared {
QDateTime end;
- bool isAllDay : 1;
+bool isAllDay : 1;
QString timezone;
@@ -100,8 +118,12 @@ struct OEvent::Data : public QShared {
+
OEvent::OEvent( int uid )
- : OPimRecord( uid ) {
+ : OPimRecord( uid )
+{
data = new Data;
}
-OEvent::OEvent( const OEvent& ev)
- : OPimRecord( ev ), data( ev.data )
+
+
+OEvent::OEvent( const OEvent& ev )
+ : OPimRecord( ev ), data( ev.data )
{
@@ -110,12 +132,16 @@ OEvent::OEvent( const OEvent& ev)
+
OEvent::OEvent( const QMap<int, QString> map )
- : OPimRecord( 0 )
+ : OPimRecord( 0 )
{
- data = new Data;
+ data = new Data;
- fromMap( map );
+ fromMap( map );
}
-OEvent::~OEvent() {
- if ( data->deref() ) {
+
+OEvent::~OEvent()
+{
+ if ( data->deref() )
+ {
delete data;
@@ -124,4 +150,7 @@ OEvent::~OEvent() {
}
-OEvent& OEvent::operator=( const OEvent& ev) {
- if ( this == &ev ) return *this;
+
+
+OEvent& OEvent::operator=( const OEvent& ev )
+{
+ if ( this == &ev ) return * this;
@@ -135,6 +164,12 @@ OEvent& OEvent::operator=( const OEvent& ev) {
}
-QString OEvent::description()const {
+
+
+QString OEvent::description() const
+{
return data->description;
}
-void OEvent::setDescription( const QString& description ) {
+
+
+void OEvent::setDescription( const QString& description )
+{
changeOrModify();
@@ -142,3 +177,6 @@ void OEvent::setDescription( const QString& description ) {
}
-void OEvent::setLocation( const QString& loc ) {
+
+
+void OEvent::setLocation( const QString& loc )
+{
changeOrModify();
@@ -146,6 +184,12 @@ void OEvent::setLocation( const QString& loc ) {
}
-QString OEvent::location()const {
+
+
+QString OEvent::location() const
+{
return data->location;
}
-OPimNotifyManager &OEvent::notifiers()const {
+
+
+OPimNotifyManager &OEvent::notifiers() const
+{
// I hope we can skip the changeOrModify here
@@ -153,3 +197,3 @@ OPimNotifyManager &OEvent::notifiers()const {
// and OPimNotify is shared too
- if (!data->manager )
+ if ( !data->manager )
data->manager = new OPimNotifyManager;
@@ -158,7 +202,10 @@ OPimNotifyManager &OEvent::notifiers()const {
}
-bool OEvent::hasNotifiers()const {
- if (!data->manager )
+
+
+bool OEvent::hasNotifiers() const
+{
+ if ( !data->manager )
return false;
- if (data->manager->reminders().isEmpty() &&
- data->manager->alarms().isEmpty() )
+ if ( data->manager->reminders().isEmpty() &&
+ data->manager->alarms().isEmpty() )
return false;
@@ -167,4 +214,7 @@ bool OEvent::hasNotifiers()const {
}
-ORecur OEvent::recurrence()const {
- if (!data->recur)
+
+
+ORecur OEvent::recurrence() const
+{
+ if ( !data->recur )
data->recur = new ORecur;
@@ -173,6 +223,9 @@ ORecur OEvent::recurrence()const {
}
-void OEvent::setRecurrence( const ORecur& rec) {
+
+
+void OEvent::setRecurrence( const ORecur& rec )
+{
changeOrModify();
- if (data->recur )
- (*data->recur) = rec;
+ if ( data->recur )
+ ( *data->recur ) = rec;
else
@@ -180,10 +233,19 @@ void OEvent::setRecurrence( const ORecur& rec) {
}
-bool OEvent::hasRecurrence()const {
- if (!data->recur ) return false;
+
+
+bool OEvent::hasRecurrence() const
+{
+ if ( !data->recur ) return false;
return data->recur->doesRecur();
}
-QString OEvent::note()const {
+
+
+QString OEvent::note() const
+{
return data->note;
}
-void OEvent::setNote( const QString& note ) {
+
+
+void OEvent::setNote( const QString& note )
+{
changeOrModify();
@@ -191,6 +253,12 @@ void OEvent::setNote( const QString& note ) {
}
-QDateTime OEvent::createdDateTime()const {
+
+
+QDateTime OEvent::createdDateTime() const
+{
return data->created;
}
-void OEvent::setCreatedDateTime( const QDateTime& time ) {
+
+
+void OEvent::setCreatedDateTime( const QDateTime& time )
+{
changeOrModify();
@@ -198,15 +266,24 @@ void OEvent::setCreatedDateTime( const QDateTime& time ) {
}
-QDateTime OEvent::startDateTime()const {
+
+
+QDateTime OEvent::startDateTime() const
+{
if ( data->isAllDay )
- return QDateTime( data->start.date(), QTime(0, 0, 0 ) );
+ return QDateTime( data->start.date(), QTime( 0, 0, 0 ) );
return data->start;
}
-QDateTime OEvent::startDateTimeInZone()const {
+
+
+QDateTime OEvent::startDateTimeInZone() const
+{
/* if no timezone, or all day event or if the current and this timeZone match... */
- if (data->timezone.isEmpty() || data->isAllDay || data->timezone == OTimeZone::current().timeZone() ) return startDateTime();
+ if ( data->timezone.isEmpty() || data->isAllDay || data->timezone == OTimeZone::current().timeZone() ) return startDateTime();
- OTimeZone zone(data->timezone );
+ OTimeZone zone( data->timezone );
return zone.toDateTime( data->start, OTimeZone::current() );
}
-void OEvent::setStartDateTime( const QDateTime& dt ) {
+
+
+void OEvent::setStartDateTime( const QDateTime& dt )
+{
changeOrModify();
@@ -214,3 +291,6 @@ void OEvent::setStartDateTime( const QDateTime& dt ) {
}
-QDateTime OEvent::endDateTime()const {
+
+
+QDateTime OEvent::endDateTime() const
+{
/*
@@ -220,28 +300,46 @@ QDateTime OEvent::endDateTime()const {
if ( data->isAllDay )
- return QDateTime( data->start.date(), QTime(23, 59, 59 ) );
+ return QDateTime( data->start.date(), QTime( 23, 59, 59 ) );
return data->end;
}
-QDateTime OEvent::endDateTimeInZone()const {
+
+
+QDateTime OEvent::endDateTimeInZone() const
+{
/* if no timezone, or all day event or if the current and this timeZone match... */
- if (data->timezone.isEmpty() || data->isAllDay || data->timezone == OTimeZone::current().timeZone() ) return endDateTime();
+ if ( data->timezone.isEmpty() || data->isAllDay || data->timezone == OTimeZone::current().timeZone() ) return endDateTime();
- OTimeZone zone(data->timezone );
+ OTimeZone zone( data->timezone );
return zone.toDateTime( data->end, OTimeZone::current() );
}
-void OEvent::setEndDateTime( const QDateTime& dt ) {
+
+
+void OEvent::setEndDateTime( const QDateTime& dt )
+{
changeOrModify();
- data->end = dt;
+ data->end = dt;
}
-bool OEvent::isMultipleDay()const {
+
+
+bool OEvent::isMultipleDay() const
+{
return data->end.date().day() - data->start.date().day();
}
-bool OEvent::isAllDay()const {
+
+
+bool OEvent::isAllDay() const
+{
return data->isAllDay;
}
-void OEvent::setAllDay( bool allDay ) {
+
+
+void OEvent::setAllDay( bool allDay )
+{
changeOrModify();
data->isAllDay = allDay;
- if (allDay ) data->timezone = "UTC";
+ if ( allDay ) data->timezone = "UTC";
}
-void OEvent::setTimeZone( const QString& tz ) {
+
+
+void OEvent::setTimeZone( const QString& tz )
+{
changeOrModify();
@@ -249,8 +347,15 @@ void OEvent::setTimeZone( const QString& tz ) {
}
-QString OEvent::timeZone()const {
- if (data->isAllDay ) return QString::fromLatin1("UTC");
+
+
+QString OEvent::timeZone() const
+{
+ if ( data->isAllDay ) return QString::fromLatin1( "UTC" );
return data->timezone;
}
-bool OEvent::match( const QRegExp& re )const {
- if ( re.match( data->description ) != -1 ){
+
+
+bool OEvent::match( const QRegExp& re ) const
+{
+ if ( re.match( data->description ) != -1 )
+ {
setLastHitField( Qtopia::DatebookDescription );
@@ -258,3 +363,4 @@ bool OEvent::match( const QRegExp& re )const {
}
- if ( re.match( data->note ) != -1 ){
+ if ( re.match( data->note ) != -1 )
+ {
setLastHitField( Qtopia::Note );
@@ -262,3 +368,4 @@ bool OEvent::match( const QRegExp& re )const {
}
- if ( re.match( data->location ) != -1 ){
+ if ( re.match( data->location ) != -1 )
+ {
setLastHitField( Qtopia::Location );
@@ -266,3 +373,4 @@ bool OEvent::match( const QRegExp& re )const {
}
- if ( re.match( data->start.toString() ) != -1 ){
+ if ( re.match( data->start.toString() ) != -1 )
+ {
setLastHitField( Qtopia::StartDateTime );
@@ -270,3 +378,4 @@ bool OEvent::match( const QRegExp& re )const {
}
- if ( re.match( data->end.toString() ) != -1 ){
+ if ( re.match( data->end.toString() ) != -1 )
+ {
setLastHitField( Qtopia::EndDateTime );
@@ -276,3 +385,6 @@ bool OEvent::match( const QRegExp& re )const {
}
-QString OEvent::toRichText()const {
+
+
+QString OEvent::toRichText() const
+{
QString text, value;
@@ -281,4 +393,5 @@ QString OEvent::toRichText()const {
text += "<b><h3><img src=\"datebook/DateBook\">";
- if ( !description().isEmpty() ) {
- text += Qtopia::escapeString(description() ).replace(QRegExp( "[\n]"), "" );
+ if ( !description().isEmpty() )
+ {
+ text += Qtopia::escapeString( description() ).replace( QRegExp( "[\n]" ), "" );
}
@@ -287,5 +400,6 @@ QString OEvent::toRichText()const {
// location
- if ( !(value = location()).isEmpty() ) {
+ if ( !( value = location() ).isEmpty() )
+ {
text += "<b>" + QObject::tr( "Location:" ) + "</b> ";
- text += Qtopia::escapeString(value) + "<br>";
+ text += Qtopia::escapeString( value ) + "<br>";
}
@@ -293,3 +407,4 @@ QString OEvent::toRichText()const {
// all day event
- if ( isAllDay() ) {
+ if ( isAllDay() )
+ {
text += "<b><i>" + QObject::tr( "This is an all day event" ) + "</i></b><br>";
@@ -297,3 +412,4 @@ QString OEvent::toRichText()const {
// multiple day event
- else if ( isMultipleDay () ) {
+ else if ( isMultipleDay () )
+ {
text += "<b><i>" + QObject::tr( "This is a multiple day event" ) + "</i></b><br>";
@@ -301,8 +417,10 @@ QString OEvent::toRichText()const {
// start & end times
- else {
+ else
+ {
// start time
- if ( startDateTime().isValid() ) {
- text += "<b>" + QObject::tr( "Start:") + "</b> ";
- text += Qtopia::escapeString(startDateTime().toString() ).
- replace(QRegExp( "[\n]"), "<br>" ) + "<br>";
+ if ( startDateTime().isValid() )
+ {
+ text += "<b>" + QObject::tr( "Start:" ) + "</b> ";
+ text += Qtopia::escapeString( startDateTime().toString() ).
+ replace( QRegExp( "[\n]" ), "<br>" ) + "<br>";
}
@@ -310,6 +428,7 @@ QString OEvent::toRichText()const {
// end time
- if ( endDateTime().isValid() ) {
- text += "<b>" + QObject::tr( "End:") + "</b> ";
- text += Qtopia::escapeString(endDateTime().toString() ).
- replace(QRegExp( "[\n]"), "<br>" ) + "<br>";
+ if ( endDateTime().isValid() )
+ {
+ text += "<b>" + QObject::tr( "End:" ) + "</b> ";
+ text += Qtopia::escapeString( endDateTime().toString() ).
+ replace( QRegExp( "[\n]" ), "<br>" ) + "<br>";
}
@@ -318,6 +437,7 @@ QString OEvent::toRichText()const {
// categories
- if ( categoryNames("Calendar").count() ){
- text += "<b>" + QObject::tr( "Category:") + "</b> ";
- text += categoryNames("Calendar").join(", ");
- text += "<br>";
+ if ( categoryNames( "Calendar" ).count() )
+ {
+ text += "<b>" + QObject::tr( "Category:" ) + "</b> ";
+ text += categoryNames( "Calendar" ).join( ", " );
+ text += "<br>";
}
@@ -325,7 +445,8 @@ QString OEvent::toRichText()const {
//notes
- if ( !note().isEmpty() ) {
- text += "<b>" + QObject::tr( "Note:") + "</b><br>";
+ if ( !note().isEmpty() )
+ {
+ text += "<b>" + QObject::tr( "Note:" ) + "</b><br>";
text += note();
-// text += Qtopia::escapeString(note() ).
-// replace(QRegExp( "[\n]"), "<br>" ) + "<br>";
+ // text += Qtopia::escapeString(note() ).
+ // replace(QRegExp( "[\n]"), "<br>" ) + "<br>";
}
@@ -333,3 +454,6 @@ QString OEvent::toRichText()const {
}
-QString OEvent::toShortText()const {
+
+
+QString OEvent::toShortText() const
+{
QString text;
@@ -348,19 +472,38 @@ QString OEvent::toShortText()const {
}
-QString OEvent::type()const {
- return QString::fromLatin1("OEvent");
+
+
+QString OEvent::type() const
+{
+ return QString::fromLatin1( "OEvent" );
}
-QString OEvent::recordField( int /*id */ )const {
+
+
+QString OEvent::recordField( int /*id */ ) const
+{
return QString::null;
}
-int OEvent::rtti() {
+
+
+int OEvent::rtti()
+{
return OPimResolver::DateBook;
}
-bool OEvent::loadFromStream( QDataStream& ) {
+
+
+bool OEvent::loadFromStream( QDataStream& )
+{
return true;
}
-bool OEvent::saveToStream( QDataStream& )const {
+
+
+bool OEvent::saveToStream( QDataStream& ) const
+{
return true;
}
-void OEvent::changeOrModify() {
- if ( data->count != 1 ) {
+
+
+void OEvent::changeOrModify()
+{
+ if ( data->count != 1 )
+ {
data->deref();
@@ -370,3 +513,3 @@ void OEvent::changeOrModify() {
- if (data->manager )
+ if ( data->manager )
d2->manager = new OPimNotifyManager( *data->manager );
@@ -384,3 +527,4 @@ void OEvent::changeOrModify() {
- if ( data->child ) {
+ if ( data->child )
+ {
d2->child = new QArray<int>( *data->child );
@@ -392,4 +536,8 @@ void OEvent::changeOrModify() {
}
-void OEvent::deref() {
- if ( data->deref() ) {
+
+
+void OEvent::deref()
+{
+ if ( data->deref() )
+ {
delete data;
@@ -403,3 +551,4 @@ void OEvent::deref() {
// Encoding should happen at one place, only ! (eilers)
-QMap<int, QString> OEvent::toMap()const {
+QMap<int, QString> OEvent::toMap() const
+{
QMap<int, QString> retMap;
@@ -407,3 +556,3 @@ QMap<int, QString> OEvent::toMap()const {
retMap.insert( OEvent::FUid, QString::number( uid() ) );
- retMap.insert( OEvent::FCategories, Qtopia::escapeString( Qtopia::Record::idsToString( categories() ) ));
+ retMap.insert( OEvent::FCategories, Qtopia::escapeString( Qtopia::Record::idsToString( categories() ) ) );
retMap.insert( OEvent::FDescription, Qtopia::escapeString( description() ) );
@@ -411,41 +560,46 @@ QMap<int, QString> OEvent::toMap()const {
retMap.insert( OEvent::FType, isAllDay() ? "AllDay" : "" );
- OPimAlarm alarm = notifiers().alarms()[0];
- retMap.insert( OEvent::FAlarm, QString::number( alarm.dateTime().secsTo( startDateTime() ) / 60 ) );
- retMap.insert( OEvent::FSound, (alarm.sound() == OPimAlarm::Loud) ? "loud" : "silent" );
+ OPimAlarm alarm = notifiers().alarms() [ 0 ];
+ retMap.insert( OEvent::FAlarm, QString::number( alarm.dateTime().secsTo( startDateTime() ) / 60 ) );
+ retMap.insert( OEvent::FSound, ( alarm.sound() == OPimAlarm::Loud ) ? "loud" : "silent" );
- OTimeZone zone( timeZone().isEmpty() ? OTimeZone::current() : timeZone() );
- retMap.insert( OEvent::FStart, QString::number( zone.fromUTCDateTime( zone.toDateTime( startDateTime(), OTimeZone::utc() ) ) ) );
- retMap.insert( OEvent::FEnd, QString::number( zone.fromUTCDateTime( zone.toDateTime( endDateTime(), OTimeZone::utc() ) ) ) );
+ OTimeZone zone( timeZone().isEmpty() ? OTimeZone::current() : timeZone() );
+ retMap.insert( OEvent::FStart, QString::number( zone.fromUTCDateTime( zone.toDateTime( startDateTime(), OTimeZone::utc() ) ) ) );
+ retMap.insert( OEvent::FEnd, QString::number( zone.fromUTCDateTime( zone.toDateTime( endDateTime(), OTimeZone::utc() ) ) ) );
retMap.insert( OEvent::FNote, Qtopia::escapeString( note() ) );
retMap.insert( OEvent::FTimeZone, timeZone().isEmpty() ? QString( "None" ) : timeZone() );
- if( parent() )
- retMap.insert( OEvent::FRecParent, QString::number( parent() ) );
- if( children().count() ){
- QArray<int> childr = children();
- QString buf;
- for ( uint i = 0; i < childr.count(); i++ ) {
- if ( i != 0 ) buf += " ";
- buf += QString::number( childr[i] );
- }
- retMap.insert( OEvent::FRecChildren, buf );
- }
-
+ if ( parent() )
+ retMap.insert( OEvent::FRecParent, QString::number( parent() ) );
+ if ( children().count() )
+ {
+ QArray<int> childr = children();
+ QString buf;
+ for ( uint i = 0; i < childr.count(); i++ )
+ {
+ if ( i != 0 ) buf += " ";
+ buf += QString::number( childr[ i ] );
+ }
+ retMap.insert( OEvent::FRecChildren, buf );
+ }
+
// Add recurrence stuff
- if( hasRecurrence() ){
- ORecur recur = recurrence();
- QMap<int, QString> recFields = recur.toMap();
- retMap.insert( OEvent::FRType, recFields[ORecur::RType] );
- retMap.insert( OEvent::FRWeekdays, recFields[ORecur::RWeekdays] );
- retMap.insert( OEvent::FRPosition, recFields[ORecur::RPosition] );
- retMap.insert( OEvent::FRFreq, recFields[ORecur::RFreq] );
- retMap.insert( OEvent::FRHasEndDate, recFields[ORecur::RHasEndDate] );
- retMap.insert( OEvent::FREndDate, recFields[ORecur::EndDate] );
- retMap.insert( OEvent::FRCreated, recFields[ORecur::Created] );
- retMap.insert( OEvent::FRExceptions, recFields[ORecur::Exceptions] );
- } else {
- ORecur recur = recurrence();
- QMap<int, QString> recFields = recur.toMap();
- retMap.insert( OEvent::FRType, recFields[ORecur::RType] );
- }
-
+ if ( hasRecurrence() )
+ {
+ ORecur recur = recurrence();
+ QMap<int, QString> recFields = recur.toMap();
+ retMap.insert( OEvent::FRType, recFields[ ORecur::RType ] );
+ retMap.insert( OEvent::FRWeekdays, recFields[ ORecur::RWeekdays ] );
+ retMap.insert( OEvent::FRPosition, recFields[ ORecur::RPosition ] );
+ retMap.insert( OEvent::FRFreq, recFields[ ORecur::RFreq ] );
+ retMap.insert( OEvent::FRHasEndDate, recFields[ ORecur::RHasEndDate ] );
+ retMap.insert( OEvent::FREndDate, recFields[ ORecur::EndDate ] );
+ retMap.insert( OEvent::FRCreated, recFields[ ORecur::Created ] );
+ retMap.insert( OEvent::FRExceptions, recFields[ ORecur::Exceptions ] );
+ }
+ else
+ {
+ ORecur recur = recurrence();
+ QMap<int, QString> recFields = recur.toMap();
+ retMap.insert( OEvent::FRType, recFields[ ORecur::RType ] );
+ }
+
return retMap;
@@ -453,2 +607,3 @@ QMap<int, QString> OEvent::toMap()const {
+
void OEvent::fromMap( const QMap<int, QString>& map )
@@ -456,82 +611,94 @@ void OEvent::fromMap( const QMap<int, QString>& map )
- // We just want to set the UID if it is really stored.
- if ( !map[OEvent::FUid].isEmpty() )
- setUid( map[OEvent::FUid].toInt() );
-
- setCategories( idsFromString( map[OEvent::FCategories] ) );
- setDescription( map[OEvent::FDescription] );
- setLocation( map[OEvent::FLocation] );
-
- if ( map[OEvent::FType] == "AllDay" )
- setAllDay( true );
- else
- setAllDay( false );
-
- int alarmTime = -1;
- if( !map[OEvent::FAlarm].isEmpty() )
- alarmTime = map[OEvent::FAlarm].toInt();
-
- int sound = ( ( map[OEvent::FSound] == "loud" ) ? OPimAlarm::Loud : OPimAlarm::Silent );
- if ( ( alarmTime != -1 ) ){
- QDateTime dt = startDateTime().addSecs( -1*alarmTime*60 );
- OPimAlarm al( sound , dt );
- notifiers().add( al );
- }
- if ( !map[OEvent::FTimeZone].isEmpty() && ( map[OEvent::FTimeZone] != "None" ) ){
- setTimeZone( map[OEvent::FTimeZone] );
- }
-
- time_t start = (time_t) map[OEvent::FStart].toLong();
- time_t end = (time_t) map[OEvent::FEnd].toLong();
-
- /* AllDay is always in UTC */
- if ( isAllDay() ) {
- OTimeZone utc = OTimeZone::utc();
- setStartDateTime( utc.fromUTCDateTime( start ) );
- setEndDateTime ( utc.fromUTCDateTime( end ) );
- setTimeZone( "UTC"); // make sure it is really utc
- }else {
- /* to current date time */
- // qWarning(" Start is %d", start );
- OTimeZone zone( timeZone().isEmpty() ? OTimeZone::current() : timeZone() );
- QDateTime date = zone.toDateTime( start );
- qWarning(" Start is %s", date.toString().latin1() );
- setStartDateTime( zone.toDateTime( date, OTimeZone::current() ) );
-
- date = zone.toDateTime( end );
- setEndDateTime ( zone.toDateTime( date, OTimeZone::current() ) );
- }
-
- if ( !map[OEvent::FRecParent].isEmpty() )
- setParent( map[OEvent::FRecParent].toInt() );
-
- if ( !map[OEvent::FRecChildren].isEmpty() ){
- QStringList list = QStringList::split(' ', map[OEvent::FRecChildren] );
- for ( QStringList::Iterator it = list.begin(); it != list.end(); ++it ) {
- addChild( (*it).toInt() );
- }
- }
-
- // Fill recurrence stuff and put it directly into the ORecur-Object using fromMap..
- if( !map[OEvent::FRType].isEmpty() ){
- QMap<int, QString> recFields;
- recFields.insert( ORecur::RType, map[OEvent::FRType] );
- recFields.insert( ORecur::RWeekdays, map[OEvent::FRWeekdays] );
- recFields.insert( ORecur::RPosition, map[OEvent::FRPosition] );
- recFields.insert( ORecur::RFreq, map[OEvent::FRFreq] );
- recFields.insert( ORecur::RHasEndDate, map[OEvent::FRHasEndDate] );
- recFields.insert( ORecur::EndDate, map[OEvent::FREndDate] );
- recFields.insert( ORecur::Created, map[OEvent::FRCreated] );
- recFields.insert( ORecur::Exceptions, map[OEvent::FRExceptions] );
- ORecur recur( recFields );
- setRecurrence( recur );
- }
-
-}
-
-
-int OEvent::parent()const {
+ // We just want to set the UID if it is really stored.
+ if ( !map[ OEvent::FUid ].isEmpty() )
+ setUid( map[ OEvent::FUid ].toInt() );
+
+ setCategories( idsFromString( map[ OEvent::FCategories ] ) );
+ setDescription( map[ OEvent::FDescription ] );
+ setLocation( map[ OEvent::FLocation ] );
+
+ if ( map[ OEvent::FType ] == "AllDay" )
+ setAllDay( true );
+ else
+ setAllDay( false );
+
+ int alarmTime = -1;
+ if ( !map[ OEvent::FAlarm ].isEmpty() )
+ alarmTime = map[ OEvent::FAlarm ].toInt();
+
+ int sound = ( ( map[ OEvent::FSound ] == "loud" ) ? OPimAlarm::Loud : OPimAlarm::Silent );
+ if ( ( alarmTime != -1 ) )
+ {
+ QDateTime dt = startDateTime().addSecs( -1 * alarmTime * 60 );
+ OPimAlarm al( sound , dt );
+ notifiers().add( al );
+ }
+ if ( !map[ OEvent::FTimeZone ].isEmpty() && ( map[ OEvent::FTimeZone ] != "None" ) )
+ {
+ setTimeZone( map[ OEvent::FTimeZone ] );
+ }
+
+ time_t start = ( time_t ) map[ OEvent::FStart ].toLong();
+ time_t end = ( time_t ) map[ OEvent::FEnd ].toLong();
+
+ /* AllDay is always in UTC */
+ if ( isAllDay() )
+ {
+ OTimeZone utc = OTimeZone::utc();
+ setStartDateTime( utc.fromUTCDateTime( start ) );
+ setEndDateTime ( utc.fromUTCDateTime( end ) );
+ setTimeZone( "UTC" ); // make sure it is really utc
+ }
+ else
+ {
+ /* to current date time */
+ // qWarning(" Start is %d", start );
+ OTimeZone zone( timeZone().isEmpty() ? OTimeZone::current() : timeZone() );
+ QDateTime date = zone.toDateTime( start );
+ qWarning( " Start is %s", date.toString().latin1() );
+ setStartDateTime( zone.toDateTime( date, OTimeZone::current() ) );
+
+ date = zone.toDateTime( end );
+ setEndDateTime ( zone.toDateTime( date, OTimeZone::current() ) );
+ }
+
+ if ( !map[ OEvent::FRecParent ].isEmpty() )
+ setParent( map[ OEvent::FRecParent ].toInt() );
+
+ if ( !map[ OEvent::FRecChildren ].isEmpty() )
+ {
+ QStringList list = QStringList::split( ' ', map[ OEvent::FRecChildren ] );
+ for ( QStringList::Iterator it = list.begin(); it != list.end(); ++it )
+ {
+ addChild( ( *it ).toInt() );
+ }
+ }
+
+ // Fill recurrence stuff and put it directly into the ORecur-Object using fromMap..
+ if ( !map[ OEvent::FRType ].isEmpty() )
+ {
+ QMap<int, QString> recFields;
+ recFields.insert( ORecur::RType, map[ OEvent::FRType ] );
+ recFields.insert( ORecur::RWeekdays, map[ OEvent::FRWeekdays ] );
+ recFields.insert( ORecur::RPosition, map[ OEvent::FRPosition ] );
+ recFields.insert( ORecur::RFreq, map[ OEvent::FRFreq ] );
+ recFields.insert( ORecur::RHasEndDate, map[ OEvent::FRHasEndDate ] );
+ recFields.insert( ORecur::EndDate, map[ OEvent::FREndDate ] );
+ recFields.insert( ORecur::Created, map[ OEvent::FRCreated ] );
+ recFields.insert( ORecur::Exceptions, map[ OEvent::FRExceptions ] );
+ ORecur recur( recFields );
+ setRecurrence( recur );
+ }
+
+}
+
+
+int OEvent::parent() const
+{
return data->parent;
}
-void OEvent::setParent( int uid ) {
+
+
+void OEvent::setParent( int uid )
+{
changeOrModify();
@@ -539,4 +706,7 @@ void OEvent::setParent( int uid ) {
}
-QArray<int> OEvent::children() const{
- if (!data->child) return QArray<int>();
+
+
+QArray<int> OEvent::children() const
+{
+ if ( !data->child ) return QArray<int>();
else
@@ -544,5 +714,8 @@ QArray<int> OEvent::children() const{
}
-void OEvent::setChildren( const QArray<int>& arr ) {
+
+
+void OEvent::setChildren( const QArray<int>& arr )
+{
changeOrModify();
- if (data->child) delete data->child;
+ if ( data->child ) delete data->child;
@@ -551,15 +724,24 @@ void OEvent::setChildren( const QArray<int>& arr ) {
}
-void OEvent::addChild( int uid ) {
+
+
+void OEvent::addChild( int uid )
+{
changeOrModify();
- if (!data->child ) {
- data->child = new QArray<int>(1);
- (*data->child)[0] = uid;
- }else{
+ if ( !data->child )
+ {
+ data->child = new QArray<int>( 1 );
+ ( *data->child ) [ 0 ] = uid;
+ }
+ else
+ {
int count = data->child->count();
data->child->resize( count + 1 );
- (*data->child)[count] = uid;
+ ( *data->child ) [ count ] = uid;
}
}
-void OEvent::removeChild( int uid ) {
- if (!data->child || !data->child->contains( uid ) ) return;
+
+
+void OEvent::removeChild( int uid )
+{
+ if ( !data->child || !data->child->contains( uid ) ) return ;
changeOrModify();
@@ -568,5 +750,7 @@ void OEvent::removeChild( int uid ) {
uint count = data->child->count();
- for ( uint i = 0; i < count; i++ ) {
- if ( (*data->child)[i] != uid ) {
- newAr[j] = (*data->child)[i];
+ for ( uint i = 0; i < count; i++ )
+ {
+ if ( ( *data->child ) [ i ] != uid )
+ {
+ newAr[ j ] = ( *data->child ) [ i ];
j++;
@@ -574,7 +758,10 @@ void OEvent::removeChild( int uid ) {
}
- (*data->child) = newAr;
+ ( *data->child ) = newAr;
}
-struct OEffectiveEvent::Data : public QShared {
- Data() : QShared() {
- }
+
+
+struct OEffectiveEvent::Data : public QShared
+{
+ Data() : QShared()
+ {}
OEvent event;
@@ -583,6 +770,8 @@ struct OEffectiveEvent::Data : public QShared {
QDate startDate, endDate;
- bool dates : 1;
+bool dates : 1;
};
-OEffectiveEvent::OEffectiveEvent() {
+
+OEffectiveEvent::OEffectiveEvent()
+{
data = new Data;
@@ -592,4 +781,7 @@ OEffectiveEvent::OEffectiveEvent() {
}
+
+
OEffectiveEvent::OEffectiveEvent( const OEvent& ev, const QDate& startDate,
- Position pos ) {
+ Position pos )
+{
data = new Data;
@@ -609,3 +801,6 @@ OEffectiveEvent::OEffectiveEvent( const OEvent& ev, const QDate& startDate,
}
-OEffectiveEvent::OEffectiveEvent( const OEffectiveEvent& ev) {
+
+
+OEffectiveEvent::OEffectiveEvent( const OEffectiveEvent& ev )
+{
data = ev.data;
@@ -613,4 +808,8 @@ OEffectiveEvent::OEffectiveEvent( const OEffectiveEvent& ev) {
}
-OEffectiveEvent::~OEffectiveEvent() {
- if ( data->deref() ) {
+
+
+OEffectiveEvent::~OEffectiveEvent()
+{
+ if ( data->deref() )
+ {
delete data;
@@ -619,4 +818,7 @@ OEffectiveEvent::~OEffectiveEvent() {
}
-OEffectiveEvent& OEffectiveEvent::operator=( const OEffectiveEvent& ev ) {
- if ( *this == ev ) return *this;
+
+
+OEffectiveEvent& OEffectiveEvent::operator=( const OEffectiveEvent& ev )
+{
+ if ( *this == ev ) return * this;
@@ -629,3 +831,5 @@ OEffectiveEvent& OEffectiveEvent::operator=( const OEffectiveEvent& ev ) {
-void OEffectiveEvent::setStartTime( const QTime& ti) {
+
+void OEffectiveEvent::setStartTime( const QTime& ti )
+{
changeOrModify();
@@ -633,3 +837,6 @@ void OEffectiveEvent::setStartTime( const QTime& ti) {
}
-void OEffectiveEvent::setEndTime( const QTime& en) {
+
+
+void OEffectiveEvent::setEndTime( const QTime& en )
+{
changeOrModify();
@@ -637,3 +844,6 @@ void OEffectiveEvent::setEndTime( const QTime& en) {
}
-void OEffectiveEvent::setEvent( const OEvent& ev) {
+
+
+void OEffectiveEvent::setEvent( const OEvent& ev )
+{
changeOrModify();
@@ -641,3 +851,6 @@ void OEffectiveEvent::setEvent( const OEvent& ev) {
}
-void OEffectiveEvent::setDate( const QDate& da) {
+
+
+void OEffectiveEvent::setDate( const QDate& da )
+{
changeOrModify();
@@ -645,7 +858,11 @@ void OEffectiveEvent::setDate( const QDate& da) {
}
+
+
void OEffectiveEvent::setEffectiveDates( const QDate& from,
- const QDate& to ) {
- if (!from.isValid() ) {
+ const QDate& to )
+{
+ if ( !from.isValid() )
+ {
data->dates = false;
- return;
+ return ;
}
@@ -655,36 +872,66 @@ void OEffectiveEvent::setEffectiveDates( const QDate& from,
}
-QString OEffectiveEvent::description()const {
+
+
+QString OEffectiveEvent::description() const
+{
return data->event.description();
}
-QString OEffectiveEvent::location()const {
+
+
+QString OEffectiveEvent::location() const
+{
return data->event.location();
}
-QString OEffectiveEvent::note()const {
+
+
+QString OEffectiveEvent::note() const
+{
return data->event.note();
}
-OEvent OEffectiveEvent::event()const {
+
+
+OEvent OEffectiveEvent::event() const
+{
return data->event;
}
-QTime OEffectiveEvent::startTime()const {
+
+
+QTime OEffectiveEvent::startTime() const
+{
return data->start;
}
-QTime OEffectiveEvent::endTime()const {
+
+
+QTime OEffectiveEvent::endTime() const
+{
return data->end;
}
-QDate OEffectiveEvent::date()const {
+
+
+QDate OEffectiveEvent::date() const
+{
return data->date;
}
-int OEffectiveEvent::length()const {
- return (data->end.hour() * 60 - data->start.hour() * 60)
- + QABS(data->start.minute() - data->end.minute() );
+
+
+int OEffectiveEvent::length() const
+{
+ return ( data->end.hour() * 60 - data->start.hour() * 60 )
+ + QABS( data->start.minute() - data->end.minute() );
}
-int OEffectiveEvent::size()const {
+
+
+int OEffectiveEvent::size() const
+{
return ( data->end.hour() - data->start.hour() ) * 3600
- + (data->end.minute() - data->start.minute() * 60
- + data->end.second() - data->start.second() );
+ + ( data->end.minute() - data->start.minute() * 60
+ + data->end.second() - data->start.second() );
}
-QDate OEffectiveEvent::startDate()const {
+
+
+QDate OEffectiveEvent::startDate() const
+{
if ( data->dates )
return data->startDate;
- else if ( data->event.hasRecurrence() ) // single day, since multi-day should have a d pointer
+ else if ( data->event.hasRecurrence() ) // single day, since multi-day should have a d pointer
return data->date;
@@ -693,3 +940,6 @@ QDate OEffectiveEvent::startDate()const {
}
-QDate OEffectiveEvent::endDate()const {
+
+
+QDate OEffectiveEvent::endDate() const
+{
if ( data->dates )
@@ -701,4 +951,8 @@ QDate OEffectiveEvent::endDate()const {
}
-void OEffectiveEvent::deref() {
- if ( data->deref() ) {
+
+
+void OEffectiveEvent::deref()
+{
+ if ( data->deref() )
+ {
delete data;
@@ -707,4 +961,8 @@ void OEffectiveEvent::deref() {
}
-void OEffectiveEvent::changeOrModify() {
- if ( data->count != 1 ) {
+
+
+void OEffectiveEvent::changeOrModify()
+{
+ if ( data->count != 1 )
+ {
data->deref();
@@ -721,27 +979,45 @@ void OEffectiveEvent::changeOrModify() {
}
-bool OEffectiveEvent::operator<( const OEffectiveEvent &e ) const{
+
+
+bool OEffectiveEvent::operator<( const OEffectiveEvent &e ) const
+{
if ( data->date < e.date() )
- return TRUE;
+ return TRUE;
if ( data->date == e.date() )
- return ( startTime() < e.startTime() );
+ return ( startTime() < e.startTime() );
else
- return FALSE;
+ return FALSE;
}
-bool OEffectiveEvent::operator<=( const OEffectiveEvent &e ) const{
- return (data->date <= e.date() );
+
+
+bool OEffectiveEvent::operator<=( const OEffectiveEvent &e ) const
+{
+ return ( data->date <= e.date() );
}
-bool OEffectiveEvent::operator==( const OEffectiveEvent &e ) const {
+
+
+bool OEffectiveEvent::operator==( const OEffectiveEvent &e ) const
+{
return ( date() == e.date()
- && startTime() == e.startTime()
- && endTime()== e.endTime()
- && event() == e.event() );
+ && startTime() == e.startTime()
+ && endTime() == e.endTime()
+ && event() == e.event() );
}
-bool OEffectiveEvent::operator!=( const OEffectiveEvent &e ) const {
- return !(*this == e );
+
+
+bool OEffectiveEvent::operator!=( const OEffectiveEvent &e ) const
+{
+ return !( *this == e );
}
-bool OEffectiveEvent::operator>( const OEffectiveEvent &e ) const {
- return !(*this <= e );
+
+
+bool OEffectiveEvent::operator>( const OEffectiveEvent &e ) const
+{
+ return !( *this <= e );
}
-bool OEffectiveEvent::operator>= ( const OEffectiveEvent &e ) const {
- return !(*this < e);
+
+
+bool OEffectiveEvent::operator>= ( const OEffectiveEvent &e ) const
+{
+ return !( *this < e );
}
diff --git a/libopie2/opiepim/oevent.h b/libopie2/opiepim/oevent.h
index 9502efa..dc5e4d6 100644
--- a/libopie2/opiepim/oevent.h
+++ b/libopie2/opiepim/oevent.h
@@ -2,3 +2,3 @@
This file is part of the Opie Project
- Copyright (C) Stefan Eilers (Eilers.Stefan@epost.de)
+ Copyright (C) Stefan Eilers <Eilers.Stefan@epost.de>
=. Copyright (C) The Opie Team <opie-devel@handhelds.org>
@@ -30,9 +30,8 @@
-#ifndef OPIE_PIM_EVENT_H
-#define OPIE_PIM_EVENT_H
-
-#include <qstring.h>
-#include <qdatetime.h>
-#include <qvaluelist.h>
+#ifndef OEVENT_H
+#define OEVENT_H
+/* OPIE */
+#include <opie2/otimezone.h>
+#include <opie2/opimrecord.h>
#include <qpe/recordfields.h>
@@ -40,7 +39,11 @@
-#include <opie2/otimezone.h>
-#include <opie2/opimrecord.h>
+/* QT */
+#include <qstring.h>
+#include <qdatetime.h>
+#include <qvaluelist.h>
-namespace Opie {
-struct OCalendarHelper {
+namespace Opie
+{
+struct OCalendarHelper
+{
/** calculate the week number of the date */
@@ -67,4 +70,5 @@ class ORecur;
*/
-class OEvent : public OPimRecord {
-public:
+class OEvent : public OPimRecord
+{
+ public:
typedef QValueList<OEvent> ValueList;
@@ -79,16 +83,16 @@ public:
FLocation,
- FType,
- FAlarm,
- FSound,
- FRType,
- FRWeekdays,
- FRPosition,
- FRFreq,
- FRHasEndDate,
- FREndDate,
- FRCreated,
- FRExceptions,
- FStart,
- FEnd,
- FNote,
+ FType,
+ FAlarm,
+ FSound,
+ FRType,
+ FRWeekdays,
+ FRPosition,
+ FRFreq,
+ FRHasEndDate,
+ FREndDate,
+ FRCreated,
+ FRExceptions,
+ FStart,
+ FEnd,
+ FNote,
FTimeZone,
@@ -101,3 +105,3 @@ public:
*/
- OEvent(int uid = 0);
+ OEvent( int uid = 0 );
@@ -116,16 +120,16 @@ public:
- QString description()const;
+ QString description() const;
void setDescription( const QString& description );
- QString location()const;
- void setLocation( const QString& loc );
+ QString location() const;
+ void setLocation( const QString& loc );
- bool hasNotifiers()const;
- OPimNotifyManager &notifiers()const;
+ bool hasNotifiers() const;
+ OPimNotifyManager &notifiers() const;
- ORecur recurrence()const;
+ ORecur recurrence() const;
void setRecurrence( const ORecur& );
- bool hasRecurrence()const;
+ bool hasRecurrence() const;
- QString note()const;
+ QString note() const;
void setNote( const QString& note );
@@ -133,4 +137,4 @@ public:
- QDateTime createdDateTime()const;
- void setCreatedDateTime( const QDateTime& dt);
+ QDateTime createdDateTime() const;
+ void setCreatedDateTime( const QDateTime& dt );
@@ -139,6 +143,6 @@ public:
/** returns the datetime in the local timeZone */
- QDateTime startDateTime()const;
+ QDateTime startDateTime() const;
/** returns the start datetime in the current zone */
- QDateTime startDateTimeInZone()const;
+ QDateTime startDateTimeInZone() const;
@@ -147,7 +151,7 @@ public:
/** in current timezone */
- QDateTime endDateTime()const;
- QDateTime endDateTimeInZone()const;
+ QDateTime endDateTime() const;
+ QDateTime endDateTimeInZone() const;
- bool isMultipleDay()const;
- bool isAllDay()const;
+ bool isMultipleDay() const;
+ bool isAllDay() const;
void setAllDay( bool isAllDay );
@@ -156,9 +160,9 @@ public:
void setTimeZone( const QString& timeZone );
- QString timeZone()const;
+ QString timeZone() const;
- virtual bool match( const QRegExp& )const;
+ virtual bool match( const QRegExp& ) const;
/** For exception to recurrence here is a list of children... */
- QArray<int> children()const;
+ QArray<int> children() const;
void setChildren( const QArray<int>& );
@@ -168,3 +172,3 @@ public:
/** return the parent OEvent */
- int parent()const;
+ int parent() const;
void setParent( int uid );
@@ -173,9 +177,9 @@ public:
/* needed reimp */
- QString toRichText()const;
- QString toShortText()const;
- QString type()const;
+ QString toRichText() const;
+ QString toShortText() const;
+ QString type() const;
- QMap<int, QString> toMap()const;
+ QMap<int, QString> toMap() const;
void fromMap( const QMap<int, QString>& map );
- QString recordField(int )const;
+ QString recordField( int ) const;
@@ -184,12 +188,13 @@ public:
bool loadFromStream( QDataStream& );
- bool saveToStream( QDataStream& )const;
-
-/* bool operator==( const OEvent& );
- bool operator!=( const OEvent& );
- bool operator<( const OEvent& );
- bool operator<=( const OEvent& );
- bool operator>( const OEvent& );
- bool operator>=(const OEvent& );
-*/
-private:
+ bool saveToStream( QDataStream& ) const;
+
+ /* bool operator==( const OEvent& );
+ bool operator!=( const OEvent& );
+ bool operator<( const OEvent& );
+ bool operator<=( const OEvent& );
+ bool operator>( const OEvent& );
+ bool operator>=(const OEvent& );
+ */
+
+ private:
inline void changeOrModify();
@@ -206,7 +211,9 @@ private:
*/
-class OEffectiveEvent {
-public:
+class OEffectiveEvent
+{
+
+ public:
typedef QValueList<OEffectiveEvent> ValueList;
enum Position { MidWay, Start, End, StartEnd };
- // If we calculate the effective event of a multi-day event
+ // If we calculate the effective event of a multi-day event
// we have to figure out whether we are at the first day,
@@ -223,3 +230,3 @@ public:
OEffectiveEvent( const OEffectiveEvent& );
- OEffectiveEvent &operator=(const OEffectiveEvent& );
+ OEffectiveEvent &operator=( const OEffectiveEvent& );
~OEffectiveEvent();
@@ -233,16 +240,16 @@ public:
- QString description()const;
- QString location()const;
- QString note()const;
- OEvent event()const;
- QTime startTime()const;
- QTime endTime()const;
- QDate date()const;
+ QString description() const;
+ QString location() const;
+ QString note() const;
+ OEvent event() const;
+ QTime startTime() const;
+ QTime endTime() const;
+ QDate date() const;
/* return the length in hours */
- int length()const;
- int size()const;
+ int length() const;
+ int size() const;
- QDate startDate()const;
- QDate endDate()const;
+ QDate startDate() const;
+ QDate endDate() const;
@@ -255,3 +262,3 @@ public:
-private:
+ private:
void deref();
diff --git a/libopie2/opiepim/orecordlist.h b/libopie2/opiepim/orecordlist.h
index 8f0011b..1742dcc 100644
--- a/libopie2/opiepim/orecordlist.h
+++ b/libopie2/opiepim/orecordlist.h
@@ -29,7 +29,6 @@
-#ifndef OPIE_RECORD_LIST_H
-#define OPIE_RECORD_LIST_H
-
-#include <qarray.h>
+#ifndef ORECORDLIST_H
+#define ORECORDLIST_H
+/* OPIE */
#include <opie2/otemplatebase.h>
@@ -37,3 +36,7 @@
-namespace Opie {
+/* QT */
+#include <qarray.h>
+
+namespace Opie
+{
@@ -49,5 +52,7 @@ template <class T> class ORecordList;
template <class T = OPimRecord>
-class ORecordListIterator {
+class ORecordListIterator
+{
friend class ORecordList<T>;
-public:
+
+ public:
typedef OTemplateBase<T> Base;
@@ -67,3 +72,3 @@ public:
ORecordListIterator( const ORecordListIterator& );
- ORecordListIterator &operator=(const ORecordListIterator& );
+ ORecordListIterator &operator=( const ORecordListIterator& );
@@ -83,3 +88,3 @@ public:
*/
- uint current()const;
+ uint current() const;
@@ -88,3 +93,3 @@ public:
*/
- uint count()const;
+ uint count() const;
@@ -95,3 +100,3 @@ public:
-private:
+ private:
QArray<int> m_uids;
@@ -101,3 +106,3 @@ private:
T m_record;
- bool m_direction :1;
+ bool m_direction : 1;
@@ -107,2 +112,3 @@ private:
+
class ORecordListPrivate;
@@ -113,4 +119,5 @@ class ORecordListPrivate;
template <class T = OPimRecord >
-class ORecordList {
-public:
+class ORecordList
+{
+ public:
typedef OTemplateBase<T> Base;
@@ -121,5 +128,5 @@ public:
*/
- ORecordList () {
- }
-ORecordList( const QArray<int>& ids,
+ ORecordList ()
+ {}
+ ORecordList( const QArray<int>& ids,
const Base* );
@@ -140,10 +147,10 @@ ORecordList( const QArray<int>& ids,
*/
- uint count()const;
+ uint count() const;
- T operator[]( uint i );
- int uidAt(uint i );
+ T operator[] ( uint i );
+ int uidAt( uint i );
- /**
- * Remove the contact with given uid
- */
+ /**
+ * Remove the contact with given uid
+ */
bool remove( int uid );
@@ -154,3 +161,3 @@ ORecordList( const QArray<int>& ids,
*/
-private:
+ private:
QArray<int> m_ids;
@@ -160,5 +167,7 @@ private:
+
/* ok now implement it */
template <class T>
-ORecordListIterator<T>::ORecordListIterator() {
+ORecordListIterator<T>::ORecordListIterator()
+{
m_current = 0;
@@ -170,10 +179,15 @@ ORecordListIterator<T>::ORecordListIterator() {
}
+
+
template <class T>
-ORecordListIterator<T>::~ORecordListIterator() {
-/* nothing to delete */
+ORecordListIterator<T>::~ORecordListIterator()
+{
+ /* nothing to delete */
}
+
template <class T>
-ORecordListIterator<T>::ORecordListIterator( const ORecordListIterator<T>& it) {
-// qWarning("ORecordListIterator copy c'tor");
+ORecordListIterator<T>::ORecordListIterator( const ORecordListIterator<T>& it )
+{
+ // qWarning("ORecordListIterator copy c'tor");
m_uids = it.m_uids;
@@ -186,4 +200,6 @@ ORecordListIterator<T>::ORecordListIterator( const ORecordListIterator<T>& it) {
+
template <class T>
-ORecordListIterator<T> &ORecordListIterator<T>::operator=( const ORecordListIterator<T>& it) {
+ORecordListIterator<T> &ORecordListIterator<T>::operator=( const ORecordListIterator<T>& it )
+{
m_uids = it.m_uids;
@@ -197,9 +213,11 @@ ORecordListIterator<T> &ORecordListIterator<T>::operator=( const ORecordListIter
+
template <class T>
-T ORecordListIterator<T>::operator*() {
- //qWarning("operator* %d %d", m_current, m_uids[m_current] );
- if (!m_end )
- m_record = m_temp->find( m_uids[m_current], m_uids, m_current,
+T ORecordListIterator<T>::operator*()
+{
+ //qWarning("operator* %d %d", m_current, m_uids[m_current] );
+ if ( !m_end )
+ m_record = m_temp->find( m_uids[ m_current ], m_uids, m_current,
m_direction ? Base::Forward :
- Base::Reverse );
+ Base::Reverse );
else
@@ -210,9 +228,13 @@ T ORecordListIterator<T>::operator*() {
+
template <class T>
-ORecordListIterator<T> &ORecordListIterator<T>::operator++() {
+ORecordListIterator<T> &ORecordListIterator<T>::operator++()
+{
m_direction = true;
- if (m_current < m_uids.count() ) {
+ if ( m_current < m_uids.count() )
+ {
m_end = false;
++m_current;
- }else
+ }
+ else
m_end = true;
@@ -221,9 +243,14 @@ ORecordListIterator<T> &ORecordListIterator<T>::operator++() {
}
+
+
template <class T>
-ORecordListIterator<T> &ORecordListIterator<T>::operator--() {
+ORecordListIterator<T> &ORecordListIterator<T>::operator--()
+{
m_direction = false;
- if ( m_current > 0 ) {
+ if ( m_current > 0 )
+ {
--m_current;
m_end = false;
- } else
+ }
+ else
m_end = true;
@@ -233,4 +260,6 @@ ORecordListIterator<T> &ORecordListIterator<T>::operator--() {
+
template <class T>
-bool ORecordListIterator<T>::operator==( const ORecordListIterator<T>& it ) {
+bool ORecordListIterator<T>::operator==( const ORecordListIterator<T>& it )
+{
@@ -245,25 +274,37 @@ bool ORecordListIterator<T>::operator==( const ORecordListIterator<T>& it ) {
}
+
+
template <class T>
-bool ORecordListIterator<T>::operator!=( const ORecordListIterator<T>& it ) {
- return !(*this == it );
+bool ORecordListIterator<T>::operator!=( const ORecordListIterator<T>& it )
+{
+ return !( *this == it );
}
+
+
template <class T>
ORecordListIterator<T>::ORecordListIterator( const QArray<int> uids,
- const Base* t )
- : m_uids( uids ), m_current( 0 ), m_temp( t ), m_end( false ),
- m_direction( false )
+ const Base* t )
+ : m_uids( uids ), m_current( 0 ), m_temp( t ), m_end( false ),
+ m_direction( false )
{
/* if the list is empty we're already at the end of the list */
- if (uids.count() == 0 )
+ if ( uids.count() == 0 )
m_end = true;
}
+
+
template <class T>
-uint ORecordListIterator<T>::current()const {
+uint ORecordListIterator<T>::current() const
+{
return m_current;
}
+
+
template <class T>
-void ORecordListIterator<T>::setCurrent( uint cur ) {
- if( cur < m_uids.count() ) {
- m_end = false;
- m_current= cur;
+void ORecordListIterator<T>::setCurrent( uint cur )
+{
+ if ( cur < m_uids.count() )
+ {
+ m_end = false;
+ m_current = cur;
}
@@ -271,5 +312,8 @@ void ORecordListIterator<T>::setCurrent( uint cur ) {
template <class T>
-uint ORecordListIterator<T>::count()const {
+uint ORecordListIterator<T>::count() const
+{
return m_uids.count();
}
+
+
template <class T>
@@ -277,11 +321,16 @@ ORecordList<T>::ORecordList( const QArray<int>& ids,
const Base* acc )
- : m_ids( ids ), m_acc( acc )
-{
-}
+ : m_ids( ids ), m_acc( acc )
+{}
+
+
template <class T>
-ORecordList<T>::~ORecordList() {
-/* nothing to do here */
+ORecordList<T>::~ORecordList()
+{
+ /* nothing to do here */
}
+
+
template <class T>
-typename ORecordList<T>::Iterator ORecordList<T>::begin() {
+typename ORecordList<T>::Iterator ORecordList<T>::begin()
+{
Iterator it( m_ids, m_acc );
@@ -289,4 +338,7 @@ typename ORecordList<T>::Iterator ORecordList<T>::begin() {
}
+
+
template <class T>
-typename ORecordList<T>::Iterator ORecordList<T>::end() {
+typename ORecordList<T>::Iterator ORecordList<T>::end()
+{
Iterator it( m_ids, m_acc );
@@ -297,8 +349,14 @@ typename ORecordList<T>::Iterator ORecordList<T>::end() {
}
+
+
template <class T>
-uint ORecordList<T>::count()const {
-return m_ids.count();
+uint ORecordList<T>::count() const
+{
+ return m_ids.count();
}
+
+
template <class T>
-T ORecordList<T>::operator[]( uint i ) {
+T ORecordList<T>::operator[] ( uint i )
+{
if ( i >= m_ids.count() )
@@ -306,28 +364,36 @@ T ORecordList<T>::operator[]( uint i ) {
/* forward */
- return m_acc->find( m_ids[i], m_ids, i );
-}
-template <class T>
-int ORecordList<T>::uidAt( uint i ) {
- return m_ids[i];
+ return m_acc->find( m_ids[ i ], m_ids, i );
}
+
template <class T>
-bool ORecordList<T>::remove( int uid ) {
- QArray<int> copy( m_ids.count() );
- int counter = 0;
- bool ret_val = false;
+int ORecordList<T>::uidAt( uint i )
+{
+ return m_ids[ i ];
+}
- for (uint i = 0; i < m_ids.count(); i++){
- if ( m_ids[i] != uid ){
- copy[counter++] = m_ids[i];
- }else
- ret_val = true;
- }
+template <class T>
+bool ORecordList<T>::remove( int uid )
+{
+ QArray<int> copy( m_ids.count() );
+ int counter = 0;
+ bool ret_val = false;
+
+ for ( uint i = 0; i < m_ids.count(); i++ )
+ {
+ if ( m_ids[ i ] != uid )
+ {
+ copy[ counter++ ] = m_ids[ i ];
+
+ }
+ else
+ ret_val = true;
+ }
- copy.resize( counter );
- m_ids = copy;
+ copy.resize( counter );
+ m_ids = copy;
- return ret_val;
+ return ret_val;
}
diff --git a/libopie2/opiepim/otodo.cpp b/libopie2/opiepim/otodo.cpp
index 3eb0026..f534067 100644
--- a/libopie2/opiepim/otodo.cpp
+++ b/libopie2/opiepim/otodo.cpp
@@ -28,7 +28,11 @@
*/
-#include <qobject.h>
-#include <qshared.h>
-
+#include "otodo.h"
+/* OPIE */
+#include <opie2/opimstate.h>
+#include <opie2/orecur.h>
+#include <opie2/opimmaintainer.h>
+#include <opie2/opimnotifymanager.h>
+#include <opie2/opimresolver.h>
#include <qpe/palmtopuidgen.h>
@@ -40,15 +44,13 @@
+/* QT */
+#include <qobject.h>
+#include <qshared.h>
-#include <opie2/opimstate.h>
-#include <opie2/orecur.h>
-#include <opie2/opimmaintainer.h>
-#include <opie2/opimnotifymanager.h>
-#include <opie2/opimresolver.h>
-
-#include <opie2/otodo.h>
-
-namespace Opie {
+namespace Opie
+{
-struct OTodo::OTodoData : public QShared {
- OTodoData() : QShared() {
+struct OTodo::OTodoData : public QShared
+{
+ OTodoData() : QShared()
+ {
recur = 0;
@@ -58,3 +60,4 @@ struct OTodo::OTodoData : public QShared {
};
- ~OTodoData() {
+ ~OTodoData()
+ {
delete recur;
@@ -65,4 +68,4 @@ struct OTodo::OTodoData : public QShared {
QDate date;
- bool isCompleted:1;
- bool hasDate:1;
+ bool isCompleted: 1;
+ bool hasDate: 1;
int priority;
@@ -80,13 +83,18 @@ struct OTodo::OTodoData : public QShared {
-OTodo::OTodo(const OTodo &event )
- : OPimRecord( event ), data( event.data )
+
+OTodo::OTodo( const OTodo &event )
+ : OPimRecord( event ), data( event.data )
{
data->ref();
-// qWarning("ref up");
+ // qWarning("ref up");
}
-OTodo::~OTodo() {
-// qWarning("~OTodo " );
- if ( data->deref() ) {
-// qWarning("OTodo::dereffing");
+
+OTodo::~OTodo()
+{
+
+ // qWarning("~OTodo " );
+ if ( data->deref() )
+ {
+ // qWarning("OTodo::dereffing");
delete data;
@@ -95,11 +103,13 @@ OTodo::~OTodo() {
}
-OTodo::OTodo(bool completed, int priority,
- const QArray<int> &category,
- const QString& summary,
- const QString &description,
- ushort progress,
- bool hasDate, QDate date, int uid )
- : OPimRecord( uid )
+
+
+OTodo::OTodo( bool completed, int priority,
+ const QArray<int> &category,
+ const QString& summary,
+ const QString &description,
+ ushort progress,
+ bool hasDate, QDate date, int uid )
+ : OPimRecord( uid )
{
-// qWarning("OTodoData " + summary);
+ // qWarning("OTodoData " + summary);
setCategories( category );
@@ -114,14 +124,16 @@ OTodo::OTodo(bool completed, int priority,
data->prog = progress;
- data->desc = Qtopia::simplifyMultiLineSpace(description );
+ data->desc = Qtopia::simplifyMultiLineSpace( description );
}
-OTodo::OTodo(bool completed, int priority,
- const QStringList &category,
- const QString& summary,
- const QString &description,
- ushort progress,
- bool hasDate, QDate date, int uid )
- : OPimRecord( uid )
+
+
+OTodo::OTodo( bool completed, int priority,
+ const QStringList &category,
+ const QString& summary,
+ const QString &description,
+ ushort progress,
+ bool hasDate, QDate date, int uid )
+ : OPimRecord( uid )
{
-// qWarning("OTodoData" + summary);
- setCategories( idsFromString( category.join(";") ) );
+ // qWarning("OTodoData" + summary);
+ setCategories( idsFromString( category.join( ";" ) ) );
@@ -135,21 +147,32 @@ OTodo::OTodo(bool completed, int priority,
data->prog = progress;
- data->desc = Qtopia::simplifyMultiLineSpace(description );
+ data->desc = Qtopia::simplifyMultiLineSpace( description );
}
-bool OTodo::match( const QRegExp &regExp )const
+
+
+bool OTodo::match( const QRegExp &regExp ) const
{
- if( QString::number( data->priority ).find( regExp ) != -1 ){
- setLastHitField( Priority );
- return true;
- }else if( data->hasDate && data->date.toString().find( regExp) != -1 ){
- setLastHitField( HasDate );
- return true;
- }else if(data->desc.find( regExp ) != -1 ){
+ if ( QString::number( data->priority ).find( regExp ) != -1 )
+ {
+ setLastHitField( Priority );
+ return true;
+ }
+ else if ( data->hasDate && data->date.toString().find( regExp ) != -1 )
+ {
+ setLastHitField( HasDate );
+ return true;
+ }
+ else if ( data->desc.find( regExp ) != -1 )
+ {
setLastHitField( Description );
return true;
- }else if(data->sum.find( regExp ) != -1 ) {
+ }
+ else if ( data->sum.find( regExp ) != -1 )
+ {
setLastHitField( Summary );
return true;
- }
- return false;
+ }
+ return false;
}
+
+
bool OTodo::isCompleted() const
@@ -158,2 +181,4 @@ bool OTodo::isCompleted() const
}
+
+
bool OTodo::hasDueDate() const
@@ -162,9 +187,17 @@ bool OTodo::hasDueDate() const
}
-bool OTodo::hasStartDate()const {
+
+
+bool OTodo::hasStartDate() const
+{
return data->start.isValid();
}
-bool OTodo::hasCompletedDate()const {
+
+
+bool OTodo::hasCompletedDate() const
+{
return data->completed.isValid();
}
-int OTodo::priority()const
+
+
+int OTodo::priority() const
{
@@ -172,2 +205,4 @@ int OTodo::priority()const
}
+
+
QString OTodo::summary() const
@@ -176,2 +211,4 @@ QString OTodo::summary() const
}
+
+
ushort OTodo::progress() const
@@ -180,3 +217,5 @@ ushort OTodo::progress() const
}
-QDate OTodo::dueDate()const
+
+
+QDate OTodo::dueDate() const
{
@@ -184,9 +223,17 @@ QDate OTodo::dueDate()const
}
-QDate OTodo::startDate()const {
+
+
+QDate OTodo::startDate() const
+{
return data->start;
}
-QDate OTodo::completedDate()const {
+
+
+QDate OTodo::completedDate() const
+{
return data->completed;
}
-QString OTodo::description()const
+
+
+QString OTodo::description() const
{
@@ -194,8 +241,15 @@ QString OTodo::description()const
}
-bool OTodo::hasState() const{
- if (!data->state ) return false;
+
+
+bool OTodo::hasState() const
+{
+ if ( !data->state ) return false;
return ( data->state->state() != OPimState::Undefined );
}
-OPimState OTodo::state()const {
- if (!data->state ) {
+
+
+OPimState OTodo::state() const
+{
+ if ( !data->state )
+ {
OPimState state;
@@ -204,23 +258,37 @@ OPimState OTodo::state()const {
- return (*data->state);
+ return ( *data->state );
}
-bool OTodo::hasRecurrence()const {
- if (!data->recur) return false;
+
+
+bool OTodo::hasRecurrence() const
+{
+ if ( !data->recur ) return false;
return data->recur->doesRecur();
}
-ORecur OTodo::recurrence()const {
- if (!data->recur) return ORecur();
- return (*data->recur);
+
+ORecur OTodo::recurrence() const
+{
+ if ( !data->recur ) return ORecur();
+
+ return ( *data->recur );
}
-bool OTodo::hasMaintainer()const {
- if (!data->maintainer) return false;
- return (data->maintainer->mode() != OPimMaintainer::Undefined );
+
+bool OTodo::hasMaintainer() const
+{
+ if ( !data->maintainer ) return false;
+
+ return ( data->maintainer->mode() != OPimMaintainer::Undefined );
}
-OPimMaintainer OTodo::maintainer()const {
- if (!data->maintainer) return OPimMaintainer();
- return (*data->maintainer);
+
+OPimMaintainer OTodo::maintainer() const
+{
+ if ( !data->maintainer ) return OPimMaintainer();
+
+ return ( *data->maintainer );
}
+
+
void OTodo::setCompleted( bool completed )
@@ -230,2 +298,4 @@ void OTodo::setCompleted( bool completed )
}
+
+
void OTodo::setHasDueDate( bool hasDate )
@@ -235,8 +305,12 @@ void OTodo::setHasDueDate( bool hasDate )
}
-void OTodo::setDescription(const QString &desc )
+
+
+void OTodo::setDescription( const QString &desc )
{
-// qWarning( "desc " + desc );
+ // qWarning( "desc " + desc );
changeOrModify();
- data->desc = Qtopia::simplifyMultiLineSpace(desc );
+ data->desc = Qtopia::simplifyMultiLineSpace( desc );
}
+
+
void OTodo::setSummary( const QString& sum )
@@ -246,3 +320,5 @@ void OTodo::setSummary( const QString& sum )
}
-void OTodo::setPriority(int prio )
+
+
+void OTodo::setPriority( int prio )
{
@@ -251,2 +327,4 @@ void OTodo::setPriority(int prio )
}
+
+
void OTodo::setDueDate( const QDate& date )
@@ -256,3 +334,6 @@ void OTodo::setDueDate( const QDate& date )
}
-void OTodo::setStartDate( const QDate& date ) {
+
+
+void OTodo::setStartDate( const QDate& date )
+{
changeOrModify();
@@ -260,3 +341,6 @@ void OTodo::setStartDate( const QDate& date ) {
}
-void OTodo::setCompletedDate( const QDate& date ) {
+
+
+void OTodo::setCompletedDate( const QDate& date )
+{
changeOrModify();
@@ -264,6 +348,9 @@ void OTodo::setCompletedDate( const QDate& date ) {
}
-void OTodo::setState( const OPimState& state ) {
+
+
+void OTodo::setState( const OPimState& state )
+{
changeOrModify();
- if (data->state )
- (*data->state) = state;
+ if ( data->state )
+ ( *data->state ) = state;
else
@@ -271,6 +358,9 @@ void OTodo::setState( const OPimState& state ) {
}
-void OTodo::setRecurrence( const ORecur& rec) {
+
+
+void OTodo::setRecurrence( const ORecur& rec )
+{
changeOrModify();
- if (data->recur )
- (*data->recur) = rec;
+ if ( data->recur )
+ ( *data->recur ) = rec;
else
@@ -278,7 +368,10 @@ void OTodo::setRecurrence( const ORecur& rec) {
}
-void OTodo::setMaintainer( const OPimMaintainer& pim ) {
+
+
+void OTodo::setMaintainer( const OPimMaintainer& pim )
+{
changeOrModify();
- if (data->maintainer )
- (*data->maintainer) = pim;
+ if ( data->maintainer )
+ ( *data->maintainer ) = pim;
else
@@ -286,9 +379,13 @@ void OTodo::setMaintainer( const OPimMaintainer& pim ) {
}
+
+
bool OTodo::isOverdue( )
{
- if( data->hasDate && !data->isCompleted)
- return QDate::currentDate() > data->date;
+ if ( data->hasDate && !data->isCompleted )
+ return QDate::currentDate() > data->date;
return false;
}
-void OTodo::setProgress(ushort progress )
+
+
+void OTodo::setProgress( ushort progress )
{
@@ -297,5 +394,10 @@ void OTodo::setProgress(ushort progress )
}
-QString OTodo::toShortText() const {
- return summary();
+
+
+QString OTodo::toShortText() const
+{
+ return summary();
}
+
+
/*!
@@ -305,25 +407,27 @@ QString OTodo::toRichText() const
{
- QString text;
- QStringList catlist;
-
- // summary
- text += "<b><h3><img src=\"todo/TodoList\"> ";
- if ( !summary().isEmpty() ) {
- text += Qtopia::escapeString(summary() ).replace(QRegExp( "[\n]"), "" );
- }
- text += "</h3></b><br><hr><br>";
-
- // description
- if( !description().isEmpty() ){
- text += "<b>" + QObject::tr( "Description:" ) + "</b><br>";
- text += Qtopia::escapeString(description() ).replace(QRegExp( "[\n]"), "<br>" ) + "<br>";
- }
-
- // priority
- int priorityval = priority();
- text += "<b>" + QObject::tr( "Priority:") +" </b><img src=\"todo/priority" +
- QString::number( priorityval ) + "\"> ";
-
- switch ( priorityval )
- {
+ QString text;
+ QStringList catlist;
+
+ // summary
+ text += "<b><h3><img src=\"todo/TodoList\"> ";
+ if ( !summary().isEmpty() )
+ {
+ text += Qtopia::escapeString( summary() ).replace( QRegExp( "[\n]" ), "" );
+ }
+ text += "</h3></b><br><hr><br>";
+
+ // description
+ if ( !description().isEmpty() )
+ {
+ text += "<b>" + QObject::tr( "Description:" ) + "</b><br>";
+ text += Qtopia::escapeString( description() ).replace( QRegExp( "[\n]" ), "<br>" ) + "<br>";
+ }
+
+ // priority
+ int priorityval = priority();
+ text += "<b>" + QObject::tr( "Priority:" ) + " </b><img src=\"todo/priority" +
+ QString::number( priorityval ) + "\"> ";
+
+ switch ( priorityval )
+ {
case 1 : text += QObject::tr( "Very high" );
@@ -338,57 +442,73 @@ QString OTodo::toRichText() const
break;
- };
- text += "<br>";
-
- // progress
- text += "<b>" + QObject::tr( "Progress:") + " </b>"
- + QString::number( progress() ) + " %<br>";
-
- // due date
- if (hasDueDate() ){
- QDate dd = dueDate();
- int off = QDate::currentDate().daysTo( dd );
-
- text += "<b>" + QObject::tr( "Deadline:" ) + " </b><font color=\"";
- if ( off < 0 )
- text += "#FF0000";
- else if ( off == 0 )
- text += "#FFFF00";
- else if ( off > 0 )
- text += "#00FF00";
-
- text += "\">" + dd.toString() + "</font><br>";
- }
-
- // categories
- text += "<b>" + QObject::tr( "Category:") + "</b> ";
- text += categoryNames( "Todo List" ).join(", ");
- text += "<br>";
-
- return text;
-}
-bool OTodo::hasNotifiers()const {
- if (!data->notifiers) return false;
+ };
+ text += "<br>";
+
+ // progress
+ text += "<b>" + QObject::tr( "Progress:" ) + " </b>"
+ + QString::number( progress() ) + " %<br>";
+
+ // due date
+ if ( hasDueDate() )
+ {
+ QDate dd = dueDate();
+ int off = QDate::currentDate().daysTo( dd );
+
+ text += "<b>" + QObject::tr( "Deadline:" ) + " </b><font color=\"";
+ if ( off < 0 )
+ text += "#FF0000";
+ else if ( off == 0 )
+ text += "#FFFF00";
+ else if ( off > 0 )
+ text += "#00FF00";
+
+ text += "\">" + dd.toString() + "</font><br>";
+ }
+
+ // categories
+ text += "<b>" + QObject::tr( "Category:" ) + "</b> ";
+ text += categoryNames( "Todo List" ).join( ", " );
+ text += "<br>";
+
+ return text;
+}
+
+
+bool OTodo::hasNotifiers() const
+{
+ if ( !data->notifiers ) return false;
return !data->notifiers->isEmpty();
}
-OPimNotifyManager& OTodo::notifiers() {
- if (!data->notifiers )
+
+
+OPimNotifyManager& OTodo::notifiers()
+{
+ if ( !data->notifiers )
data->notifiers = new OPimNotifyManager;
- return (*data->notifiers);
+ return ( *data->notifiers );
}
-const OPimNotifyManager& OTodo::notifiers()const{
- if (!data->notifiers )
+
+
+const OPimNotifyManager& OTodo::notifiers() const
+{
+ if ( !data->notifiers )
data->notifiers = new OPimNotifyManager;
- return (*data->notifiers);
+ return ( *data->notifiers );
}
-bool OTodo::operator<( const OTodo &toDoEvent )const{
- if( !hasDueDate() && !toDoEvent.hasDueDate() ) return true;
- if( !hasDueDate() && toDoEvent.hasDueDate() ) return false;
- if( hasDueDate() && toDoEvent.hasDueDate() ){
- if( dueDate() == toDoEvent.dueDate() ){ // let's the priority decide
- return priority() < toDoEvent.priority();
- }else{
- return dueDate() < toDoEvent.dueDate();
- }
+
+bool OTodo::operator<( const OTodo &toDoEvent ) const
+{
+ if ( !hasDueDate() && !toDoEvent.hasDueDate() ) return true;
+ if ( !hasDueDate() && toDoEvent.hasDueDate() ) return false;
+ if ( hasDueDate() && toDoEvent.hasDueDate() )
+ {
+ if ( dueDate() == toDoEvent.dueDate() )
+ { // let's the priority decide
+ return priority() < toDoEvent.priority();
+ }
+ else
+ {
+ return dueDate() < toDoEvent.dueDate();
+ }
}
@@ -396,12 +516,18 @@ bool OTodo::operator<( const OTodo &toDoEvent )const{
}
-bool OTodo::operator<=(const OTodo &toDoEvent )const
+
+
+bool OTodo::operator<=( const OTodo &toDoEvent ) const
{
- if( !hasDueDate() && !toDoEvent.hasDueDate() ) return true;
- if( !hasDueDate() && toDoEvent.hasDueDate() ) return true;
- if( hasDueDate() && toDoEvent.hasDueDate() ){
- if( dueDate() == toDoEvent.dueDate() ){ // let's the priority decide
- return priority() <= toDoEvent.priority();
- }else{
- return dueDate() <= toDoEvent.dueDate();
- }
+ if ( !hasDueDate() && !toDoEvent.hasDueDate() ) return true;
+ if ( !hasDueDate() && toDoEvent.hasDueDate() ) return true;
+ if ( hasDueDate() && toDoEvent.hasDueDate() )
+ {
+ if ( dueDate() == toDoEvent.dueDate() )
+ { // let's the priority decide
+ return priority() <= toDoEvent.priority();
+ }
+ else
+ {
+ return dueDate() <= toDoEvent.dueDate();
+ }
}
@@ -409,12 +535,18 @@ bool OTodo::operator<=(const OTodo &toDoEvent )const
}
-bool OTodo::operator>(const OTodo &toDoEvent )const
+
+
+bool OTodo::operator>( const OTodo &toDoEvent ) const
{
- if( !hasDueDate() && !toDoEvent.hasDueDate() ) return false;
- if( !hasDueDate() && toDoEvent.hasDueDate() ) return false;
- if( hasDueDate() && toDoEvent.hasDueDate() ){
- if( dueDate() == toDoEvent.dueDate() ){ // let's the priority decide
- return priority() > toDoEvent.priority();
- }else{
- return dueDate() > toDoEvent.dueDate();
- }
+ if ( !hasDueDate() && !toDoEvent.hasDueDate() ) return false;
+ if ( !hasDueDate() && toDoEvent.hasDueDate() ) return false;
+ if ( hasDueDate() && toDoEvent.hasDueDate() )
+ {
+ if ( dueDate() == toDoEvent.dueDate() )
+ { // let's the priority decide
+ return priority() > toDoEvent.priority();
+ }
+ else
+ {
+ return dueDate() > toDoEvent.dueDate();
+ }
}
@@ -422,12 +554,18 @@ bool OTodo::operator>(const OTodo &toDoEvent )const
}
-bool OTodo::operator>=(const OTodo &toDoEvent )const
+
+
+bool OTodo::operator>=( const OTodo &toDoEvent ) const
{
- if( !hasDueDate() && !toDoEvent.hasDueDate() ) return true;
- if( !hasDueDate() && toDoEvent.hasDueDate() ) return false;
- if( hasDueDate() && toDoEvent.hasDueDate() ){
- if( dueDate() == toDoEvent.dueDate() ){ // let's the priority decide
- return priority() > toDoEvent.priority();
- }else{
- return dueDate() > toDoEvent.dueDate();
- }
+ if ( !hasDueDate() && !toDoEvent.hasDueDate() ) return true;
+ if ( !hasDueDate() && toDoEvent.hasDueDate() ) return false;
+ if ( hasDueDate() && toDoEvent.hasDueDate() )
+ {
+ if ( dueDate() == toDoEvent.dueDate() )
+ { // let's the priority decide
+ return priority() > toDoEvent.priority();
+ }
+ else
+ {
+ return dueDate() > toDoEvent.dueDate();
+ }
}
@@ -435,3 +573,5 @@ bool OTodo::operator>=(const OTodo &toDoEvent )const
}
-bool OTodo::operator==(const OTodo &toDoEvent )const
+
+
+bool OTodo::operator==( const OTodo &toDoEvent ) const
{
@@ -444,3 +584,3 @@ bool OTodo::operator==(const OTodo &toDoEvent )const
if ( data->desc != toDoEvent.data->desc ) return false;
- if ( data->maintainer != toDoEvent.data->maintainer )
+ if ( data->maintainer != toDoEvent.data->maintainer )
return false;
@@ -449,14 +589,20 @@ bool OTodo::operator==(const OTodo &toDoEvent )const
}
-void OTodo::deref() {
-// qWarning("deref in ToDoEvent");
- if ( data->deref() ) {
-// qWarning("deleting");
+
+void OTodo::deref()
+{
+
+ // qWarning("deref in ToDoEvent");
+ if ( data->deref() )
+ {
+ // qWarning("deleting");
delete data;
- data= 0;
+ data = 0;
}
}
-OTodo &OTodo::operator=(const OTodo &item )
+
+
+OTodo &OTodo::operator=( const OTodo &item )
{
- if ( this == &item ) return *this;
+ if ( this == &item ) return * this;
@@ -471,3 +617,5 @@ OTodo &OTodo::operator=(const OTodo &item )
-QMap<int, QString> OTodo::toMap() const {
+
+QMap<int, QString> OTodo::toMap() const
+{
QMap<int, QString> map;
@@ -475,3 +623,3 @@ QMap<int, QString> OTodo::toMap() const {
map.insert( Uid, QString::number( uid() ) );
- map.insert( Category, idsToString( categories() ) );
+ map.insert( Category, idsToString( categories() ) );
map.insert( HasDate, QString::number( data->hasDate ) );
@@ -481,3 +629,3 @@ QMap<int, QString> OTodo::toMap() const {
map.insert( Priority, QString::number( data->priority ) );
- map.insert( DateDay, QString::number( data->date.day() ) );
+ map.insert( DateDay, QString::number( data->date.day() ) );
map.insert( DateMonth, QString::number( data->date.month() ) );
@@ -485,3 +633,3 @@ QMap<int, QString> OTodo::toMap() const {
map.insert( Progress, QString::number( data->prog ) );
-// map.insert( CrossReference, crossToString() );
+ // map.insert( CrossReference, crossToString() );
/* FIXME!!! map.insert( State, );
@@ -494,2 +642,3 @@ QMap<int, QString> OTodo::toMap() const {
+
/**
@@ -499,8 +648,10 @@ QMap<int, QString> OTodo::toMap() const {
*/
-void OTodo::changeOrModify() {
- if ( data->count != 1 ) {
- qWarning("changeOrModify");
+void OTodo::changeOrModify()
+{
+ if ( data->count != 1 )
+ {
+ qWarning( "changeOrModify" );
data->deref();
OTodoData* d2 = new OTodoData();
- copy(data, d2 );
+ copy( data, d2 );
data = d2;
@@ -508,2 +659,4 @@ void OTodo::changeOrModify() {
}
+
+
// WATCHOUT
@@ -513,3 +666,4 @@ void OTodo::changeOrModify() {
*/
-void OTodo::copy( OTodoData* src, OTodoData* dest ) {
+void OTodo::copy( OTodoData* src, OTodoData* dest )
+{
dest->date = src->date;
@@ -523,9 +677,9 @@ void OTodo::copy( OTodoData* src, OTodoData* dest ) {
- if (src->state )
+ if ( src->state )
dest->state = new OPimState( *src->state );
- if (src->recur )
+ if ( src->recur )
dest->recur = new ORecur( *src->recur );
- if (src->maintainer )
+ if ( src->maintainer )
dest->maintainer = new OPimMaintainer( *src->maintainer )
@@ -535,9 +689,15 @@ void OTodo::copy( OTodoData* src, OTodoData* dest ) {
- if (src->notifiers )
+ if ( src->notifiers )
dest->notifiers = new OPimNotifyManager( *src->notifiers );
}
-QString OTodo::type() const {
- return QString::fromLatin1("OTodo");
+
+
+QString OTodo::type() const
+{
+ return QString::fromLatin1( "OTodo" );
}
-QString OTodo::recordField(int /*id*/ )const {
+
+
+QString OTodo::recordField( int /*id*/ ) const
+{
return QString::null;
@@ -545,3 +705,5 @@ QString OTodo::recordField(int /*id*/ )const {
-int OTodo::rtti(){
+
+int OTodo::rtti()
+{
return OPimResolver::TodoList;
diff --git a/libopie2/opiepim/otodo.h b/libopie2/opiepim/otodo.h
index 61add04..04dd269 100644
--- a/libopie2/opiepim/otodo.h
+++ b/libopie2/opiepim/otodo.h
@@ -1,8 +1,8 @@
/*
- This file is part of the Opie Project
- Copyright (C) The Main Author <main-author@whereever.org>
- =. Copyright (C) The Opie Team <opie-devel@handhelds.org>
- .=l.
- .>+-=
- _;:, .> :=|. This program is free software; you can
+ This file is part of the Opie Project
+ Copyright (C) The Main Author <main-author@whereever.org>
+ =. Copyright (C) The Opie Team <opie-devel@handhelds.org>
+ .=l.
+ .>+-=
+_;:, .> :=|. This program is free software; you can
.> <`_, > . <= redistribute it and/or modify it under
@@ -10,24 +10,30 @@
.="- .-=="i, .._ License as published by the Free Software
- - . .-<_> .<> Foundation; either version 2 of the License,
- ._= =} : or (at your option) any later version.
- .%`+i> _;_.
- .i_,=:_. -<s. This program is distributed in the hope that
- + . -:. = it will be useful, but WITHOUT ANY WARRANTY;
- : .. .:, . . . without even the implied warranty of
- =_ + =;=|` MERCHANTABILITY or FITNESS FOR A
- _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU
+- . .-<_> .<> Foundation; either version 2 of the License,
+ ._= =} : or (at your option) any later version.
+ .%`+i> _;_.
+ .i_,=:_. -<s. This program is distributed in the hope that
+ + . -:. = it will be useful, but WITHOUT ANY WARRANTY;
+ : .. .:, . . . without even the implied warranty of
+ =_ + =;=|` MERCHANTABILITY or FITNESS FOR A
+ _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU
..}^=.= = ; Library General Public License for more
++= -. .` .: details.
- : = ...= . :.=-
- -. .:....=;==+<; You should have received a copy of the GNU
- -_. . . )=. = Library General Public License along with
- -- :-=` this library; see the file COPYING.LIB.
- If not, write to the Free Software Foundation,
- Inc., 59 Temple Place - Suite 330,
- Boston, MA 02111-1307, USA.
+: = ...= . :.=-
+-. .:....=;==+<; You should have received a copy of the GNU
+ -_. . . )=. = Library General Public License along with
+ -- :-=` this library; see the file COPYING.LIB.
+ If not, write to the Free Software Foundation,
+ Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA.
*/
-#ifndef OPIE_TODO_EVENT_H
-#define OPIE_TODO_EVENT_H
+#ifndef OTODOEVENT_H
+#define OTODOEVENT_H
+/* OPIE */
+#include <opie2/opimrecord.h>
+#include <qpe/recordfields.h>
+#include <qpe/palmtopuidgen.h>
+
+/* QT */
#include <qarray.h>
@@ -39,9 +45,4 @@
-#include <qpe/recordfields.h>
-#include <qpe/palmtopuidgen.h>
-
-#include <opie2/opimrecord.h>
-
-
-namespace Opie {
+namespace Opie
+{
@@ -51,4 +52,5 @@ class OPimMaintainer;
class OPimNotifyManager;
-class OTodo : public OPimRecord {
-public:
+class OTodo : public OPimRecord
+{
+ public:
typedef QValueList<OTodo> ValueList;
@@ -76,5 +78,5 @@ public:
};
- public:
+ public:
// priorities from Very low to very high
- enum TaskPriority { VeryHigh=1, High, Normal, Low, VeryLow };
+ enum TaskPriority { VeryHigh = 1, High, Normal, Low, VeryLow };
@@ -103,3 +105,3 @@ public:
ushort progress = 0,
- bool hasDate = false, QDate date = QDate::currentDate(),
+ bool hasDate = false, QDate date = QDate::currentDate(),
int uid = 0 /* empty */ );
@@ -109,3 +111,3 @@ public:
*/
- OTodo(const OTodo & );
+ OTodo( const OTodo & );
@@ -125,4 +127,4 @@ public:
bool hasDueDate() const;
- bool hasStartDate()const;
- bool hasCompletedDate()const;
+ bool hasStartDate() const;
+ bool hasCompletedDate() const;
@@ -131,3 +133,3 @@ public:
*/
- int priority()const ;
+ int priority() const ;
@@ -141,3 +143,3 @@ public:
*/
- QDate dueDate()const;
+ QDate dueDate() const;
@@ -146,3 +148,3 @@ public:
*/
- QDate startDate()const;
+ QDate startDate() const;
@@ -151,3 +153,3 @@ public:
*/
- QDate completedDate()const;
+ QDate completedDate() const;
@@ -156,3 +158,3 @@ public:
*/
- bool hasState()const;
+ bool hasState() const;
@@ -161,3 +163,3 @@ public:
*/
- OPimState state()const;
+ OPimState state() const;
@@ -166,3 +168,3 @@ public:
*/
- bool hasRecurrence()const;
+ bool hasRecurrence() const;
@@ -171,3 +173,3 @@ public:
*/
- ORecur recurrence()const;
+ ORecur recurrence() const;
@@ -176,3 +178,3 @@ public:
*/
- bool hasMaintainer()const;
+ bool hasMaintainer() const;
@@ -181,3 +183,3 @@ public:
*/
- OPimMaintainer maintainer()const;
+ OPimMaintainer maintainer() const;
@@ -186,3 +188,3 @@ public:
*/
- QString description()const;
+ QString description() const;
@@ -199,3 +201,3 @@ public:
- bool hasNotifiers()const;
+ bool hasNotifiers() const;
/*
@@ -212,3 +214,3 @@ public:
*/
- const OPimNotifyManager &notifiers()const;
+ const OPimNotifyManager &notifiers() const;
@@ -217,5 +219,5 @@ public:
*/
- QString type()const;
- QString toShortText()const;
- QString recordField(int id )const;
+ QString type() const;
+ QString toShortText() const;
+ QString recordField( int id ) const;
@@ -225,3 +227,3 @@ public:
*/
- QMap<int, QString> toMap()const;
+ QMap<int, QString> toMap() const;
@@ -230,3 +232,3 @@ public:
*/
- void setCompleted(bool completed );
+ void setCompleted( bool completed );
@@ -244,3 +246,3 @@ public:
*/
- void setPriority(int priority );
+ void setPriority( int priority );
@@ -268,4 +270,4 @@ public:
- void setDescription(const QString& );
- void setSummary(const QString& );
+ void setDescription( const QString& );
+ void setSummary( const QString& );
@@ -275,3 +277,3 @@ public:
*/
- void setState( const OPimState& state);
+ void setState( const OPimState& state );
@@ -285,11 +287,11 @@ public:
- virtual bool match( const QRegExp &r )const;
+ virtual bool match( const QRegExp &r ) const;
- bool operator<(const OTodo &toDoEvent )const;
- bool operator<=(const OTodo &toDoEvent )const;
- bool operator!=(const OTodo &toDoEvent )const;
- bool operator>(const OTodo &toDoEvent )const;
- bool operator>=(const OTodo &toDoEvent)const;
- bool operator==(const OTodo &toDoEvent )const;
- OTodo &operator=(const OTodo &toDoEvent );
+ bool operator<( const OTodo &toDoEvent ) const;
+ bool operator<=( const OTodo &toDoEvent ) const;
+ bool operator!=( const OTodo &toDoEvent ) const;
+ bool operator>( const OTodo &toDoEvent ) const;
+ bool operator>=( const OTodo &toDoEvent ) const;
+ bool operator==( const OTodo &toDoEvent ) const;
+ OTodo &operator=( const OTodo &toDoEvent );
@@ -297,3 +299,3 @@ public:
- private:
+ private:
class OTodoPrivate;
@@ -308,4 +310,7 @@ public:
};
-inline bool OTodo::operator!=(const OTodo &toDoEvent )const {
- return !(*this == toDoEvent);
+
+
+inline bool OTodo::operator!=( const OTodo &toDoEvent ) const
+{
+ return !( *this == toDoEvent );
}