-rw-r--r-- | libopie/pim/ocontact.cpp | 10 | ||||
-rw-r--r-- | libopie/pim/oevent.cpp | 11 | ||||
-rw-r--r-- | libopie/pim/oevent.h | 1 | ||||
-rw-r--r-- | libopie/pim/opimrecord.cpp | 6 | ||||
-rw-r--r-- | libopie/pim/opimrecord.h | 8 | ||||
-rw-r--r-- | libopie/pim/otodo.cpp | 13 | ||||
-rw-r--r-- | libopie/pim/otodo.h | 1 | ||||
-rw-r--r-- | libopie/pim/otodoaccessxml.cpp | 23 | ||||
-rw-r--r-- | libopie2/opiepim/backend/otodoaccessxml.cpp | 23 | ||||
-rw-r--r-- | libopie2/opiepim/core/opimrecord.cpp | 6 | ||||
-rw-r--r-- | libopie2/opiepim/core/opimrecord.h | 8 | ||||
-rw-r--r-- | libopie2/opiepim/ocontact.cpp | 10 | ||||
-rw-r--r-- | libopie2/opiepim/oevent.cpp | 11 | ||||
-rw-r--r-- | libopie2/opiepim/oevent.h | 1 | ||||
-rw-r--r-- | libopie2/opiepim/otodo.cpp | 13 | ||||
-rw-r--r-- | libopie2/opiepim/otodo.h | 1 |
16 files changed, 94 insertions, 52 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 @@ -441,7 +441,7 @@ 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) + "<br>"; @@ -982,13 +982,7 @@ 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 { 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 @@ -236,14 +236,14 @@ bool OEvent::match( const QRegExp& re )const { } QString OEvent::toRichText()const { QString text, value; - + // description text += "<b><h3><img src=\"datebook/DateBook\">"; if ( !description().isEmpty() ) { text += Qtopia::escapeString(description() ).replace(QRegExp( "[\n]"), "" ); } text += "</h3></b><br><hr><br>"; - + // location if ( !(value = location()).isEmpty() ) { text += "<b>" + QObject::tr( "Location:" ) + "</b> "; @@ -274,14 +274,14 @@ QString OEvent::toRichText()const { replace(QRegExp( "[\n]"), "<br>" ) + "<br>"; } } - + // categories if ( categoryNames("Calendar").count() ){ text += "<b>" + QObject::tr( "Category:") + "</b> "; text += categoryNames("Calendar").join(", "); text += "<br>"; } - + //notes if ( !note().isEmpty() ) { text += "<b>" + QObject::tr( "Note:") + "</b><br>"; @@ -360,9 +360,6 @@ void OEvent::deref() { 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; } 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 @@ -132,7 +132,6 @@ public: QString type()const; QMap<int, QString> toMap()const; - QMap<QString, QString> toExtraMap()const; QString recordField(int )const; static int rtti(); 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 @@ -174,3 +174,9 @@ void OPimRecord::setLastHitField( int lastHit )const { 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 @@ -6,7 +6,12 @@ #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> @@ -94,7 +99,8 @@ public: /** * 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 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 @@ -279,7 +279,7 @@ QString OTodo::toRichText() const text += Qtopia::escapeString(summary() ).replace(QRegExp( "[\n]"), "" ); } text += "</h3></b><br><hr><br>"; - + // description if( !description().isEmpty() ){ text += "<b>" + QObject::tr( "Description:" ) + "</b><br>"; @@ -306,16 +306,16 @@ 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"; @@ -326,7 +326,7 @@ QString OTodo::toRichText() const text += "\">" + dd.toString() + "</font><br>"; } - + // categories text += "<b>" + QObject::tr( "Category:") + "</b> "; text += categoryNames( "Todo List" ).join(", "); @@ -460,9 +460,6 @@ QMap<int, QString> OTodo::toMap() const { 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 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 @@ -193,7 +193,6 @@ public: */ QString type()const; QString toShortText()const; - QMap<QString, QString> toExtraMap()const; QString recordField(int id )const; /** 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 @@ -497,9 +497,31 @@ void OTodoAccessXML::todo( QAsciiDict<int>* dict, OTodo& ev, 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; @@ -581,6 +603,7 @@ QString OTodoAccessXML::toString( const OTodo& ev )const { str += "Reminders=\""+ records.join(";") +"\" "; } } + str += customToXml( ev.toExtraMap() ); return str; diff --git a/libopie2/opiepim/backend/otodoaccessxml.cpp b/libopie2/opiepim/backend/otodoaccessxml.cpp index 2b62f0d..3d15354 100644 --- a/libopie2/opiepim/backend/otodoaccessxml.cpp +++ b/libopie2/opiepim/backend/otodoaccessxml.cpp @@ -497,9 +497,31 @@ void OTodoAccessXML::todo( QAsciiDict<int>* dict, OTodo& ev, 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; @@ -581,6 +603,7 @@ QString OTodoAccessXML::toString( const OTodo& ev )const { str += "Reminders=\""+ records.join(";") +"\" "; } } + str += customToXml( ev.toExtraMap() ); return str; diff --git a/libopie2/opiepim/core/opimrecord.cpp b/libopie2/opiepim/core/opimrecord.cpp index 0c9734d..2365748 100644 --- a/libopie2/opiepim/core/opimrecord.cpp +++ b/libopie2/opiepim/core/opimrecord.cpp @@ -174,3 +174,9 @@ void OPimRecord::setLastHitField( int lastHit )const { 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/libopie2/opiepim/core/opimrecord.h b/libopie2/opiepim/core/opimrecord.h index 494c78e..563b19c 100644 --- a/libopie2/opiepim/core/opimrecord.h +++ b/libopie2/opiepim/core/opimrecord.h @@ -6,7 +6,12 @@ #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> @@ -94,7 +99,8 @@ public: /** * 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 diff --git a/libopie2/opiepim/ocontact.cpp b/libopie2/opiepim/ocontact.cpp index a2fb68c..be4ce0a 100644 --- a/libopie2/opiepim/ocontact.cpp +++ b/libopie2/opiepim/ocontact.cpp @@ -441,7 +441,7 @@ 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) + "<br>"; @@ -982,13 +982,7 @@ 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 { diff --git a/libopie2/opiepim/oevent.cpp b/libopie2/opiepim/oevent.cpp index e4f5d92..7bcf944 100644 --- a/libopie2/opiepim/oevent.cpp +++ b/libopie2/opiepim/oevent.cpp @@ -236,14 +236,14 @@ bool OEvent::match( const QRegExp& re )const { } QString OEvent::toRichText()const { QString text, value; - + // description text += "<b><h3><img src=\"datebook/DateBook\">"; if ( !description().isEmpty() ) { text += Qtopia::escapeString(description() ).replace(QRegExp( "[\n]"), "" ); } text += "</h3></b><br><hr><br>"; - + // location if ( !(value = location()).isEmpty() ) { text += "<b>" + QObject::tr( "Location:" ) + "</b> "; @@ -274,14 +274,14 @@ QString OEvent::toRichText()const { replace(QRegExp( "[\n]"), "<br>" ) + "<br>"; } } - + // categories if ( categoryNames("Calendar").count() ){ text += "<b>" + QObject::tr( "Category:") + "</b> "; text += categoryNames("Calendar").join(", "); text += "<br>"; } - + //notes if ( !note().isEmpty() ) { text += "<b>" + QObject::tr( "Note:") + "</b><br>"; @@ -360,9 +360,6 @@ void OEvent::deref() { 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; } diff --git a/libopie2/opiepim/oevent.h b/libopie2/opiepim/oevent.h index b696d81..30f442e 100644 --- a/libopie2/opiepim/oevent.h +++ b/libopie2/opiepim/oevent.h @@ -132,7 +132,6 @@ public: QString type()const; QMap<int, QString> toMap()const; - QMap<QString, QString> toExtraMap()const; QString recordField(int )const; static int rtti(); diff --git a/libopie2/opiepim/otodo.cpp b/libopie2/opiepim/otodo.cpp index c84eeeb..38b93f7 100644 --- a/libopie2/opiepim/otodo.cpp +++ b/libopie2/opiepim/otodo.cpp @@ -279,7 +279,7 @@ QString OTodo::toRichText() const text += Qtopia::escapeString(summary() ).replace(QRegExp( "[\n]"), "" ); } text += "</h3></b><br><hr><br>"; - + // description if( !description().isEmpty() ){ text += "<b>" + QObject::tr( "Description:" ) + "</b><br>"; @@ -306,16 +306,16 @@ 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"; @@ -326,7 +326,7 @@ QString OTodo::toRichText() const text += "\">" + dd.toString() + "</font><br>"; } - + // categories text += "<b>" + QObject::tr( "Category:") + "</b> "; text += categoryNames( "Todo List" ).join(", "); @@ -460,9 +460,6 @@ QMap<int, QString> OTodo::toMap() const { 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 diff --git a/libopie2/opiepim/otodo.h b/libopie2/opiepim/otodo.h index 4d5ee36..f9a345a 100644 --- a/libopie2/opiepim/otodo.h +++ b/libopie2/opiepim/otodo.h @@ -193,7 +193,6 @@ public: */ QString type()const; QString toShortText()const; - QMap<QString, QString> toExtraMap()const; QString recordField(int id )const; /** |