-rw-r--r-- | kabc/vcardformatimpl.h | 112 |
1 files changed, 112 insertions, 0 deletions
diff --git a/kabc/vcardformatimpl.h b/kabc/vcardformatimpl.h new file mode 100644 index 0000000..2dd68d9 --- a/dev/null +++ b/kabc/vcardformatimpl.h | |||
@@ -0,0 +1,112 @@ | |||
1 | /* | ||
2 | This file is part of libkabc. | ||
3 | Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org> | ||
4 | |||
5 | This library is free software; you can redistribute it and/or | ||
6 | modify it under the terms of the GNU Library General Public | ||
7 | License as published by the Free Software Foundation; either | ||
8 | version 2 of the License, or (at your option) any later version. | ||
9 | |||
10 | This library is distributed in the hope that it will be useful, | ||
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
13 | Library General Public License for more details. | ||
14 | |||
15 | You should have received a copy of the GNU Library General Public License | ||
16 | along with this library; see the file COPYING.LIB. If not, write to | ||
17 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, | ||
18 | Boston, MA 02111-1307, USA. | ||
19 | */ | ||
20 | |||
21 | /* | ||
22 | Enhanced Version of the file for platform independent KDE tools. | ||
23 | Copyright (c) 2004 Ulf Schenk | ||
24 | |||
25 | $Id$ | ||
26 | */ | ||
27 | |||
28 | #ifndef KABC_VCARDFORMATIMPL_H | ||
29 | #define KABC_VCARDFORMATIMPL_H | ||
30 | |||
31 | #include <qstring.h> | ||
32 | #include <qfile.h> | ||
33 | |||
34 | #include "address.h" | ||
35 | #include "addressee.h" | ||
36 | |||
37 | #include <VCard.h> | ||
38 | |||
39 | namespace KABC { | ||
40 | |||
41 | class AddressBook; | ||
42 | |||
43 | /** | ||
44 | @short Implementation of vCard backend for address book. | ||
45 | |||
46 | This class implements reading and writing of address book information using | ||
47 | the vCard format. It requires the vCard lib from kdepim. | ||
48 | */ | ||
49 | class VCardFormatImpl | ||
50 | { | ||
51 | public: | ||
52 | bool load( Addressee &, QFile *file ); | ||
53 | bool loadAll( AddressBook *, Resource *, QFile *file ); | ||
54 | void save( const Addressee &, QFile *file ); | ||
55 | void saveAll( AddressBook *, Resource *, QFile *file ); | ||
56 | |||
57 | bool readFromString( const QString &vcard, Addressee &addr ); | ||
58 | bool writeToString( const Addressee &addressee, QString &vcard ); | ||
59 | |||
60 | protected: | ||
61 | bool loadAddressee( Addressee &, VCARD::VCard & ); | ||
62 | void saveAddressee( const Addressee &, VCARD::VCard *, bool intern ); | ||
63 | |||
64 | void addTextValue (VCARD::VCard *, VCARD::EntityType, const QString & ); | ||
65 | QString readTextValue( VCARD::ContentLine * ); | ||
66 | |||
67 | void addDateValue( VCARD::VCard *, VCARD::EntityType, const QDate & ); | ||
68 | QDate readDateValue( VCARD::ContentLine * ); | ||
69 | |||
70 | void addDateTimeValue( VCARD::VCard *, VCARD::EntityType, const QDateTime & ); | ||
71 | QDateTime readDateTimeValue( VCARD::ContentLine * ); | ||
72 | |||
73 | void addAddressValue( VCARD::VCard *, const Address & ); | ||
74 | Address readAddressValue( VCARD::ContentLine * ); | ||
75 | |||
76 | void addLabelValue( VCARD::VCard *, const Address & ); | ||
77 | |||
78 | void addTelephoneValue( VCARD::VCard *, const PhoneNumber & ); | ||
79 | PhoneNumber readTelephoneValue( VCARD::ContentLine * ); | ||
80 | |||
81 | void addNValue( VCARD::VCard *, const Addressee & ); | ||
82 | void readNValue( VCARD::ContentLine *, Addressee & ); | ||
83 | |||
84 | void addCustomValue( VCARD::VCard *, const QString & ); | ||
85 | |||
86 | void addAddressParam( VCARD::ContentLine *, int ); | ||
87 | int readAddressParam( VCARD::ContentLine * ); | ||
88 | |||
89 | void addGeoValue( VCARD::VCard *, const Geo & ); | ||
90 | Geo readGeoValue( VCARD::ContentLine * ); | ||
91 | |||
92 | void addUTCValue( VCARD::VCard *, const TimeZone & ); | ||
93 | TimeZone readUTCValue( VCARD::ContentLine * ); | ||
94 | |||
95 | void addClassValue( VCARD::VCard *, const Secrecy & ); | ||
96 | Secrecy readClassValue( VCARD::ContentLine * ); | ||
97 | |||
98 | void addKeyValue( VCARD::VCard *, const Key & ); | ||
99 | Key readKeyValue( VCARD::ContentLine * ); | ||
100 | |||
101 | void addPictureValue( VCARD::VCard *, VCARD::EntityType, const Picture &, const Addressee &, bool ); | ||
102 | Picture readPictureValue( VCARD::ContentLine *, VCARD::EntityType, const Addressee &addr ); | ||
103 | |||
104 | void addSoundValue( VCARD::VCard *, const Sound &, const Addressee &, bool ); | ||
105 | Sound readSoundValue( VCARD::ContentLine *, const Addressee &addr ); | ||
106 | |||
107 | void addAgentValue( VCARD::VCard *, const Agent & ); | ||
108 | Agent readAgentValue( VCARD::ContentLine * ); | ||
109 | }; | ||
110 | |||
111 | } | ||
112 | #endif | ||