Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

opimcontact.h

Go to the documentation of this file.
00001 /*
00002                              This file is part of the Opie Project
00003                              Copyright (C) Stefan Eilers <eilers.stefan@handhelds.org>
00004               =.             Copyright (C) The Opie Team <opie-devel@handhelds.org>
00005             .=l.
00006            .>+-=
00007  _;:,     .>    :=|.         This program is free software; you can
00008 .> <`_,   >  .   <=          redistribute it and/or  modify it under
00009 :`=1 )Y*s>-.--   :           the terms of the GNU Library General Public
00010 .="- .-=="i,     .._         License as published by the Free Software
00011  - .   .-<_>     .<>         Foundation; either version 2 of the License,
00012      ._= =}       :          or (at your option) any later version.
00013     .%`+i>       _;_.
00014     .i_,=:_.      -<s.       This program is distributed in the hope that
00015      +  .  -:.       =       it will be useful,  but WITHOUT ANY WARRANTY;
00016     : ..    .:,     . . .    without even the implied warranty of
00017     =_        +     =;=|`    MERCHANTABILITY or FITNESS FOR A
00018   _.=:.       :    :=>`:     PARTICULAR PURPOSE. See the GNU
00019 ..}^=.=       =       ;      Library General Public License for more
00020 ++=   -.     .`     .:       details.
00021  :     =  ...= . :.=-
00022  -.   .:....=;==+<;          You should have received a copy of the GNU
00023   -_. . .   )=.  =           Library General Public License along with
00024     --        :-=`           this library; see the file COPYING.LIB.
00025                              If not, write to the Free Software Foundation,
00026                              Inc., 59 Temple Place - Suite 330,
00027                              Boston, MA 02111-1307, USA.
00028 */
00029 
00030 #ifndef OCONTACT_H
00031 #define OCONTACT_H
00032 
00033 /* OPIE */
00034 #include <opie2/opimrecord.h>
00035 #include <qpe/recordfields.h>
00036 
00037 /* QT */
00038 #include <qdatetime.h>
00039 #include <qstringlist.h>
00040 
00041 #if defined(QPC_TEMPLATEDLL)
00042 // MOC_SKIP_BEGIN
00043 QPC_TEMPLATEEXTERN template class QPC_EXPORT QMap<int, QString>;
00044 // MOC_SKIP_END
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      * do we need to inline them
00074      * if yes do we need to inline them this way?
00075      * -zecke
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     // default email address
00086     void setDefaultEmail( const QString &v );
00087     // inserts email to list and ensure's doesn't already exist
00088     void insertEmail( const QString &v );
00089     void removeEmail( const QString &v );
00090     void clearEmails();
00091     void insertEmails( const QStringList &v );
00092 
00093     // home
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     // business
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     // personal
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     // other
00132     void setNotes( const QString &v ) { replace( Qtopia::Notes, v ); }
00133 
00134     virtual bool match( const QRegExp &regexp ) const;
00135 
00136     //     // custom
00137     //     void setCustomField( const QString &key, const QString &v )
00138     //         { replace(Custom- + key, v ); }
00139 
00140     // name
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     // email
00150     QString defaultEmail() const { return find( Qtopia::DefaultEmail ); }
00151     QStringList emailList() const;
00152 
00153     // home
00154     /*
00155      * OPimAddress address(enum Location)const;
00156      * would be some how nicer...
00157      *  -zecke
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     // business
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     //personal
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     // other
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     // Why private ? (eilers,se)
00226     QString emailSeparator() const { return " "; }
00227 
00228     // the emails should be seperated by a comma
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     // The XML Backend needs some access to the private functions
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

Generated on Sat Nov 5 16:16:19 2005 for OPIE by  doxygen 1.4.2