summaryrefslogtreecommitdiff
path: root/libopie/pim
Side-by-side diff
Diffstat (limited to 'libopie/pim') (more/less context) (show whitespace changes)
-rw-r--r--libopie/pim/ocontact.cpp8
-rw-r--r--libopie/pim/oevent.cpp3
-rw-r--r--libopie/pim/oevent.h1
-rw-r--r--libopie/pim/opimrecord.cpp6
-rw-r--r--libopie/pim/opimrecord.h8
-rw-r--r--libopie/pim/otodo.cpp3
-rw-r--r--libopie/pim/otodo.h1
-rw-r--r--libopie/pim/otodoaccessxml.cpp23
8 files changed, 37 insertions, 16 deletions
diff --git a/libopie/pim/ocontact.cpp b/libopie/pim/ocontact.cpp
index a2fb68c..be4ce0a 100644
--- a/libopie/pim/ocontact.cpp
+++ b/libopie/pim/ocontact.cpp
@@ -979,19 +979,13 @@ QString OContact::toShortText() const
}
QString OContact::type() const
{
return QString::fromLatin1( "OContact" );
}
-// Definition is missing ! (se)
-QMap<QString,QString> OContact::toExtraMap() const
-{
- qWarning ("Function not implemented: OContact::toExtraMap()");
- QMap <QString,QString> useless;
- return useless;
-}
+
class QString OContact::recordField( int pos ) const
{
QStringList SLFIELDS = fields(); // ?? why this ? (se)
return SLFIELDS[pos];
}
diff --git a/libopie/pim/oevent.cpp b/libopie/pim/oevent.cpp
index e4f5d92..7bcf944 100644
--- a/libopie/pim/oevent.cpp
+++ b/libopie/pim/oevent.cpp
@@ -357,15 +357,12 @@ void OEvent::deref() {
}
}
// FIXME
QMap<int, QString> OEvent::toMap()const {
return QMap<int, QString>();
}
-QMap<QString, QString> OEvent::toExtraMap()const {
- return QMap<QString, QString>();
-}
int OEvent::parent()const {
return data->parent;
}
void OEvent::setParent( int uid ) {
changeOrModify();
data->parent = uid;
diff --git a/libopie/pim/oevent.h b/libopie/pim/oevent.h
index b696d81..30f442e 100644
--- a/libopie/pim/oevent.h
+++ b/libopie/pim/oevent.h
@@ -129,13 +129,12 @@ public:
/* needed reimp */
QString toRichText()const;
QString toShortText()const;
QString type()const;
QMap<int, QString> toMap()const;
- QMap<QString, QString> toExtraMap()const;
QString recordField(int )const;
static int rtti();
bool loadFromStream( QDataStream& );
bool saveToStream( QDataStream& )const;
diff --git a/libopie/pim/opimrecord.cpp b/libopie/pim/opimrecord.cpp
index 0c9734d..2365748 100644
--- a/libopie/pim/opimrecord.cpp
+++ b/libopie/pim/opimrecord.cpp
@@ -171,6 +171,12 @@ OPimXRefPartner OPimRecord::partner( QDataStream& stream ) {
void OPimRecord::setLastHitField( int lastHit )const {
m_lastHit = lastHit;
}
int OPimRecord::lastHitField()const{
return m_lastHit;
}
+QMap<QString, QString> OPimRecord::toExtraMap()const {
+ return customMap;
+}
+void OPimRecord::setExtraMap( const QMap<QString, QString>& map) {
+ customMap = map;
+}
diff --git a/libopie/pim/opimrecord.h b/libopie/pim/opimrecord.h
index 494c78e..563b19c 100644
--- a/libopie/pim/opimrecord.h
+++ b/libopie/pim/opimrecord.h
@@ -3,13 +3,18 @@
#include <qdatastream.h>
#include <qmap.h>
#include <qstring.h>
#include <qstringlist.h>
+/*
+ * we need to get customMap which is private...
+ */
+#define private protected
#include <qpe/palmtoprecord.h>
+#undef private
#include <opie/opimxrefmanager.h>
/**
* This is the base class for
* all PIM Records
@@ -91,13 +96,14 @@ public:
*/
virtual QMap<int, QString> toMap()const = 0;
/**
* key value representation of extra items
*/
- virtual QMap<QString, QString> toExtraMap()const = 0;
+ QMap<QString, QString> toExtraMap()const;
+ void setExtraMap( const QMap<QString, QString>& );
/**
* the name for a recordField
*/
virtual QString recordField(int)const = 0;
diff --git a/libopie/pim/otodo.cpp b/libopie/pim/otodo.cpp
index c84eeeb..38b93f7 100644
--- a/libopie/pim/otodo.cpp
+++ b/libopie/pim/otodo.cpp
@@ -457,15 +457,12 @@ QMap<int, QString> OTodo::toMap() const {
map.insert( Reminders, );
map.
*/
return map;
}
-QMap<QString, QString> OTodo::toExtraMap()const {
- return data->extra;
-}
/**
* change or modify looks at the ref count and either
* creates a new QShared Object or it can modify it
* right in place
*/
void OTodo::changeOrModify() {
diff --git a/libopie/pim/otodo.h b/libopie/pim/otodo.h
index 4d5ee36..f9a345a 100644
--- a/libopie/pim/otodo.h
+++ b/libopie/pim/otodo.h
@@ -190,13 +190,12 @@ public:
/**
* reimplementations
*/
QString type()const;
QString toShortText()const;
- QMap<QString, QString> toExtraMap()const;
QString recordField(int id )const;
/**
* toMap puts all data into the map. int relates
* to ToDoEvent RecordFields enum
*/
diff --git a/libopie/pim/otodoaccessxml.cpp b/libopie/pim/otodoaccessxml.cpp
index 2b62f0d..3d15354 100644
--- a/libopie/pim/otodoaccessxml.cpp
+++ b/libopie/pim/otodoaccessxml.cpp
@@ -494,15 +494,37 @@ void OTodoAccessXML::todo( QAsciiDict<int>* dict, OTodo& ev,
break;
case FREndDate: {
rp_end = (time_t) val.toLong();
break;
}
default:
+ ev.setCustomField( attr, val );
break;
}
}
+
+// from PalmtopRecord... GPL ### FIXME
+namespace {
+QString customToXml(const QMap<QString, QString>& customMap )
+{
+ //qWarning(QString("writing custom %1").arg(customMap.count()));
+ QString buf(" ");
+ for ( QMap<QString, QString>::ConstIterator cit = customMap.begin();
+ cit != customMap.end(); ++cit) {
+// qWarning(".ITEM.");
+ buf += cit.key();
+ buf += "=\"";
+ buf += Qtopia::escapeString(cit.data());
+ buf += "\" ";
+ }
+ return buf;
+}
+
+
+}
+
QString OTodoAccessXML::toString( const OTodo& ev )const {
QString str;
str += "Completed=\"" + QString::number( ev.isCompleted() ) + "\" ";
str += "HasDate=\"" + QString::number( ev.hasDueDate() ) + "\" ";
str += "Priority=\"" + QString::number( ev.priority() ) + "\" ";
@@ -578,12 +600,13 @@ QString OTodoAccessXML::toString( const OTodo& ev )const {
for ( ; it != reminders.end(); ++it ) {
records << QString::number( (*it).recordUid() );
}
str += "Reminders=\""+ records.join(";") +"\" ";
}
}
+ str += customToXml( ev.toExtraMap() );
return str;
}
QString OTodoAccessXML::toString( const QArray<int>& ints ) const {
return Qtopia::Record::idsToString( ints );