00001
#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
#include <time.h>
00032
#include <string.h>
00033
00034
#ifndef _PILOT_MACROS_H_
00035
#include <pi-macros.h>
00036
#endif
00037
00038
#ifndef _PILOT_ADDRESS_H_
00039
#include <pi-address.h>
00040
#endif
00041
00042
#ifndef _KPILOT_PILOTAPPCATEGORY_H
00043
#include "pilotAppCategory.h"
00044
#endif
00045
00081 class 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);
00090
PilotAddress(
struct AddressAppInfo &appInfo, PilotRecord* rec);
00091
PilotAddress(
const PilotAddress ©From);
00092
PilotAddress& operator=(
const PilotAddress &r );
00093
bool operator==(
const PilotAddress &r);
00094
00095 ~
PilotAddress();
00096
00100
virtual QString
getTextRepresentation(
bool richText=
false);
00101
00105 void reset() { memset(&fAddressInfo, 0,
sizeof(
struct Address)); }
00106
00116
void setField(
int field,
const QString &text);
00117 QString getField(
int field)
const;
00118
00119 QString getCategoryLabel() const;
00120
00125
bool setCategory(const QString &label);
00126
00127
00132 QString getPhoneField(EPhoneType type,
bool checkCustom4=true) const;
00133
00137
void setPhoneField(EPhoneType type, const QString &field,
00138
bool overflowCustom=true);
00139
00148 int getShownPhone()
const {
return fAddressInfo.showPhone; }
00149
void setShownPhone(EPhoneType phoneType);
00150
int getPhoneLabelIndex(
int index) {
return fAddressInfo.phoneLabel[index]; }
00151 PilotRecord* pack() {
return PilotAppCategory::pack(); }
00152
00153
00154
void *pack(
void *,
int *);
00155
void unpack(
const void *,
int = 0) { }
00156
00157
static const int APP_BUFFER_SIZE;
00158
00159
protected:
00160
00161
00162
00163
const char *getFieldP(
int field)
const
00164
{
return fAddressInfo.entry[field]; }
00165
00166
private:
00167
void _copyAddressInfo(
const struct Address ©From);
00168
int _getNextEmptyPhoneSlot() const;
00169
00173
int _getAppPhoneLabelNum(const QString &phoneType) const;
00174
00178
int _findPhoneFieldSlot(
int appTypeNum) const;
00179
00180 struct AddressAppInfo &fAppInfo;
00181 struct Address fAddressInfo;
00182 };
00183
00184
00185
00186
00187 #endif