00001 #ifndef _KPILOT_KABCRECORD_H
00002 #define _KPILOT_KABCRECORD_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
00033
00034
00035
00036 #include <qvaluevector.h>
00037
00038 #include <kabc/phonenumber.h>
00039
00040 #include "pilotAddress.h"
00041
00042 #define SYNCNONE 0
00043 #define SYNCMOD 1
00044 #define SYNCDEL 3
00045
00046 namespace KABCSync
00047 {
00048
00049
00050
00051
00052 enum MappingForOtherPhone {
00053 eOtherPhone=0,
00054 eAssistant,
00055 eBusinessFax,
00056 eCarPhone,
00057 eEmail2,
00058 eHomeFax,
00059 eTelex,
00060 eTTYTTDPhone
00061 } ;
00062
00063 enum MappingForCustomField {
00064 eCustomField=0,
00065 eCustomBirthdate,
00066 eCustomURL,
00067 eCustomIM
00068 } ;
00069
00070 class Settings
00071 {
00072 public:
00073 Settings();
00074 QString dateFormat() const
00075 {
00076 return fDateFormat;
00077 }
00078 void setDateFormat(const QString& s)
00079 {
00080 fDateFormat = s;
00081 }
00082
00083 const QValueVector<int> &customMapping() const
00084 {
00085 return fCustomMapping;
00086 }
00087 void setCustomMapping(const QValueVector<int> &v)
00088 {
00089 if (v.count()==4)
00090 {
00091 fCustomMapping = v;
00092 }
00093 }
00094 int custom(int index) const
00095 {
00096 if ( (index<0) || (index>3) )
00097 {
00098 return 0;
00099 }
00100 else
00101 {
00102 return fCustomMapping[index];
00103 }
00104 }
00105
00106 int fieldForOtherPhone() const
00107 {
00108 return fOtherPhone;
00109 }
00110 void setFieldForOtherPhone(int v)
00111 {
00112 fOtherPhone = v;
00113 }
00114
00115 bool preferHome() const
00116 {
00117 return fPreferHome;
00118 }
00119 void setPreferHome(bool v)
00120 {
00121 fPreferHome = v;
00122 }
00123
00124 int faxTypeOnPC() const
00125 {
00126 return fFaxTypeOnPC;
00127 }
00128 void setFaxTypeOnPC(int v)
00129 {
00130 fFaxTypeOnPC = v;
00131 }
00132 private:
00133 QString fDateFormat;
00134 QValueVector<int> fCustomMapping;
00135 int fOtherPhone;
00136 bool fPreferHome;
00137 int fFaxTypeOnPC;
00138 } ;
00139
00140
00144 KABC::PhoneNumber::List getPhoneNumbers(const PilotAddress &a);
00145
00152 void setPhoneNumbers(const PilotAddressInfo &info,
00153 PilotAddress &a,
00154 const KABC::PhoneNumber::List &list);
00155
00168 unsigned int bestMatchedCategory(const QStringList &categorynames,
00169 const PilotAddressInfo &info,
00170 unsigned int category);
00171
00173 inline QString bestMatchedCategoryName(const QStringList &categorynames,
00174 const PilotAddressInfo &info,
00175 unsigned int category)
00176 {
00177 return info.categoryName(
00178 bestMatchedCategory(categorynames, info, category));
00179 }
00180
00184 void setCategory(KABC::Addressee &abEntry, const QString &cat);
00185
00186
00187
00188
00189 const QString appString=CSL1("KPILOT");
00190 const QString flagString=CSL1("Flag");
00191 const QString idString=CSL1("RecordID");
00192
00193
00204 QString getFieldForHHCustom(
00205 unsigned int index,
00206 const KABC::Addressee &abEntry,
00207 const Settings &settings);
00208
00215 void setFieldFromHHCustom(
00216 const unsigned int index,
00217 KABC::Addressee &abEntry,
00218 const QString &value,
00219 const Settings &settings);
00220
00226 QString getFieldForHHOtherPhone(const KABC::Addressee &abEntry, const Settings &s);
00227
00234 void setFieldFromHHOtherPhone(KABC::Addressee &abEntry, const QString &nr, const Settings &s);
00235
00242 KABC::Address getAddress(const KABC::Addressee &abEntry, const Settings &);
00243
00245 void setAddress(PilotAddress &toPilotAddr, const KABC::Address &abAddress);
00246
00247 bool isArchived(const KABC::Addressee &);
00248 void makeArchived(KABC::Addressee &);
00249
00250 void copy(PilotAddress &toPilotAddr,
00251 const KABC::Addressee &fromAbEntry,
00252 const PilotAddressInfo &appInfo,
00253 const Settings &syncSettings);
00254 void copy(KABC::Addressee &toAbEntry,
00255 const PilotAddress &fromPiAddr,
00256 const PilotAddressInfo &appInfo,
00257 const Settings &syncSettings);
00258
00259 void showAddressee(const KABC::Addressee &);
00260 }
00261
00262 #endif
00263