summaryrefslogtreecommitdiff
path: root/libopie2
Unidiff
Diffstat (limited to 'libopie2') (more/less context) (ignore whitespace changes)
-rw-r--r--libopie2/opiepim/ocontact.h26
1 files changed, 26 insertions, 0 deletions
diff --git a/libopie2/opiepim/ocontact.h b/libopie2/opiepim/ocontact.h
index 81ac1c1..9643e8b 100644
--- a/libopie2/opiepim/ocontact.h
+++ b/libopie2/opiepim/ocontact.h
@@ -1,238 +1,264 @@
1/********************************************************************** 1/**********************************************************************
2** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. 2** Copyright (C) 2000-2002 Trolltech AS. All rights reserved.
3** Copyright (C) 2002 by Stefan Eilers (eilers.stefan@epost.de) 3** Copyright (C) 2002 by Stefan Eilers (eilers.stefan@epost.de)
4** 4**
5** This file is part of the Qtopia Environment. 5** This file is part of the Qtopia Environment.
6** 6**
7** This file may be distributed and/or modified under the terms of the 7** This file may be distributed and/or modified under the terms of the
8** GNU General Public License version 2 as published by the Free Software 8** GNU General Public License version 2 as published by the Free Software
9** Foundation and appearing in the file LICENSE.GPL included in the 9** Foundation and appearing in the file LICENSE.GPL included in the
10** packaging of this file. 10** packaging of this file.
11** 11**
12** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 12** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
13** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 13** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
14** 14**
15** See http://www.trolltech.com/gpl/ for GPL licensing information. 15** See http://www.trolltech.com/gpl/ for GPL licensing information.
16** 16**
17** Contact info@trolltech.com if any conditions of this licensing are 17** Contact info@trolltech.com if any conditions of this licensing are
18** not clear to you. 18** not clear to you.
19** 19**
20**********************************************************************/ 20**********************************************************************/
21 21
22#ifndef __OCONTACT_H__ 22#ifndef __OCONTACT_H__
23#define __OCONTACT_H__ 23#define __OCONTACT_H__
24 24
25#include <opie/opimrecord.h> 25#include <opie/opimrecord.h>
26#include <qpe/recordfields.h> 26#include <qpe/recordfields.h>
27 27
28#include <qdatetime.h> 28#include <qdatetime.h>
29#include <qstringlist.h> 29#include <qstringlist.h>
30 30
31#if defined(QPC_TEMPLATEDLL) 31#if defined(QPC_TEMPLATEDLL)
32// MOC_SKIP_BEGIN 32// MOC_SKIP_BEGIN
33QPC_TEMPLATEEXTERN template class QPC_EXPORT QMap<int, QString>; 33QPC_TEMPLATEEXTERN template class QPC_EXPORT QMap<int, QString>;
34// MOC_SKIP_END 34// MOC_SKIP_END
35#endif 35#endif
36 36
37class ContactPrivate; // Wozu ist das gut und wo ist das decrariert ? (se) 37class ContactPrivate; // Wozu ist das gut und wo ist das decrariert ? (se)
38 /* Stefan das ist eine forward declaration
39 * dann machst du in der private section
40 * ContactPrivate *d;
41 *
42 * und wenn du bei Opie1.1 was hinzufuegen moechtest
43 * packst du es in ContactPrivate damit Opie
44 * binaer kompatibel bleibt
45 * -zecke
46 */
38class QPC_EXPORT OContact : public OPimRecord 47class QPC_EXPORT OContact : public OPimRecord
39{ 48{
40 friend class DataSet; 49 friend class DataSet;
41public: 50public:
42 OContact(); 51 OContact();
43 OContact( const QMap<int, QString> &fromMap ); 52 OContact( const QMap<int, QString> &fromMap );
44 virtual ~OContact(); 53 virtual ~OContact();
45 54
55 /* VCARD stuff should vanish! -zecke */
46 static void writeVCard( const QString &filename, const QValueList<OContact> &contacts); 56 static void writeVCard( const QString &filename, const QValueList<OContact> &contacts);
47 static void writeVCard( const QString &filename, const OContact &c ); 57 static void writeVCard( const QString &filename, const OContact &c );
48 static QValueList<OContact> readVCard( const QString &filename ); 58 static QValueList<OContact> readVCard( const QString &filename );
49 59
50 enum journal_action { ACTION_ADD, ACTION_REMOVE, ACTION_REPLACE }; 60 enum journal_action { ACTION_ADD, ACTION_REMOVE, ACTION_REPLACE };
51 61
62 /*
63 * do we need to inline them
64 * if yes do we need to inline them this way?
65 * -zecke
66 */
52 void setTitle( const QString &v ) { replace( Qtopia::Title, v ); } 67 void setTitle( const QString &v ) { replace( Qtopia::Title, v ); }
53 void setFirstName( const QString &v ) { replace( Qtopia::FirstName, v ); } 68 void setFirstName( const QString &v ) { replace( Qtopia::FirstName, v ); }
54 void setMiddleName( const QString &v ) { replace( Qtopia::MiddleName, v ); } 69 void setMiddleName( const QString &v ) { replace( Qtopia::MiddleName, v ); }
55 void setLastName( const QString &v ) { replace( Qtopia::LastName, v ); } 70 void setLastName( const QString &v ) { replace( Qtopia::LastName, v ); }
56 void setSuffix( const QString &v ) { replace( Qtopia::Suffix, v ); } 71 void setSuffix( const QString &v ) { replace( Qtopia::Suffix, v ); }
57 void setFileAs( const QString &v ) { replace( Qtopia::FileAs, v ); } 72 void setFileAs( const QString &v ) { replace( Qtopia::FileAs, v ); }
58 void setFileAs(); 73 void setFileAs();
59 74
60 // default email address 75 // default email address
61 void setDefaultEmail( const QString &v ); 76 void setDefaultEmail( const QString &v );
62 // inserts email to list and ensure's doesn't already exist 77 // inserts email to list and ensure's doesn't already exist
63 void insertEmail( const QString &v ); 78 void insertEmail( const QString &v );
64 void removeEmail( const QString &v ); 79 void removeEmail( const QString &v );
65 void clearEmails(); 80 void clearEmails();
66 void insertEmails( const QStringList &v ); 81 void insertEmails( const QStringList &v );
67 82
68 // home 83 // home
69 void setHomeStreet( const QString &v ) { replace( Qtopia::HomeStreet, v ); } 84 void setHomeStreet( const QString &v ) { replace( Qtopia::HomeStreet, v ); }
70 void setHomeCity( const QString &v ) { replace( Qtopia::HomeCity, v ); } 85 void setHomeCity( const QString &v ) { replace( Qtopia::HomeCity, v ); }
71 void setHomeState( const QString &v ) { replace( Qtopia::HomeState, v ); } 86 void setHomeState( const QString &v ) { replace( Qtopia::HomeState, v ); }
72 void setHomeZip( const QString &v ) { replace( Qtopia::HomeZip, v ); } 87 void setHomeZip( const QString &v ) { replace( Qtopia::HomeZip, v ); }
73 void setHomeCountry( const QString &v ) { replace( Qtopia::HomeCountry, v ); } 88 void setHomeCountry( const QString &v ) { replace( Qtopia::HomeCountry, v ); }
74 void setHomePhone( const QString &v ) { replace( Qtopia::HomePhone, v ); } 89 void setHomePhone( const QString &v ) { replace( Qtopia::HomePhone, v ); }
75 void setHomeFax( const QString &v ) { replace( Qtopia::HomeFax, v ); } 90 void setHomeFax( const QString &v ) { replace( Qtopia::HomeFax, v ); }
76 void setHomeMobile( const QString &v ) { replace( Qtopia::HomeMobile, v ); } 91 void setHomeMobile( const QString &v ) { replace( Qtopia::HomeMobile, v ); }
77 void setHomeWebpage( const QString &v ) { replace( Qtopia::HomeWebPage, v ); } 92 void setHomeWebpage( const QString &v ) { replace( Qtopia::HomeWebPage, v ); }
78 93
79 // business 94 // business
80 void setCompany( const QString &v ) { replace( Qtopia::Company, v ); } 95 void setCompany( const QString &v ) { replace( Qtopia::Company, v ); }
81 void setBusinessStreet( const QString &v ) { replace( Qtopia::BusinessStreet, v ); } 96 void setBusinessStreet( const QString &v ) { replace( Qtopia::BusinessStreet, v ); }
82 void setBusinessCity( const QString &v ) { replace( Qtopia::BusinessCity, v ); } 97 void setBusinessCity( const QString &v ) { replace( Qtopia::BusinessCity, v ); }
83 void setBusinessState( const QString &v ) { replace( Qtopia::BusinessState, v ); } 98 void setBusinessState( const QString &v ) { replace( Qtopia::BusinessState, v ); }
84 void setBusinessZip( const QString &v ) { replace( Qtopia::BusinessZip, v ); } 99 void setBusinessZip( const QString &v ) { replace( Qtopia::BusinessZip, v ); }
85 void setBusinessCountry( const QString &v ) { replace( Qtopia::BusinessCountry, v ); } 100 void setBusinessCountry( const QString &v ) { replace( Qtopia::BusinessCountry, v ); }
86 void setBusinessWebpage( const QString &v ) { replace( Qtopia::BusinessWebPage, v ); } 101 void setBusinessWebpage( const QString &v ) { replace( Qtopia::BusinessWebPage, v ); }
87 void setJobTitle( const QString &v ) { replace( Qtopia::JobTitle, v ); } 102 void setJobTitle( const QString &v ) { replace( Qtopia::JobTitle, v ); }
88 void setDepartment( const QString &v ) { replace( Qtopia::Department, v ); } 103 void setDepartment( const QString &v ) { replace( Qtopia::Department, v ); }
89 void setOffice( const QString &v ) { replace( Qtopia::Office, v ); } 104 void setOffice( const QString &v ) { replace( Qtopia::Office, v ); }
90 void setBusinessPhone( const QString &v ) { replace( Qtopia::BusinessPhone, v ); } 105 void setBusinessPhone( const QString &v ) { replace( Qtopia::BusinessPhone, v ); }
91 void setBusinessFax( const QString &v ) { replace( Qtopia::BusinessFax, v ); } 106 void setBusinessFax( const QString &v ) { replace( Qtopia::BusinessFax, v ); }
92 void setBusinessMobile( const QString &v ) { replace( Qtopia::BusinessMobile, v ); } 107 void setBusinessMobile( const QString &v ) { replace( Qtopia::BusinessMobile, v ); }
93 void setBusinessPager( const QString &v ) { replace( Qtopia::BusinessPager, v ); } 108 void setBusinessPager( const QString &v ) { replace( Qtopia::BusinessPager, v ); }
94 void setProfession( const QString &v ) { replace( Qtopia::Profession, v ); } 109 void setProfession( const QString &v ) { replace( Qtopia::Profession, v ); }
95 void setAssistant( const QString &v ) { replace( Qtopia::Assistant, v ); } 110 void setAssistant( const QString &v ) { replace( Qtopia::Assistant, v ); }
96 void setManager( const QString &v ) { replace( Qtopia::Manager, v ); } 111 void setManager( const QString &v ) { replace( Qtopia::Manager, v ); }
97 112
98 // personal 113 // personal
99 void setSpouse( const QString &v ) { replace( Qtopia::Spouse, v ); } 114 void setSpouse( const QString &v ) { replace( Qtopia::Spouse, v ); }
100 void setGender( const QString &v ) { replace( Qtopia::Gender, v ); } 115 void setGender( const QString &v ) { replace( Qtopia::Gender, v ); }
101 void setBirthday( const QDate &v ); 116 void setBirthday( const QDate &v );
102 void setAnniversary( const QDate &v ); 117 void setAnniversary( const QDate &v );
103 void setNickname( const QString &v ) { replace( Qtopia::Nickname, v ); } 118 void setNickname( const QString &v ) { replace( Qtopia::Nickname, v ); }
104 void setChildren( const QString &v ); 119 void setChildren( const QString &v );
105 120
106 // other 121 // other
107 void setNotes( const QString &v ) { replace( Qtopia::Notes, v); } 122 void setNotes( const QString &v ) { replace( Qtopia::Notes, v); }
108 123
109 bool match( const QString &regexp ) const; 124 bool match( const QString &regexp ) const;
110 bool match( const QRegExp &regexp ) const; 125 bool match( const QRegExp &regexp ) const;
111 126
112// // custom 127// // custom
113// void setCustomField( const QString &key, const QString &v ) 128// void setCustomField( const QString &key, const QString &v )
114// { replace(Custom- + key, v ); } 129// { replace(Custom- + key, v ); }
115 130
116 // name 131 // name
117 QString fullName() const; 132 QString fullName() const;
118 QString title() const { return find( Qtopia::Title ); } 133 QString title() const { return find( Qtopia::Title ); }
119 QString firstName() const { return find( Qtopia::FirstName ); } 134 QString firstName() const { return find( Qtopia::FirstName ); }
120 QString middleName() const { return find( Qtopia::MiddleName ); } 135 QString middleName() const { return find( Qtopia::MiddleName ); }
121 QString lastName() const { return find( Qtopia::LastName ); } 136 QString lastName() const { return find( Qtopia::LastName ); }
122 QString suffix() const { return find( Qtopia::Suffix ); } 137 QString suffix() const { return find( Qtopia::Suffix ); }
123 QString fileAs() const { return find( Qtopia::FileAs ); } 138 QString fileAs() const { return find( Qtopia::FileAs ); }
124 139
125 // email 140 // email
126 QString defaultEmail() const { return find( Qtopia::DefaultEmail ); } 141 QString defaultEmail() const { return find( Qtopia::DefaultEmail ); }
127 QStringList emailList() const; 142 QStringList emailList() const;
128 143
129 // home 144 // home
145 /*
146 * OPimAddress address(enum Location)const;
147 * would be some how nicer...
148 * -zecke
149 */
130 QString homeStreet() const { return find( Qtopia::HomeStreet ); } 150 QString homeStreet() const { return find( Qtopia::HomeStreet ); }
131 QString homeCity() const { return find( Qtopia::HomeCity ); } 151 QString homeCity() const { return find( Qtopia::HomeCity ); }
132 QString homeState() const { return find( Qtopia::HomeState ); } 152 QString homeState() const { return find( Qtopia::HomeState ); }
133 QString homeZip() const { return find( Qtopia::HomeZip ); } 153 QString homeZip() const { return find( Qtopia::HomeZip ); }
134 QString homeCountry() const { return find( Qtopia::HomeCountry ); } 154 QString homeCountry() const { return find( Qtopia::HomeCountry ); }
135 QString homePhone() const { return find( Qtopia::HomePhone ); } 155 QString homePhone() const { return find( Qtopia::HomePhone ); }
136 QString homeFax() const { return find( Qtopia::HomeFax ); } 156 QString homeFax() const { return find( Qtopia::HomeFax ); }
137 QString homeMobile() const { return find( Qtopia::HomeMobile ); } 157 QString homeMobile() const { return find( Qtopia::HomeMobile ); }
138 QString homeWebpage() const { return find( Qtopia::HomeWebPage ); } 158 QString homeWebpage() const { return find( Qtopia::HomeWebPage ); }
139 /** Multi line string containing all non-empty address info in the form 159 /** Multi line string containing all non-empty address info in the form
140 * Street 160 * Street
141 * City, State Zip 161 * City, State Zip
142 * Country 162 * Country
143 */ 163 */
144 QString displayHomeAddress() const; 164 QString displayHomeAddress() const;
145 165
146 // business 166 // business
147 QString company() const { return find( Qtopia::Company ); } 167 QString company() const { return find( Qtopia::Company ); }
148 QString businessStreet() const { return find( Qtopia::BusinessStreet ); } 168 QString businessStreet() const { return find( Qtopia::BusinessStreet ); }
149 QString businessCity() const { return find( Qtopia::BusinessCity ); } 169 QString businessCity() const { return find( Qtopia::BusinessCity ); }
150 QString businessState() const { return find( Qtopia::BusinessState ); } 170 QString businessState() const { return find( Qtopia::BusinessState ); }
151 QString businessZip() const { return find( Qtopia::BusinessZip ); } 171 QString businessZip() const { return find( Qtopia::BusinessZip ); }
152 QString businessCountry() const { return find( Qtopia::BusinessCountry ); } 172 QString businessCountry() const { return find( Qtopia::BusinessCountry ); }
153 QString businessWebpage() const { return find( Qtopia::BusinessWebPage ); } 173 QString businessWebpage() const { return find( Qtopia::BusinessWebPage ); }
154 QString jobTitle() const { return find( Qtopia::JobTitle ); } 174 QString jobTitle() const { return find( Qtopia::JobTitle ); }
155 QString department() const { return find( Qtopia::Department ); } 175 QString department() const { return find( Qtopia::Department ); }
156 QString office() const { return find( Qtopia::Office ); } 176 QString office() const { return find( Qtopia::Office ); }
157 QString businessPhone() const { return find( Qtopia::BusinessPhone ); } 177 QString businessPhone() const { return find( Qtopia::BusinessPhone ); }
158 QString businessFax() const { return find( Qtopia::BusinessFax ); } 178 QString businessFax() const { return find( Qtopia::BusinessFax ); }
159 QString businessMobile() const { return find( Qtopia::BusinessMobile ); } 179 QString businessMobile() const { return find( Qtopia::BusinessMobile ); }
160 QString businessPager() const { return find( Qtopia::BusinessPager ); } 180 QString businessPager() const { return find( Qtopia::BusinessPager ); }
161 QString profession() const { return find( Qtopia::Profession ); } 181 QString profession() const { return find( Qtopia::Profession ); }
162 QString assistant() const { return find( Qtopia::Assistant ); } 182 QString assistant() const { return find( Qtopia::Assistant ); }
163 QString manager() const { return find( Qtopia::Manager ); } 183 QString manager() const { return find( Qtopia::Manager ); }
164 /** Multi line string containing all non-empty address info in the form 184 /** Multi line string containing all non-empty address info in the form
165 * Street 185 * Street
166 * City, State Zip 186 * City, State Zip
167 * Country 187 * Country
168 */ 188 */
169 QString displayBusinessAddress() const; 189 QString displayBusinessAddress() const;
170 190
171 //personal 191 //personal
172 QString spouse() const { return find( Qtopia::Spouse ); } 192 QString spouse() const { return find( Qtopia::Spouse ); }
173 QString gender() const { return find( Qtopia::Gender ); } 193 QString gender() const { return find( Qtopia::Gender ); }
174 QDate birthday() const; 194 QDate birthday() const;
175 QDate anniversary() const; 195 QDate anniversary() const;
176 QString nickname() const { return find( Qtopia::Nickname ); } 196 QString nickname() const { return find( Qtopia::Nickname ); }
177 QString children() const { return find( Qtopia::Children ); } 197 QString children() const { return find( Qtopia::Children ); }
178 QStringList childrenList() const; 198 QStringList childrenList() const;
179 199
180 // other 200 // other
181 QString notes() const { return find( Qtopia::Notes ); } 201 QString notes() const { return find( Qtopia::Notes ); }
182 QString groups() const { return find( Qtopia::Groups ); } 202 QString groups() const { return find( Qtopia::Groups ); }
183 QStringList groupList() const; 203 QStringList groupList() const;
184 204
185// // custom 205// // custom
186// const QString &customField( const QString &key ) 206// const QString &customField( const QString &key )
187// { return find( Custom- + key ); } 207// { return find( Custom- + key ); }
188 208
189 static QStringList fields(); 209 static QStringList fields();
190 static QStringList trfields(); 210 static QStringList trfields();
191 static QStringList untrfields(); 211 static QStringList untrfields();
192 212
193 QString toRichText() const; 213 QString toRichText() const;
194 QMap<int, QString> toMap() const; 214 QMap<int, QString> toMap() const;
195 QString field( int key ) const { return find( key ); } 215 QString field( int key ) const { return find( key ); }
196 216
197 217
198 // journaling... 218 // journaling...
219 /* do we still need them? Stefan your backend takes care of these -zecke */
199 void saveJournal( journal_action action, const QString &key = QString::null ); 220 void saveJournal( journal_action action, const QString &key = QString::null );
200 void save( QString &buf ) const; 221 void save( QString &buf ) const;
201 222
223 /* we shouldn't inline this one -zecke */
202 void setUid( int i ) 224 void setUid( int i )
203{ OPimRecord::setUid(i); replace( Qtopia::AddressUid , QString::number(i)); } 225{ OPimRecord::setUid(i); replace( Qtopia::AddressUid , QString::number(i)); }
204 226
205 QString toShortText()const; 227 QString toShortText()const;
206 QString OContact::type()const; 228 QString OContact::type()const;
207 QMap<QString,QString> OContact::toExtraMap() const; 229 QMap<QString,QString> OContact::toExtraMap() const;
208 class QString OContact::recordField(int) const; 230 class QString OContact::recordField(int) const;
209 231
210 // Why private ? (eilers,se) 232 // Why private ? (eilers,se)
211 QString emailSeparator() const { return " "; } 233 QString emailSeparator() const { return " "; }
212 // the emails should be seperated by a comma 234 // the emails should be seperated by a comma
213 void setEmails( const QString &v ); 235 void setEmails( const QString &v );
214 QString emails() const { return find( Qtopia::Emails ); } 236 QString emails() const { return find( Qtopia::Emails ); }
215 237
216 238
217private: 239private:
240 /* I do not like friends ;)
241 * besides that I think we do not need them
242 * anymore -zecke
243 */
218 friend class AbEditor; 244 friend class AbEditor;
219 friend class AbTable; 245 friend class AbTable;
220 friend class AddressBookAccessPrivate; 246 friend class AddressBookAccessPrivate;
221 friend class XMLIO; 247 friend class XMLIO;
222 248
223 void insert( int key, const QString &value ); 249 void insert( int key, const QString &value );
224 void replace( int key, const QString &value ); 250 void replace( int key, const QString &value );
225 QString find( int key ) const; 251 QString find( int key ) const;
226 252
227 QString displayAddress( const QString &street, 253 QString displayAddress( const QString &street,
228 const QString &city, 254 const QString &city,
229 const QString &state, 255 const QString &state,
230 const QString &zip, 256 const QString &zip,
231 const QString &country ) const; 257 const QString &country ) const;
232 258
233 QMap<int, QString> mMap; 259 QMap<int, QString> mMap;
234 ContactPrivate *d; 260 ContactPrivate *d;
235}; 261};
236 262
237 263
238#endif 264#endif