libopie PIM API Documentation

ocontact.h

Go to the documentation of this file.
00001 /**********************************************************************
00002 ** Copyright (C) 2000-2002 Trolltech AS.  All rights reserved.
00003 ** Copyright (C) 2002-2003 by Stefan Eilers (eilers.stefan@epost.de)
00004 **
00005 ** This file may be distributed and/or modified under the terms of the
00006 ** GNU General Public License version 2 as published by the Free Software
00007 ** Foundation and appearing in the file LICENSE.GPL included in the
00008 ** packaging of this file.
00009 **
00010 ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
00011 ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
00012 **
00013 ** See http://www.trolltech.com/gpl/ for GPL licensing information.
00014 **
00015 ** Contact info@trolltech.com if any conditions of this licensing are
00016 ** not clear to you.
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 // MOC_SKIP_BEGIN
00031 QPC_TEMPLATEEXTERN template class QPC_EXPORT QMap<int, QString>;
00032 // MOC_SKIP_END
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      * do we need to inline them
00059      * if yes do we need to inline them this way?
00060      * -zecke
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     // default email address
00071     void setDefaultEmail( const QString &v );
00072     // inserts email to list and ensure's doesn't already exist
00073     void insertEmail( const QString &v );
00074     void removeEmail( const QString &v );
00075     void clearEmails();
00076     void insertEmails( const QStringList &v );
00077 
00078     // home
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     // business
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     // personal
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     // other
00117     void setNotes( const QString &v ) { replace( Qtopia::Notes, v); }
00118 
00119     virtual bool match( const QRegExp &regexp ) const;
00120 
00121 //     // custom
00122 //     void setCustomField( const QString &key, const QString &v )
00123 //         { replace(Custom- + key, v ); }
00124 
00125     // name
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     // email
00135     QString defaultEmail() const { return find( Qtopia::DefaultEmail ); }
00136     QStringList emailList() const;
00137 
00138     // home
00139     /*
00140      * OPimAddress address(enum Location)const;
00141      * would be some how nicer...
00142      *  -zecke
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     // business
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     //personal
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     // other
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     // Why private ? (eilers,se)
00211     QString emailSeparator() const { return " "; }
00212 
00213     // the emails should be seperated by a comma
00214     void setEmails( const QString &v );
00215     QString emails() const { return find( Qtopia::Emails ); }
00216     static int rtti();
00217 
00218 private:
00219     // The XML Backend needs some access to the private functions
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
KDE Logo
This file is part of the documentation for OPIE Version 1.1.
Documentation copyright © 1997-2003 the KDE developers. 2003 OPIE developers
Generated on Tue Feb 10 20:25:19 2004 by doxygen 1.3.5 written by Dimitri van Heesch, © 1997-2001