00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030 #ifndef OCONTACT_H
00031 #define OCONTACT_H
00032
00033
00034 #include <opie2/opimrecord.h>
00035 #include <qpe/recordfields.h>
00036
00037
00038 #include <qdatetime.h>
00039 #include <qstringlist.h>
00040
00041 #if defined(QPC_TEMPLATEDLL)
00042
00043 QPC_TEMPLATEEXTERN template class QPC_EXPORT QMap<int, QString>;
00044
00045 #endif
00046
00047 namespace Opie
00048 {
00049 class OPimContactPrivate;
00050
00058 class QPC_EXPORT OPimContact : public OPimRecord
00059 {
00060 friend class DataSet;
00061
00062 public:
00063 OPimContact();
00064 OPimContact( const QMap<int, QString> &fromMap );
00065 virtual ~OPimContact();
00066
00067 enum DateFormat{
00068 Zip_City_State = 0,
00069 City_State_Zip
00070 };
00071
00072
00073
00074
00075
00076
00077 void setTitle( const QString &v ) { replace( Qtopia::Title, v ); }
00078 void setFirstName( const QString &v ) { replace( Qtopia::FirstName, v ); }
00079 void setMiddleName( const QString &v ) { replace( Qtopia::MiddleName, v ); }
00080 void setLastName( const QString &v ) { replace( Qtopia::LastName, v ); }
00081 void setSuffix( const QString &v ) { replace( Qtopia::Suffix, v ); }
00082 void setFileAs( const QString &v ) { replace( Qtopia::FileAs, v ); }
00083 void setFileAs();
00084
00085
00086 void setDefaultEmail( const QString &v );
00087
00088 void insertEmail( const QString &v );
00089 void removeEmail( const QString &v );
00090 void clearEmails();
00091 void insertEmails( const QStringList &v );
00092
00093
00094 void setHomeStreet( const QString &v ) { replace( Qtopia::HomeStreet, v ); }
00095 void setHomeCity( const QString &v ) { replace( Qtopia::HomeCity, v ); }
00096 void setHomeState( const QString &v ) { replace( Qtopia::HomeState, v ); }
00097 void setHomeZip( const QString &v ) { replace( Qtopia::HomeZip, v ); }
00098 void setHomeCountry( const QString &v ) { replace( Qtopia::HomeCountry, v ); }
00099 void setHomePhone( const QString &v ) { replace( Qtopia::HomePhone, v ); }
00100 void setHomeFax( const QString &v ) { replace( Qtopia::HomeFax, v ); }
00101 void setHomeMobile( const QString &v ) { replace( Qtopia::HomeMobile, v ); }
00102 void setHomeWebpage( const QString &v ) { replace( Qtopia::HomeWebPage, v ); }
00103
00104
00105 void setCompany( const QString &v ) { replace( Qtopia::Company, v ); }
00106 void setBusinessStreet( const QString &v ) { replace( Qtopia::BusinessStreet, v ); }
00107 void setBusinessCity( const QString &v ) { replace( Qtopia::BusinessCity, v ); }
00108 void setBusinessState( const QString &v ) { replace( Qtopia::BusinessState, v ); }
00109 void setBusinessZip( const QString &v ) { replace( Qtopia::BusinessZip, v ); }
00110 void setBusinessCountry( const QString &v ) { replace( Qtopia::BusinessCountry, v ); }
00111 void setBusinessWebpage( const QString &v ) { replace( Qtopia::BusinessWebPage, v ); }
00112 void setJobTitle( const QString &v ) { replace( Qtopia::JobTitle, v ); }
00113 void setDepartment( const QString &v ) { replace( Qtopia::Department, v ); }
00114 void setOffice( const QString &v ) { replace( Qtopia::Office, v ); }
00115 void setBusinessPhone( const QString &v ) { replace( Qtopia::BusinessPhone, v ); }
00116 void setBusinessFax( const QString &v ) { replace( Qtopia::BusinessFax, v ); }
00117 void setBusinessMobile( const QString &v ) { replace( Qtopia::BusinessMobile, v ); }
00118 void setBusinessPager( const QString &v ) { replace( Qtopia::BusinessPager, v ); }
00119 void setProfession( const QString &v ) { replace( Qtopia::Profession, v ); }
00120 void setAssistant( const QString &v ) { replace( Qtopia::Assistant, v ); }
00121 void setManager( const QString &v ) { replace( Qtopia::Manager, v ); }
00122
00123
00124 void setSpouse( const QString &v ) { replace( Qtopia::Spouse, v ); }
00125 void setGender( const QString &v ) { replace( Qtopia::Gender, v ); }
00126 void setBirthday( const QDate &v );
00127 void setAnniversary( const QDate &v );
00128 void setNickname( const QString &v ) { replace( Qtopia::Nickname, v ); }
00129 void setChildren( const QString &v );
00130
00131
00132 void setNotes( const QString &v ) { replace( Qtopia::Notes, v ); }
00133
00134 virtual bool match( const QRegExp ®exp ) const;
00135
00136
00137
00138
00139
00140
00141 QString fullName() const;
00142 QString title() const { return find( Qtopia::Title ); }
00143 QString firstName() const { return find( Qtopia::FirstName ); }
00144 QString middleName() const { return find( Qtopia::MiddleName ); }
00145 QString lastName() const { return find( Qtopia::LastName ); }
00146 QString suffix() const { return find( Qtopia::Suffix ); }
00147 QString fileAs() const { return find( Qtopia::FileAs ); }
00148
00149
00150 QString defaultEmail() const { return find( Qtopia::DefaultEmail ); }
00151 QStringList emailList() const;
00152
00153
00154
00155
00156
00157
00158
00159 QString homeStreet() const { return find( Qtopia::HomeStreet ); }
00160 QString homeCity() const { return find( Qtopia::HomeCity ); }
00161 QString homeState() const { return find( Qtopia::HomeState ); }
00162 QString homeZip() const { return find( Qtopia::HomeZip ); }
00163 QString homeCountry() const { return find( Qtopia::HomeCountry ); }
00164 QString homePhone() const { return find( Qtopia::HomePhone ); }
00165 QString homeFax() const { return find( Qtopia::HomeFax ); }
00166 QString homeMobile() const { return find( Qtopia::HomeMobile ); }
00167 QString homeWebpage() const { return find( Qtopia::HomeWebPage ); }
00173 QString displayHomeAddress() const;
00174
00175
00176 QString company() const { return find( Qtopia::Company ); }
00177 QString businessStreet() const { return find( Qtopia::BusinessStreet ); }
00178 QString businessCity() const { return find( Qtopia::BusinessCity ); }
00179 QString businessState() const { return find( Qtopia::BusinessState ); }
00180 QString businessZip() const { return find( Qtopia::BusinessZip ); }
00181 QString businessCountry() const { return find( Qtopia::BusinessCountry ); }
00182 QString businessWebpage() const { return find( Qtopia::BusinessWebPage ); }
00183 QString jobTitle() const { return find( Qtopia::JobTitle ); }
00184 QString department() const { return find( Qtopia::Department ); }
00185 QString office() const { return find( Qtopia::Office ); }
00186 QString businessPhone() const { return find( Qtopia::BusinessPhone ); }
00187 QString businessFax() const { return find( Qtopia::BusinessFax ); }
00188 QString businessMobile() const { return find( Qtopia::BusinessMobile ); }
00189 QString businessPager() const { return find( Qtopia::BusinessPager ); }
00190 QString profession() const { return find( Qtopia::Profession ); }
00191 QString assistant() const { return find( Qtopia::Assistant ); }
00192 QString manager() const { return find( Qtopia::Manager ); }
00198 QString displayBusinessAddress() const;
00199
00200
00201 QString spouse() const { return find( Qtopia::Spouse ); }
00202 QString gender() const { return find( Qtopia::Gender ); }
00203 QDate birthday() const;
00204 QDate anniversary() const;
00205 QString nickname() const { return find( Qtopia::Nickname ); }
00206 QString children() const { return find( Qtopia::Children ); }
00207 QStringList childrenList() const;
00208
00209
00210 QString notes() const { return find( Qtopia::Notes ); }
00211 QString groups() const { return find( Qtopia::Groups ); }
00212 QStringList groupList() const;
00213
00214 QString toRichText() const;
00215 QMap<int, QString> toMap() const;
00216 QString field( int key ) const { return find( key ); }
00217
00218
00219 void setUid( int i );
00220
00221 QString toShortText() const;
00222 QString type() const;
00223 class QString recordField( int ) const;
00224
00225
00226 QString emailSeparator() const { return " "; }
00227
00228
00229 void setEmails( const QString &v );
00230 QString emails() const { return find( Qtopia::Emails ); }
00231
00233 int rtti() const;
00234 static OPimContact* safeCast( const OPimRecord* );
00236
00237 private:
00238
00239 friend class OPimContactAccessBackend_XML;
00240
00241 void insert( int key, const QString &value );
00242 void replace( int key, const QString &value );
00243 QString find( int key ) const;
00244 static QStringList fields();
00245
00246 void save( QString &buf ) const;
00247
00248 QString displayAddress( const QString &street,
00249 const QString &city,
00250 const QString &state,
00251 const QString &zip,
00252 const QString &country ) const;
00253
00254 QMap<int, QString> mMap;
00255 OPimContactPrivate *d;
00256 };
00257
00258 }
00259
00260 #endif