-rw-r--r-- | kabc/address.h | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/kabc/address.h b/kabc/address.h index ad132a7..6b53c7e 100644 --- a/kabc/address.h +++ b/kabc/address.h | |||
@@ -14,192 +14,193 @@ | |||
14 | 14 | ||
15 | You should have received a copy of the GNU Library General Public License | 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 | 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, | 17 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
18 | Boston, MA 02111-1307, USA. | 18 | Boston, MA 02111-1307, USA. |
19 | */ | 19 | */ |
20 | 20 | ||
21 | /* | 21 | /* |
22 | Enhanced Version of the file for platform independent KDE tools. | 22 | Enhanced Version of the file for platform independent KDE tools. |
23 | Copyright (c) 2004 Ulf Schenk | 23 | Copyright (c) 2004 Ulf Schenk |
24 | 24 | ||
25 | $Id$ | 25 | $Id$ |
26 | */ | 26 | */ |
27 | 27 | ||
28 | #ifndef KABC_ADDRESS_H | 28 | #ifndef KABC_ADDRESS_H |
29 | #define KABC_ADDRESS_H | 29 | #define KABC_ADDRESS_H |
30 | 30 | ||
31 | #include <qmap.h> | 31 | #include <qmap.h> |
32 | #include <qstring.h> | 32 | #include <qstring.h> |
33 | #include <qvaluelist.h> | 33 | #include <qvaluelist.h> |
34 | 34 | ||
35 | // template tags for address formatting localization | 35 | // template tags for address formatting localization |
36 | #define KABC_FMTTAG_realname QString("%n") | 36 | #define KABC_FMTTAG_realname QString("%n") |
37 | #define KABC_FMTTAG_REALNAME QString("%N") | 37 | #define KABC_FMTTAG_REALNAME QString("%N") |
38 | #define KABC_FMTTAG_company QString("%cm") | 38 | #define KABC_FMTTAG_company QString("%cm") |
39 | #define KABC_FMTTAG_COMPANY QString("%CM") | 39 | #define KABC_FMTTAG_COMPANY QString("%CM") |
40 | #define KABC_FMTTAG_pobox QString("%p") | 40 | #define KABC_FMTTAG_pobox QString("%p") |
41 | #define KABC_FMTTAG_street QString("%s") | 41 | #define KABC_FMTTAG_street QString("%s") |
42 | #define KABC_FMTTAG_STREET QString("%S") | 42 | #define KABC_FMTTAG_STREET QString("%S") |
43 | #define KABC_FMTTAG_zipcode QString("%z") | 43 | #define KABC_FMTTAG_zipcode QString("%z") |
44 | #define KABC_FMTTAG_location QString("%l") | 44 | #define KABC_FMTTAG_location QString("%l") |
45 | #define KABC_FMTTAG_LOCATION QString("%L") | 45 | #define KABC_FMTTAG_LOCATION QString("%L") |
46 | #define KABC_FMTTAG_region QString("%r") | 46 | #define KABC_FMTTAG_region QString("%r") |
47 | #define KABC_FMTTAG_REGION QString("%R") | 47 | #define KABC_FMTTAG_REGION QString("%R") |
48 | #define KABC_FMTTAG_newline QString("\\n") | 48 | #define KABC_FMTTAG_newline QString("\\n") |
49 | #define KABC_FMTTAG_condcomma QString("%,") | 49 | #define KABC_FMTTAG_condcomma QString("%,") |
50 | #define KABC_FMTTAG_condwhite QString("%w") | 50 | #define KABC_FMTTAG_condwhite QString("%w") |
51 | #define KABC_FMTTAG_purgeempty QString("%0") | 51 | #define KABC_FMTTAG_purgeempty QString("%0") |
52 | 52 | ||
53 | namespace KABC { | 53 | namespace KABC { |
54 | 54 | ||
55 | /** | 55 | /** |
56 | @short Postal address information. | 56 | @short Postal address information. |
57 | 57 | ||
58 | This class represents information about a postal address. | 58 | This class represents information about a postal address. |
59 | */ | 59 | */ |
60 | class Address | 60 | class Address |
61 | { | 61 | { |
62 | friend QDataStream &operator<<( QDataStream &, const Address & ); | 62 | friend QDataStream &operator<<( QDataStream &, const Address & ); |
63 | friend QDataStream &operator>>( QDataStream &, Address & ); | 63 | friend QDataStream &operator>>( QDataStream &, Address & ); |
64 | 64 | ||
65 | public: | 65 | public: |
66 | /** | 66 | /** |
67 | List of addresses. | 67 | List of addresses. |
68 | */ | 68 | */ |
69 | typedef QValueList<Address> List; | 69 | typedef QValueList<Address> List; |
70 | typedef QValueList<int> TypeList; | 70 | typedef QValueList<int> TypeList; |
71 | 71 | ||
72 | /** | 72 | /** |
73 | Address types: | 73 | Address types: |
74 | 74 | ||
75 | @li @p Dom - domestic | 75 | @li @p Dom - domestic |
76 | @li @p Intl - international | 76 | @li @p Intl - international |
77 | @li @p Postal - postal | 77 | @li @p Postal - postal |
78 | @li @p Parcel - parcel | 78 | @li @p Parcel - parcel |
79 | @li @p Home - home address | 79 | @li @p Home - home address |
80 | @li @p Work - address at work | 80 | @li @p Work - address at work |
81 | @li @p Pref - preferred address | 81 | @li @p Pref - preferred address |
82 | */ | 82 | */ |
83 | enum Type { Dom = 1, Intl = 2, Postal = 4, Parcel = 8, Home = 16, Work = 32, | 83 | enum Type { Dom = 1, Intl = 2, Postal = 4, Parcel = 8, Home = 16, Work = 32, |
84 | Pref = 64 }; | 84 | Pref = 64 }; |
85 | 85 | ||
86 | /** | 86 | /** |
87 | Constructor that creates an empty Address, which is initialized | 87 | Constructor that creates an empty Address, which is initialized |
88 | with a unique id (see @ref id()). | 88 | with a unique id (see @ref id()). |
89 | */ | 89 | */ |
90 | Address(); | 90 | Address(); |
91 | 91 | ||
92 | /** | 92 | /** |
93 | This is like @ref Address() just above, with the difference | 93 | This is like @ref Address() just above, with the difference |
94 | that you can specify the type. | 94 | that you can specify the type. |
95 | */ | 95 | */ |
96 | Address( int ); | 96 | Address( int ); |
97 | 97 | ||
98 | bool operator==( const Address & ) const; | 98 | bool operator==( const Address & ) const; |
99 | bool operator!=( const Address & ) const; | 99 | bool operator!=( const Address & ) const; |
100 | 100 | ||
101 | /** | 101 | /** |
102 | Returns true, if the address is empty. | 102 | Returns true, if the address is empty. |
103 | */ | 103 | */ |
104 | bool isEmpty() const; | 104 | bool isEmpty() const; |
105 | 105 | ||
106 | /** | 106 | /** |
107 | Clears all entries of the address. | 107 | Clears all entries of the address. |
108 | */ | 108 | */ |
109 | void clear(); | 109 | void clear(); |
110 | QStringList asList(); | ||
110 | 111 | ||
111 | /** | 112 | /** |
112 | Sets the unique id. | 113 | Sets the unique id. |
113 | */ | 114 | */ |
114 | void setId( const QString & ); | 115 | void setId( const QString & ); |
115 | 116 | ||
116 | /* | 117 | /* |
117 | Returns the unique id. | 118 | Returns the unique id. |
118 | */ | 119 | */ |
119 | QString id() const; | 120 | QString id() const; |
120 | 121 | ||
121 | /** | 122 | /** |
122 | Sets the type of address. See enum for definiton of types. | 123 | Sets the type of address. See enum for definiton of types. |
123 | 124 | ||
124 | @param type type, can be a bitwise or of multiple types. | 125 | @param type type, can be a bitwise or of multiple types. |
125 | */ | 126 | */ |
126 | void setType( int type ); | 127 | void setType( int type ); |
127 | 128 | ||
128 | /** | 129 | /** |
129 | Returns the type of address. Can be a bitwise or of multiple types. | 130 | Returns the type of address. Can be a bitwise or of multiple types. |
130 | */ | 131 | */ |
131 | int type() const; | 132 | int type() const; |
132 | 133 | ||
133 | /** | 134 | /** |
134 | Returns a translated string of all types the address has. | 135 | Returns a translated string of all types the address has. |
135 | */ | 136 | */ |
136 | QString typeLabel() const; | 137 | QString typeLabel() const; |
137 | 138 | ||
138 | /** | 139 | /** |
139 | Sets the post office box. | 140 | Sets the post office box. |
140 | */ | 141 | */ |
141 | void setPostOfficeBox( const QString & ); | 142 | void setPostOfficeBox( const QString & ); |
142 | 143 | ||
143 | /** | 144 | /** |
144 | Returns the post office box. | 145 | Returns the post office box. |
145 | */ | 146 | */ |
146 | QString postOfficeBox() const; | 147 | QString postOfficeBox() const; |
147 | 148 | ||
148 | /** | 149 | /** |
149 | Returns the translated label for post office box field. | 150 | Returns the translated label for post office box field. |
150 | */ | 151 | */ |
151 | static QString postOfficeBoxLabel(); | 152 | static QString postOfficeBoxLabel(); |
152 | 153 | ||
153 | /** | 154 | /** |
154 | Sets the extended address information. | 155 | Sets the extended address information. |
155 | */ | 156 | */ |
156 | void setExtended( const QString & ); | 157 | void setExtended( const QString & ); |
157 | 158 | ||
158 | /** | 159 | /** |
159 | Returns the extended address information. | 160 | Returns the extended address information. |
160 | */ | 161 | */ |
161 | QString extended() const; | 162 | QString extended() const; |
162 | 163 | ||
163 | /** | 164 | /** |
164 | Returns the translated label for extended field. | 165 | Returns the translated label for extended field. |
165 | */ | 166 | */ |
166 | static QString extendedLabel(); | 167 | static QString extendedLabel(); |
167 | 168 | ||
168 | /** | 169 | /** |
169 | Sets the street (including number). | 170 | Sets the street (including number). |
170 | */ | 171 | */ |
171 | void setStreet( const QString & ); | 172 | void setStreet( const QString & ); |
172 | 173 | ||
173 | /** | 174 | /** |
174 | Returns the street. | 175 | Returns the street. |
175 | */ | 176 | */ |
176 | QString street() const; | 177 | QString street() const; |
177 | 178 | ||
178 | /** | 179 | /** |
179 | Returns the translated label for street field. | 180 | Returns the translated label for street field. |
180 | */ | 181 | */ |
181 | static QString streetLabel(); | 182 | static QString streetLabel(); |
182 | 183 | ||
183 | /** | 184 | /** |
184 | Sets the locality, e.g. city. | 185 | Sets the locality, e.g. city. |
185 | */ | 186 | */ |
186 | void setLocality( const QString & ); | 187 | void setLocality( const QString & ); |
187 | 188 | ||
188 | /** | 189 | /** |
189 | Returns the locality. | 190 | Returns the locality. |
190 | */ | 191 | */ |
191 | QString locality() const; | 192 | QString locality() const; |
192 | 193 | ||
193 | /** | 194 | /** |
194 | Returns the translated label for locality field. | 195 | Returns the translated label for locality field. |
195 | */ | 196 | */ |
196 | static QString localityLabel(); | 197 | static QString localityLabel(); |
197 | 198 | ||
198 | /** | 199 | /** |
199 | Sets the region, e.g. state. | 200 | Sets the region, e.g. state. |
200 | */ | 201 | */ |
201 | void setRegion( const QString & ); | 202 | void setRegion( const QString & ); |
202 | 203 | ||
203 | /** | 204 | /** |
204 | Returns the region. | 205 | Returns the region. |
205 | */ | 206 | */ |