summaryrefslogtreecommitdiff
path: root/libopie2/opiepim/core
authormickeyl <mickeyl>2004-02-23 13:15:42 (UTC)
committer mickeyl <mickeyl>2004-02-23 13:15:42 (UTC)
commitf9f0c26d9ac94586ffc36efa1b582ece3dbc43cf (patch) (side-by-side diff)
tree4044006e676c78370fdeccf960ea4214f13eabd2 /libopie2/opiepim/core
parent2d37d653310da0a9d6e2e2e6c9f5bf092e54cbbb (diff)
downloadopie-f9f0c26d9ac94586ffc36efa1b582ece3dbc43cf.zip
opie-f9f0c26d9ac94586ffc36efa1b582ece3dbc43cf.tar.gz
opie-f9f0c26d9ac94586ffc36efa1b582ece3dbc43cf.tar.bz2
cosmetics
Diffstat (limited to 'libopie2/opiepim/core') (more/less context) (show whitespace changes)
-rw-r--r--libopie2/opiepim/core/opimnotify.cpp219
-rw-r--r--libopie2/opiepim/core/opimnotify.h21
-rw-r--r--libopie2/opiepim/core/opimnotifymanager.cpp120
-rw-r--r--libopie2/opiepim/core/opimnotifymanager.h18
-rw-r--r--libopie2/opiepim/core/opimrecord.cpp117
-rw-r--r--libopie2/opiepim/core/opimrecord.h28
6 files changed, 387 insertions, 136 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
@@ -26,15 +26,19 @@
Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
-#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 )
+ {
}
QDateTime start;
int dur;
@@ -42,32 +46,44 @@ struct OPimNotify::Data : public QShared {
int parent;
};
-OPimNotify::OPimNotify( const QDateTime& start, int duration, int parent ) {
+OPimNotify::OPimNotify( const QDateTime& start, int duration, int parent )
+{
data = new Data;
data->start = start;
data->dur = duration;
data->parent = parent;
}
+
+
OPimNotify::OPimNotify( const OPimNotify& noti)
: data( noti.data )
{
data->ref();
}
-OPimNotify::~OPimNotify() {
- if ( data->deref() ) {
+
+
+OPimNotify::~OPimNotify()
+{
+ if ( data->deref() )
+ {
delete data;
data = 0l;
}
}
-OPimNotify &OPimNotify::operator=( const OPimNotify& noti) {
+
+OPimNotify &OPimNotify::operator=( const OPimNotify& noti )
+{
noti.data->ref();
deref();
data = noti.data;
return *this;
}
-bool OPimNotify::operator==( const OPimNotify& noti ) {
+
+
+bool OPimNotify::operator==( const OPimNotify& noti )
+{
if ( data == noti.data ) return true;
if ( data->dur != noti.data->dur ) return false;
if ( data->parent != noti.data->parent ) return false;
@@ -76,39 +92,70 @@ bool OPimNotify::operator==( const OPimNotify& noti ) {
return true;
}
-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 {
+
+
+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();
data->start = time;
}
-void OPimNotify::setDuration( int dur ) {
+
+
+void OPimNotify::setDuration( int dur )
+{
copyIntern();
data->dur = dur;
}
-void OPimNotify::setParent( int uid ) {
+
+
+void OPimNotify::setParent( int uid )
+{
copyIntern();
data->parent = uid;
}
-void OPimNotify::setService( const QString& str ) {
+
+
+void OPimNotify::setService( const QString& str )
+{
copyIntern();
data->application = str;
}
-void OPimNotify::copyIntern() {
- if ( data->count != 1 ) {
+
+
+void OPimNotify::copyIntern()
+{
+ if ( data->count != 1 )
+ {
data->deref();
Data* dat = new Data;
dat->start = data->start;
@@ -118,38 +165,55 @@ void OPimNotify::copyIntern() {
data = dat;
}
}
-void OPimNotify::deref() {
- if ( data->deref() ) {
+
+
+void OPimNotify::deref()
+{
+ if ( data->deref() )
+ {
delete data;
data = 0;
}
}
+
/***********************************************************/
-struct OPimAlarm::Data : public QShared {
- Data() : QShared() {
+struct OPimAlarm::Data : public QShared
+{
+ Data() : QShared()
+ {
sound = 1;
}
int sound;
QString file;
};
+
+
OPimAlarm::OPimAlarm( int sound, const QDateTime& start, int duration, int parent )
: OPimNotify( start, duration, parent )
{
data = new Data;
data->sound = sound;
}
+
+
OPimAlarm::OPimAlarm( const OPimAlarm& al)
: OPimNotify(al), data( al.data )
{
data->ref();
}
-OPimAlarm::~OPimAlarm() {
- if ( data->deref() ) {
+
+
+OPimAlarm::~OPimAlarm()
+{
+ if ( data->deref() )
+ {
delete data;
data = 0l;
}
}
+
+
OPimAlarm &OPimAlarm::operator=( const OPimAlarm& al)
{
OPimNotify::operator=( al );
@@ -161,38 +225,64 @@ OPimAlarm &OPimAlarm::operator=( const OPimAlarm& al)
return *this;
}
-bool OPimAlarm::operator==( const OPimAlarm& al) {
+
+
+bool OPimAlarm::operator==( const OPimAlarm& al )
+{
if ( data->sound != al.data->sound ) return false;
else if ( data->sound == Custom && data->file != al.data->file )
return false;
return OPimNotify::operator==( al );
}
-QString OPimAlarm::type()const {
+
+
+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();
data->sound = snd;
}
-void OPimAlarm::setFile( const QString& sound ) {
+
+
+void OPimAlarm::setFile( const QString& sound )
+{
copyIntern();
data->file = sound;
}
-void OPimAlarm::deref() {
- if ( data->deref() ) {
+
+
+void OPimAlarm::deref()
+{
+ if ( data->deref() )
+ {
delete data;
data = 0l;
}
}
-void OPimAlarm::copyIntern() {
- if ( data->count != 1 ) {
+
+
+void OPimAlarm::copyIntern()
+{
+ if ( data->count != 1 )
+ {
data->deref();
Data *newDat = new Data;
newDat->sound = data->sound;
@@ -200,25 +290,35 @@ void OPimAlarm::copyIntern() {
data = newDat;
}
}
+
+
/************************/
-struct OPimReminder::Data : public QShared {
- Data() : QShared(), record( 0) {
- }
+struct OPimReminder::Data : public QShared
+{
+ Data() : QShared(), record( 0 )
+ {}
int record;
};
+
+
OPimReminder::OPimReminder( int uid, const QDateTime& start, int dur, int parent )
: OPimNotify( start, dur, parent )
{
data = new Data;
data->record = uid;
}
+
+
OPimReminder::OPimReminder( const OPimReminder& rem )
: OPimNotify( rem ), data( rem.data )
{
data->ref();
}
-OPimReminder& OPimReminder::operator=( const OPimReminder& rem) {
+
+
+OPimReminder& OPimReminder::operator=( const OPimReminder& rem )
+{
OPimNotify::operator=(rem );
deref();
@@ -227,32 +327,53 @@ OPimReminder& OPimReminder::operator=( const OPimReminder& rem) {
return *this;
}
-bool OPimReminder::operator==( const OPimReminder& rem) {
+
+
+bool OPimReminder::operator==( const OPimReminder& rem )
+{
if ( data->record != rem.data->record ) return false;
return OPimNotify::operator==( rem );
}
-QString OPimReminder::type()const {
+
+
+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();
data->record = uid;
}
-void OPimReminder::deref() {
- if ( data->deref() ) {
+
+
+void OPimReminder::deref()
+{
+ if ( data->deref() )
+ {
delete data;
data = 0l;
}
}
-void OPimReminder::copyIntern() {
- if ( data->count != 1 ) {
+
+
+void OPimReminder::copyIntern()
+{
+ if ( data->count != 1 )
+ {
Data* da = new Data;
da->record = data->record;
data = da;
}
}
+
}
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
@@ -26,14 +26,16 @@
Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
-#ifndef OPIE_PIM_NOTIFY_H
-#define OPIE_PIM_NOTIFY_H
+#ifndef OPIMNOTIFY_H
+#define OPIMNOTIFY_H
+
+/* QT */
#include <qdatetime.h>
#include <qvaluelist.h>
-
-namespace Opie {
+namespace Opie
+{
/**
* This is the base class of Notifiers. Possible
* notifiers would be Alarms, Reminders
@@ -47,7 +49,9 @@ namespace Opie {
* given on the Due/Start Date? -zecke
* discuss: do we need a uid for the notify? -zecke
*/
-class OPimNotify {
+class OPimNotify
+{
+
public:
typedef QValueList<OPimNotify> ValueList;
OPimNotify( const QDateTime& start = QDateTime(), int duration = 0, int parent = 0 );
@@ -100,7 +104,8 @@ private:
* at a given time to inform about
* an Event
*/
-class OPimAlarm : public OPimNotify {
+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 );
@@ -135,9 +140,9 @@ private:
* Note that the returned dateTime() may be not valid.
* In these cases one must resolve the uid and get the OEvent
*/
-class OPimReminder : public OPimNotify {
+class OPimReminder : public OPimNotify
+{
public:
-
/**
* c'tor of a reminder
* @param uid The uid of the Record inside the Datebook
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
@@ -26,60 +26,94 @@
Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
-#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() {
-}
+
+
+OPimNotifyManager::~OPimNotifyManager()
+{}
+
+
/* use static_cast and type instead of dynamic... */
-void OPimNotifyManager::add( const OPimNotify& noti) {
- if ( noti.type() == QString::fromLatin1("OPimReminder") ) {
+void OPimNotifyManager::add( const OPimNotify& noti )
+{
+ if ( noti.type() == QString::fromLatin1( "OPimReminder" ) )
+ {
const OPimReminder& rem = static_cast<const OPimReminder&>(noti);
m_rem.append( rem );
- }else if ( noti.type() == QString::fromLatin1("OPimAlarm") ) {
+ }
+ else if ( noti.type() == QString::fromLatin1( "OPimAlarm" ) )
+ {
const OPimAlarm& al = static_cast<const OPimAlarm&>(noti);
m_al.append( al );
}
}
-void OPimNotifyManager::remove( const OPimNotify& noti) {
- if ( noti.type() == QString::fromLatin1("OPimReminder") ) {
+
+
+void OPimNotifyManager::remove( const OPimNotify& noti )
+{
+ if ( noti.type() == QString::fromLatin1( "OPimReminder" ) )
+ {
const OPimReminder& rem = static_cast<const OPimReminder&>(noti);
m_rem.remove( rem );
- }else if ( noti.type() == QString::fromLatin1("OPimAlarm") ) {
+ }
+ else if ( noti.type() == QString::fromLatin1( "OPimAlarm" ) )
+ {
const OPimAlarm& al = static_cast<const OPimAlarm&>(noti);
m_al.remove( al );
}
}
-void OPimNotifyManager::replace( const OPimNotify& noti) {
- if ( noti.type() == QString::fromLatin1("OPimReminder") ) {
+
+
+void OPimNotifyManager::replace( const OPimNotify& noti )
+{
+ if ( noti.type() == QString::fromLatin1( "OPimReminder" ) )
+ {
const OPimReminder& rem = static_cast<const OPimReminder&>(noti);
m_rem.remove( rem );
m_rem.append( rem );
- }else if ( noti.type() == QString::fromLatin1("OPimAlarm") ) {
+ }
+ else if ( noti.type() == QString::fromLatin1( "OPimAlarm" ) )
+ {
const OPimAlarm& al = static_cast<const OPimAlarm&>(noti);
m_al.remove( al );
m_al.append( al );
}
}
-OPimNotifyManager::Reminders OPimNotifyManager::reminders()const {
+
+
+OPimNotifyManager::Reminders OPimNotifyManager::reminders() const
+{
return m_rem;
}
-OPimNotifyManager::Alarms OPimNotifyManager::alarms()const {
+
+
+OPimNotifyManager::Alarms OPimNotifyManager::alarms() const
+{
return m_al;
}
-OPimAlarm OPimNotifyManager::alarmAtDateTime( const QDateTime& when, bool& found ) const {
+
+
+OPimAlarm OPimNotifyManager::alarmAtDateTime( const QDateTime& when, bool& found ) const
+{
Alarms::ConstIterator it;
found = true;
- for ( it = m_al.begin(); it != m_al.end(); ++it ){
+ for ( it = m_al.begin(); it != m_al.end(); ++it )
+ {
if ( (*it).dateTime() == when )
return (*it);
}
@@ -91,12 +125,18 @@ 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!!! */
/**
* The idea is to check if the provider for our service
@@ -105,37 +145,45 @@ void OPimNotifyManager::setReminders( const Reminders& rem) {
* if not the Factory to get the backend...
* Qtopia1.6 services would be kewl to have here....
*/
-void OPimNotifyManager::registerNotify( const OPimNotify& ) {
-
+void OPimNotifyManager::registerNotify( const OPimNotify& )
+{
}
+
+
/* FIXME!!! */
/**
* same as above...
* Also implement Url model
* have a MainWindow....
*/
-void OPimNotifyManager::deregister( const OPimNotify& ) {
-
+void OPimNotifyManager::deregister( const OPimNotify& )
+{
}
-bool OPimNotifyManager::isEmpty()const {
+
+bool OPimNotifyManager::isEmpty() const
+{
qWarning("is Empty called on OPimNotifyManager %d %d", m_rem.count(), m_al.count() );
if ( m_rem.isEmpty() && m_al.isEmpty() ) return true;
else return false;
}
-// 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() ) {
+ if ( !alarms.isEmpty() )
+ {
QStringList als;
OPimNotifyManager::Alarms::Iterator it = alarms.begin();
- for ( ; it != alarms.end(); ++it ) {
+ for ( ; it != alarms.end(); ++it )
+ {
/* only if time is valid */
- if ( (*it).dateTime().isValid() ) {
+ if ( ( *it ).dateTime().isValid() )
+ {
als << OConversion::dateTimeToString( (*it).dateTime() )
+ ":" + QString::number( (*it).duration() )
+ ":" + QString::number( (*it).sound() )
@@ -149,15 +197,19 @@ QString OPimNotifyManager::alarmsToString() const
return str;
}
+
+
QString OPimNotifyManager::remindersToString() const
{
QString str;
OPimNotifyManager::Reminders reminders = m_rem;
- if (!reminders.isEmpty() ) {
+ if ( !reminders.isEmpty() )
+ {
OPimNotifyManager::Reminders::Iterator it = reminders.begin();
QStringList records;
- for ( ; it != reminders.end(); ++it ) {
+ for ( ; it != reminders.end(); ++it )
+ {
records << QString::number( (*it).recordUid() );
}
str = records.join(";");
@@ -166,10 +218,12 @@ QString OPimNotifyManager::remindersToString() const
return str;
}
+
void OPimNotifyManager::alarmsFromString( const QString& str )
{
QStringList als = QStringList::split(";", str );
- for (QStringList::Iterator it = als.begin(); it != als.end(); ++it ) {
+ for ( QStringList::Iterator it = als.begin(); it != als.end(); ++it )
+ {
QStringList alarm = QStringList::split(":", (*it), TRUE ); // allow empty
qWarning("alarm: %s", alarm.join("___").latin1() );
qWarning("alarm[0]: %s %s", alarm[0].latin1(),
@@ -180,11 +234,13 @@ void OPimNotifyManager::alarmsFromString( const QString& str )
}
}
+
void OPimNotifyManager::remindersFromString( const QString& str )
{
QStringList rems = QStringList::split(";", str );
- for (QStringList::Iterator it = rems.begin(); it != rems.end(); ++it ) {
+ for ( QStringList::Iterator it = rems.begin(); it != rems.end(); ++it )
+ {
OPimReminder rem( (*it).toInt() );
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
@@ -26,18 +26,22 @@
Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
-#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
+{
/**
* The notify manager keeps track of the Notifiers....
*/
-class OPimNotifyManager {
+class OPimNotifyManager
+{
public:
typedef QValueList<OPimReminder> Reminders;
typedef QValueList<OPimAlarm> Alarms;
@@ -106,8 +110,6 @@ public:
*/
void remindersFromString( const QString& str );
-
-
private:
Reminders m_rem;
Alarms m_al;
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
@@ -26,32 +26,43 @@
Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
-#include <qarray.h>
+#include "opimrecord.h"
+
+/* OPIE */
#include <qpe/categories.h>
#include <qpe/categoryselect.h>
-#include <opie2/opimrecord.h>
+/* QT */
+#include <qarray.h>
-namespace Opie {
+namespace Opie
+{
Qtopia::UidGen OPimRecord::m_uidGen( Qtopia::UidGen::Qtopia );
OPimRecord::OPimRecord( int uid )
- : Qtopia::Record() {
+ : Qtopia::Record()
+{
m_lastHit = -1;
setUid( uid );
}
-OPimRecord::~OPimRecord() {
-}
+
+
+OPimRecord::~OPimRecord()
+{}
+
+
OPimRecord::OPimRecord( const OPimRecord& rec )
: Qtopia::Record( rec )
{
(*this) = rec;
}
-OPimRecord &OPimRecord::operator=( const OPimRecord& rec) {
+
+OPimRecord &OPimRecord::operator=( const OPimRecord& rec )
+{
if ( this == &rec ) return *this;
Qtopia::Record::operator=( rec );
@@ -60,33 +71,47 @@ OPimRecord &OPimRecord::operator=( const OPimRecord& rec) {
return *this;
}
+
+
/*
* category names
*/
-QStringList OPimRecord::categoryNames( const QString& appname ) const {
+QStringList OPimRecord::categoryNames( const QString& appname ) const
+{
QStringList list;
QArray<int> cats = categories();
Categories catDB;
catDB.load( categoryFileName() );
- for (uint i = 0; i < cats.count(); i++ ) {
+ for ( uint i = 0; i < cats.count(); i++ )
+ {
list << catDB.label( appname, cats[i] );
}
return list;
}
-void OPimRecord::setCategoryNames( const QStringList& ) {
+
+void OPimRecord::setCategoryNames( const QStringList& )
+{
}
-void OPimRecord::addCategoryName( const QString& ) {
+
+
+void OPimRecord::addCategoryName( const QString& )
+{
Categories catDB;
catDB.load( categoryFileName() );
}
-bool OPimRecord::isEmpty()const {
+
+
+bool OPimRecord::isEmpty() const
+{
return ( uid() == 0 );
}
+
+
/*QString OPimRecord::crossToString()const {
QString str;
QMap<QString, QArray<int> >::ConstIterator it;
@@ -102,19 +127,29 @@ bool OPimRecord::isEmpty()const {
return str;
}*/
/* if uid = 1 assign a new one */
-void OPimRecord::setUid( int uid ) {
+void OPimRecord::setUid( int uid )
+{
if ( uid == 1)
uid = uidGen().generate();
Qtopia::Record::setUid( 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;
}
@@ -126,7 +161,8 @@ int OPimRecord::rtti(){
* Categories
* XRef
*/
-bool OPimRecord::loadFromStream( QDataStream& stream ) {
+bool OPimRecord::loadFromStream( QDataStream& stream )
+{
int Int;
uint UInt;
stream >> Int;
@@ -135,7 +171,8 @@ bool OPimRecord::loadFromStream( QDataStream& stream ) {
/** Categories */
stream >> UInt;
QArray<int> array(UInt);
- for (uint i = 0; i < UInt; i++ ) {
+ for ( uint i = 0; i < UInt; i++ )
+ {
stream >> array[i];
}
setCategories( array );
@@ -145,7 +182,8 @@ bool OPimRecord::loadFromStream( QDataStream& stream ) {
*/
OPimXRef xref;
stream >> UInt;
- for ( uint i = 0; i < UInt; i++ ) {
+ for ( uint i = 0; i < UInt; i++ )
+ {
xref.setPartner( OPimXRef::One, partner( stream ) );
xref.setPartner( OPimXRef::Two, partner( stream ) );
m_xrefman.add( xref );
@@ -153,14 +191,18 @@ bool OPimRecord::loadFromStream( QDataStream& stream ) {
return true;
}
-bool OPimRecord::saveToStream( QDataStream& stream )const {
+
+
+bool OPimRecord::saveToStream( QDataStream& stream ) const
+{
/** UIDs */
stream << uid();
/** Categories */
stream << categories().count();
- for ( uint i = 0; i < categories().count(); i++ ) {
+ for ( uint i = 0; i < categories().count(); i++ )
+ {
stream << categories()[i];
}
@@ -170,18 +212,25 @@ bool OPimRecord::saveToStream( QDataStream& stream )const {
*/
stream << m_xrefman.list().count();
for ( OPimXRef::ValueList::ConstIterator it = m_xrefman.list().begin();
- it != m_xrefman.list().end(); ++it ) {
+ it != m_xrefman.list().end(); ++it )
+ {
flush( (*it).partner( OPimXRef::One), stream );
flush( (*it).partner( OPimXRef::Two), stream );
}
return true;
}
-void OPimRecord::flush( const OPimXRefPartner& par, QDataStream& str ) const{
+
+
+void OPimRecord::flush( const OPimXRefPartner& par, QDataStream& str ) const
+{
str << par.service();
str << par.uid();
str << par.field();
}
-OPimXRefPartner OPimRecord::partner( QDataStream& stream ) {
+
+
+OPimXRefPartner OPimRecord::partner( QDataStream& stream )
+{
OPimXRefPartner par;
QString str;
int i;
@@ -197,16 +246,28 @@ OPimXRefPartner OPimRecord::partner( QDataStream& stream ) {
return par;
}
-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
@@ -26,14 +26,12 @@
Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
-#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>
/*
* we need to get customMap which is private...
*/
@@ -41,15 +39,21 @@
#include <qpe/palmtoprecord.h>
#undef private
-#include <opie2/opimxrefmanager.h>
+/* QT */
+#include <qdatastream.h>
+#include <qmap.h>
+#include <qstring.h>
+#include <qstringlist.h>
-namespace Opie {
+namespace Opie
+{
/**
* This is the base class for
* all PIM Records
*
*/
-class OPimRecord : public Qtopia::Record {
+class OPimRecord : public Qtopia::Record
+{
public:
/**
* c'tor
@@ -110,8 +114,10 @@ public:
* matches the Records the regular expression?
*/
virtual bool match( const QString &regexp ) const
- {setLastHitField( -1 );
- return Qtopia::Record::match(QRegExp(regexp));};
+ {
+ setLastHitField( -1 );
+ return Qtopia::Record::match( QRegExp( regexp ) );
+ };
/**
* if implemented this function returns which item has been