summaryrefslogtreecommitdiff
path: root/libopie/pim/ocontactaccessbackend_xml.h
Unidiff
Diffstat (limited to 'libopie/pim/ocontactaccessbackend_xml.h') (more/less context) (ignore whitespace changes)
-rw-r--r--libopie/pim/ocontactaccessbackend_xml.h46
1 files changed, 28 insertions, 18 deletions
diff --git a/libopie/pim/ocontactaccessbackend_xml.h b/libopie/pim/ocontactaccessbackend_xml.h
index 4d6a7ef..7b5365b 100644
--- a/libopie/pim/ocontactaccessbackend_xml.h
+++ b/libopie/pim/ocontactaccessbackend_xml.h
@@ -8,24 +8,29 @@
8 *modify it under the terms of the GNU Library General Public 8 *modify it under the terms of the GNU Library General Public
9 * License as published by the Free Software Foundation; either 9 * License as published by the Free Software Foundation; either
10 * version 2 of the License, or (at your option) any later version. 10 * version 2 of the License, or (at your option) any later version.
11 * ===================================================================== 11 * =====================================================================
12 * ToDo: XML-Backend: Automatic reload if something was changed... 12 * ToDo: XML-Backend: Automatic reload if something was changed...
13 * 13 *
14 * 14 *
15 * ===================================================================== 15 * =====================================================================
16 * Version: $Id$ 16 * Version: $Id$
17 * ===================================================================== 17 * =====================================================================
18 * History: 18 * History:
19 * $Log$ 19 * $Log$
20 * Revision 1.14 2003/04/13 18:07:10 zecke
21 * More API doc
22 * QString -> const QString&
23 * QString = 0l -> QString::null
24 *
20 * Revision 1.13 2003/03/21 10:33:09 eilers 25 * Revision 1.13 2003/03/21 10:33:09 eilers
21 * Merged speed optimized xml backend for contacts to main. 26 * Merged speed optimized xml backend for contacts to main.
22 * Added QDateTime to querybyexample. For instance, it is now possible to get 27 * Added QDateTime to querybyexample. For instance, it is now possible to get
23 * all Birthdays/Anniversaries between two dates. This should be used 28 * all Birthdays/Anniversaries between two dates. This should be used
24 * to show all birthdays in the datebook.. 29 * to show all birthdays in the datebook..
25 * This change is sourcecode backward compatible but you have to upgrade 30 * This change is sourcecode backward compatible but you have to upgrade
26 * the binaries for today-addressbook. 31 * the binaries for today-addressbook.
27 * 32 *
28 * Revision 1.12.2.2 2003/02/11 12:17:28 eilers 33 * Revision 1.12.2.2 2003/02/11 12:17:28 eilers
29 * Speed optimization. Removed the sequential search loops. 34 * Speed optimization. Removed the sequential search loops.
30 * 35 *
31 * Revision 1.12.2.1 2003/02/09 15:05:01 eilers 36 * Revision 1.12.2.1 2003/02/09 15:05:01 eilers
@@ -75,70 +80,75 @@
75 */ 80 */
76 81
77#ifndef _OContactAccessBackend_XML_ 82#ifndef _OContactAccessBackend_XML_
78#define _OContactAccessBackend_XML_ 83#define _OContactAccessBackend_XML_
79 84
80#include "ocontactaccessbackend.h" 85#include "ocontactaccessbackend.h"
81#include "ocontactaccess.h" 86#include "ocontactaccess.h"
82 87
83#include <qlist.h> 88#include <qlist.h>
84#include <qdict.h> 89#include <qdict.h>
85 90
86/* the default xml implementation */ 91/* the default xml implementation */
92/**
93 * This class is the XML implementation of a Contact backend
94 * it does implement everything available for OContact.
95 * @see OPimAccessBackend for more information of available methods
96 */
87class OContactAccessBackend_XML : public OContactAccessBackend { 97class OContactAccessBackend_XML : public OContactAccessBackend {
88 public: 98 public:
89 OContactAccessBackend_XML ( QString appname, QString filename = 0l ); 99 OContactAccessBackend_XML ( const QString& appname, const QString& filename = QString::null );
90 100
91 bool save(); 101 bool save();
92 102
93 bool load (); 103 bool load ();
94 104
95 void clear (); 105 void clear ();
96 106
97 bool wasChangedExternally(); 107 bool wasChangedExternally();
98 108
99 QArray<int> allRecords() const; 109 QArray<int> allRecords() const;
100 110
101 OContact find ( int uid ) const; 111 OContact find ( int uid ) const;
102 112
103 QArray<int> queryByExample ( const OContact &query, int settings, const QDateTime& d = QDateTime() ); 113 QArray<int> queryByExample ( const OContact &query, int settings, const QDateTime& d = QDateTime() );
104 114
105 QArray<int> matchRegexp( const QRegExp &r ) const; 115 QArray<int> matchRegexp( const QRegExp &r ) const;
106 116
107 const uint querySettings(); 117 const uint querySettings();
108 118
109 bool hasQuerySettings (uint querySettings) const; 119 bool hasQuerySettings (uint querySettings) const;
110 120
111 // Currently only asc implemented.. 121 // Currently only asc implemented..
112 QArray<int> sorted( bool asc, int , int , int ); 122 QArray<int> sorted( bool asc, int , int , int );
113 bool add ( const OContact &newcontact ); 123 bool add ( const OContact &newcontact );
114 124
115 bool replace ( const OContact &contact ); 125 bool replace ( const OContact &contact );
116 126
117 bool remove ( int uid ); 127 bool remove ( int uid );
118 bool reload(); 128 bool reload();
119 129
120 private: 130 private:
121 131
122 enum journal_action { ACTION_ADD, ACTION_REMOVE, ACTION_REPLACE }; 132 enum journal_action { ACTION_ADD, ACTION_REMOVE, ACTION_REPLACE };
123 133
124 void addContact_p( const OContact &newcontact ); 134 void addContact_p( const OContact &newcontact );
125 135
126 /* This function loads the xml-database and the journalfile */ 136 /* This function loads the xml-database and the journalfile */
127 bool load( const QString filename, bool isJournal ); 137 bool load( const QString filename, bool isJournal );
128 138
129 139
130 void updateJournal( const OContact& cnt, journal_action action ); 140 void updateJournal( const OContact& cnt, journal_action action );
131 void removeJournal(); 141 void removeJournal();
132 142
133 protected: 143 protected:
134 bool m_changed; 144 bool m_changed;
135 QString m_journalName; 145 QString m_journalName;
136 QString m_fileName; 146 QString m_fileName;
137 QString m_appName; 147 QString m_appName;
138 QList<OContact> m_contactList; 148 QList<OContact> m_contactList;
139 QDateTime m_readtime; 149 QDateTime m_readtime;
140 150
141 QDict<OContact> m_uidToContact; 151 QDict<OContact> m_uidToContact;
142}; 152};
143 153
144#endif 154#endif