00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049 #ifndef __OCONTACTACCESSBACKEND_VCARD_H_
00050 #define __OCONTACTACCESSBACKEND_VCARD_H_
00051
00052 #include <opie/ocontact.h>
00053
00054 #include "ocontactaccessbackend.h"
00055
00056 class VObject;
00057
00063 class OContactAccessBackend_VCard : public OContactAccessBackend {
00064 public:
00065 OContactAccessBackend_VCard ( const QString& appname, const QString& filename = QString::null );
00066
00067 bool load ();
00068 bool reload();
00069 bool save();
00070 void clear ();
00071
00072 bool add ( const OContact& newcontact );
00073 bool remove ( int uid );
00074 bool replace ( const OContact& contact );
00075
00076 OContact find ( int uid ) const;
00077 QArray<int> allRecords() const;
00078 QArray<int> queryByExample ( const OContact &query, int settings, const QDateTime& d = QDateTime() );
00079 QArray<int> matchRegexp( const QRegExp &r ) const;
00080
00081 const uint querySettings();
00082 bool hasQuerySettings (uint querySettings) const;
00083 QArray<int> sorted( bool ascending, int sortOrder, int sortFilter, int cat );
00084 bool wasChangedExternally();
00085
00086 private:
00087 OContact parseVObject( VObject* obj );
00088 VObject* createVObject( const OContact& c );
00089 QString convDateToVCardDate( const QDate& c ) const;
00090 QDate convVCardDateToDate( const QString& datestr );
00091 VObject *safeAddPropValue( VObject *o, const char* prop, const QString& value );
00092 VObject *safeAddProp( VObject* o, const char* prop);
00093
00094 bool m_dirty : 1;
00095 QString m_file;
00096 QMap<int, OContact> m_map;
00097 };
00098
00099 #endif