Diffstat (limited to 'libopie2/opiepim/backend/ocontactaccessbackend_vcard.h') (more/less context) (show whitespace changes)
-rw-r--r-- | libopie2/opiepim/backend/ocontactaccessbackend_vcard.h | 77 |
1 files changed, 33 insertions, 44 deletions
diff --git a/libopie2/opiepim/backend/ocontactaccessbackend_vcard.h b/libopie2/opiepim/backend/ocontactaccessbackend_vcard.h index 712d769..11be027 100644 --- a/libopie2/opiepim/backend/ocontactaccessbackend_vcard.h +++ b/libopie2/opiepim/backend/ocontactaccessbackend_vcard.h | |||
@@ -1,96 +1,85 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of the Opie Project | ||
3 | Copyright (C) The Main Author <main-author@whereever.org> | ||
4 | =. Copyright (C) The Opie Team <opie-devel@handhelds.org> | ||
5 | .=l. | ||
6 | .>+-= | ||
7 | _;:, .> :=|. This program is free software; you can | ||
8 | .> <`_, > . <= redistribute it and/or modify it under | ||
9 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public | ||
10 | .="- .-=="i, .._ License as published by the Free Software | ||
11 | - . .-<_> .<> Foundation; either version 2 of the License, | ||
12 | ._= =} : or (at your option) any later version. | ||
13 | .%`+i> _;_. | ||
14 | .i_,=:_. -<s. This program is distributed in the hope that | ||
15 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | ||
16 | : .. .:, . . . without even the implied warranty of | ||
17 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | ||
18 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU | ||
19 | ..}^=.= = ; Library General Public License for more | ||
20 | ++= -. .` .: details. | ||
21 | : = ...= . :.=- | ||
22 | -. .:....=;==+<; You should have received a copy of the GNU | ||
23 | -_. . . )=. = Library General Public License along with | ||
24 | -- :-=` this library; see the file COPYING.LIB. | ||
25 | If not, write to the Free Software Foundation, | ||
26 | Inc., 59 Temple Place - Suite 330, | ||
27 | Boston, MA 02111-1307, USA. | ||
28 | */ | ||
29 | /* | ||
2 | * VCard Backend for the OPIE-Contact Database. | 30 | * VCard Backend for the OPIE-Contact Database. |
3 | * | ||
4 | * Copyright (C) 2000 Trolltech AS. All rights reserved. | ||
5 | * Copyright (c) 2002 by Stefan Eilers (Eilers.Stefan@epost.de) | ||
6 | * | ||
7 | * ===================================================================== | ||
8 | *This program is free software; you can redistribute it and/or | ||
9 | *modify it under the terms of the GNU Library General Public | ||
10 | * License as published by the Free Software Foundation; either | ||
11 | * version 2 of the License, or (at your option) any later version. | ||
12 | * ===================================================================== | ||
13 | * ToDo: | ||
14 | * | ||
15 | * ===================================================================== | ||
16 | * Version: $Id$ | ||
17 | * ===================================================================== | ||
18 | * History: | ||
19 | * $Log$ | ||
20 | * Revision 1.6 2003/04/13 18:07:10 zecke | ||
21 | * More API doc | ||
22 | * QString -> const QString& | ||
23 | * QString = 0l -> QString::null | ||
24 | * | ||
25 | * Revision 1.5 2003/03/21 10:33:09 eilers | ||
26 | * Merged speed optimized xml backend for contacts to main. | ||
27 | * Added QDateTime to querybyexample. For instance, it is now possible to get | ||
28 | * all Birthdays/Anniversaries between two dates. This should be used | ||
29 | * to show all birthdays in the datebook.. | ||
30 | * This change is sourcecode backward compatible but you have to upgrade | ||
31 | * the binaries for today-addressbook. | ||
32 | * | ||
33 | * Revision 1.4 2002/12/07 13:26:22 eilers | ||
34 | * Fixing bug in storing anniversary.. | ||
35 | * | ||
36 | * Revision 1.3 2002/11/13 14:14:51 eilers | ||
37 | * Added sorted for Contacts.. | ||
38 | * | ||
39 | * Revision 1.2 2002/11/10 15:41:53 eilers | ||
40 | * Bugfixes.. | ||
41 | * | ||
42 | * Revision 1.1 2002/11/09 14:34:52 eilers | ||
43 | * Added VCard Backend. | ||
44 | * | ||
45 | */ | 31 | */ |
46 | #ifndef __OCONTACTACCESSBACKEND_VCARD_H_ | 32 | #ifndef __OCONTACTACCESSBACKEND_VCARD_H_ |
47 | #define __OCONTACTACCESSBACKEND_VCARD_H_ | 33 | #define __OCONTACTACCESSBACKEND_VCARD_H_ |
48 | 34 | ||
49 | #include <opie/ocontact.h> | 35 | #include <opie2/ocontact.h> |
50 | 36 | ||
51 | #include "ocontactaccessbackend.h" | 37 | #include <opie2/ocontactaccessbackend.h> |
52 | 38 | ||
53 | class VObject; | 39 | class VObject; |
54 | 40 | ||
41 | namespace Opie { | ||
55 | /** | 42 | /** |
56 | * This is the vCard 2.1 implementation of the Contact Storage | 43 | * This is the vCard 2.1 implementation of the Contact Storage |
57 | * @see OContactAccessBackend_XML | 44 | * @see OContactAccessBackend_XML |
58 | * @see OPimAccessBackend | 45 | * @see OPimAccessBackend |
59 | */ | 46 | */ |
60 | class OContactAccessBackend_VCard : public OContactAccessBackend { | 47 | class OContactAccessBackend_VCard : public OContactAccessBackend { |
61 | public: | 48 | public: |
62 | OContactAccessBackend_VCard ( const QString& appname, const QString& filename = QString::null ); | 49 | OContactAccessBackend_VCard ( const QString& appname, const QString& filename = QString::null ); |
63 | 50 | ||
64 | bool load (); | 51 | bool load (); |
65 | bool reload(); | 52 | bool reload(); |
66 | bool save(); | 53 | bool save(); |
67 | void clear (); | 54 | void clear (); |
68 | 55 | ||
69 | bool add ( const OContact& newcontact ); | 56 | bool add ( const OContact& newcontact ); |
70 | bool remove ( int uid ); | 57 | bool remove ( int uid ); |
71 | bool replace ( const OContact& contact ); | 58 | bool replace ( const OContact& contact ); |
72 | 59 | ||
73 | OContact find ( int uid ) const; | 60 | OContact find ( int uid ) const; |
74 | QArray<int> allRecords() const; | 61 | QArray<int> allRecords() const; |
75 | QArray<int> queryByExample ( const OContact &query, int settings, const QDateTime& d = QDateTime() ); | 62 | QArray<int> queryByExample ( const OContact &query, int settings, const QDateTime& d = QDateTime() ); |
76 | QArray<int> matchRegexp( const QRegExp &r ) const; | 63 | QArray<int> matchRegexp( const QRegExp &r ) const; |
77 | 64 | ||
78 | const uint querySettings(); | 65 | const uint querySettings(); |
79 | bool hasQuerySettings (uint querySettings) const; | 66 | bool hasQuerySettings (uint querySettings) const; |
80 | QArray<int> sorted( bool ascending, int sortOrder, int sortFilter, int cat ); | 67 | QArray<int> sorted( bool ascending, int sortOrder, int sortFilter, int cat ); |
81 | bool wasChangedExternally(); | 68 | bool wasChangedExternally(); |
82 | 69 | ||
83 | private: | 70 | private: |
84 | OContact parseVObject( VObject* obj ); | 71 | OContact parseVObject( VObject* obj ); |
85 | VObject* createVObject( const OContact& c ); | 72 | VObject* createVObject( const OContact& c ); |
86 | QString convDateToVCardDate( const QDate& c ) const; | 73 | QString convDateToVCardDate( const QDate& c ) const; |
87 | QDate convVCardDateToDate( const QString& datestr ); | 74 | QDate convVCardDateToDate( const QString& datestr ); |
88 | VObject *safeAddPropValue( VObject *o, const char* prop, const QString& value ); | 75 | VObject *safeAddPropValue( VObject *o, const char* prop, const QString& value ); |
89 | VObject *safeAddProp( VObject* o, const char* prop); | 76 | VObject *safeAddProp( VObject* o, const char* prop); |
90 | 77 | ||
91 | bool m_dirty : 1; | 78 | bool m_dirty : 1; |
92 | QString m_file; | 79 | QString m_file; |
93 | QMap<int, OContact> m_map; | 80 | QMap<int, OContact> m_map; |
94 | }; | 81 | }; |
95 | 82 | ||
83 | } | ||
84 | |||
96 | #endif | 85 | #endif |