author | ulf69 <ulf69> | 2004-09-09 18:57:57 (UTC) |
---|---|---|
committer | ulf69 <ulf69> | 2004-09-09 18:57:57 (UTC) |
commit | 880518b6f1d4b06e3df45224c244d9c62f6fb7a9 (patch) (unidiff) | |
tree | 2b0b5a0c7e40481c31f29ff2bd98aa6abb4c6c90 /kabc/vcard21parser.h | |
parent | 72860f2b84ba97de9223238d9fb97edc0804cc68 (diff) | |
download | kdepimpi-880518b6f1d4b06e3df45224c244d9c62f6fb7a9.zip kdepimpi-880518b6f1d4b06e3df45224c244d9c62f6fb7a9.tar.gz kdepimpi-880518b6f1d4b06e3df45224c244d9c62f6fb7a9.tar.bz2 |
added sip type to phonnumbers
-rw-r--r-- | kabc/vcard21parser.h | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/kabc/vcard21parser.h b/kabc/vcard21parser.h index 24b0eb2..77e69b6 100644 --- a/kabc/vcard21parser.h +++ b/kabc/vcard21parser.h | |||
@@ -1,225 +1,226 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of libkabc. | 2 | This file is part of libkabc. |
3 | 3 | ||
4 | Copyright (c) 2002 Mark Westcott <mark@houseoffish.org> | 4 | Copyright (c) 2002 Mark Westcott <mark@houseoffish.org> |
5 | Copyright (c) 2000 George Staikos <staikos@kde.org> | 5 | Copyright (c) 2000 George Staikos <staikos@kde.org> |
6 | This library is free software; you can redistribute it and/or | 6 | This library is free software; you can redistribute it and/or |
7 | modify it under the terms of the GNU Library General Public | 7 | modify it under the terms of the GNU Library General Public |
8 | License as published by the Free Software Foundation; either | 8 | License as published by the Free Software Foundation; either |
9 | version 2 of the License, or (at your option) any later version. | 9 | version 2 of the License, or (at your option) any later version. |
10 | 10 | ||
11 | This library is distributed in the hope that it will be useful, | 11 | This library is distributed in the hope that it will be useful, |
12 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
14 | Library General Public License for more details. | 14 | Library General Public License for more details. |
15 | 15 | ||
16 | You should have received a copy of the GNU Library General Public License | 16 | You should have received a copy of the GNU Library General Public License |
17 | along with this library; see the file COPYING.LIB. If not, write to | 17 | along with this library; see the file COPYING.LIB. If not, write to |
18 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, | 18 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
19 | Boston, MA 02111-1307, USA. | 19 | Boston, MA 02111-1307, USA. |
20 | */ | 20 | */ |
21 | 21 | ||
22 | /* | 22 | /* |
23 | Enhanced Version of the file for platform independent KDE tools. | 23 | Enhanced Version of the file for platform independent KDE tools. |
24 | Copyright (c) 2004 Ulf Schenk | 24 | Copyright (c) 2004 Ulf Schenk |
25 | 25 | ||
26 | $Id$ | 26 | $Id$ |
27 | */ | 27 | */ |
28 | 28 | ||
29 | #ifndef KABC_VCARD21FORMAT_H | 29 | #ifndef KABC_VCARD21FORMAT_H |
30 | #define KABC_VCARD21FORMAT_H | 30 | #define KABC_VCARD21FORMAT_H |
31 | 31 | ||
32 | #include <qdatetime.h> | 32 | #include <qdatetime.h> |
33 | #include <kdebug.h> | 33 | #include <kdebug.h> |
34 | #include <qregexp.h> | 34 | #include <qregexp.h> |
35 | #include <qstring.h> | 35 | #include <qstring.h> |
36 | #include <kurl.h> | 36 | #include <kurl.h> |
37 | #include <qvaluelist.h> | 37 | #include <qvaluelist.h> |
38 | 38 | ||
39 | #include "addressee.h" | 39 | #include "addressee.h" |
40 | #include "addressbook.h" | 40 | #include "addressbook.h" |
41 | #include "phonenumber.h" | 41 | #include "phonenumber.h" |
42 | 42 | ||
43 | 43 | ||
44 | #define VCARD_BEGIN "begin:vcard" | 44 | #define VCARD_BEGIN "begin:vcard" |
45 | #define VCARD_END "end:vcard" | 45 | #define VCARD_END "end:vcard" |
46 | #define VCARD_BEGIN_N "begin" | 46 | #define VCARD_BEGIN_N "begin" |
47 | #define VCARD_END_N "end" | 47 | #define VCARD_END_N "end" |
48 | #define VCARD_VERSION "version" | 48 | #define VCARD_VERSION "version" |
49 | 49 | ||
50 | #define VCARD_FN "fn" | 50 | #define VCARD_FN "fn" |
51 | #define VCARD_N "n" | 51 | #define VCARD_N "n" |
52 | 52 | ||
53 | // optional | 53 | // optional |
54 | #define VCARD_NAME "name" | 54 | #define VCARD_NAME "name" |
55 | #define VCARD_NICKNAME "nickname" | 55 | #define VCARD_NICKNAME "nickname" |
56 | #define VCARD_PHOTO "photo" | 56 | #define VCARD_PHOTO "photo" |
57 | #define VCARD_BDAY "bday" | 57 | #define VCARD_BDAY "bday" |
58 | #define VCARD_ADR "adr" | 58 | #define VCARD_ADR "adr" |
59 | 59 | ||
60 | // types | 60 | // types |
61 | #define VCARD_ADR_DOM "dom" | 61 | #define VCARD_ADR_DOM "dom" |
62 | #define VCARD_ADR_INTL "intl" | 62 | #define VCARD_ADR_INTL "intl" |
63 | #define VCARD_ADR_POSTAL "postal" | 63 | #define VCARD_ADR_POSTAL "postal" |
64 | #define VCARD_ADR_PARCEL "parcel" | 64 | #define VCARD_ADR_PARCEL "parcel" |
65 | #define VCARD_ADR_HOME "home" | 65 | #define VCARD_ADR_HOME "home" |
66 | #define VCARD_ADR_WORK "work" | 66 | #define VCARD_ADR_WORK "work" |
67 | #define VCARD_ADR_PREF "pref" | 67 | #define VCARD_ADR_PREF "pref" |
68 | // values | 68 | // values |
69 | #define VCARD_ADR_POBOX "PO Box" | 69 | #define VCARD_ADR_POBOX "PO Box" |
70 | #define VCARD_ADR_EXTADR "Extended Address" | 70 | #define VCARD_ADR_EXTADR "Extended Address" |
71 | #define VCARD_ADR_STREET "Street" | 71 | #define VCARD_ADR_STREET "Street" |
72 | #define VCARD_ADR_LOCALITY "Locality" | 72 | #define VCARD_ADR_LOCALITY "Locality" |
73 | #define VCARD_ADR_REGION "Region" | 73 | #define VCARD_ADR_REGION "Region" |
74 | #define VCARD_ADR_POSTCODE "Postal Code" | 74 | #define VCARD_ADR_POSTCODE "Postal Code" |
75 | #define VCARD_ADR_COUNTRY "Country Name" | 75 | #define VCARD_ADR_COUNTRY "Country Name" |
76 | #define VCARD_LABEL "label" | 76 | #define VCARD_LABEL "label" |
77 | #define VCARD_PROFILE "profile" | 77 | #define VCARD_PROFILE "profile" |
78 | #define VCARD_SOURCE "source" | 78 | #define VCARD_SOURCE "source" |
79 | #define VCARD_TEL "tel" | 79 | #define VCARD_TEL "tel" |
80 | // types | 80 | // types |
81 | #define VCARD_TEL_HOME "home" | 81 | #define VCARD_TEL_HOME "home" |
82 | #define VCARD_TEL_WORK "work" | 82 | #define VCARD_TEL_WORK "work" |
83 | #define VCARD_TEL_PREF "pref" | 83 | #define VCARD_TEL_PREF "pref" |
84 | #define VCARD_TEL_VOICE "voice" | 84 | #define VCARD_TEL_VOICE "voice" |
85 | #define VCARD_TEL_FAX "fax" | 85 | #define VCARD_TEL_FAX "fax" |
86 | #define VCARD_TEL_MSG "msg" | 86 | #define VCARD_TEL_MSG "msg" |
87 | #define VCARD_TEL_CELL "cell" | 87 | #define VCARD_TEL_CELL "cell" |
88 | #define VCARD_TEL_PAGER "pager" | 88 | #define VCARD_TEL_PAGER "pager" |
89 | #define VCARD_TEL_BBS "bbs" | 89 | #define VCARD_TEL_BBS "bbs" |
90 | #define VCARD_TEL_MODEM "modem" | 90 | #define VCARD_TEL_MODEM "modem" |
91 | #define VCARD_TEL_CAR "car" | 91 | #define VCARD_TEL_CAR "car" |
92 | #define VCARD_TEL_ISDN "isdn" | 92 | #define VCARD_TEL_ISDN "isdn" |
93 | #define VCARD_TEL_VIDEO "video" | 93 | #define VCARD_TEL_VIDEO "video" |
94 | #define VCARD_TEL_PCS "pcs" | 94 | #define VCARD_TEL_PCS "pcs" |
95 | #define VCARD_TEL_SIP "sip" | ||
95 | #define VCARD_EMAIL "email" | 96 | #define VCARD_EMAIL "email" |
96 | // types | 97 | // types |
97 | #define VCARD_EMAIL_PREF "pref" | 98 | #define VCARD_EMAIL_PREF "pref" |
98 | #define VCARD_EMAIL_INTERNET "internet" | 99 | #define VCARD_EMAIL_INTERNET "internet" |
99 | #define VCARD_EMAIL_X400 "x400" | 100 | #define VCARD_EMAIL_X400 "x400" |
100 | #define VCARD_TZ "tz" | 101 | #define VCARD_TZ "tz" |
101 | #define VCARD_GEO "geo" | 102 | #define VCARD_GEO "geo" |
102 | #define VCARD_MAILER "mailer" | 103 | #define VCARD_MAILER "mailer" |
103 | #define VCARD_TITLE "title" | 104 | #define VCARD_TITLE "title" |
104 | #define VCARD_ROLE "role" | 105 | #define VCARD_ROLE "role" |
105 | #define VCARD_LOGO "logo" | 106 | #define VCARD_LOGO "logo" |
106 | #define VCARD_AGENT "agent" | 107 | #define VCARD_AGENT "agent" |
107 | #define VCARD_ORG "org" | 108 | #define VCARD_ORG "org" |
108 | #define VCARD_CATEGORIES "categories" | 109 | #define VCARD_CATEGORIES "categories" |
109 | #define VCARD_NOTE "note" | 110 | #define VCARD_NOTE "note" |
110 | #define VCARD_PRODID "prodid" | 111 | #define VCARD_PRODID "prodid" |
111 | #define VCARD_REV "rev" | 112 | #define VCARD_REV "rev" |
112 | #define VCARD_SOUND "sound" | 113 | #define VCARD_SOUND "sound" |
113 | #define VCARD_UID "uid" | 114 | #define VCARD_UID "uid" |
114 | #define VCARD_URL "url" | 115 | #define VCARD_URL "url" |
115 | #define VCARD_CLASS "class" | 116 | #define VCARD_CLASS "class" |
116 | #define VCARD_CLASS_PUBLIC "public" | 117 | #define VCARD_CLASS_PUBLIC "public" |
117 | #define VCARD_CLASS_PRIVATE "private" | 118 | #define VCARD_CLASS_PRIVATE "private" |
118 | #define VCARD_CLASS_CONFIDENTIAL "confidential" | 119 | #define VCARD_CLASS_CONFIDENTIAL "confidential" |
119 | #define VCARD_KEY "key" | 120 | #define VCARD_KEY "key" |
120 | // types | 121 | // types |
121 | #define VCARD_KEY_X509 "x509" | 122 | #define VCARD_KEY_X509 "x509" |
122 | #define VCARD_KEY_PGP "pgp" | 123 | #define VCARD_KEY_PGP "pgp" |
123 | 124 | ||
124 | #define VCARD_QUOTED_PRINTABLE "quoted-printable" | 125 | #define VCARD_QUOTED_PRINTABLE "quoted-printable" |
125 | // this one is a temporary hack until we support TYPE=VALUE | 126 | // this one is a temporary hack until we support TYPE=VALUE |
126 | #define VCARD_ENCODING_QUOTED_PRINTABLE "encoding=quoted-printable" | 127 | #define VCARD_ENCODING_QUOTED_PRINTABLE "encoding=quoted-printable" |
127 | #define VCARD_BASE64 "base64" | 128 | #define VCARD_BASE64 "base64" |
128 | 129 | ||
129 | #define VC_STATE_BEGIN 1 | 130 | #define VC_STATE_BEGIN 1 |
130 | #define VC_STATE_BODY 2 | 131 | #define VC_STATE_BODY 2 |
131 | #define VC_STATE_END 4 | 132 | #define VC_STATE_END 4 |
132 | #define VC_STATE_HAVE_N 8 | 133 | #define VC_STATE_HAVE_N 8 |
133 | #define VC_STATE_HAVE_VERSION 16 | 134 | #define VC_STATE_HAVE_VERSION 16 |
134 | 135 | ||
135 | #define VC_ERR_NO_BEGIN 1 | 136 | #define VC_ERR_NO_BEGIN 1 |
136 | #define VC_ERR_NO_END 2 | 137 | #define VC_ERR_NO_END 2 |
137 | #define VC_ERR_INVALID_LINE 3 | 138 | #define VC_ERR_INVALID_LINE 3 |
138 | #define VC_ERR_INTERNAL 4 | 139 | #define VC_ERR_INTERNAL 4 |
139 | #define VC_ERR_INVALID_NAME 5 | 140 | #define VC_ERR_INVALID_NAME 5 |
140 | #define VC_ERR_MISSING_MANDATORY 6 | 141 | #define VC_ERR_MISSING_MANDATORY 6 |
141 | 142 | ||
142 | namespace KABC { | 143 | namespace KABC { |
143 | 144 | ||
144 | class AddressBook; | 145 | class AddressBook; |
145 | 146 | ||
146 | class VCard21Parser | 147 | class VCard21Parser |
147 | { | 148 | { |
148 | public: | 149 | public: |
149 | 150 | ||
150 | /** | 151 | /** |
151 | * Constructor. | 152 | * Constructor. |
152 | */ | 153 | */ |
153 | VCard21Parser(); | 154 | VCard21Parser(); |
154 | 155 | ||
155 | /** | 156 | /** |
156 | * Destructor. | 157 | * Destructor. |
157 | */ | 158 | */ |
158 | virtual ~VCard21Parser(); | 159 | virtual ~VCard21Parser(); |
159 | 160 | ||
160 | /** | 161 | /** |
161 | * Parses a string in vcard2.1 format and saves the single addressees | 162 | * Parses a string in vcard2.1 format and saves the single addressees |
162 | * to the address book. | 163 | * to the address book. |
163 | * | 164 | * |
164 | * @param ab The address book. | 165 | * @param ab The address book. |
165 | * @param str The vcard string. | 166 | * @param str The vcard string. |
166 | */ | 167 | */ |
167 | void readFromString( KABC::AddressBook *ab, const QString &str ); | 168 | void readFromString( KABC::AddressBook *ab, const QString &str ); |
168 | 169 | ||
169 | /** | 170 | /** |
170 | * FIXME: we need a writeToString method | 171 | * FIXME: we need a writeToString method |
171 | * QString writeToString (KABC::AddressBook *); | 172 | * QString writeToString (KABC::AddressBook *); |
172 | */ | 173 | */ |
173 | 174 | ||
174 | /** | 175 | /** |
175 | * Parses a string in vcard2.1 format and returns the inherent addressee. | 176 | * Parses a string in vcard2.1 format and returns the inherent addressee. |
176 | */ | 177 | */ |
177 | KABC::Addressee readFromString( const QString &data); | 178 | KABC::Addressee readFromString( const QString &data); |
178 | 179 | ||
179 | /** | 180 | /** |
180 | * Helper method to store a address. | 181 | * Helper method to store a address. |
181 | * | 182 | * |
182 | * @param data A string list, that is filled with 'street', 'house number' ... | 183 | * @param data A string list, that is filled with 'street', 'house number' ... |
183 | * @param type The type of the returned address. | 184 | * @param type The type of the returned address. |
184 | */ | 185 | */ |
185 | static KABC::Address readAddressFromQStringList (const QStringList &data, const int type); | 186 | static KABC::Address readAddressFromQStringList (const QStringList &data, const int type); |
186 | }; | 187 | }; |
187 | 188 | ||
188 | } | 189 | } |
189 | 190 | ||
190 | /** | 191 | /** |
191 | * @short Helper class | 192 | * @short Helper class |
192 | */ | 193 | */ |
193 | class VCardLineX | 194 | class VCardLineX |
194 | { | 195 | { |
195 | public: | 196 | public: |
196 | QString name; | 197 | QString name; |
197 | bool qualified; | 198 | bool qualified; |
198 | QValueList<QString> qualifiers; | 199 | QValueList<QString> qualifiers; |
199 | QValueList<QString> parameters; | 200 | QValueList<QString> parameters; |
200 | bool isValid() const; | 201 | bool isValid() const; |
201 | }; | 202 | }; |
202 | 203 | ||
203 | /** | 204 | /** |
204 | * @short Helper class | 205 | * @short Helper class |
205 | */ | 206 | */ |
206 | class VCard21ParserImpl | 207 | class VCard21ParserImpl |
207 | { | 208 | { |
208 | friend class VCardLineX; | 209 | friend class VCardLineX; |
209 | 210 | ||
210 | public: | 211 | public: |
211 | VCard21ParserImpl() { }; | 212 | VCard21ParserImpl() { }; |
212 | virtual ~VCard21ParserImpl() { }; | 213 | virtual ~VCard21ParserImpl() { }; |
213 | static VCard21ParserImpl *parseVCard(const QString& vc, int *err = NULL); | 214 | static VCard21ParserImpl *parseVCard(const QString& vc, int *err = NULL); |
214 | QString getValue(const QString& name, const QString& qualifier); | 215 | QString getValue(const QString& name, const QString& qualifier); |
215 | QString getValue(const QString& name); | 216 | QString getValue(const QString& name); |
216 | QStringList getValues(const QString& name, const QString& qualifier); | 217 | QStringList getValues(const QString& name, const QString& qualifier); |
217 | QStringList getValues(const QString& name); | 218 | QStringList getValues(const QString& name); |
218 | 219 | ||
219 | QValueList<VCardLineX> *_vcdata; | 220 | QValueList<VCardLineX> *_vcdata; |
220 | 221 | ||
221 | private: | 222 | private: |
222 | VCard21ParserImpl (QValueList<VCardLineX> *_vcd); | 223 | VCard21ParserImpl (QValueList<VCardLineX> *_vcd); |
223 | }; | 224 | }; |
224 | 225 | ||
225 | #endif | 226 | #endif |