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