author | zautrix <zautrix> | 2004-06-26 19:01:18 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2004-06-26 19:01:18 (UTC) |
commit | b9aad1f15dc600e4dbe4c62d3fcced6363188ba3 (patch) (unidiff) | |
tree | 2c3d4004fb21c72cba65793859f9bcd8ffd3a49c /kabc/vcardconverter.h | |
download | kdepimpi-b9aad1f15dc600e4dbe4c62d3fcced6363188ba3.zip kdepimpi-b9aad1f15dc600e4dbe4c62d3fcced6363188ba3.tar.gz kdepimpi-b9aad1f15dc600e4dbe4c62d3fcced6363188ba3.tar.bz2 |
Initial revision
-rw-r--r-- | kabc/vcardconverter.h | 120 |
1 files changed, 120 insertions, 0 deletions
diff --git a/kabc/vcardconverter.h b/kabc/vcardconverter.h new file mode 100644 index 0000000..52259fc --- a/dev/null +++ b/kabc/vcardconverter.h | |||
@@ -0,0 +1,120 @@ | |||
1 | /* | ||
2 | This file is part of libkabc. | ||
3 | Copyright (c) 2002 Tobias Koenig <tokoe@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_VCARDCONVERTER_H | ||
29 | #define KABC_VCARDCONVERTER_H | ||
30 | |||
31 | #include <qstring.h> | ||
32 | |||
33 | #include "addressee.h" | ||
34 | |||
35 | namespace KABC { | ||
36 | |||
37 | /** | ||
38 | * Class to convert a vcard string to a addressee and vice versa. | ||
39 | * At the moment there exists read support for vCard2.1 and vCard3.0 | ||
40 | * and write support for vCard3.0 | ||
41 | */ | ||
42 | class VCardConverter | ||
43 | { | ||
44 | public: | ||
45 | |||
46 | /** | ||
47 | * @li v2_1 - VCard format version 2.1 | ||
48 | * @li v3_0 - VCard format version 3.0 | ||
49 | */ | ||
50 | enum Version | ||
51 | { | ||
52 | v2_1, | ||
53 | v3_0 | ||
54 | }; | ||
55 | |||
56 | /** | ||
57 | * Constructor. | ||
58 | */ | ||
59 | VCardConverter(); | ||
60 | |||
61 | /** | ||
62 | * Destructor. | ||
63 | */ | ||
64 | ~VCardConverter(); | ||
65 | |||
66 | /** | ||
67 | * Converts a vcard string to an addressee. | ||
68 | * | ||
69 | * @param str The vcard string. | ||
70 | * @param addr The addressee. | ||
71 | * @param version The version of the vcard string. | ||
72 | */ | ||
73 | bool vCardToAddressee( const QString &str, Addressee &addr, Version version = v3_0 ); | ||
74 | |||
75 | /** | ||
76 | * Converts an addressee to a vcard string. | ||
77 | * | ||
78 | * @param addr The addressee. | ||
79 | * @param str The vcard string. | ||
80 | * @param version The version of the vcard string. | ||
81 | */ | ||
82 | bool addresseeToVCard( const Addressee &addr, QString &str, Version version = v3_0 ); | ||
83 | |||
84 | private: | ||
85 | struct VCardConverterData; | ||
86 | VCardConverterData *d; | ||
87 | }; | ||
88 | |||
89 | |||
90 | /** | ||
91 | Helper functions | ||
92 | */ | ||
93 | |||
94 | /** | ||
95 | * Converts a QDateTime to a date string as it is used in VCard and LDIF files. | ||
96 | * The return value is in the form "yyyyMMddThhmmssZ" (e.g. "20031201T120000Z") | ||
97 | * @param dateTime date and time to be converted | ||
98 | * @since 3.2 | ||
99 | */ | ||
100 | QString dateToVCardString( const QDateTime &dateTime ); | ||
101 | |||
102 | /** | ||
103 | * Converts a QDate to a short date string as it is used in VCard and LDIF files. | ||
104 | * The return value is in the form "yyyyMMdd" (e.g. "20031201") | ||
105 | * @param date date to be converted | ||
106 | * @since 3.2 | ||
107 | */ | ||
108 | QString dateToVCardString( const QDate &date ); | ||
109 | |||
110 | /** | ||
111 | * Converts a date string as it is used in VCard and LDIF files to a QDateTime value. | ||
112 | * If the date string does not contain a time value, it will be returned as 00:00:00. | ||
113 | * (e.g. "20031201T120000" will return a QDateTime for 2003-12-01 at 12:00) | ||
114 | * @param dateString string representing the date and time. | ||
115 | * @since 3.2 | ||
116 | */ | ||
117 | QDateTime VCardStringToDate( const QString &dateString ); | ||
118 | |||
119 | } | ||
120 | #endif | ||