Diffstat (limited to 'libopie2/opiepim/core/ocontactaccess.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | libopie2/opiepim/core/ocontactaccess.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/libopie2/opiepim/core/ocontactaccess.cpp b/libopie2/opiepim/core/ocontactaccess.cpp index f868b53..9c9338e 100644 --- a/libopie2/opiepim/core/ocontactaccess.cpp +++ b/libopie2/opiepim/core/ocontactaccess.cpp | |||
@@ -1,47 +1,50 @@ | |||
1 | /* | 1 | /* |
2 | * Class to manage the Contacts. | 2 | * Class to manage the Contacts. |
3 | * | 3 | * |
4 | * Copyright (c) 2002 by Stefan Eilers (Eilers.Stefan@epost.de) | 4 | * Copyright (c) 2002 by Stefan Eilers (Eilers.Stefan@epost.de) |
5 | * | 5 | * |
6 | * ===================================================================== | 6 | * ===================================================================== |
7 | *This program is free software; you can redistribute it and/or | 7 | *This program is free software; you can redistribute it and/or |
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 | * Info: This class could just work with a change in the header-file | 12 | * Info: This class could just work with a change in the header-file |
13 | * of the Contact class ! Therefore our libopie only compiles | 13 | * of the Contact class ! Therefore our libopie only compiles |
14 | * with our version of libqpe | 14 | * with our version of libqpe |
15 | * ===================================================================== | 15 | * ===================================================================== |
16 | * ToDo: XML-Backend: Automatic reload if something was changed... | 16 | * ToDo: XML-Backend: Automatic reload if something was changed... |
17 | * | 17 | * |
18 | * | 18 | * |
19 | * ===================================================================== | 19 | * ===================================================================== |
20 | * Version: $Id$ | 20 | * Version: $Id$ |
21 | * ===================================================================== | 21 | * ===================================================================== |
22 | * History: | 22 | * History: |
23 | * $Log$ | 23 | * $Log$ |
24 | * Revision 1.7 2002/11/13 14:14:51 eilers | ||
25 | * Added sorted for Contacts.. | ||
26 | * | ||
24 | * Revision 1.6 2002/11/01 15:10:42 eilers | 27 | * Revision 1.6 2002/11/01 15:10:42 eilers |
25 | * Added regExp-search in database for all fields in a contact. | 28 | * Added regExp-search in database for all fields in a contact. |
26 | * | 29 | * |
27 | * Revision 1.5 2002/10/16 10:52:40 eilers | 30 | * Revision 1.5 2002/10/16 10:52:40 eilers |
28 | * Added some docu to the interface and now using the cache infrastucture by zecke.. :) | 31 | * Added some docu to the interface and now using the cache infrastucture by zecke.. :) |
29 | * | 32 | * |
30 | * Revision 1.4 2002/10/14 16:21:54 eilers | 33 | * Revision 1.4 2002/10/14 16:21:54 eilers |
31 | * Some minor interface updates | 34 | * Some minor interface updates |
32 | * | 35 | * |
33 | * Revision 1.3 2002/10/07 17:34:24 eilers | 36 | * Revision 1.3 2002/10/07 17:34:24 eilers |
34 | * added OBackendFactory for advanced backend access | 37 | * added OBackendFactory for advanced backend access |
35 | * | 38 | * |
36 | * Revision 1.2 2002/10/02 16:18:11 eilers | 39 | * Revision 1.2 2002/10/02 16:18:11 eilers |
37 | * debugged and seems to work almost perfectly .. | 40 | * debugged and seems to work almost perfectly .. |
38 | * | 41 | * |
39 | * Revision 1.1 2002/09/27 17:11:44 eilers | 42 | * Revision 1.1 2002/09/27 17:11:44 eilers |
40 | * Added API for accessing the Contact-Database ! It is compiling, but | 43 | * Added API for accessing the Contact-Database ! It is compiling, but |
41 | * please do not expect that anything is working ! | 44 | * please do not expect that anything is working ! |
42 | * I will debug that stuff in the next time .. | 45 | * I will debug that stuff in the next time .. |
43 | * Please read README_COMPILE for compiling ! | 46 | * Please read README_COMPILE for compiling ! |
44 | * | 47 | * |
45 | * | 48 | * |
46 | */ | 49 | */ |
47 | 50 | ||
@@ -116,46 +119,51 @@ bool OContactAccess::save () | |||
116 | bool status = OPimAccessTemplate<OContact>::save(); | 119 | bool status = OPimAccessTemplate<OContact>::save(); |
117 | if ( !status ) return false; | 120 | if ( !status ) return false; |
118 | 121 | ||
119 | /* Now tell everyone that new data is available. | 122 | /* Now tell everyone that new data is available. |
120 | */ | 123 | */ |
121 | QCopEnvelope e( "QPE/PIM", "addressbookUpdated()" ); | 124 | QCopEnvelope e( "QPE/PIM", "addressbookUpdated()" ); |
122 | 125 | ||
123 | return true; | 126 | return true; |
124 | } | 127 | } |
125 | 128 | ||
126 | ORecordList<OContact> OContactAccess::matchRegexp( const QRegExp &r ) const{ | 129 | ORecordList<OContact> OContactAccess::matchRegexp( const QRegExp &r ) const{ |
127 | QArray<int> matchingContacts = m_backEnd -> matchRegexp( r ); | 130 | QArray<int> matchingContacts = m_backEnd -> matchRegexp( r ); |
128 | return ( ORecordList<OContact>(matchingContacts, this) ); | 131 | return ( ORecordList<OContact>(matchingContacts, this) ); |
129 | } | 132 | } |
130 | 133 | ||
131 | const uint OContactAccess::querySettings() | 134 | const uint OContactAccess::querySettings() |
132 | { | 135 | { |
133 | return ( m_backEnd->querySettings() ); | 136 | return ( m_backEnd->querySettings() ); |
134 | } | 137 | } |
135 | 138 | ||
136 | bool OContactAccess::hasQuerySettings ( int querySettings ) const | 139 | bool OContactAccess::hasQuerySettings ( int querySettings ) const |
137 | { | 140 | { |
138 | return ( m_backEnd->hasQuerySettings ( querySettings ) ); | 141 | return ( m_backEnd->hasQuerySettings ( querySettings ) ); |
139 | } | 142 | } |
143 | ORecordList<OContact> OContactAccess::sorted( bool ascending, int sortOrder, int sortFilter, int cat ) const | ||
144 | { | ||
145 | QArray<int> matchingContacts = m_backEnd -> sorted( ascending, sortOrder, sortFilter, cat ); | ||
146 | return ( ORecordList<OContact>(matchingContacts, this) ); | ||
147 | } | ||
140 | 148 | ||
141 | 149 | ||
142 | bool OContactAccess::wasChangedExternally()const | 150 | bool OContactAccess::wasChangedExternally()const |
143 | { | 151 | { |
144 | return ( m_backEnd->wasChangedExternally() ); | 152 | return ( m_backEnd->wasChangedExternally() ); |
145 | } | 153 | } |
146 | 154 | ||
147 | 155 | ||
148 | void OContactAccess::copMessage( const QCString &msg, const QByteArray & ) | 156 | void OContactAccess::copMessage( const QCString &msg, const QByteArray & ) |
149 | { | 157 | { |
150 | if ( msg == "addressbookUpdated()" ){ | 158 | if ( msg == "addressbookUpdated()" ){ |
151 | qWarning ("OContactAccess: Received addressbokUpdated()"); | 159 | qWarning ("OContactAccess: Received addressbokUpdated()"); |
152 | emit signalChanged ( this ); | 160 | emit signalChanged ( this ); |
153 | } else if ( msg == "flush()" ) { | 161 | } else if ( msg == "flush()" ) { |
154 | qWarning ("OContactAccess: Received flush()"); | 162 | qWarning ("OContactAccess: Received flush()"); |
155 | save (); | 163 | save (); |
156 | } else if ( msg == "reload()" ) { | 164 | } else if ( msg == "reload()" ) { |
157 | qWarning ("OContactAccess: Received reload()"); | 165 | qWarning ("OContactAccess: Received reload()"); |
158 | reload (); | 166 | reload (); |
159 | emit signalChanged ( this ); | 167 | emit signalChanged ( this ); |
160 | } | 168 | } |
161 | } | 169 | } |