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