Diffstat (limited to 'libopie/pim/ocontactaccessbackend_xml.h') (more/less context) (show whitespace changes)
-rw-r--r-- | libopie/pim/ocontactaccessbackend_xml.h | 160 |
1 files changed, 0 insertions, 160 deletions
diff --git a/libopie/pim/ocontactaccessbackend_xml.h b/libopie/pim/ocontactaccessbackend_xml.h deleted file mode 100644 index a0cae4d..0000000 --- a/libopie/pim/ocontactaccessbackend_xml.h +++ b/dev/null | |||
@@ -1,160 +0,0 @@ | |||
1 | /* | ||
2 | * XML Backend for the OPIE-Contact Database. | ||
3 | * | ||
4 | * Copyright (c) 2002 by Stefan Eilers (Eilers.Stefan@epost.de) | ||
5 | * | ||
6 | * ===================================================================== | ||
7 | *This program is free software; you can redistribute it and/or | ||
8 | *modify it under the terms of the GNU Library General Public | ||
9 | * License as published by the Free Software Foundation; either | ||
10 | * version 2 of the License, or (at your option) any later version. | ||
11 | * ===================================================================== | ||
12 | * ToDo: XML-Backend: Automatic reload if something was changed... | ||
13 | * File Locking to protect against concurrent access | ||
14 | * | ||
15 | * | ||
16 | * ===================================================================== | ||
17 | * Version: $Id$ | ||
18 | * ===================================================================== | ||
19 | * History: | ||
20 | * $Log$ | ||
21 | * Revision 1.15 2003/09/22 14:31:16 eilers | ||
22 | * Added first experimental incarnation of sql-backend for addressbook. | ||
23 | * Some modifications to be able to compile the todo sql-backend. | ||
24 | * A lot of changes fill follow... | ||
25 | * | ||
26 | * Revision 1.14 2003/04/13 18:07:10 zecke | ||
27 | * More API doc | ||
28 | * QString -> const QString& | ||
29 | * QString = 0l -> QString::null | ||
30 | * | ||
31 | * Revision 1.13 2003/03/21 10:33:09 eilers | ||
32 | * Merged speed optimized xml backend for contacts to main. | ||
33 | * Added QDateTime to querybyexample. For instance, it is now possible to get | ||
34 | * all Birthdays/Anniversaries between two dates. This should be used | ||
35 | * to show all birthdays in the datebook.. | ||
36 | * This change is sourcecode backward compatible but you have to upgrade | ||
37 | * the binaries for today-addressbook. | ||
38 | * | ||
39 | * Revision 1.12.2.2 2003/02/11 12:17:28 eilers | ||
40 | * Speed optimization. Removed the sequential search loops. | ||
41 | * | ||
42 | * Revision 1.12.2.1 2003/02/09 15:05:01 eilers | ||
43 | * Nothing happened.. Just some cleanup before I will start.. | ||
44 | * | ||
45 | * Revision 1.12 2003/01/03 16:58:03 eilers | ||
46 | * Reenable debug output | ||
47 | * | ||
48 | * Revision 1.11 2003/01/03 12:31:28 eilers | ||
49 | * Bugfix for calculating data diffs.. | ||
50 | * | ||
51 | * Revision 1.10 2003/01/02 14:27:12 eilers | ||
52 | * Improved query by example: Search by date is possible.. First step | ||
53 | * for a today plugin for birthdays.. | ||
54 | * | ||
55 | * Revision 1.9 2002/12/08 12:48:57 eilers | ||
56 | * Moved journal-enum from ocontact into i the xml-backend.. | ||
57 | * | ||
58 | * Revision 1.8 2002/11/14 17:04:24 eilers | ||
59 | * Sorting will now work if fullname is identical on some entries | ||
60 | * | ||
61 | * Revision 1.7 2002/11/13 15:02:46 eilers | ||
62 | * Small Bug in sorted fixed | ||
63 | * | ||
64 | * Revision 1.6 2002/11/13 14:14:51 eilers | ||
65 | * Added sorted for Contacts.. | ||
66 | * | ||
67 | * Revision 1.5 2002/11/01 15:10:42 eilers | ||
68 | * Added regExp-search in database for all fields in a contact. | ||
69 | * | ||
70 | * Revision 1.4 2002/10/16 10:52:40 eilers | ||
71 | * Added some docu to the interface and now using the cache infrastucture by zecke.. :) | ||
72 | * | ||
73 | * Revision 1.3 2002/10/14 16:21:54 eilers | ||
74 | * Some minor interface updates | ||
75 | * | ||
76 | * Revision 1.2 2002/10/07 17:34:24 eilers | ||
77 | * added OBackendFactory for advanced backend access | ||
78 | * | ||
79 | * Revision 1.1 2002/09/27 17:11:44 eilers | ||
80 | * Added API for accessing the Contact-Database ! It is compiling, but | ||
81 | * please do not expect that anything is working ! | ||
82 | * I will debug that stuff in the next time .. | ||
83 | * Please read README_COMPILE for compiling ! | ||
84 | * | ||
85 | * | ||
86 | */ | ||
87 | |||
88 | #ifndef _OContactAccessBackend_XML_ | ||
89 | #define _OContactAccessBackend_XML_ | ||
90 | |||
91 | #include "ocontactaccessbackend.h" | ||
92 | #include "ocontactaccess.h" | ||
93 | |||
94 | #include <qlist.h> | ||
95 | #include <qdict.h> | ||
96 | |||
97 | /* the default xml implementation */ | ||
98 | /** | ||
99 | * This class is the XML implementation of a Contact backend | ||
100 | * it does implement everything available for OContact. | ||
101 | * @see OPimAccessBackend for more information of available methods | ||
102 | */ | ||
103 | class OContactAccessBackend_XML : public OContactAccessBackend { | ||
104 | public: | ||
105 | OContactAccessBackend_XML ( const QString& appname, const QString& filename = QString::null ); | ||
106 | |||
107 | bool save(); | ||
108 | |||
109 | bool load (); | ||
110 | |||
111 | void clear (); | ||
112 | |||
113 | bool wasChangedExternally(); | ||
114 | |||
115 | QArray<int> allRecords() const; | ||
116 | |||
117 | OContact find ( int uid ) const; | ||
118 | |||
119 | QArray<int> queryByExample ( const OContact &query, int settings, const QDateTime& d = QDateTime() ); | ||
120 | |||
121 | QArray<int> matchRegexp( const QRegExp &r ) const; | ||
122 | |||
123 | const uint querySettings(); | ||
124 | |||
125 | bool hasQuerySettings (uint querySettings) const; | ||
126 | |||
127 | // Currently only asc implemented.. | ||
128 | QArray<int> sorted( bool asc, int , int , int ); | ||
129 | bool add ( const OContact &newcontact ); | ||
130 | |||
131 | bool replace ( const OContact &contact ); | ||
132 | |||
133 | bool remove ( int uid ); | ||
134 | bool reload(); | ||
135 | |||
136 | private: | ||
137 | |||
138 | enum journal_action { ACTION_ADD, ACTION_REMOVE, ACTION_REPLACE }; | ||
139 | |||
140 | void addContact_p( const OContact &newcontact ); | ||
141 | |||
142 | /* This function loads the xml-database and the journalfile */ | ||
143 | bool load( const QString filename, bool isJournal ); | ||
144 | |||
145 | |||
146 | void updateJournal( const OContact& cnt, journal_action action ); | ||
147 | void removeJournal(); | ||
148 | |||
149 | protected: | ||
150 | bool m_changed; | ||
151 | QString m_journalName; | ||
152 | QString m_fileName; | ||
153 | QString m_appName; | ||
154 | QList<OContact> m_contactList; | ||
155 | QDateTime m_readtime; | ||
156 | |||
157 | QDict<OContact> m_uidToContact; | ||
158 | }; | ||
159 | |||
160 | #endif | ||