summaryrefslogtreecommitdiff
path: root/noncore/unsupported/libopie/pim/ocontactaccessbackend_vcard.h
Unidiff
Diffstat (limited to 'noncore/unsupported/libopie/pim/ocontactaccessbackend_vcard.h') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/unsupported/libopie/pim/ocontactaccessbackend_vcard.h99
1 files changed, 99 insertions, 0 deletions
diff --git a/noncore/unsupported/libopie/pim/ocontactaccessbackend_vcard.h b/noncore/unsupported/libopie/pim/ocontactaccessbackend_vcard.h
new file mode 100644
index 0000000..6dbc718
--- a/dev/null
+++ b/noncore/unsupported/libopie/pim/ocontactaccessbackend_vcard.h
@@ -0,0 +1,99 @@
1/*
2 * 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.1 2004/11/16 21:46:07 mickeyl
21 * libopie1 goes into unsupported
22 *
23 * Revision 1.6 2003/04/13 18:07:10 zecke
24 * More API doc
25 * QString -> const QString&
26 * QString = 0l -> QString::null
27 *
28 * Revision 1.5 2003/03/21 10:33:09 eilers
29 * Merged speed optimized xml backend for contacts to main.
30 * Added QDateTime to querybyexample. For instance, it is now possible to get
31 * all Birthdays/Anniversaries between two dates. This should be used
32 * to show all birthdays in the datebook..
33 * This change is sourcecode backward compatible but you have to upgrade
34 * the binaries for today-addressbook.
35 *
36 * Revision 1.4 2002/12/07 13:26:22 eilers
37 * Fixing bug in storing anniversary..
38 *
39 * Revision 1.3 2002/11/13 14:14:51 eilers
40 * Added sorted for Contacts..
41 *
42 * Revision 1.2 2002/11/10 15:41:53 eilers
43 * Bugfixes..
44 *
45 * Revision 1.1 2002/11/09 14:34:52 eilers
46 * Added VCard Backend.
47 *
48 */
49#ifndef __OCONTACTACCESSBACKEND_VCARD_H_
50#define __OCONTACTACCESSBACKEND_VCARD_H_
51
52#include <opie/ocontact.h>
53
54#include "ocontactaccessbackend.h"
55
56class VObject;
57
58/**
59 * This is the vCard 2.1 implementation of the Contact Storage
60 * @see OContactAccessBackend_XML
61 * @see OPimAccessBackend
62 */
63class OContactAccessBackend_VCard : public OContactAccessBackend {
64 public:
65 OContactAccessBackend_VCard ( const QString& appname, const QString& filename = QString::null );
66
67 bool load ();
68 bool reload();
69 bool save();
70 void clear ();
71
72 bool add ( const OContact& newcontact );
73 bool remove ( int uid );
74 bool replace ( const OContact& contact );
75
76 OContact find ( int uid ) const;
77 QArray<int> allRecords() const;
78 QArray<int> queryByExample ( const OContact &query, int settings, const QDateTime& d = QDateTime() );
79 QArray<int> matchRegexp( const QRegExp &r ) const;
80
81 const uint querySettings();
82 bool hasQuerySettings (uint querySettings) const;
83 QArray<int> sorted( bool ascending, int sortOrder, int sortFilter, int cat );
84 bool wasChangedExternally();
85
86private:
87 OContact parseVObject( VObject* obj );
88 VObject* createVObject( const OContact& c );
89 QString convDateToVCardDate( const QDate& c ) const;
90 QDate convVCardDateToDate( const QString& datestr );
91 VObject *safeAddPropValue( VObject *o, const char* prop, const QString& value );
92 VObject *safeAddProp( VObject* o, const char* prop);
93
94 bool m_dirty : 1;
95 QString m_file;
96 QMap<int, OContact> m_map;
97};
98
99#endif