pull/2/head
Timothy Pearson 12 years ago
parent 62671c6d01
commit 50aecf2cb3

@ -65,14 +65,14 @@ unsigned long version_conduit_address = Pilot::PLUGIN_API;
/* This is partly stolen from the boost libraries, partly from /* This is partly stolen from the boost libraries, partly from
* "Modern C++ design" for doing compile time checks; we need * "Modern C++ design" for doing compile time checks; we need
* to make sure that the enum values in KABCSync:: and in the * to make sure that the enum values in TDEABCSync:: and in the
* AbbrowserSettings class are the same so that both interpret * AbbrowserSettings class are the same so that both interpret
* configuration values the same way. * configuration values the same way.
*/ */
template<bool> struct EnumerationMismatch; template<bool> struct EnumerationMismatch;
template<> struct EnumerationMismatch<true>{}; template<> struct EnumerationMismatch<true>{};
#define CHECK_ENUM(a) (void)sizeof(EnumerationMismatch<((int)KABCSync::a)==((int)AbbrowserSettings::a)>) #define CHECK_ENUM(a) (void)sizeof(EnumerationMismatch<((int)TDEABCSync::a)==((int)AbbrowserSettings::a)>)
static inline void compile_time_check() static inline void compile_time_check()
{ {
@ -163,7 +163,7 @@ void AbbrowserConduit::_mapContactsToPilot(TQMap < recordid_t, TQString > &idCon
contactIter != aBook->end(); ++contactIter) contactIter != aBook->end(); ++contactIter)
{ {
Addressee aContact = *contactIter; Addressee aContact = *contactIter;
TQString recid = aContact.custom(KABCSync::appString, KABCSync::idString); TQString recid = aContact.custom(TDEABCSync::appString, TDEABCSync::idString);
if(!recid.isEmpty()) if(!recid.isEmpty())
{ {
recordid_t id = recid.toULong(); recordid_t id = recid.toULong();
@ -180,7 +180,7 @@ void AbbrowserConduit::_mapContactsToPilot(TQMap < recordid_t, TQString > &idCon
DEBUGKPILOT << fname << ": found duplicate pilot key: [" DEBUGKPILOT << fname << ": found duplicate pilot key: ["
<< id << "], removing pilot id from addressee: [" << id << "], removing pilot id from addressee: ["
<< aContact.realName() << "]" << endl; << aContact.realName() << "]" << endl;
aContact.removeCustom(KABCSync::appString, KABCSync::idString); aContact.removeCustom(TDEABCSync::appString, TDEABCSync::idString);
aBook->insertAddressee(aContact); aBook->insertAddressee(aContact);
abChanged = true; abChanged = true;
} }
@ -489,7 +489,7 @@ void AbbrowserConduit::showAddresses(
if (debug_level >= 3) if (debug_level >= 3)
{ {
DEBUGKPILOT << fname << "abEntry:" << endl; DEBUGKPILOT << fname << "abEntry:" << endl;
KABCSync::showAddressee(pcAddr); TDEABCSync::showAddressee(pcAddr);
DEBUGKPILOT << fname << "pilotAddress:" << endl; DEBUGKPILOT << fname << "pilotAddress:" << endl;
showPilotAddress(palmAddr); showPilotAddress(palmAddr);
DEBUGKPILOT << fname << "backupAddress:" << endl; DEBUGKPILOT << fname << "backupAddress:" << endl;
@ -674,7 +674,7 @@ void AbbrowserConduit::slotPCRecToPalm()
abiter++; abiter++;
// If marked as archived, don't sync! // If marked as archived, don't sync!
if (KABCSync::isArchived(ad)) if (TDEABCSync::isArchived(ad))
{ {
DEBUGKPILOT << fname << ": address with id " << ad.uid() << DEBUGKPILOT << fname << ": address with id " << ad.uid() <<
" marked archived, so don't sync." << endl; " marked archived, so don't sync." << endl;
@ -683,7 +683,7 @@ void AbbrowserConduit::slotPCRecToPalm()
} }
TQString recID(ad.custom(KABCSync::appString, KABCSync::idString)); TQString recID(ad.custom(TDEABCSync::appString, TDEABCSync::idString));
bool ok; bool ok;
recordid_t rid = recID.toLong(&ok); recordid_t rid = recID.toLong(&ok);
if (recID.isEmpty() || !ok || !rid) if (recID.isEmpty() || !ok || !rid)
@ -946,7 +946,7 @@ bool AbbrowserConduit::syncAddressee(Addressee &pcAddr, PilotAddress*backupAddr,
E/A 0 | HH -> PC E/A 0 | HH -> PC
E/A E/A| merge/CR E/A E/A| merge/CR
*/ */
if (!palmAddr && KABCSync::isArchived(pcAddr) ) if (!palmAddr && TDEABCSync::isArchived(pcAddr) )
{ {
return true; return true;
} }
@ -1081,10 +1081,10 @@ bool AbbrowserConduit::_copyToHH(Addressee &pcAddr, PilotAddress*backupAddr,
{ {
fCtrHH->updated(); fCtrHH->updated();
} }
KABCSync::copy(*paddr, pcAddr, *fAddressAppInfo, fSyncSettings); TDEABCSync::copy(*paddr, pcAddr, *fAddressAppInfo, fSyncSettings);
DEBUGKPILOT << fname << "palmAddr->id=" << paddr->id() DEBUGKPILOT << fname << "palmAddr->id=" << paddr->id()
<< ", pcAddr.ID=" << pcAddr.custom(KABCSync::appString, KABCSync::idString) << endl; << ", pcAddr.ID=" << pcAddr.custom(TDEABCSync::appString, TDEABCSync::idString) << endl;
if(_savePalmAddr(paddr, pcAddr)) if(_savePalmAddr(paddr, pcAddr))
{ {
@ -1115,10 +1115,10 @@ bool AbbrowserConduit::_copyToPC(Addressee &pcAddr, PilotAddress*backupAddr,
} }
showPilotAddress(palmAddr); showPilotAddress(palmAddr);
KABCSync::copy(pcAddr, *palmAddr, *fAddressAppInfo, fSyncSettings); TDEABCSync::copy(pcAddr, *palmAddr, *fAddressAppInfo, fSyncSettings);
if (isArchived(palmAddr)) if (isArchived(palmAddr))
{ {
KABCSync::makeArchived(pcAddr); TDEABCSync::makeArchived(pcAddr);
} }
_savePCAddr(pcAddr, backupAddr, palmAddr); _savePCAddr(pcAddr, backupAddr, palmAddr);
@ -1212,10 +1212,10 @@ bool AbbrowserConduit::_savePalmAddr(PilotAddress *palmAddr, Addressee &pcAddr)
} }
recordid_t abId = 0; recordid_t abId = 0;
abId = pcAddr.custom(KABCSync::appString, KABCSync::idString).toUInt(); abId = pcAddr.custom(TDEABCSync::appString, TDEABCSync::idString).toUInt();
if(abId != pilotId) if(abId != pilotId)
{ {
pcAddr.insertCustom(KABCSync::appString, KABCSync::idString, TQString::number(pilotId)); pcAddr.insertCustom(TDEABCSync::appString, TDEABCSync::idString, TQString::number(pilotId));
return true; return true;
} }
@ -1229,8 +1229,8 @@ bool AbbrowserConduit::_savePCAddr(Addressee &pcAddr, PilotAddress*,
{ {
FUNCTIONSETUP; FUNCTIONSETUP;
DEBUGKPILOT<<"Before _savePCAddr, pcAddr.custom="<<pcAddr.custom(KABCSync::appString, KABCSync::idString)<<endl; DEBUGKPILOT<<"Before _savePCAddr, pcAddr.custom="<<pcAddr.custom(TDEABCSync::appString, TDEABCSync::idString)<<endl;
TQString pilotId = pcAddr.custom(KABCSync::appString, KABCSync::idString); TQString pilotId = pcAddr.custom(TDEABCSync::appString, TDEABCSync::idString);
long pilotIdL = pilotId.toLong(); long pilotIdL = pilotId.toLong();
if(!pilotId.isEmpty()) if(!pilotId.isEmpty())
{ {
@ -1281,7 +1281,7 @@ bool AbbrowserConduit::_equal(const PilotAddress *piAddress, const Addressee &ab
} }
// Archived records match anything so they won't be copied to the HH again // Archived records match anything so they won't be copied to the HH again
if (flags & eqFlagsFlags) if (flags & eqFlagsFlags)
if (isArchived(piAddress) && KABCSync::isArchived(abEntry) ) return true; if (isArchived(piAddress) && TDEABCSync::isArchived(abEntry) ) return true;
if (flags & eqFlagsName) if (flags & eqFlagsName)
{ {
@ -1318,7 +1318,7 @@ bool AbbrowserConduit::_equal(const PilotAddress *piAddress, const Addressee &ab
// Check that the name of the category of the HH record // Check that the name of the category of the HH record
// is one matching the PC record. // is one matching the PC record.
TQString addressCategoryLabel = fAddressAppInfo->categoryName(piAddress->category()); TQString addressCategoryLabel = fAddressAppInfo->categoryName(piAddress->category());
TQString cat = KABCSync::bestMatchedCategoryName(abEntry.categories(), TQString cat = TDEABCSync::bestMatchedCategoryName(abEntry.categories(),
*fAddressAppInfo, piAddress->category()); *fAddressAppInfo, piAddress->category());
if(!_equal(cat, addressCategoryLabel)) if(!_equal(cat, addressCategoryLabel))
{ {
@ -1358,7 +1358,7 @@ bool AbbrowserConduit::_equal(const PilotAddress *piAddress, const Addressee &ab
// has more than one of a given type, we're comparing the correct two. // has more than one of a given type, we're comparing the correct two.
PhoneNumber::List abPhones(abEntry.phoneNumbers()); PhoneNumber::List abPhones(abEntry.phoneNumbers());
PhoneNumber::List piPhones = KABCSync::getPhoneNumbers(*piAddress); PhoneNumber::List piPhones = TDEABCSync::getPhoneNumbers(*piAddress);
// first make sure that all of the pilot phone numbers are in kabc // first make sure that all of the pilot phone numbers are in kabc
for (PhoneNumber::List::Iterator it = piPhones.begin(); it != piPhones.end(); it++) { for (PhoneNumber::List::Iterator it = piPhones.begin(); it != piPhones.end(); it++) {
PhoneNumber piPhone = *it; PhoneNumber piPhone = *it;
@ -1398,7 +1398,7 @@ bool AbbrowserConduit::_equal(const PilotAddress *piAddress, const Addressee &ab
} }
} }
if(!_equal(KABCSync::getFieldForHHOtherPhone(abEntry,fSyncSettings), if(!_equal(TDEABCSync::getFieldForHHOtherPhone(abEntry,fSyncSettings),
piAddress->getPhoneField(PilotAddressInfo::eOther))) piAddress->getPhoneField(PilotAddressInfo::eOther)))
{ {
DEBUGKPILOT << fname << ": not equal because of other phone field." << endl; DEBUGKPILOT << fname << ": not equal because of other phone field." << endl;
@ -1408,7 +1408,7 @@ bool AbbrowserConduit::_equal(const PilotAddress *piAddress, const Addressee &ab
if (flags & eqFlagsAdress) if (flags & eqFlagsAdress)
{ {
TDEABC::Address address = KABCSync::getAddress(abEntry,fSyncSettings); TDEABC::Address address = TDEABCSync::getAddress(abEntry,fSyncSettings);
if(!_equal(address.street(), piAddress->getField(entryAddress))) if(!_equal(address.street(), piAddress->getField(entryAddress)))
{ {
DEBUGKPILOT << fname << ": address not equal" << endl; DEBUGKPILOT << fname << ": address not equal" << endl;
@ -1443,7 +1443,7 @@ bool AbbrowserConduit::_equal(const PilotAddress *piAddress, const Addressee &ab
for ( ; customIndex<4; ++customIndex,++hhField ) for ( ; customIndex<4; ++customIndex,++hhField )
{ {
if (!_equal(KABCSync::getFieldForHHCustom(customIndex, abEntry, fSyncSettings), if (!_equal(TDEABCSync::getFieldForHHCustom(customIndex, abEntry, fSyncSettings),
piAddress->getField(hhField))) piAddress->getField(hhField)))
{ {
DEBUGKPILOT << fname << ": Custom field " << customIndex DEBUGKPILOT << fname << ": Custom field " << customIndex
@ -1455,7 +1455,7 @@ bool AbbrowserConduit::_equal(const PilotAddress *piAddress, const Addressee &ab
// if any side is marked archived, but the other is not, the two // if any side is marked archived, but the other is not, the two
// are not equal. // are not equal.
if ( (flags & eqFlagsFlags) && (isArchived(piAddress) || KABCSync::isArchived(abEntry) ) ) if ( (flags & eqFlagsFlags) && (isArchived(piAddress) || TDEABCSync::isArchived(abEntry) ) )
{ {
DEBUGKPILOT << fname << ": archived flags don't match" << endl; DEBUGKPILOT << fname << ": archived flags don't match" << endl;
return false; return false;
@ -1552,20 +1552,20 @@ bool AbbrowserConduit::_buildResolutionTable(ResolutionTable*tab, const Addresse
appendAddr(i18n("Title"), pcAddr.prefix(), entryTitle); appendAddr(i18n("Title"), pcAddr.prefix(), entryTitle);
appendAddr(i18n("Note"), pcAddr.note(), entryNote); appendAddr(i18n("Note"), pcAddr.note(), entryNote);
appendAddr(i18n("Custom 1"), KABCSync::getFieldForHHCustom(0, pcAddr, fSyncSettings), entryCustom1); appendAddr(i18n("Custom 1"), TDEABCSync::getFieldForHHCustom(0, pcAddr, fSyncSettings), entryCustom1);
appendAddr(i18n("Custom 2"), KABCSync::getFieldForHHCustom(1, pcAddr, fSyncSettings), entryCustom2); appendAddr(i18n("Custom 2"), TDEABCSync::getFieldForHHCustom(1, pcAddr, fSyncSettings), entryCustom2);
appendAddr(i18n("Custom 3"), KABCSync::getFieldForHHCustom(2, pcAddr, fSyncSettings), entryCustom3); appendAddr(i18n("Custom 3"), TDEABCSync::getFieldForHHCustom(2, pcAddr, fSyncSettings), entryCustom3);
appendAddr(i18n("Custom 4"), KABCSync::getFieldForHHCustom(3, pcAddr, fSyncSettings), entryCustom4); appendAddr(i18n("Custom 4"), TDEABCSync::getFieldForHHCustom(3, pcAddr, fSyncSettings), entryCustom4);
appendPhone(i18n("Work Phone"), Work, eWork); appendPhone(i18n("Work Phone"), Work, eWork);
appendPhone(i18n("Home Phone"), Home, eHome); appendPhone(i18n("Home Phone"), Home, eHome);
appendPhone(i18n("Mobile Phone"), Cell, eMobile); appendPhone(i18n("Mobile Phone"), Cell, eMobile);
appendGenPhone(i18n("Fax"), pcAddr.phoneNumber(faxTypeOnPC()).number(), eFax); appendGenPhone(i18n("Fax"), pcAddr.phoneNumber(faxTypeOnPC()).number(), eFax);
appendPhone(i18n("Pager"), Pager, ePager); appendPhone(i18n("Pager"), Pager, ePager);
appendGenPhone(i18n("Other"), KABCSync::getFieldForHHOtherPhone(pcAddr,fSyncSettings), eOther); appendGenPhone(i18n("Other"), TDEABCSync::getFieldForHHOtherPhone(pcAddr,fSyncSettings), eOther);
appendGenPhone(i18n("Email"), pcAddr.preferredEmail(), eEmail); appendGenPhone(i18n("Email"), pcAddr.preferredEmail(), eEmail);
TDEABC::Address abAddress = KABCSync::getAddress(pcAddr,fSyncSettings); TDEABC::Address abAddress = TDEABCSync::getAddress(pcAddr,fSyncSettings);
appendAddr(i18n("Address"), abAddress.street(), entryAddress); appendAddr(i18n("Address"), abAddress.street(), entryAddress);
appendAddr(i18n("City"), abAddress.locality(), entryCity); appendAddr(i18n("City"), abAddress.locality(), entryCity);
appendAddr(i18n("Region"), abAddress.region(), entryState); appendAddr(i18n("Region"), abAddress.region(), entryState);
@ -1587,7 +1587,7 @@ bool AbbrowserConduit::_buildResolutionTable(ResolutionTable*tab, const Addresse
i18n("Category"), i18n("Category"),
tab->fExistItems, tab->fExistItems,
!pcAddr.isEmpty() ? !pcAddr.isEmpty() ?
KABCSync::bestMatchedCategoryName(pcAddr.categories(), *fAddressAppInfo, category) : TDEABCSync::bestMatchedCategoryName(pcAddr.categories(), *fAddressAppInfo, category) :
TQString(), TQString(),
palmAddrCategoryLabel, palmAddrCategoryLabel,
backupAddrCategoryLabel)); backupAddrCategoryLabel));
@ -1629,7 +1629,7 @@ bool AbbrowserConduit::_applyResolutionTable(ResolutionTable*tab, Addressee &pcA
#define SETFIELD(abfield, palmfield) \ #define SETFIELD(abfield, palmfield) \
SETGENFIELD(pcAddr.set##abfield(item->fResolved), palmfield) SETGENFIELD(pcAddr.set##abfield(item->fResolved), palmfield)
#define SETCUSTOMFIELD(abfield, palmfield) \ #define SETCUSTOMFIELD(abfield, palmfield) \
SETGENFIELD(KABCSync::setFieldFromHHCustom(abfield, pcAddr, item->fResolved, fSyncSettings), palmfield) SETGENFIELD(TDEABCSync::setFieldFromHHCustom(abfield, pcAddr, item->fResolved, fSyncSettings), palmfield)
#define SETGENPHONE(abfield, palmfield) \ #define SETGENPHONE(abfield, palmfield) \
if (item) { \ if (item) { \
abfield; \ abfield; \
@ -1657,7 +1657,7 @@ bool AbbrowserConduit::_applyResolutionTable(ResolutionTable*tab, Addressee &pcA
SETPHONEFIELD(Cell, eMobile); SETPHONEFIELD(Cell, eMobile);
SETGENPHONE(setPhoneNumber(pcAddr, faxTypeOnPC(), item->fResolved), eFax); SETGENPHONE(setPhoneNumber(pcAddr, faxTypeOnPC(), item->fResolved), eFax);
SETPHONEFIELD(Pager, ePager); SETPHONEFIELD(Pager, ePager);
SETGENPHONE(KABCSync::setFieldFromHHOtherPhone(pcAddr, item->fResolved, fSyncSettings), eOther); SETGENPHONE(TDEABCSync::setFieldFromHHOtherPhone(pcAddr, item->fResolved, fSyncSettings), eOther);
// TODO: fix email // TODO: fix email
if (item) if (item)
@ -1672,7 +1672,7 @@ bool AbbrowserConduit::_applyResolutionTable(ResolutionTable*tab, Addressee &pcA
} }
item=tab->next(); item=tab->next();
TDEABC::Address abAddress = KABCSync::getAddress(pcAddr, fSyncSettings); TDEABC::Address abAddress = TDEABCSync::getAddress(pcAddr, fSyncSettings);
SETADDRESSFIELD(setStreet, entryAddress); SETADDRESSFIELD(setStreet, entryAddress);
SETADDRESSFIELD(setLocality, entryCity); SETADDRESSFIELD(setLocality, entryCity);
SETADDRESSFIELD(setRegion, entryState); SETADDRESSFIELD(setRegion, entryState);
@ -1684,7 +1684,7 @@ bool AbbrowserConduit::_applyResolutionTable(ResolutionTable*tab, Addressee &pcA
if (item) if (item)
{ {
palmAddr->setCategory( fAddressAppInfo->findCategory(item->fResolved) ); palmAddr->setCategory( fAddressAppInfo->findCategory(item->fResolved) );
KABCSync::setCategory(pcAddr, item->fResolved); TDEABCSync::setCategory(pcAddr, item->fResolved);
} }
@ -1784,7 +1784,7 @@ bool AbbrowserConduit::_smartMergeAddressee(Addressee &pcAddr,
switch (res) { switch (res) {
case SyncAction::eDuplicate: case SyncAction::eDuplicate:
// Set the Palm ID to 0 so we don't overwrite the existing record. // Set the Palm ID to 0 so we don't overwrite the existing record.
pcAddr.removeCustom(KABCSync::appString, KABCSync::idString); pcAddr.removeCustom(TDEABCSync::appString, TDEABCSync::idString);
result &= _copyToHH(pcAddr, 0L, 0L); result &= _copyToHH(pcAddr, 0L, 0L);
{ {
Addressee pcadr; Addressee pcadr;
@ -1800,7 +1800,7 @@ bool AbbrowserConduit::_smartMergeAddressee(Addressee &pcAddr,
result &= _copyToHH(pcAddr, backupAddr, pAddr); result &= _copyToHH(pcAddr, backupAddr, pAddr);
break; break;
case SyncAction::ePreviousSyncOverrides: case SyncAction::ePreviousSyncOverrides:
KABCSync::copy(pcAddr, *backupAddr, *fAddressAppInfo, fSyncSettings); TDEABCSync::copy(pcAddr, *backupAddr, *fAddressAppInfo, fSyncSettings);
if (palmAddr && backupAddr) *palmAddr=*backupAddr; if (palmAddr && backupAddr) *palmAddr=*backupAddr;
result &= _savePalmAddr(backupAddr, pcAddr); result &= _savePalmAddr(backupAddr, pcAddr);
result &= _savePCAddr(pcAddr, backupAddr, backupAddr); result &= _savePCAddr(pcAddr, backupAddr, backupAddr);
@ -1852,7 +1852,7 @@ Addressee AbbrowserConduit::_findMatch(const PilotAddress & pilotAddress) const
for(AddressBook::Iterator iter = aBook->begin(); iter != aBook->end(); ++iter) for(AddressBook::Iterator iter = aBook->begin(); iter != aBook->end(); ++iter)
{ {
Addressee abEntry = *iter; Addressee abEntry = *iter;
TQString recID(abEntry.custom(KABCSync::appString, KABCSync::idString)); TQString recID(abEntry.custom(TDEABCSync::appString, TDEABCSync::idString));
bool ok; bool ok;
if (!recID.isEmpty() ) if (!recID.isEmpty() )
{ {

@ -196,7 +196,7 @@ private:
PilotAddressInfo *fAddressAppInfo; PilotAddressInfo *fAddressAppInfo;
KABCSync::Settings fSyncSettings; TDEABCSync::Settings fSyncSettings;
int pilotindex; int pilotindex;
bool abChanged; bool abChanged;

@ -74,7 +74,7 @@ static TDEABC::PhoneNumber::Types pilotToPhoneMap[8] = {
TDEABC::PhoneNumber::Cell // eMobile TDEABC::PhoneNumber::Cell // eMobile
} ; } ;
TDEABC::PhoneNumber::List KABCSync::getPhoneNumbers(const PilotAddress &a) TDEABC::PhoneNumber::List TDEABCSync::getPhoneNumbers(const PilotAddress &a)
{ {
FUNCTIONSETUP; FUNCTIONSETUP;
@ -131,7 +131,7 @@ TDEABC::PhoneNumber::List KABCSync::getPhoneNumbers(const PilotAddress &a)
return list; return list;
} }
void KABCSync::setPhoneNumbers(const PilotAddressInfo &info, void TDEABCSync::setPhoneNumbers(const PilotAddressInfo &info,
PilotAddress &a, PilotAddress &a,
const TDEABC::PhoneNumber::List &list) const TDEABC::PhoneNumber::List &list)
{ {
@ -222,7 +222,7 @@ void KABCSync::setPhoneNumbers(const PilotAddressInfo &info,
} }
} }
unsigned int KABCSync::bestMatchedCategory(const TQStringList &pccategories, unsigned int TDEABCSync::bestMatchedCategory(const TQStringList &pccategories,
const PilotAddressInfo &info, const PilotAddressInfo &info,
unsigned int hhcategory) unsigned int hhcategory)
{ {
@ -258,7 +258,7 @@ unsigned int KABCSync::bestMatchedCategory(const TQStringList &pccategories,
return Pilot::Unfiled; return Pilot::Unfiled;
} }
void KABCSync::setCategory(TDEABC::Addressee & abEntry, const TQString &cat) void TDEABCSync::setCategory(TDEABC::Addressee & abEntry, const TQString &cat)
{ {
if ( (!cat.isEmpty())) if ( (!cat.isEmpty()))
{ {
@ -267,10 +267,10 @@ void KABCSync::setCategory(TDEABC::Addressee & abEntry, const TQString &cat)
} }
TQString KABCSync::getFieldForHHCustom( TQString TDEABCSync::getFieldForHHCustom(
const unsigned int index, const unsigned int index,
const TDEABC::Addressee &abEntry, const TDEABC::Addressee &abEntry,
const KABCSync::Settings &settings) const TDEABCSync::Settings &settings)
{ {
FUNCTIONSETUPL(4); FUNCTIONSETUPL(4);
@ -318,11 +318,11 @@ TQString KABCSync::getFieldForHHCustom(
return retval; return retval;
} }
void KABCSync::setFieldFromHHCustom( void TDEABCSync::setFieldFromHHCustom(
const unsigned int index, const unsigned int index,
TDEABC::Addressee &abEntry, TDEABC::Addressee &abEntry,
const TQString &value, const TQString &value,
const KABCSync::Settings &settings) const TDEABCSync::Settings &settings)
{ {
FUNCTIONSETUPL(4); FUNCTIONSETUPL(4);
@ -392,7 +392,7 @@ void KABCSync::setFieldFromHHCustom(
* for home or work as specified in the config dialog. If we don't have * for home or work as specified in the config dialog. If we don't have
* such one, either, search for the other type. If we still have no luck, * such one, either, search for the other type. If we still have no luck,
* return an address with preferred + home/work flag (from config dlg). */ * return an address with preferred + home/work flag (from config dlg). */
TDEABC::Address KABCSync::getAddress(const TDEABC::Addressee &abEntry, const KABCSync::Settings &s) TDEABC::Address TDEABCSync::getAddress(const TDEABC::Addressee &abEntry, const TDEABCSync::Settings &s)
{ {
// preferhome == (AbbrowserSettings::pilotStreet==0) // preferhome == (AbbrowserSettings::pilotStreet==0)
@ -416,7 +416,7 @@ TDEABC::Address KABCSync::getAddress(const TDEABC::Addressee &abEntry, const KAB
} }
TQString KABCSync::getFieldForHHOtherPhone(const TDEABC::Addressee & abEntry, const KABCSync::Settings &s) TQString TDEABCSync::getFieldForHHOtherPhone(const TDEABC::Addressee & abEntry, const TDEABCSync::Settings &s)
{ {
switch(s.fieldForOtherPhone()) switch(s.fieldForOtherPhone())
{ {
@ -441,7 +441,7 @@ TQString KABCSync::getFieldForHHOtherPhone(const TDEABC::Addressee & abEntry, co
} }
} }
void KABCSync::setFieldFromHHOtherPhone(TDEABC::Addressee & abEntry, const TQString &nr, const KABCSync::Settings &s) void TDEABCSync::setFieldFromHHOtherPhone(TDEABC::Addressee & abEntry, const TQString &nr, const TDEABCSync::Settings &s)
{ {
int phoneType = 0; int phoneType = 0;
switch (s.fieldForOtherPhone()) switch (s.fieldForOtherPhone())
@ -483,7 +483,7 @@ void KABCSync::setFieldFromHHOtherPhone(TDEABC::Addressee & abEntry, const TQStr
abEntry.insertPhoneNumber(phone); abEntry.insertPhoneNumber(phone);
} }
void KABCSync::setAddress(PilotAddress &toPilotAddr, void TDEABCSync::setAddress(PilotAddress &toPilotAddr,
const TDEABC::Address & abAddress) const TDEABC::Address & abAddress)
{ {
toPilotAddr.setField(entryAddress, abAddress.street()); toPilotAddr.setField(entryAddress, abAddress.street());
@ -494,25 +494,25 @@ void KABCSync::setAddress(PilotAddress &toPilotAddr,
} }
bool KABCSync::isArchived(const TDEABC::Addressee &addr) bool TDEABCSync::isArchived(const TDEABC::Addressee &addr)
{ {
return addr.custom(KABCSync::appString, KABCSync::flagString) == TQString::number(SYNCDEL); return addr.custom(TDEABCSync::appString, TDEABCSync::flagString) == TQString::number(SYNCDEL);
} }
void KABCSync::makeArchived(TDEABC::Addressee &addr) void TDEABCSync::makeArchived(TDEABC::Addressee &addr)
{ {
FUNCTIONSETUP; FUNCTIONSETUP;
addr.insertCustom(KABCSync::appString, KABCSync::flagString, TQString::number(SYNCDEL)); addr.insertCustom(TDEABCSync::appString, TDEABCSync::flagString, TQString::number(SYNCDEL));
addr.removeCustom(KABCSync::appString, KABCSync::idString); addr.removeCustom(TDEABCSync::appString, TDEABCSync::idString);
} }
void KABCSync::copy(PilotAddress &toPilotAddr, void TDEABCSync::copy(PilotAddress &toPilotAddr,
const TDEABC::Addressee &fromAbEntry, const TDEABC::Addressee &fromAbEntry,
const PilotAddressInfo &appInfo, const PilotAddressInfo &appInfo,
const KABCSync::Settings &syncSettings) const TDEABCSync::Settings &syncSettings)
{ {
FUNCTIONSETUP; FUNCTIONSETUP;
@ -532,17 +532,17 @@ void KABCSync::copy(PilotAddress &toPilotAddr,
// now in one fell swoop, set all phone numbers from the Addressee. Note, // now in one fell swoop, set all phone numbers from the Addressee. Note,
// we don't need to differentiate between Fax numbers here--all Fax numbers // we don't need to differentiate between Fax numbers here--all Fax numbers
// (Home Fax or Work Fax or just plain old Fax) will get synced to the Pilot // (Home Fax or Work Fax or just plain old Fax) will get synced to the Pilot
KABCSync::setPhoneNumbers(appInfo,toPilotAddr,fromAbEntry.phoneNumbers()); TDEABCSync::setPhoneNumbers(appInfo,toPilotAddr,fromAbEntry.phoneNumbers());
// Other field is an oddball and if the user has more than one field set // Other field is an oddball and if the user has more than one field set
// as "Other" then only one will be carried over. // as "Other" then only one will be carried over.
TQString oth = KABCSync::getFieldForHHOtherPhone(fromAbEntry,syncSettings); TQString oth = TDEABCSync::getFieldForHHOtherPhone(fromAbEntry,syncSettings);
DEBUGKPILOT << fname << ": putting: ["<<oth<<"] into Palm's other"<<endl; DEBUGKPILOT << fname << ": putting: ["<<oth<<"] into Palm's other"<<endl;
toPilotAddr.setPhoneField(PilotAddressInfo::eOther, toPilotAddr.setPhoneField(PilotAddressInfo::eOther,
oth, PilotAddress::Replace); oth, PilotAddress::Replace);
TDEABC::Address homeAddress = KABCSync::getAddress(fromAbEntry, syncSettings); TDEABC::Address homeAddress = TDEABCSync::getAddress(fromAbEntry, syncSettings);
KABCSync::setAddress(toPilotAddr, homeAddress); TDEABCSync::setAddress(toPilotAddr, homeAddress);
// Process the additional entries from the Palm(the palm database app block tells us the name of the fields) // Process the additional entries from the Palm(the palm database app block tells us the name of the fields)
unsigned int customIndex = 0; unsigned int customIndex = 0;
@ -553,7 +553,7 @@ void KABCSync::copy(PilotAddress &toPilotAddr,
toPilotAddr.setField(hhField,getFieldForHHCustom(customIndex,fromAbEntry,syncSettings)); toPilotAddr.setField(hhField,getFieldForHHCustom(customIndex,fromAbEntry,syncSettings));
} }
int categoryForHH = KABCSync::bestMatchedCategory(fromAbEntry.categories(), int categoryForHH = TDEABCSync::bestMatchedCategory(fromAbEntry.categories(),
appInfo,toPilotAddr.category()); appInfo,toPilotAddr.category());
toPilotAddr.setCategory(categoryForHH); toPilotAddr.setCategory(categoryForHH);
@ -567,10 +567,10 @@ void KABCSync::copy(PilotAddress &toPilotAddr,
} }
} }
void KABCSync::copy(TDEABC::Addressee &toAbEntry, void TDEABCSync::copy(TDEABC::Addressee &toAbEntry,
const PilotAddress &fromPiAddr, const PilotAddress &fromPiAddr,
const PilotAddressInfo &appInfo, const PilotAddressInfo &appInfo,
const KABCSync::Settings &syncSettings) const TDEABCSync::Settings &syncSettings)
{ {
FUNCTIONSETUP; FUNCTIONSETUP;
@ -601,7 +601,7 @@ void KABCSync::copy(TDEABC::Addressee &toAbEntry,
} }
// now, get the phone numbers from the Pilot and set them one at a time in kabc // now, get the phone numbers from the Pilot and set them one at a time in kabc
TDEABC::PhoneNumber::List phones = KABCSync::getPhoneNumbers(fromPiAddr); TDEABC::PhoneNumber::List phones = TDEABCSync::getPhoneNumbers(fromPiAddr);
for (TDEABC::PhoneNumber::List::Iterator it = phones.begin(); it != phones.end(); ++it) { for (TDEABC::PhoneNumber::List::Iterator it = phones.begin(); it != phones.end(); ++it) {
TDEABC::PhoneNumber phone = *it; TDEABC::PhoneNumber phone = *it;
// check for fax number if it is one, set the type per the user's direction // check for fax number if it is one, set the type per the user's direction
@ -615,7 +615,7 @@ void KABCSync::copy(TDEABC::Addressee &toAbEntry,
// Note: this is weird, and it may cause data to not be synced if there is // Note: this is weird, and it may cause data to not be synced if there is
// more than one "Other" field being used on the Pilot, since only one will // more than one "Other" field being used on the Pilot, since only one will
// be synced in either direction. // be synced in either direction.
KABCSync::setFieldFromHHOtherPhone(toAbEntry, TDEABCSync::setFieldFromHHOtherPhone(toAbEntry,
fromPiAddr.getPhoneField(PilotAddressInfo::eOther),syncSettings); fromPiAddr.getPhoneField(PilotAddressInfo::eOther),syncSettings);
// going from Pilot to kabc, we need to clear out all addresses in kabc // going from Pilot to kabc, we need to clear out all addresses in kabc
@ -627,7 +627,7 @@ void KABCSync::copy(TDEABC::Addressee &toAbEntry,
const TDEABC::Address addr = *it; const TDEABC::Address addr = *it;
toAbEntry.removeAddress(addr); toAbEntry.removeAddress(addr);
} }
TDEABC::Address homeAddress = KABCSync::getAddress(toAbEntry,syncSettings); TDEABC::Address homeAddress = TDEABCSync::getAddress(toAbEntry,syncSettings);
homeAddress.setStreet(fromPiAddr.getField(entryAddress)); homeAddress.setStreet(fromPiAddr.getField(entryAddress));
homeAddress.setLocality(fromPiAddr.getField(entryCity)); homeAddress.setLocality(fromPiAddr.getField(entryCity));
homeAddress.setRegion(fromPiAddr.getField(entryState)); homeAddress.setRegion(fromPiAddr.getField(entryState));
@ -640,7 +640,7 @@ void KABCSync::copy(TDEABC::Addressee &toAbEntry,
for ( ; customIndex<4; ++customIndex,++hhField ) for ( ; customIndex<4; ++customIndex,++hhField )
{ {
KABCSync::setFieldFromHHCustom(customIndex, TDEABCSync::setFieldFromHHCustom(customIndex,
toAbEntry, toAbEntry,
fromPiAddr.getField(hhField), fromPiAddr.getField(hhField),
syncSettings); syncSettings);
@ -650,14 +650,14 @@ void KABCSync::copy(TDEABC::Addressee &toAbEntry,
// pilot id may be zero(since it could be new) but couldn't hurt // pilot id may be zero(since it could be new) but couldn't hurt
// to even assign it to zero; let's us know what state the // to even assign it to zero; let's us know what state the
// toAbEntry is in // toAbEntry is in
toAbEntry.insertCustom(KABCSync::appString, KABCSync::idString, TQString::number(fromPiAddr.id())); toAbEntry.insertCustom(TDEABCSync::appString, TDEABCSync::idString, TQString::number(fromPiAddr.id()));
KABCSync::setCategory(toAbEntry, appInfo.categoryName(fromPiAddr.category())); TDEABCSync::setCategory(toAbEntry, appInfo.categoryName(fromPiAddr.category()));
showAddressee(toAbEntry); showAddressee(toAbEntry);
} }
void KABCSync::showAddressee(const TDEABC::Addressee & abAddress) void TDEABCSync::showAddressee(const TDEABC::Addressee & abAddress)
{ {
FUNCTIONSETUP; FUNCTIONSETUP;
#ifdef DEBUG #ifdef DEBUG
@ -699,7 +699,7 @@ void KABCSync::showAddressee(const TDEABC::Addressee & abAddress)
KABCSync::Settings::Settings() : TDEABCSync::Settings::Settings() :
fDateFormat(), fDateFormat(),
fCustomMapping(4), // Reserve space for 4 elements, value 0 == CustomField fCustomMapping(4), // Reserve space for 4 elements, value 0 == CustomField
fOtherPhone(eOtherPhone), fOtherPhone(eOtherPhone),

@ -100,7 +100,7 @@ int main(int argc, char **argv)
info.resetToDefault(); info.resetToDefault();
info.writeTo(&db); info.writeTo(&db);
KABCSync::Settings settings; TDEABCSync::Settings settings;
kdDebug() << "# Printing address book." << endl; kdDebug() << "# Printing address book." << endl;
unsigned int count = 1; unsigned int count = 1;
@ -112,7 +112,7 @@ int main(int argc, char **argv)
kdDebug() << "# " << a.name() << endl; kdDebug() << "# " << a.name() << endl;
kdDebug() << "# " << a.formattedName() << endl; kdDebug() << "# " << a.formattedName() << endl;
PilotAddress *p = new PilotAddress(); PilotAddress *p = new PilotAddress();
KABCSync::copy(*p,a,info,settings); TDEABCSync::copy(*p,a,info,settings);
PilotRecord *r = p->pack(); PilotRecord *r = p->pack();
if (r) if (r)
{ {

Loading…
Cancel
Save