kpilot/lib
pilotAddress.h00001 #ifndef _KPILOT_PILOTADDRESS_H
00002 #define _KPILOT_PILOTADDRESS_H
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
00031
00032 #include <pi-macros.h>
00033 #include <pi-address.h>
00034
00035 #include <kabc/addressbook.h>
00036
00037 #include "pilotAppCategory.h"
00038 #include "pilotDatabase.h"
00039
00074 namespace KABC
00075 {
00076 class PhoneNumber;
00077 }
00078
00079 typedef PilotAppInfo<AddressAppInfo,unpack_AddressAppInfo, pack_AddressAppInfo> PilotAddressInfo;
00080
00081 class KDE_EXPORT PilotAddress : public PilotAppCategory
00082 {
00083 public:
00084 enum EPhoneType {
00085 eWork=0, eHome, eFax, eOther, eEmail, eMain,
00086 ePager, eMobile
00087 };
00088
00089 PilotAddress(struct AddressAppInfo &appInfo) KDE_DEPRECATED ;
00090 PilotAddress(struct AddressAppInfo &appInfo, PilotRecord* rec) KDE_DEPRECATED ;
00091 PilotAddress(PilotAddressInfo *appinfo, PilotRecord *rec = 0L);
00092 PilotAddress(const PilotAddress ©From);
00093 PilotAddress& operator=( const PilotAddress &r );
00094 bool operator==(const PilotAddress &r);
00095
00096 ~PilotAddress();
00097
00101 virtual QString getTextRepresentation(bool richText=false);
00102
00106 void reset() { memset(&fAddressInfo, 0, sizeof(struct Address)); }
00107
00119 void setField(int field, const QString &text);
00120 QString getField(int field) const;
00121
00126 QStringList getEmails() const;
00127 void setEmails(QStringList emails);
00128
00133 KABC::PhoneNumber::List getPhoneNumbers() const;
00134 void setPhoneNumbers(KABC::PhoneNumber::List list);
00135
00136 QString getCategoryLabel() const;
00137
00142 inline bool setCategory(const QString &label) { return PilotAppCategory::setCategory(fAppInfo.category,label); } ;
00143
00144
00151 QString getPhoneField(EPhoneType type, bool checkCustom4=true) const;
00152
00162 int setPhoneField(EPhoneType type, const QString &field,
00163 bool overflowCustom=true, bool overwriteExisting=true);
00164
00173 int getShownPhone() const { return fAddressInfo.showPhone; }
00174 void setShownPhone(EPhoneType phoneType);
00175 int getPhoneLabelIndex(int index) const { return fAddressInfo.phoneLabel[index]; }
00176
00177
00178 virtual void *pack_(void *, int *);
00179 void unpack(const void *, int = 0) { }
00180
00181 static const int APP_BUFFER_SIZE;
00182
00183 const struct Address *address() const { return &fAddressInfo; } ;
00184
00185 protected:
00186
00187
00188
00189 const char *getFieldP(int field) const
00190 { return fAddressInfo.entry[field]; }
00191
00192 private:
00193 void _copyAddressInfo(const struct Address ©From);
00194 int _getNextEmptyPhoneSlot() const;
00195
00199 int _getAppPhoneLabelNum(const QString &phoneType) const;
00200
00204 int _findPhoneFieldSlot(int appTypeNum) const;
00205
00206 void _loadMaps();
00207
00209 QMap < int, int> pilotToPhoneMap;
00210
00211 struct AddressAppInfo &fAppInfo;
00212 struct Address fAddressInfo;
00213 };
00214
00215
00216
00217
00218 #endif
|