|
|
|
@ -65,14 +65,14 @@ unsigned long version_conduit_address = Pilot::PLUGIN_API;
|
|
|
|
|
|
|
|
|
|
/* This is partly stolen from the boost libraries, partly from
|
|
|
|
|
* "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
|
|
|
|
|
* configuration values the same way.
|
|
|
|
|
*/
|
|
|
|
|
template<bool> struct EnumerationMismatch;
|
|
|
|
|
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()
|
|
|
|
|
{
|
|
|
|
@ -163,7 +163,7 @@ void AbbrowserConduit::_mapContactsToPilot(TQMap < recordid_t, TQString > &idCon
|
|
|
|
|
contactIter != aBook->end(); ++contactIter)
|
|
|
|
|
{
|
|
|
|
|
Addressee aContact = *contactIter;
|
|
|
|
|
TQString recid = aContact.custom(KABCSync::appString, KABCSync::idString);
|
|
|
|
|
TQString recid = aContact.custom(TDEABCSync::appString, TDEABCSync::idString);
|
|
|
|
|
if(!recid.isEmpty())
|
|
|
|
|
{
|
|
|
|
|
recordid_t id = recid.toULong();
|
|
|
|
@ -180,7 +180,7 @@ void AbbrowserConduit::_mapContactsToPilot(TQMap < recordid_t, TQString > &idCon
|
|
|
|
|
DEBUGKPILOT << fname << ": found duplicate pilot key: ["
|
|
|
|
|
<< id << "], removing pilot id from addressee: ["
|
|
|
|
|
<< aContact.realName() << "]" << endl;
|
|
|
|
|
aContact.removeCustom(KABCSync::appString, KABCSync::idString);
|
|
|
|
|
aContact.removeCustom(TDEABCSync::appString, TDEABCSync::idString);
|
|
|
|
|
aBook->insertAddressee(aContact);
|
|
|
|
|
abChanged = true;
|
|
|
|
|
}
|
|
|
|
@ -489,7 +489,7 @@ void AbbrowserConduit::showAddresses(
|
|
|
|
|
if (debug_level >= 3)
|
|
|
|
|
{
|
|
|
|
|
DEBUGKPILOT << fname << "abEntry:" << endl;
|
|
|
|
|
KABCSync::showAddressee(pcAddr);
|
|
|
|
|
TDEABCSync::showAddressee(pcAddr);
|
|
|
|
|
DEBUGKPILOT << fname << "pilotAddress:" << endl;
|
|
|
|
|
showPilotAddress(palmAddr);
|
|
|
|
|
DEBUGKPILOT << fname << "backupAddress:" << endl;
|
|
|
|
@ -674,7 +674,7 @@ void AbbrowserConduit::slotPCRecToPalm()
|
|
|
|
|
abiter++;
|
|
|
|
|
|
|
|
|
|
// If marked as archived, don't sync!
|
|
|
|
|
if (KABCSync::isArchived(ad))
|
|
|
|
|
if (TDEABCSync::isArchived(ad))
|
|
|
|
|
{
|
|
|
|
|
DEBUGKPILOT << fname << ": address with id " << ad.uid() <<
|
|
|
|
|
" 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;
|
|
|
|
|
recordid_t rid = recID.toLong(&ok);
|
|
|
|
|
if (recID.isEmpty() || !ok || !rid)
|
|
|
|
@ -946,7 +946,7 @@ bool AbbrowserConduit::syncAddressee(Addressee &pcAddr, PilotAddress*backupAddr,
|
|
|
|
|
E/A 0 | HH -> PC
|
|
|
|
|
E/A E/A| merge/CR
|
|
|
|
|
*/
|
|
|
|
|
if (!palmAddr && KABCSync::isArchived(pcAddr) )
|
|
|
|
|
if (!palmAddr && TDEABCSync::isArchived(pcAddr) )
|
|
|
|
|
{
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
@ -1081,10 +1081,10 @@ bool AbbrowserConduit::_copyToHH(Addressee &pcAddr, PilotAddress*backupAddr,
|
|
|
|
|
{
|
|
|
|
|
fCtrHH->updated();
|
|
|
|
|
}
|
|
|
|
|
KABCSync::copy(*paddr, pcAddr, *fAddressAppInfo, fSyncSettings);
|
|
|
|
|
TDEABCSync::copy(*paddr, pcAddr, *fAddressAppInfo, fSyncSettings);
|
|
|
|
|
|
|
|
|
|
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))
|
|
|
|
|
{
|
|
|
|
@ -1115,10 +1115,10 @@ bool AbbrowserConduit::_copyToPC(Addressee &pcAddr, PilotAddress*backupAddr,
|
|
|
|
|
}
|
|
|
|
|
showPilotAddress(palmAddr);
|
|
|
|
|
|
|
|
|
|
KABCSync::copy(pcAddr, *palmAddr, *fAddressAppInfo, fSyncSettings);
|
|
|
|
|
TDEABCSync::copy(pcAddr, *palmAddr, *fAddressAppInfo, fSyncSettings);
|
|
|
|
|
if (isArchived(palmAddr))
|
|
|
|
|
{
|
|
|
|
|
KABCSync::makeArchived(pcAddr);
|
|
|
|
|
TDEABCSync::makeArchived(pcAddr);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
_savePCAddr(pcAddr, backupAddr, palmAddr);
|
|
|
|
@ -1212,10 +1212,10 @@ bool AbbrowserConduit::_savePalmAddr(PilotAddress *palmAddr, Addressee &pcAddr)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
recordid_t abId = 0;
|
|
|
|
|
abId = pcAddr.custom(KABCSync::appString, KABCSync::idString).toUInt();
|
|
|
|
|
abId = pcAddr.custom(TDEABCSync::appString, TDEABCSync::idString).toUInt();
|
|
|
|
|
if(abId != pilotId)
|
|
|
|
|
{
|
|
|
|
|
pcAddr.insertCustom(KABCSync::appString, KABCSync::idString, TQString::number(pilotId));
|
|
|
|
|
pcAddr.insertCustom(TDEABCSync::appString, TDEABCSync::idString, TQString::number(pilotId));
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -1229,8 +1229,8 @@ bool AbbrowserConduit::_savePCAddr(Addressee &pcAddr, PilotAddress*,
|
|
|
|
|
{
|
|
|
|
|
FUNCTIONSETUP;
|
|
|
|
|
|
|
|
|
|
DEBUGKPILOT<<"Before _savePCAddr, pcAddr.custom="<<pcAddr.custom(KABCSync::appString, KABCSync::idString)<<endl;
|
|
|
|
|
TQString pilotId = pcAddr.custom(KABCSync::appString, KABCSync::idString);
|
|
|
|
|
DEBUGKPILOT<<"Before _savePCAddr, pcAddr.custom="<<pcAddr.custom(TDEABCSync::appString, TDEABCSync::idString)<<endl;
|
|
|
|
|
TQString pilotId = pcAddr.custom(TDEABCSync::appString, TDEABCSync::idString);
|
|
|
|
|
long pilotIdL = pilotId.toLong();
|
|
|
|
|
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
|
|
|
|
|
if (flags & eqFlagsFlags)
|
|
|
|
|
if (isArchived(piAddress) && KABCSync::isArchived(abEntry) ) return true;
|
|
|
|
|
if (isArchived(piAddress) && TDEABCSync::isArchived(abEntry) ) return true;
|
|
|
|
|
|
|
|
|
|
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
|
|
|
|
|
// is one matching the PC record.
|
|
|
|
|
TQString addressCategoryLabel = fAddressAppInfo->categoryName(piAddress->category());
|
|
|
|
|
TQString cat = KABCSync::bestMatchedCategoryName(abEntry.categories(),
|
|
|
|
|
TQString cat = TDEABCSync::bestMatchedCategoryName(abEntry.categories(),
|
|
|
|
|
*fAddressAppInfo, piAddress->category());
|
|
|
|
|
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.
|
|
|
|
|
|
|
|
|
|
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
|
|
|
|
|
for (PhoneNumber::List::Iterator it = piPhones.begin(); it != piPhones.end(); 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)))
|
|
|
|
|
{
|
|
|
|
|
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)
|
|
|
|
|
{
|
|
|
|
|
TDEABC::Address address = KABCSync::getAddress(abEntry,fSyncSettings);
|
|
|
|
|
TDEABC::Address address = TDEABCSync::getAddress(abEntry,fSyncSettings);
|
|
|
|
|
if(!_equal(address.street(), piAddress->getField(entryAddress)))
|
|
|
|
|
{
|
|
|
|
|
DEBUGKPILOT << fname << ": address not equal" << endl;
|
|
|
|
@ -1443,7 +1443,7 @@ bool AbbrowserConduit::_equal(const PilotAddress *piAddress, const Addressee &ab
|
|
|
|
|
|
|
|
|
|
for ( ; customIndex<4; ++customIndex,++hhField )
|
|
|
|
|
{
|
|
|
|
|
if (!_equal(KABCSync::getFieldForHHCustom(customIndex, abEntry, fSyncSettings),
|
|
|
|
|
if (!_equal(TDEABCSync::getFieldForHHCustom(customIndex, abEntry, fSyncSettings),
|
|
|
|
|
piAddress->getField(hhField)))
|
|
|
|
|
{
|
|
|
|
|
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
|
|
|
|
|
// 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;
|
|
|
|
|
return false;
|
|
|
|
@ -1552,20 +1552,20 @@ bool AbbrowserConduit::_buildResolutionTable(ResolutionTable*tab, const Addresse
|
|
|
|
|
appendAddr(i18n("Title"), pcAddr.prefix(), entryTitle);
|
|
|
|
|
appendAddr(i18n("Note"), pcAddr.note(), entryNote);
|
|
|
|
|
|
|
|
|
|
appendAddr(i18n("Custom 1"), KABCSync::getFieldForHHCustom(0, pcAddr, fSyncSettings), entryCustom1);
|
|
|
|
|
appendAddr(i18n("Custom 2"), KABCSync::getFieldForHHCustom(1, pcAddr, fSyncSettings), entryCustom2);
|
|
|
|
|
appendAddr(i18n("Custom 3"), KABCSync::getFieldForHHCustom(2, pcAddr, fSyncSettings), entryCustom3);
|
|
|
|
|
appendAddr(i18n("Custom 4"), KABCSync::getFieldForHHCustom(3, pcAddr, fSyncSettings), entryCustom4);
|
|
|
|
|
appendAddr(i18n("Custom 1"), TDEABCSync::getFieldForHHCustom(0, pcAddr, fSyncSettings), entryCustom1);
|
|
|
|
|
appendAddr(i18n("Custom 2"), TDEABCSync::getFieldForHHCustom(1, pcAddr, fSyncSettings), entryCustom2);
|
|
|
|
|
appendAddr(i18n("Custom 3"), TDEABCSync::getFieldForHHCustom(2, pcAddr, fSyncSettings), entryCustom3);
|
|
|
|
|
appendAddr(i18n("Custom 4"), TDEABCSync::getFieldForHHCustom(3, pcAddr, fSyncSettings), entryCustom4);
|
|
|
|
|
|
|
|
|
|
appendPhone(i18n("Work Phone"), Work, eWork);
|
|
|
|
|
appendPhone(i18n("Home Phone"), Home, eHome);
|
|
|
|
|
appendPhone(i18n("Mobile Phone"), Cell, eMobile);
|
|
|
|
|
appendGenPhone(i18n("Fax"), pcAddr.phoneNumber(faxTypeOnPC()).number(), eFax);
|
|
|
|
|
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);
|
|
|
|
|
|
|
|
|
|
TDEABC::Address abAddress = KABCSync::getAddress(pcAddr,fSyncSettings);
|
|
|
|
|
TDEABC::Address abAddress = TDEABCSync::getAddress(pcAddr,fSyncSettings);
|
|
|
|
|
appendAddr(i18n("Address"), abAddress.street(), entryAddress);
|
|
|
|
|
appendAddr(i18n("City"), abAddress.locality(), entryCity);
|
|
|
|
|
appendAddr(i18n("Region"), abAddress.region(), entryState);
|
|
|
|
@ -1587,7 +1587,7 @@ bool AbbrowserConduit::_buildResolutionTable(ResolutionTable*tab, const Addresse
|
|
|
|
|
i18n("Category"),
|
|
|
|
|
tab->fExistItems,
|
|
|
|
|
!pcAddr.isEmpty() ?
|
|
|
|
|
KABCSync::bestMatchedCategoryName(pcAddr.categories(), *fAddressAppInfo, category) :
|
|
|
|
|
TDEABCSync::bestMatchedCategoryName(pcAddr.categories(), *fAddressAppInfo, category) :
|
|
|
|
|
TQString(),
|
|
|
|
|
palmAddrCategoryLabel,
|
|
|
|
|
backupAddrCategoryLabel));
|
|
|
|
@ -1629,7 +1629,7 @@ bool AbbrowserConduit::_applyResolutionTable(ResolutionTable*tab, Addressee &pcA
|
|
|
|
|
#define SETFIELD(abfield, palmfield) \
|
|
|
|
|
SETGENFIELD(pcAddr.set##abfield(item->fResolved), 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) \
|
|
|
|
|
if (item) { \
|
|
|
|
|
abfield; \
|
|
|
|
@ -1657,7 +1657,7 @@ bool AbbrowserConduit::_applyResolutionTable(ResolutionTable*tab, Addressee &pcA
|
|
|
|
|
SETPHONEFIELD(Cell, eMobile);
|
|
|
|
|
SETGENPHONE(setPhoneNumber(pcAddr, faxTypeOnPC(), item->fResolved), eFax);
|
|
|
|
|
SETPHONEFIELD(Pager, ePager);
|
|
|
|
|
SETGENPHONE(KABCSync::setFieldFromHHOtherPhone(pcAddr, item->fResolved, fSyncSettings), eOther);
|
|
|
|
|
SETGENPHONE(TDEABCSync::setFieldFromHHOtherPhone(pcAddr, item->fResolved, fSyncSettings), eOther);
|
|
|
|
|
|
|
|
|
|
// TODO: fix email
|
|
|
|
|
if (item)
|
|
|
|
@ -1672,7 +1672,7 @@ bool AbbrowserConduit::_applyResolutionTable(ResolutionTable*tab, Addressee &pcA
|
|
|
|
|
}
|
|
|
|
|
item=tab->next();
|
|
|
|
|
|
|
|
|
|
TDEABC::Address abAddress = KABCSync::getAddress(pcAddr, fSyncSettings);
|
|
|
|
|
TDEABC::Address abAddress = TDEABCSync::getAddress(pcAddr, fSyncSettings);
|
|
|
|
|
SETADDRESSFIELD(setStreet, entryAddress);
|
|
|
|
|
SETADDRESSFIELD(setLocality, entryCity);
|
|
|
|
|
SETADDRESSFIELD(setRegion, entryState);
|
|
|
|
@ -1684,7 +1684,7 @@ bool AbbrowserConduit::_applyResolutionTable(ResolutionTable*tab, Addressee &pcA
|
|
|
|
|
if (item)
|
|
|
|
|
{
|
|
|
|
|
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) {
|
|
|
|
|
case SyncAction::eDuplicate:
|
|
|
|
|
// 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);
|
|
|
|
|
{
|
|
|
|
|
Addressee pcadr;
|
|
|
|
@ -1800,7 +1800,7 @@ bool AbbrowserConduit::_smartMergeAddressee(Addressee &pcAddr,
|
|
|
|
|
result &= _copyToHH(pcAddr, backupAddr, pAddr);
|
|
|
|
|
break;
|
|
|
|
|
case SyncAction::ePreviousSyncOverrides:
|
|
|
|
|
KABCSync::copy(pcAddr, *backupAddr, *fAddressAppInfo, fSyncSettings);
|
|
|
|
|
TDEABCSync::copy(pcAddr, *backupAddr, *fAddressAppInfo, fSyncSettings);
|
|
|
|
|
if (palmAddr && backupAddr) *palmAddr=*backupAddr;
|
|
|
|
|
result &= _savePalmAddr(backupAddr, pcAddr);
|
|
|
|
|
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)
|
|
|
|
|
{
|
|
|
|
|
Addressee abEntry = *iter;
|
|
|
|
|
TQString recID(abEntry.custom(KABCSync::appString, KABCSync::idString));
|
|
|
|
|
TQString recID(abEntry.custom(TDEABCSync::appString, TDEABCSync::idString));
|
|
|
|
|
bool ok;
|
|
|
|
|
if (!recID.isEmpty() )
|
|
|
|
|
{
|
|
|
|
|