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