summaryrefslogtreecommitdiff
path: root/libopie
Side-by-side diff
Diffstat (limited to 'libopie') (more/less context) (ignore whitespace changes)
-rw-r--r--libopie/pim/obackendfactory.h12
-rw-r--r--libopie/pim/ocontact.cpp253
-rw-r--r--libopie/pim/ocontact.h9
-rw-r--r--libopie/pim/ocontactaccess.h11
-rw-r--r--libopie/pim/ocontactaccessbackend.h14
-rw-r--r--libopie/pim/ocontactaccessbackend_vcard.cpp22
-rw-r--r--libopie/pim/ocontactaccessbackend_xml.cpp3
-rw-r--r--libopie/pim/oconversion.h5
-rw-r--r--libopie/pim/odatebookaccessbackend.h4
-rw-r--r--libopie/pim/odatebookaccessbackend_xml.cpp6
-rw-r--r--libopie/pim/opimaccessbackend.h4
-rw-r--r--libopie/pim/opimaccesstemplate.h4
-rw-r--r--libopie/pim/opimcache.h6
-rw-r--r--libopie/pim/opimmainwindow.cpp14
-rw-r--r--libopie/pim/opimxrefmanager.h2
-rw-r--r--libopie/pim/orecordlist.h12
-rw-r--r--libopie/pim/otemplatebase.h7
-rw-r--r--libopie/pim/otodo.cpp16
-rw-r--r--libopie/pim/otodo.h9
-rw-r--r--libopie/pim/otodoaccessbackend.h4
-rw-r--r--libopie/pim/otodoaccessvcal.cpp26
-rw-r--r--libopie/pim/otodoaccessxml.cpp6
22 files changed, 327 insertions, 122 deletions
diff --git a/libopie/pim/obackendfactory.h b/libopie/pim/obackendfactory.h
index ad6cf5a..f3c339d 100644
--- a/libopie/pim/obackendfactory.h
+++ b/libopie/pim/obackendfactory.h
@@ -7,24 +7,32 @@
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation;
* either version 2 of the License, or (at your option) any later
* version.
* =====================================================================
* ToDo: Use plugins
* =====================================================================
* Version: $Id$
* =====================================================================
* History:
* $Log$
+ * Revision 1.7 2003/08/01 12:30:16 eilers
+ * Merging changes from BRANCH_1_0 to HEAD
+ *
+ * Revision 1.6.4.1 2003/06/30 14:34:19 eilers
+ * Patches from Zecke:
+ * Fixing and cleaning up extraMap handling
+ * Adding d_ptr for binary compatibility in the future
+ *
* Revision 1.6 2003/04/13 18:07:10 zecke
* More API doc
* QString -> const QString&
* QString = 0l -> QString::null
*
* Revision 1.5 2003/02/21 23:31:52 zecke
* Add XML datebookresource
* -clean up todoaccessxml header
* -implement some more stuff in the oeven tester
* -extend DefaultFactory to not crash and to use datebook
*
* -reading of OEvents is working nicely.. saving will be added
@@ -59,24 +67,26 @@
#include <qstring.h>
#include <qasciidict.h>
#include <qpe/config.h>
#include "otodoaccessxml.h"
#include "ocontactaccessbackend_xml.h"
#include "odatebookaccessbackend_xml.h"
#ifdef __USE_SQL
#include "otodoaccesssql.h"
#endif
+class OBackendPrivate;
+
/**
* This class is our factory. It will give us the default implementations
* of at least Todolist, Contacts and Datebook. In the future this class will
* allow users to switch the backend with ( XML->SQLite ) without the need
* to recompile.#
* This class as the whole PIM Api is making use of templates
*
* <pre>
* OTodoAccessBackend* backend = OBackEndFactory<OTodoAccessBackend>::Default("todo", QString::null );
* backend->load();
* </pre>
*
@@ -139,16 +149,18 @@ class OBackendFactory
return (T*) new OContactAccessBackend_XML( appName );
case DATE:
if ( backend == "sql" )
qWarning("OBackendFactory:: sql Backend not implemented! Using XML instead!");
return (T*) new ODateBookAccessBackend_XML( appName );
default:
return NULL;
}
}
+ private:
+ OBackendPrivate* d;
};
#endif
diff --git a/libopie/pim/ocontact.cpp b/libopie/pim/ocontact.cpp
index be4ce0a..3473baa 100644
--- a/libopie/pim/ocontact.cpp
+++ b/libopie/pim/ocontact.cpp
@@ -12,28 +12,29 @@
**
** 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 "ocontact.h"
#include "opimresolver.h"
+#include "oconversion.h"
#include <qpe/stringutil.h>
-#include "oconversion.h"
#include <qpe/timestring.h>
+#include <qpe/config.h>
#include <qobject.h>
#include <qregexp.h>
#include <qstylesheet.h>
#include <qfileinfo.h>
#include <qmap.h>
#include <stdio.h>
/*!
\class Contact contact.h
\brief The Contact class holds the data of an address book entry.
@@ -429,220 +430,292 @@ QMap<int, QString> OContact::toMap() const
}
/*!
Returns a rich text formatted QString representing the contents the contact.
*/
QString OContact::toRichText() const
{
QString text;
QString value, comp, state;
QString str;
bool marker = false;
+ Config cfg("qpe");
+ cfg.setGroup("Appearance");
+ int addressformat = cfg.readNumEntry( "AddressFormat", Zip_City_State );
+
// name, jobtitle and company
if ( !(value = fullName()).isEmpty() )
- text += "<b><h3><img src=\"addressbook/AddressBook\">" + Qtopia::escapeString(value) + "</h3></b>";
-
+ text += "<b><h3><img src=\"addressbook/AddressBook\"> " + Qtopia::escapeString(value) + "</h3></b>";
+
if ( !(value = jobTitle()).isEmpty() )
- text += Qtopia::escapeString(value) + "<br>";
+ text += Qtopia::escapeString(value);
comp = company();
if ( !(value = department()).isEmpty() ) {
text += Qtopia::escapeString(value);
if ( comp )
text += ", ";
else
text += "<br>";
}
if ( !comp.isEmpty() )
- text += Qtopia::escapeString(comp) + "<br>";
+ text += Qtopia::escapeString(comp);
- text += "<hr><br>";
+ text += "<br><hr>";
// defailt email
QString defEmail = defaultEmail();
- if ( !defEmail.isEmpty() )
- text += "<b><img src=\"addressbook/email\">" + QObject::tr("Default Email: ") + "</b>"
- + Qtopia::escapeString(defEmail) + "<br>";
-
- text += "<br>";
+ if ( !defEmail.isEmpty() ){
+ text += "<b><img src=\"addressbook/email\"> " + QObject::tr("Default Email: ") + "</b>"
+ + Qtopia::escapeString(defEmail);
+ marker = true;
+ }
// business address
if ( !businessStreet().isEmpty() || !businessCity().isEmpty() ||
!businessZip().isEmpty() || !businessCountry().isEmpty() ) {
- text += QObject::tr( "<b>Work Address:</b>" );
- text += "<br>";
+ text += QObject::tr( "<br><br><b>Work Address:</b>" );
marker = true;
}
- if ( !(value = businessStreet()).isEmpty() )
- text += Qtopia::escapeString(value) + "<br>";
- state = businessState();
- if ( !(value = businessZip()).isEmpty() )
- text += Qtopia::escapeString(value) + " ";
- if ( !(value = businessCity()).isEmpty() ) {
- text += Qtopia::escapeString(value);
- if ( state )
- text += ", " + Qtopia::escapeString(state);
- text += "<br>";
- } else if ( !state.isEmpty() )
- text += Qtopia::escapeString(state) + "<br>";
+ 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;
+
+ } else
+ text += "<br>";
+
+ if ( !(value = businessCity()).isEmpty() ) {
+ marker = true;
+ 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 += Qtopia::escapeString(value) + "<br>";
+ if ( !(value = businessCountry()).isEmpty() ){
+ text += "<br>" + Qtopia::escapeString(value);
+ marker = true;
+ }
// rest of Business data
str = office();
if ( !str.isEmpty() ){
- text += "<b>" + QObject::tr("Office: ") + "</b>"
- + Qtopia::escapeString(str) + "<br>";
+ text += "<br><b>" + QObject::tr("Office: ") + "</b>"
+ + Qtopia::escapeString(str);
marker = true;
}
str = businessWebpage();
if ( !str.isEmpty() ){
- text += "<b><img src=\"addressbook/webpagework\">" + QObject::tr("Business Web Page: ") + "</b>"
- + Qtopia::escapeString(str) + "<br>";
+ text += "<br><b><img src=\"addressbook/webpagework\"> " + QObject::tr("Business Web Page: ") + "</b>"
+ + Qtopia::escapeString(str);
marker = true;
}
str = businessPhone();
if ( !str.isEmpty() ){
- text += "<b><img src=\"addressbook/phonework\">" + QObject::tr("Business Phone: ") + "</b>"
- + Qtopia::escapeString(str) + "<br>";
+ text += "<br><b><img src=\"addressbook/phonework\"> " + QObject::tr("Business Phone: ") + "</b>"
+ + Qtopia::escapeString(str);
marker = true;
}
str = businessFax();
if ( !str.isEmpty() ){
- text += "<b><img src=\"addressbook/faxwork\">" + QObject::tr("Business Fax: ") + "</b>"
- + Qtopia::escapeString(str) + "<br>";
+ text += "<br><b><img src=\"addressbook/faxwork\"> " + QObject::tr("Business Fax: ") + "</b>"
+ + Qtopia::escapeString(str);
marker = true;
}
str = businessMobile();
if ( !str.isEmpty() ){
- text += "<b><img src=\"addressbook/mobilework\">" + QObject::tr("Business Mobile: ") + "</b>"
- + Qtopia::escapeString(str) + "<br>";
+ text += "<br><b><img src=\"addressbook/mobilework\"> " + QObject::tr("Business Mobile: ") + "</b>"
+ + Qtopia::escapeString(str);
marker = true;
}
str = businessPager();
if ( !str.isEmpty() ){
- text += "<b>" + QObject::tr("Business Pager: ") + "</b>"
- + Qtopia::escapeString(str) + "<br>";
+ text += "<br><b>" + QObject::tr("Business Pager: ") + "</b>"
+ + Qtopia::escapeString(str);
marker = true;
}
text += "<br>";
// home address
if ( !homeStreet().isEmpty() || !homeCity().isEmpty() ||
!homeZip().isEmpty() || !homeCountry().isEmpty() ) {
- text += QObject::tr( "<b>Home Address:</b>" );
- text += "<br>";
+ text += QObject::tr( "<br><br><b>Home Address:</b>" );
+ marker = true;
}
- if ( !(value = homeStreet()).isEmpty() )
- text += Qtopia::escapeString(value) + "<br>";
- state = homeState();
- if ( !(value = homeZip()).isEmpty() )
- text += Qtopia::escapeString(value) + " ";
- if ( !(value = homeCity()).isEmpty() ) {
- text += Qtopia::escapeString(value);
- if ( !state.isEmpty() )
- text += ", " + Qtopia::escapeString(state);
- text += "<br>";
- } else if (!state.isEmpty())
- text += Qtopia::escapeString(state) + "<br>";
- if ( !(value = homeCountry()).isEmpty() )
- text += Qtopia::escapeString(value) + "<br>";
+ 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;
+ } else
+ text += "<br>";
+
+ if ( !(value = homeCity()).isEmpty() ) {
+ marker = true;
+ 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;
+ }
// rest of Home data
str = homeWebpage();
if ( !str.isEmpty() ){
- text += "<b><img src=\"addressbook/webpagehome\">" + QObject::tr("Home Web Page: ") + "</b>"
- + Qtopia::escapeString(str) + "<br>";
+ text += "<br><b><img src=\"addressbook/webpagehome\"> " + QObject::tr("Home Web Page: ") + "</b>"
+ + Qtopia::escapeString(str);
marker = true;
}
str = homePhone();
if ( !str.isEmpty() ){
- text += "<b><img src=\"addressbook/phonehome\">" + QObject::tr("Home Phone: ") + "</b>"
- + Qtopia::escapeString(str) + "<br>";
+ text += "<br><b><img src=\"addressbook/phonehome\"> " + QObject::tr("Home Phone: ") + "</b>"
+ + Qtopia::escapeString(str);
marker = true;
}
str = homeFax();
if ( !str.isEmpty() ){
- text += "<b><img src=\"addressbook/faxhome\">" + QObject::tr("Home Fax: ") + "</b>"
- + Qtopia::escapeString(str) + "<br>";
+ text += "<br><b><img src=\"addressbook/faxhome\"> " + QObject::tr("Home Fax: ") + "</b>"
+ + Qtopia::escapeString(str);
marker = true;
}
str = homeMobile();
if ( !str.isEmpty() ){
- text += "<b><img src=\"addressbook/mobilehome\">" + QObject::tr("Home Mobile: ") + "</b>"
- + Qtopia::escapeString(str) + "<br>";
+ text += "<br><b><img src=\"addressbook/mobilehome\"> " + QObject::tr("Home Mobile: ") + "</b>"
+ + Qtopia::escapeString(str);
marker = true;
}
if ( marker )
- text += "<br><hr><br>";
- // the others...
+ text += "<br><hr>";
+
+ // the rest...
str = emails();
if ( !str.isEmpty() && ( str != defEmail ) )
- text += "<b>" + QObject::tr("All Emails: ") + "</b>"
- + Qtopia::escapeString(str) + "<br>";
+ text += "<br><b>" + QObject::tr("All Emails: ") + "</b>"
+ + Qtopia::escapeString(str);
str = profession();
if ( !str.isEmpty() )
- text += "<b>" + QObject::tr("Profession: ") + "</b>"
- + Qtopia::escapeString(str) + "<br>";
+ text += "<br><b>" + QObject::tr("Profession: ") + "</b>"
+ + Qtopia::escapeString(str);
str = assistant();
if ( !str.isEmpty() )
- text += "<b>" + QObject::tr("Assistant: ") + "</b>"
- + Qtopia::escapeString(str) + "<br>";
+ text += "<br><b>" + QObject::tr("Assistant: ") + "</b>"
+ + Qtopia::escapeString(str);
str = manager();
if ( !str.isEmpty() )
- text += "<b>" + QObject::tr("Manager: ") + "</b>"
- + Qtopia::escapeString(str) + "<br>";
+ text += "<br><b>" + QObject::tr("Manager: ") + "</b>"
+ + Qtopia::escapeString(str);
str = gender();
if ( !str.isEmpty() && str.toInt() != 0 ) {
- if ( str.toInt() == 1 )
- str = QObject::tr( "Male" );
- else if ( str.toInt() == 2 )
- str = QObject::tr( "Female" );
- text += "<b>" + QObject::tr("Gender: ") + "</b>" + str + "<br>";
+ 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;
}
str = spouse();
if ( !str.isEmpty() )
- text += "<b>" + QObject::tr("Spouse: ") + "</b>"
- + Qtopia::escapeString(str) + "<br>";
+ text += "<br><b>" + QObject::tr("Spouse: ") + "</b>"
+ + Qtopia::escapeString(str);
if ( birthday().isValid() ){
str = TimeString::numberDateString( birthday() );
- text += "<b>" + QObject::tr("Birthday: ") + "</b>"
- + Qtopia::escapeString(str) + "<br>";
+ text += "<br><b>" + QObject::tr("Birthday: ") + "</b>"
+ + Qtopia::escapeString(str);
}
if ( anniversary().isValid() ){
str = TimeString::numberDateString( anniversary() );
- text += "<b>" + QObject::tr("Anniversary: ") + "</b>"
- + Qtopia::escapeString(str) + "<br>";
+ text += "<br><b>" + QObject::tr("Anniversary: ") + "</b>"
+ + Qtopia::escapeString(str);
}
str = children();
if ( !str.isEmpty() )
- text += "<b>" + QObject::tr("Children: ") + "</b>"
- + Qtopia::escapeString(str) + "<br>";
+ text += "<br><b>" + QObject::tr("Children: ") + "</b>"
+ + Qtopia::escapeString(str);
str = nickname();
if ( !str.isEmpty() )
- text += "<b>" + QObject::tr("Nickname: ") + "</b>"
- + Qtopia::escapeString(str) + "<br>";
+ text += "<br><b>" + QObject::tr("Nickname: ") + "</b>"
+ + Qtopia::escapeString(str);
// categories
if ( categoryNames("Contacts").count() ){
- text += "<b>" + QObject::tr( "Category:") + "</b> ";
+ text += "<br><b>" + QObject::tr( "Category:") + "</b> ";
text += categoryNames("Contacts").join(", ");
- text += "<br>";
}
// 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>";
}
diff --git a/libopie/pim/ocontact.h b/libopie/pim/ocontact.h
index dd2de17..9a1a8dc 100644
--- a/libopie/pim/ocontact.h
+++ b/libopie/pim/ocontact.h
@@ -23,41 +23,46 @@
#include <opie/opimrecord.h>
#include <qpe/recordfields.h>
#include <qdatetime.h>
#include <qstringlist.h>
#if defined(QPC_TEMPLATEDLL)
// MOC_SKIP_BEGIN
QPC_TEMPLATEEXTERN template class QPC_EXPORT QMap<int, QString>;
// MOC_SKIP_END
#endif
-class ContactPrivate;
+class OContactPrivate;
/**
* OContact class represents a specialised PIM Record for contacts.
* It does store all kind of persopn related information.
*
* @short Contact Container
* @author TT, Stefan Eiler, Holger Freyther
*/
class QPC_EXPORT OContact : public OPimRecord
{
friend class DataSet;
public:
OContact();
OContact( const QMap<int, QString> &fromMap );
virtual ~OContact();
+ enum DateFormat{
+ Zip_City_State = 0,
+ City_State_Zip
+ };
+
/*
* do we need to inline them
* if yes do we need to inline them this way?
* -zecke
*/
void setTitle( const QString &v ) { replace( Qtopia::Title, v ); }
void setFirstName( const QString &v ) { replace( Qtopia::FirstName, v ); }
void setMiddleName( const QString &v ) { replace( Qtopia::MiddleName, v ); }
void setLastName( const QString &v ) { replace( Qtopia::LastName, v ); }
void setSuffix( const QString &v ) { replace( Qtopia::Suffix, v ); }
void setFileAs( const QString &v ) { replace( Qtopia::FileAs, v ); }
void setFileAs();
@@ -224,17 +229,17 @@ private:
QString find( int key ) const;
static QStringList fields();
void save( QString &buf ) const;
QString displayAddress( const QString &street,
const QString &city,
const QString &state,
const QString &zip,
const QString &country ) const;
QMap<int, QString> mMap;
- ContactPrivate *d;
+ OContactPrivate *d;
};
#endif
diff --git a/libopie/pim/ocontactaccess.h b/libopie/pim/ocontactaccess.h
index e90db32..9b0a719 100644
--- a/libopie/pim/ocontactaccess.h
+++ b/libopie/pim/ocontactaccess.h
@@ -8,24 +8,32 @@
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation;
* either version 2 of the License, or (at your option) any later
* version.
* =====================================================================
* ToDo: Define enum for query settings
* =====================================================================
* Version: $Id$
* =====================================================================
* History:
* $Log$
+ * Revision 1.9 2003/08/01 12:30:16 eilers
+ * Merging changes from BRANCH_1_0 to HEAD
+ *
+ * Revision 1.8.2.1 2003/06/30 14:34:19 eilers
+ * Patches from Zecke:
+ * Fixing and cleaning up extraMap handling
+ * Adding d_ptr for binary compatibility in the future
+ *
* Revision 1.8 2003/05/08 13:55:09 tille
* search stuff
* and match, toRichText & toShortText in oevent
*
* Revision 1.7 2003/04/13 18:07:10 zecke
* More API doc
* QString -> const QString&
* QString = 0l -> QString::null
*
* Revision 1.6 2003/01/02 14:27:12 eilers
* Improved query by example: Search by date is possible.. First step
* for a today plugin for birthdays..
@@ -156,15 +164,18 @@ class OContactAccess: public QObject, public OPimAccessTemplate<OContact>
void signalChanged ( const OContactAccess *which );
private:
// class OContactAccessPrivate;
// OContactAccessPrivate* d;
OContactAccessBackend *m_backEnd;
bool m_loading:1;
private slots:
void copMessage( const QCString &msg, const QByteArray &data );
+ private:
+ class Private;
+ Private *d;
};
#endif
diff --git a/libopie/pim/ocontactaccessbackend.h b/libopie/pim/ocontactaccessbackend.h
index ebeb42d..280e05c 100644
--- a/libopie/pim/ocontactaccessbackend.h
+++ b/libopie/pim/ocontactaccessbackend.h
@@ -10,24 +10,32 @@
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation;
* either version 2 of the License, or (at your option) any later
* version.
* =====================================================================
* ToDo: Define enum for query settings
* =====================================================================
* Version: $Id$
* =====================================================================
* History:
* $Log$
+ * Revision 1.6 2003/08/01 12:30:16 eilers
+ * Merging changes from BRANCH_1_0 to HEAD
+ *
+ * Revision 1.5.4.1 2003/06/30 14:34:19 eilers
+ * Patches from Zecke:
+ * Fixing and cleaning up extraMap handling
+ * Adding d_ptr for binary compatibility in the future
+ *
* Revision 1.5 2003/04/13 18:07:10 zecke
* More API doc
* QString -> const QString&
* QString = 0l -> QString::null
*
* Revision 1.4 2002/11/13 14:14:51 eilers
* Added sorted for Contacts..
*
* Revision 1.3 2002/11/01 15:10:42 eilers
* Added regExp-search in database for all fields in a contact.
*
* Revision 1.2 2002/10/07 17:34:24 eilers
@@ -93,15 +101,19 @@ class OContactAccessBackend: public OPimAccessBackend<OContact> {
/**
* Check whether settings are correct.
* @return <i>true</i> if the given settings are correct and possible.
*/
virtual bool hasQuerySettings (uint querySettings) const = 0;
/**
* FIXME!!!
* Returns a sorted list of records either ascendinf or descending for a giving criteria and category
*/
virtual QArray<int> sorted( bool ascending, int sortOrder, int sortFilter, int cat ) = 0;
-
+
+
+private:
+ class Private;
+ Private *d;
};
#endif
diff --git a/libopie/pim/ocontactaccessbackend_vcard.cpp b/libopie/pim/ocontactaccessbackend_vcard.cpp
index 270bef3..b60c5be 100644
--- a/libopie/pim/ocontactaccessbackend_vcard.cpp
+++ b/libopie/pim/ocontactaccessbackend_vcard.cpp
@@ -8,24 +8,39 @@
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
* =====================================================================
* ToDo:
*
* =====================================================================
* Version: $Id$
* =====================================================================
* History:
* $Log$
+ * Revision 1.11 2003/08/01 12:30:16 eilers
+ * Merging changes from BRANCH_1_0 to HEAD
+ *
+ * Revision 1.10.4.3 2003/07/23 08:54:37 eilers
+ * Default email was added to the list of all emails, which already contains
+ * the default email..
+ * This closes bug #1045
+ *
+ * Revision 1.10.4.2 2003/07/23 08:44:45 eilers
+ * Importing of Notes in vcard files wasn't implemented.
+ * Closes bug #1044
+ *
+ * Revision 1.10.4.1 2003/06/02 13:37:49 eilers
+ * Fixing memory leak
+ *
* Revision 1.10 2003/04/13 18:07:10 zecke
* More API doc
* QString -> const QString&
* QString = 0l -> QString::null
*
* Revision 1.9 2003/03/21 10:33:09 eilers
* Merged speed optimized xml backend for contacts to main.
* Added QDateTime to querybyexample. For instance, it is now possible to get
* all Birthdays/Anniversaries between two dates. This should be used
* to show all birthdays in the datebook..
* This change is sourcecode backward compatible but you have to upgrade
* the binaries for today-addressbook.
@@ -142,24 +157,25 @@ bool OContactAccessBackend_VCard::save()
VObject *obj;
obj = newVObject( VCCalProp );
addPropValue( obj, VCVersionProp, "1.0" );
VObject *vo;
for(QMap<int, OContact>::ConstIterator it=m_map.begin(); it !=m_map.end(); ++it ){
vo = createVObject( *it );
writeVObject( file.directHandle() , vo );
cleanVObject( vo );
}
cleanStrTbl();
+ deleteVObject( obj );
m_dirty = false;
return true;
}
void OContactAccessBackend_VCard::clear ()
{
m_map.clear();
m_dirty = true; // ??? sure ? (se)
}
@@ -437,25 +453,27 @@ OContact OContactAccessBackend_VCard::parseVObject( VObject *obj )
}
else if ( name == "X-Qtopia-Nickname" ) {
c.setNickname( value );
}
else if ( name == "X-Qtopia-Children" ) {
c.setChildren( value );
}
else if ( name == VCBirthDateProp ) {
// Reading Birthdate regarding RFC 2425 (5.8.4)
c.setBirthday( convVCardDateToDate( value ) );
}
-
+ else if ( name == VCCommentProp ) {
+ c.setNotes( value );
+ }
#if 0
else {
printf("Name: %s, value=%s\n", name.data(), vObjectStringZValue( o ) );
VObjectIterator nit;
initPropIterator( &nit, o );
while( moreIteration( &nit ) ) {
VObject *o = nextVObject( &nit );
QCString name = vObjectName( o );
QString value = vObjectStringZValue( o );
printf(" subprop: %s = %s\n", name.data(), value.latin1() );
}
}
@@ -525,25 +543,25 @@ VObject* OContactAccessBackend_VCard::createVObject( const OContact &c )
work_phone = safeAddPropValue( vcard, VCTelephoneProp, c.businessPager() );
safeAddProp( work_phone, VCWorkProp );
safeAddProp( work_phone, VCPagerProp );
url = safeAddPropValue( vcard, VCURLProp, c.businessWebpage() );
safeAddProp( url, VCWorkProp );
VObject *title = safeAddPropValue( vcard, VCTitleProp, c.jobTitle() );
safeAddProp( title, VCWorkProp );
QStringList emails = c.emailList();
- emails.prepend( c.defaultEmail() );
+ // emails.prepend( c.defaultEmail() ); Fix for bugreport #1045
for( QStringList::Iterator it = emails.begin(); it != emails.end(); ++it ) {
VObject *email = safeAddPropValue( vcard, VCEmailAddressProp, *it );
safeAddProp( email, VCInternetProp );
}
safeAddPropValue( vcard, VCNoteProp, c.notes() );
// Exporting Birthday regarding RFC 2425 (5.8.4)
if ( c.birthday().isValid() ){
qWarning("Exporting birthday as: %s", convDateToVCardDate( c.birthday() ).latin1() );
safeAddPropValue( vcard, VCBirthDateProp, convDateToVCardDate( c.birthday() ) );
}
diff --git a/libopie/pim/ocontactaccessbackend_xml.cpp b/libopie/pim/ocontactaccessbackend_xml.cpp
index 097142b..1c21619 100644
--- a/libopie/pim/ocontactaccessbackend_xml.cpp
+++ b/libopie/pim/ocontactaccessbackend_xml.cpp
@@ -8,24 +8,27 @@
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
* =====================================================================
* ToDo: XML-Backend: Automatic reload if something was changed...
*
*
* =====================================================================
* Version: $Id$
* =====================================================================
* History:
* $Log$
+ * Revision 1.7 2003/08/01 12:30:16 eilers
+ * Merging changes from BRANCH_1_0 to HEAD
+ *
* Revision 1.6 2003/07/07 16:19:47 eilers
* Fixing serious bug in hasQuerySettings()
*
* Revision 1.5 2003/04/13 18:07:10 zecke
* More API doc
* QString -> const QString&
* QString = 0l -> QString::null
*
* Revision 1.4 2003/03/21 14:32:54 mickeyl
* g++ compliance fix: default arguments belong into the declaration, but not the definition
*
* Revision 1.3 2003/03/21 12:26:28 eilers
diff --git a/libopie/pim/oconversion.h b/libopie/pim/oconversion.h
index 13367e1..4c0a497 100644
--- a/libopie/pim/oconversion.h
+++ b/libopie/pim/oconversion.h
@@ -28,16 +28,21 @@ class OConversion
{
public:
static QString dateToString( const QDate &d );
static QDate dateFromString( const QString &datestr );
/**
* simple function to store DateTime as string and read from string
* no timezone changing is done
* DDMMYYYYHHMMSS is the simple format
*/
static QString dateTimeToString( const QDateTime& );
static QDateTime dateTimeFromString( const QString& );
+
+private:
+ class Private;
+ Private* d;
+
};
#endif // __oconversion_h__
diff --git a/libopie/pim/odatebookaccessbackend.h b/libopie/pim/odatebookaccessbackend.h
index 86ff298..3c02c42 100644
--- a/libopie/pim/odatebookaccessbackend.h
+++ b/libopie/pim/odatebookaccessbackend.h
@@ -59,15 +59,19 @@ public:
* Effective Events are special event occuring during a time frame. This method does calcualte
* EffectiveEvents bases on the directNonRepeats and directRawRepeats. You may implement this method
* yourself
*/
virtual OEffectiveEvent::ValueList effecticeEvents( const QDate& from, const QDate& to );
/**
* this is an overloaded member function
* @see effecticeEvents
*/
virtual OEffectiveEvent::ValueList effecticeEvents( const QDateTime& start );
+private:
+ class Private;
+ Private *d;
+
};
#endif
diff --git a/libopie/pim/odatebookaccessbackend_xml.cpp b/libopie/pim/odatebookaccessbackend_xml.cpp
index ab2eea4..5ea945c 100644
--- a/libopie/pim/odatebookaccessbackend_xml.cpp
+++ b/libopie/pim/odatebookaccessbackend_xml.cpp
@@ -421,48 +421,48 @@ bool ODateBookAccessBackend_XML::loadFile() {
i = j + 1;
QString str = (haveUtf ? QString::fromUtf8( value )
: QString::fromLatin1( value ) );
if ( haveEnt )
str = Qtopia::plainString( str );
/*
* add key + value
*/
find = dict[attr.data()];
if (!find)
- ev.setCustomField( attr, value );
+ ev.setCustomField( attr, str );
else {
- setField( ev, *find, value );
+ setField( ev, *find, str );
}
}
/* time to finalize */
finalizeRecord( ev );
delete rec;
}
::munmap(map_addr, attribute.st_size );
m_changed = false; // changed during add
return true;
}
void ODateBookAccessBackend_XML::finalizeRecord( OEvent& ev ) {
/* AllDay is alway in UTC */
if ( ev.isAllDay() ) {
OTimeZone utc = OTimeZone::utc();
ev.setStartDateTime( utc.fromUTCDateTime( start ) );
ev.setEndDateTime ( utc.fromUTCDateTime( end ) );
ev.setTimeZone( "UTC"); // make sure it is really utc
}else {
/* to current date time */
- qWarning(" Start is %d", start );
+ // qWarning(" Start is %d", start );
OTimeZone zone( ev.timeZone().isEmpty() ? OTimeZone::current() : ev.timeZone() );
QDateTime date = zone.toDateTime( start );
qWarning(" Start is %s", date.toString().latin1() );
ev.setStartDateTime( zone.toDateTime( date, OTimeZone::current() ) );
date = zone.toDateTime( end );
ev.setEndDateTime ( zone.toDateTime( date, OTimeZone::current() ) );
}
if ( rec && rec->doesRecur() ) {
OTimeZone utc = OTimeZone::utc();
ORecur recu( *rec ); // call copy c'tor;
recu.setEndDate ( utc.fromUTCDateTime( rp_end ).date() );
diff --git a/libopie/pim/opimaccessbackend.h b/libopie/pim/opimaccessbackend.h
index f4bbe35..c3d91f7 100644
--- a/libopie/pim/opimaccessbackend.h
+++ b/libopie/pim/opimaccessbackend.h
@@ -1,21 +1,22 @@
#ifndef OPIE_PIM_ACCESS_BACKEND
#define OPIE_PIM_ACCESS_BACKEND
#include <qarray.h>
#include <opie/otemplatebase.h>
#include <opie/opimrecord.h>
+class OPimAccessBackendPrivate;
/**
* OPimAccessBackend is the base class
* for all private backends
* it operates on OPimRecord as the base class
* and it's responsible for fast manipulating
* the resource the implementation takes care
* of
*/
template <class T = OPimRecord>
class OPimAccessBackend {
public:
typedef OTemplateBase<T> Frontend;
@@ -98,26 +99,25 @@ public:
protected:
int access()const;
void cache( const T& t )const;
/**
* use a prime number here!
*/
void setSaneCacheSize( int );
uint readAhead()const;
private:
- class Private;
- Private* d;
+ OPimAccessBackendPrivate *d;
Frontend* m_front;
uint m_read;
int m_acc;
};
template <class T>
OPimAccessBackend<T>::OPimAccessBackend(int acc)
: m_acc( acc )
{
m_front = 0l;
}
diff --git a/libopie/pim/opimaccesstemplate.h b/libopie/pim/opimaccesstemplate.h
index 8ff205c..ecbeb68 100644
--- a/libopie/pim/opimaccesstemplate.h
+++ b/libopie/pim/opimaccesstemplate.h
@@ -1,24 +1,25 @@
#ifndef OPIE_PIM_ACCESS_TEMPLATE_H
#define OPIE_PIM_ACCESS_TEMPLATE_H
#include <qarray.h>
#include <opie/opimrecord.h>
#include <opie/opimaccessbackend.h>
#include <opie/orecordlist.h>
#include "opimcache.h"
#include "otemplatebase.h"
+class OPimAccessTemplatePrivate;
/**
* Thats the frontend to our OPIE PIM
* Library. Either you want to use it's
* interface or you want to implement
* your own Access lib
* Just create a OPimRecord and inherit from
* the plugins
*/
template <class T = OPimRecord >
class OPimAccessTemplate : public OTemplateBase<T> {
public:
@@ -143,24 +144,27 @@ protected:
* invalidate the cache
*/
void invalidateCache();
void setBackEnd( BackEnd* end );
/**
* returns the backend
*/
BackEnd* backEnd();
BackEnd* m_backEnd;
Cache m_cache;
+private:
+ OPimAccessTemplatePrivate *d;
+
};
template <class T>
OPimAccessTemplate<T>::OPimAccessTemplate( BackEnd* end )
: OTemplateBase<T>(), m_backEnd( end )
{
if (end )
end->setFrontend( this );
}
template <class T>
OPimAccessTemplate<T>::~OPimAccessTemplate() {
qWarning("~OPimAccessTemplate<T>");
diff --git a/libopie/pim/opimcache.h b/libopie/pim/opimcache.h
index 73414e5..7f7cff5 100644
--- a/libopie/pim/opimcache.h
+++ b/libopie/pim/opimcache.h
@@ -1,34 +1,39 @@
#ifndef OPIE_PIM_CACHE_H
#define OPIE_PIM_CACHE_H
#include <qintcache.h>
#include "opimrecord.h"
+class OPimCacheItemPrivate;
+
template <class T = OPimRecord>
class OPimCacheItem {
public:
OPimCacheItem( const T& t = T() );
OPimCacheItem( const OPimCacheItem& );
~OPimCacheItem();
OPimCacheItem &operator=( const OPimCacheItem& );
T record()const;
void setRecord( const T& );
private:
T m_t;
+ OPimCacheItemPrivate *d;
};
+
+class OPimCachePrivate;
/**
* OPimCache for caching the items
* We support adding, removing
* and finding
*/
template <class T = OPimRecord>
class OPimCache {
public:
typedef OPimCacheItem<T> Item;
OPimCache();
OPimCache( const OPimCache& );
~OPimCache();
@@ -37,24 +42,25 @@ public:
bool contains(int uid)const;
void invalidate();
void setSize( int size );
T find(int uid )const;
void add( const T& );
void remove( int uid );
void replace( const T& );
private:
QIntCache<Item> m_cache;
+ OPimCachePrivate* d;
};
// Implementation
template <class T>
OPimCacheItem<T>::OPimCacheItem( const T& t )
: m_t(t) {
}
template <class T>
OPimCacheItem<T>::~OPimCacheItem() {
}
template <class T>
diff --git a/libopie/pim/opimmainwindow.cpp b/libopie/pim/opimmainwindow.cpp
index 4044bc1..2739e26 100644
--- a/libopie/pim/opimmainwindow.cpp
+++ b/libopie/pim/opimmainwindow.cpp
@@ -1,18 +1,19 @@
#include <qapplication.h>
#include <qdatetime.h>
#include <qcopchannel_qws.h>
#include <qpe/sound.h>
#include <qpe/qcopenvelope_qws.h>
+#include <qpe/qpeapplication.h>
#include "opimresolver.h"
#include "opimmainwindow.h"
OPimMainWindow::OPimMainWindow( const QString& service, QWidget* parent,
const char* name, WFlags flag )
: QMainWindow( parent, name, flag ), m_rtti(-1), m_service( service ), m_fallBack(0l) {
/*
* let's generate our QCopChannel
*/
m_str = QString("QPE/"+m_service).local8Bit();
@@ -29,71 +30,82 @@ OPimMainWindow::OPimMainWindow( const QString& service, QWidget* parent,
this, SLOT(reload() ) );
}
OPimMainWindow::~OPimMainWindow() {
delete m_channel;
}
QCopChannel* OPimMainWindow::channel() {
return m_channel;
}
void OPimMainWindow::doSetDocument( const QString& ) {
}
void OPimMainWindow::appMessage( const QCString& cmd, const QByteArray& array ) {
+ bool needShow = false;
/*
* create demands to create
* a new record...
*/
QDataStream stream(array, IO_ReadOnly);
if ( cmd == "create()" ) {
+ raise();
int uid = create();
QCopEnvelope e(m_str, "created(int)" );
e << uid;
+ needShow = true;
}else if ( cmd == "remove(int)" ) {
int uid;
stream >> uid;
bool rem = remove( uid );
QCopEnvelope e(m_str, "removed(bool)" );
e << rem;
+ needShow = true;
}else if ( cmd == "beam(int)" ) {
int uid;
stream >> uid;
beam( uid);
}else if ( cmd == "show(int)" ) {
+ raise();
int uid;
stream >> uid;
show( uid );
+ needShow = true;
}else if ( cmd == "edit(int)" ) {
+ raise();
int uid;
stream >> uid;
edit( uid );
}else if ( cmd == "add(int,QByteArray)" ) {
int rtti;
QByteArray array;
stream >> rtti;
stream >> array;
m_fallBack = record(rtti, array );
if (!m_fallBack) return;
add( *m_fallBack );
delete m_fallBack;
}else if ( cmd == "alarm(QDateTime,int)" ) {
+ raise();
QDateTime dt; int uid;
stream >> dt;
stream >> uid;
qWarning(" Date: %s Uid: %d", dt.toString().latin1(), uid );
QDateTime current = QDateTime::currentDateTime();
if ( current.time().hour() != dt.time().hour() && current.time().minute() != dt.time().minute() )
return;
doAlarm( dt, uid );
-
+ needShow = true;
}
+
+ if (needShow )
+ QPEApplication::setKeepRunning();
}
/* implement the url scripting here */
void OPimMainWindow::setDocument( const QString& str) {
doSetDocument( str );
}
/*
* we now try to get the array demarshalled
* check if the rtti matches this one
*/
OPimRecord* OPimMainWindow::record( int rtti, const QByteArray& array ) {
if ( service() != rtti )
return 0l;
diff --git a/libopie/pim/opimxrefmanager.h b/libopie/pim/opimxrefmanager.h
index 39e5eef..c485e98 100644
--- a/libopie/pim/opimxrefmanager.h
+++ b/libopie/pim/opimxrefmanager.h
@@ -27,15 +27,17 @@ public:
void clear();
/**
* apps participating
*/
QStringList apps()const;
OPimXRef::ValueList list()const;
OPimXRef::ValueList list( const QString& service )const;
OPimXRef::ValueList list( int uid )const;
private:
OPimXRef::ValueList m_list;
+ class Private;
+ Private *d;
};
#endif
diff --git a/libopie/pim/orecordlist.h b/libopie/pim/orecordlist.h
index edcd729..5211f57 100644
--- a/libopie/pim/orecordlist.h
+++ b/libopie/pim/orecordlist.h
@@ -1,21 +1,22 @@
#ifndef OPIE_RECORD_LIST_H
#define OPIE_RECORD_LIST_H
#include <qarray.h>
#include "otemplatebase.h"
#include "opimrecord.h"
+class ORecordListIteratorPrivate;
/**
* Our List Iterator
* it behaves like STL or Qt
*
* for(it = list.begin(); it != list.end(); ++it )
* doSomeCoolStuff( (*it) );
*/
template <class T> class ORecordList;
template <class T = OPimRecord>
class ORecordListIterator {
friend class ORecordList<T>;
public:
@@ -62,27 +63,28 @@ public:
*/
void setCurrent( uint cur );
private:
QArray<int> m_uids;
uint m_current;
const Base* m_temp;
bool m_end : 1;
T m_record;
bool m_direction :1;
/* d pointer for future versions */
- class IteratorPrivate;
- IteratorPrivate *d;
+ ORecordListIteratorPrivate *d;
};
+
+class ORecordListPrivate;
/**
* The recordlist used as a return type
* from OPimAccessTemplate
*/
template <class T = OPimRecord >
class ORecordList {
public:
typedef OTemplateBase<T> Base;
typedef ORecordListIterator<T> Iterator;
/**
* c'tor
@@ -102,36 +104,37 @@ ORecordList( const QArray<int>& ids,
* the end
*/
Iterator end();
/**
* the number of items in the list
*/
uint count()const;
T operator[]( uint i );
int uidAt(uint i );
- /**
+ /**
* Remove the contact with given uid
*/
bool remove( int uid );
/*
ConstIterator begin()const;
ConstIterator end()const;
*/
private:
QArray<int> m_ids;
const Base* m_acc;
+ ORecordListPrivate *d;
};
/* ok now implement it */
template <class T>
ORecordListIterator<T>::ORecordListIterator() {
m_current = 0;
m_temp = 0l;
m_end = true;
m_record = T();
/* forward */
m_direction = TRUE;
}
@@ -211,24 +214,27 @@ bool ORecordListIterator<T>::operator==( const ORecordListIterator<T>& it ) {
return true;
}
template <class T>
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 )
{
+ /* if the list is empty we're already at the end of the list */
+ if (uids.count() == 0 )
+ m_end = true;
}
template <class T>
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;
}
}
diff --git a/libopie/pim/otemplatebase.h b/libopie/pim/otemplatebase.h
index 29fb6ec..cadac74 100644
--- a/libopie/pim/otemplatebase.h
+++ b/libopie/pim/otemplatebase.h
@@ -5,71 +5,78 @@
#include <opie/opimrecord.h>
/**
* Templates do not have a base class, This is why
* we've this class
* this is here to give us the possibility
* to have a common base class
* You may not want to use that interface internaly
* POOR mans interface
*/
+class OPimBasePrivate;
struct OPimBase {
/**
* return the rtti
*/
virtual int rtti()= 0;
virtual OPimRecord* record()const = 0;
virtual OPimRecord* record(int uid)const = 0;
virtual bool add( const OPimRecord& ) = 0;
virtual bool remove( int uid ) = 0;
virtual bool remove( const OPimRecord& ) = 0;
virtual void clear() = 0;
virtual bool load() = 0;
virtual bool save() = 0;
virtual QArray<int> records()const = 0;
/*
* ADD editing here?
* -zecke
*/
+private:
+ OPimBasePrivate* d;
};
/**
* internal template base
* T needs to implement the copy c'tor!!!
*/
+class OTemplateBasePrivate;
template <class T = OPimRecord>
class OTemplateBase : public OPimBase {
public:
enum CacheDirection { Forward=0, Reverse };
OTemplateBase() {
};
virtual ~OTemplateBase() {
}
virtual T find( int uid )const = 0;
/**
* read ahead find
*/
virtual T find( int uid, const QArray<int>& items,
uint current, CacheDirection dir = Forward )const = 0;
virtual void cache( const T& )const = 0;
virtual void setSaneCacheSize( int ) = 0;
/* reimplement of OPimBase */
int rtti();
OPimRecord* record()const;
OPimRecord* record(int uid )const;
static T* rec();
+
+private:
+ OTemplateBasePrivate *d;
};
/*
* implementation
*/
template <class T>
int
OTemplateBase<T>::rtti() {
return T::rtti();
}
template <class T>
OPimRecord* OTemplateBase<T>::record()const {
diff --git a/libopie/pim/otodo.cpp b/libopie/pim/otodo.cpp
index 38b93f7..5a18c37 100644
--- a/libopie/pim/otodo.cpp
+++ b/libopie/pim/otodo.cpp
@@ -19,24 +19,29 @@
#include "opimresolver.h"
#include "otodo.h"
struct OTodo::OTodoData : public QShared {
OTodoData() : QShared() {
recur = 0;
state = 0;
maintainer = 0;
notifiers = 0;
};
+ ~OTodoData() {
+ delete recur;
+ delete maintainer;
+ delete notifiers;
+ }
QDate date;
bool isCompleted:1;
bool hasDate:1;
int priority;
QString desc;
QString sum;
QMap<QString, QString> extra;
ushort prog;
OPimState *state;
ORecur *recur;
OPimMaintainer *maintainer;
@@ -265,42 +270,41 @@ void OTodo::setProgress(ushort progress )
QString OTodo::toShortText() const {
return summary();
}
/*!
Returns a richt text string
*/
QString OTodo::toRichText() const
{
QString text;
QStringList catlist;
// summary
- text += "<b><h3><img src=\"todo/TodoList\">";
+ 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>" ) ;
+ text += "<b>" + QObject::tr( "Notes:" ) + "</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 ) + "\">";
-// text += "<b>" + QObject::tr( "Priority:") +"</b><img src=\"todo/priority" +
-// QString::number( priority() ) + "\"><br>";
+ QString::number( priorityval ) + "\"> ";
+
switch ( priorityval )
{
case 1 : text += QObject::tr( "Very high" );
break;
case 2 : text += QObject::tr( "High" );
break;
case 3 : text += QObject::tr( "Normal" );
break;
case 4 : text += QObject::tr( "Low" );
break;
case 5 : text += QObject::tr( "Very low" );
break;
diff --git a/libopie/pim/otodo.h b/libopie/pim/otodo.h
index f9a345a..6df98b9 100644
--- a/libopie/pim/otodo.h
+++ b/libopie/pim/otodo.h
@@ -89,29 +89,24 @@ public:
* Is this event completed?
*/
bool isCompleted() const;
/**
* Does this Event have a deadline
*/
bool hasDueDate() const;
bool hasStartDate()const;
bool hasCompletedDate()const;
/**
- * Does this Event has an alarm time ?
- */
- bool hasAlarmDateTime() const;
-
- /**
* What is the priority?
*/
int priority()const ;
/**
* progress as ushort 0, 20, 40, 60, 80 or 100%
*/
ushort progress() const;
/**
* The due Date
*/
@@ -232,28 +227,24 @@ public:
/**
* set the start date
*/
void setStartDate( const QDate& date );
/**
* set the completed date
*/
void setCompletedDate( const QDate& date );
void setRecurrence( const ORecur& );
- /**
- * set the alarm time
- */
- void setAlarmDateTime ( const QDateTime& alarm );
void setDescription(const QString& );
void setSummary(const QString& );
/**
* set the state of a Todo
* @param state State what the todo should take
*/
void setState( const OPimState& state);
/**
* set the Maintainer Mode
diff --git a/libopie/pim/otodoaccessbackend.h b/libopie/pim/otodoaccessbackend.h
index 05e8ca9..6be95bc 100644
--- a/libopie/pim/otodoaccessbackend.h
+++ b/libopie/pim/otodoaccessbackend.h
@@ -9,16 +9,20 @@
class OTodoAccessBackend : public OPimAccessBackend<OTodo> {
public:
OTodoAccessBackend();
~OTodoAccessBackend();
virtual QArray<int> effectiveToDos( const QDate& start,
const QDate& end,
bool includeNoDates ) = 0;
virtual QArray<int> overDue() = 0;
virtual QArray<int> sorted( bool asc, int sortOrder, int sortFilter,
int cat ) = 0;
virtual void removeAllCompleted() = 0;
virtual QBitArray supports()const = 0;
+
+private:
+ class Private;
+ Private *d;
};
#endif
diff --git a/libopie/pim/otodoaccessvcal.cpp b/libopie/pim/otodoaccessvcal.cpp
index 3577e14..6415952 100644
--- a/libopie/pim/otodoaccessvcal.cpp
+++ b/libopie/pim/otodoaccessvcal.cpp
@@ -6,30 +6,38 @@
#include "otodoaccessvcal.h"
namespace {
static OTodo eventByVObj( VObject *obj ){
OTodo event;
VObject *ob;
QCString name;
// no uid, attendees, ... and no fun
// description
if( ( ob = isAPropertyOf( obj, VCDescriptionProp )) != 0 ){
name = vObjectStringZValue( ob );
+#if 0
event.setDescription( name );
+#else
+ event.setSummary( name );
+#endif
}
// summary
if ( ( ob = isAPropertyOf( obj, VCSummaryProp ) ) != 0 ) {
name = vObjectStringZValue( ob );
+#if 0
event.setSummary( name );
+#else
+ event.setDescription( name );
+#endif
}
// completed
if( ( ob = isAPropertyOf( obj, VCStatusProp )) != 0 ){
name = vObjectStringZValue( ob );
if( name == "COMPLETED" ){
event.setCompleted( true );
}else{
event.setCompleted( false );
}
}else
event.setCompleted( false );
// priority
@@ -65,29 +73,45 @@ namespace {
TimeConversion::toISO8601( date ) );
}
if( event.isCompleted() )
addPropValue( task, VCStatusProp, "COMPLETED");
QString string = QString::number(event.priority() );
addPropValue( task, VCPriorityProp, string.local8Bit() );
addPropValue( task, VCCategoriesProp,
event.idsToString( event.categories() ).local8Bit() );
+#if 0
+
+ // There seems a misrepresentation between summary in otodoevent
+ // and summary in vcard.
+ // The same with description..
+ // Description is summary and vice versa.. Argh.. (eilers)
+
+
addPropValue( task, VCDescriptionProp,
event.description().local8Bit() );
addPropValue( task, VCSummaryProp,
event.summary().local8Bit() );
+
+#else
+ addPropValue( task, VCDescriptionProp,
+ event.summary().local8Bit() );
+
+ addPropValue( task, VCSummaryProp,
+ event.description().local8Bit() );
+#endif
return task;
};
}
OTodoAccessVCal::OTodoAccessVCal( const QString& path )
: m_dirty(false), m_file( path )
{
}
OTodoAccessVCal::~OTodoAccessVCal() {
}
bool OTodoAccessVCal::load() {
m_map.clear();
@@ -176,25 +200,25 @@ QArray<int> OTodoAccessVCal::sorted( bool, int, int, int ) {
return ar;
}
QArray<int> OTodoAccessVCal::allRecords()const {
QArray<int> ar( m_map.count() );
QMap<int, OTodo>::ConstIterator it;
int i = 0;
for ( it = m_map.begin(); it != m_map.end(); ++it ) {
ar[i] = it.key();
i++;
}
return ar;
}
-QArray<int> OTodoAccessVCal::matchRegexp(const QRegExp &r)const {
+QArray<int> OTodoAccessVCal::matchRegexp(const QRegExp& /* r */)const {
QArray<int> ar(0);
return ar;
}
QArray<int> OTodoAccessVCal::queryByExample( const OTodo&, int, const QDateTime& ) {
QArray<int> ar(0);
return ar;
}
QArray<int> OTodoAccessVCal::effectiveToDos( const QDate& ,
const QDate& ,
bool ) {
QArray<int> ar(0);
return ar;
diff --git a/libopie/pim/otodoaccessxml.cpp b/libopie/pim/otodoaccessxml.cpp
index 3d15354..f688735 100644
--- a/libopie/pim/otodoaccessxml.cpp
+++ b/libopie/pim/otodoaccessxml.cpp
@@ -78,25 +78,25 @@ OTodoAccessXML::OTodoAccessXML( const QString& appName,
}
OTodoAccessXML::~OTodoAccessXML() {
}
bool OTodoAccessXML::load() {
rec = 0;
m_opened = true;
m_changed = false;
/* initialize dict */
/*
* UPDATE dict if you change anything!!!
*/
- QAsciiDict<int> dict(21);
+ QAsciiDict<int> dict(26);
dict.setAutoDelete( TRUE );
dict.insert("Categories" , new int(OTodo::Category) );
dict.insert("Uid" , new int(OTodo::Uid) );
dict.insert("HasDate" , new int(OTodo::HasDate) );
dict.insert("Completed" , new int(OTodo::Completed) );
dict.insert("Description" , new int(OTodo::Description) );
dict.insert("Summary" , new int(OTodo::Summary) );
dict.insert("Priority" , new int(OTodo::Priority) );
dict.insert("DateDay" , new int(OTodo::DateDay) );
dict.insert("DateMonth" , new int(OTodo::DateMonth) );
dict.insert("DateYear" , new int(OTodo::DateYear) );
dict.insert("Progress" , new int(OTodo::Progress) );
@@ -827,28 +827,30 @@ QArray<int> OTodoAccessXML::sorted( bool asc, int sortOrder,
}
vector.resize( item );
/* sort it now */
vector.sort();
/* now get the uids */
QArray<int> array( vector.count() );
for (uint i= 0; i < vector.count(); i++ ) {
array[i] = ( vector.at(i) )->todo.uid();
}
return array;
};
void OTodoAccessXML::removeAllCompleted() {
+ QMap<int, OTodo> events = m_events;
for ( QMap<int, OTodo>::Iterator it = m_events.begin(); it != m_events.end(); ++it ) {
if ( (*it).isCompleted() )
- m_events.remove( it );
+ events.remove( it.key() );
}
+ m_events = events;
}
QBitArray OTodoAccessXML::supports()const {
static QBitArray ar = sup();
return ar;
}
QBitArray OTodoAccessXML::sup() {
QBitArray ar( OTodo::CompletedDate +1 );
ar.fill( true );
ar[OTodo::CrossReference] = false;
ar[OTodo::State ] = false;
ar[OTodo::Reminders] = false;
ar[OTodo::Notifiers] = false;