summaryrefslogtreecommitdiffabout
Side-by-side diff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--gammu/emb/common/service/gsmmisc.c4
-rw-r--r--gammu/emb/common/service/gsmpbk.c17
-rw-r--r--gammu/emb/gammu/gammu.c2
-rw-r--r--kabc/addressbook.cpp148
-rw-r--r--kabc/addressbook.h2
-rw-r--r--kabc/addressee.cpp46
-rw-r--r--kabc/addressee.h1
-rw-r--r--kabc/phonenumber.cpp4
-rw-r--r--kaddressbook/kabcore.cpp86
-rw-r--r--libkdepim/ksyncprefsdialog.cpp11
10 files changed, 217 insertions, 104 deletions
diff --git a/gammu/emb/common/service/gsmmisc.c b/gammu/emb/common/service/gsmmisc.c
index 6959a22..1c6ec8b 100644
--- a/gammu/emb/common/service/gsmmisc.c
+++ b/gammu/emb/common/service/gsmmisc.c
@@ -201,13 +201,13 @@ void SaveVCALText(char *Buffer, int *Length, char *Text, char *Start)
{
char buffer[1000];
if (UnicodeLength(Text) != 0) {
- EncodeUTF8QuotedPrintable(buffer,Text);
+ EncodeUTF8(buffer,Text);
if (UnicodeLength(Text)==strlen(buffer)) {
*Length+=sprintf(Buffer+(*Length), "%s:%s%c%c",Start,DecodeUnicodeString(Text),13,10);
} else {
- *Length+=sprintf(Buffer+(*Length), "%s;CHARSET=UTF-8;ENCODING=QUOTED-PRINTABLE:%s%c%c",Start,buffer,13,10);
+ *Length+=sprintf(Buffer+(*Length), "%s:%s%c%c",Start,buffer,13,10);
}
}
}
diff --git a/gammu/emb/common/service/gsmpbk.c b/gammu/emb/common/service/gsmpbk.c
index 05e5cb9..f7cf7d7 100644
--- a/gammu/emb/common/service/gsmpbk.c
+++ b/gammu/emb/common/service/gsmpbk.c
@@ -130,38 +130,38 @@ void GSM_EncodeVCARD(char *Buffer, int *Length, GSM_MemoryEntry *pbk, bool heade
ignore = true;
break;
case PBK_Number_General :
*Length+=sprintf(Buffer+(*Length),"TEL");
- if (Number == i) (*Length)+=sprintf(Buffer+(*Length),";PREF");
+ (*Length)+=sprintf(Buffer+(*Length),";PREF");
break;
case PBK_Number_Mobile :
*Length+=sprintf(Buffer+(*Length),"TEL");
- if (Number == i) (*Length)+=sprintf(Buffer+(*Length),";PREF");
+ //if (Number == i) (*Length)+=sprintf(Buffer+(*Length),";PREF");
*Length+=sprintf(Buffer+(*Length),";CELL");
break;
case PBK_Number_Work :
*Length+=sprintf(Buffer+(*Length),"TEL");
- if (Number == i) (*Length)+=sprintf(Buffer+(*Length),";PREF");
- *Length+=sprintf(Buffer+(*Length),";WORK;VOICE");
+ //if (Number == i) (*Length)+=sprintf(Buffer+(*Length),";PREF");
+ *Length+=sprintf(Buffer+(*Length),";WORK");
break;
case PBK_Number_Fax :
*Length+=sprintf(Buffer+(*Length),"TEL");
- if (Number == i) (*Length)+=sprintf(Buffer+(*Length),";PREF");
+ //if (Number == i) (*Length)+=sprintf(Buffer+(*Length),";PREF");
*Length+=sprintf(Buffer+(*Length),";FAX");
break;
case PBK_Number_Home :
*Length+=sprintf(Buffer+(*Length),"TEL");
- if (Number == i) (*Length)+=sprintf(Buffer+(*Length),";PREF");
- *Length+=sprintf(Buffer+(*Length),";HOME;VOICE");
+ //if (Number == i) (*Length)+=sprintf(Buffer+(*Length),";PREF");
+ *Length+=sprintf(Buffer+(*Length),";HOME");
break;
case PBK_Text_Note :
*Length+=sprintf(Buffer+(*Length),"NOTE");
break;
case PBK_Text_Postal :
/* Don't ask why. Nokia phones save postal address
* double - once like LABEL, second like ADR
*/
- SaveVCALText(Buffer, Length, pbk->Entries[i].Text, "LABEL");
+ //SaveVCALText(Buffer, Length, pbk->Entries[i].Text, "LABEL");
*Length+=sprintf(Buffer+(*Length),"ADR");
break;
case PBK_Text_Email :
case PBK_Text_Email2 :
@@ -178,8 +178,9 @@ void GSM_EncodeVCARD(char *Buffer, int *Length, GSM_MemoryEntry *pbk, bool heade
SaveVCALText(Buffer, Length, pbk->Entries[i].Text, "");
}
}
}
+ *Length+=sprintf(Buffer+(*Length), "X-KADDRESSBOOK-X-ExternalID:%d%c%c",pbk->Location,13,10);
if (header) *Length+=sprintf(Buffer+(*Length),"END:VCARD%c%c",13,10);
}
}
diff --git a/gammu/emb/gammu/gammu.c b/gammu/emb/gammu/gammu.c
index 8db9afb..684e67c 100644
--- a/gammu/emb/gammu/gammu.c
+++ b/gammu/emb/gammu/gammu.c
@@ -4685,9 +4685,9 @@ static void Restore(int argc, char *argv[])
if (error==ERR_NONE) {
max = 0;
while (Backup.PhonePhonebook[max]!=NULL) max++;
printmsgerr("%i entries in backup file\n",max);
- if (answer_yes("Restore phone phonebook")) DoRestore = true;
+ /* LR if (answer_yes("Restore phone phonebook")) */DoRestore = true;
}
}
if (DoRestore) {
used = 0;
diff --git a/kabc/addressbook.cpp b/kabc/addressbook.cpp
index d037d2f..ad0f702 100644
--- a/kabc/addressbook.cpp
+++ b/kabc/addressbook.cpp
@@ -340,19 +340,18 @@ AddressBook::~AddressBook()
bool AddressBook::load()
{
-
clear();
-
KRES::Manager<Resource>::ActiveIterator it;
bool ok = true;
for ( it = d->mManager->activeBegin(); it != d->mManager->activeEnd(); ++it )
if ( !(*it)->load() ) {
- error( i18n("Unable to load resource '%1'").arg( (*it)->resourceName() ) );
+ qDebug( i18n("Unable to load resource '%1'").arg( (*it)->resourceName() ) );
ok = false;
+ } else {
+ qDebug( i18n("Resource loaded: '%1'").arg( (*it)->resourceName() ) );
}
-
// mark all addressees as unchanged
Addressee::List::Iterator addrIt;
for ( addrIt = d->mAddressees.begin(); addrIt != d->mAddressees.end(); ++addrIt ) {
(*addrIt).setChanged( false );
@@ -403,8 +402,77 @@ void AddressBook::export2File( QString fileName )
}
t << "\r\n\r\n";
outFile.close();
}
+// if QStringList uids is empty, all are exported
+bool AddressBook::export2PhoneFormat( QStringList uids ,QString fileName )
+{
+ KABC::VCardConverter converter;
+ QString datastream;
+ Iterator it;
+ bool all = uids.isEmpty();
+ for ( it = begin(); it != end(); ++it ) {
+ // for( QStringList::ConstIterator it = uids.begin(); it != uids.end(); ++it ) {
+ if ( ! all ) {
+ if ( ! ( uids.contains((*it).uid() ) ))
+ continue;
+ }
+ KABC::Addressee a = ( *it );
+ if ( a.isEmpty() )
+ continue;
+ a.simplifyEmails();
+ a.simplifyPhoneNumbers();
+ a.simplifyPhoneNumberTypes();
+ a.simplifyAddresses();
+
+ QString vcard;
+ QString vcardnew;
+ converter.addresseeToVCard( a, vcard );
+ int start = 0;
+ int next;
+ while ( (next = vcard.find("TYPE=", start) )>= 0 ) {
+ int semi = vcard.find(";", next);
+ int dopp = vcard.find(":", next);
+ int sep;
+ if ( semi < dopp && semi >= 0 )
+ sep = semi ;
+ else
+ sep = dopp;
+ vcardnew +=vcard.mid( start, next - start);
+ vcardnew +=vcard.mid( next+5,sep -next -5 ).upper();
+ start = sep;
+ }
+ vcardnew += vcard.mid( start,vcard.length() );
+ vcard = "";
+ start = 0;
+ while ( (next = vcardnew.find("ADR", start) )>= 0 ) {
+ int sep = vcardnew.find(":", next);
+ vcard +=vcardnew.mid( start, next - start+3);
+ start = sep;
+ }
+ vcard += vcardnew.mid( start,vcardnew.length() );
+ vcard.replace ( QRegExp(";;;") , "" );
+ vcard.replace ( QRegExp(";;") , "" );
+ datastream += vcard;
+
+ }
+
+ QFile outFile(fileName);
+ if ( outFile.open(IO_WriteOnly) ) {
+ datastream.replace ( QRegExp("VERSION:3.0") , "VERSION:2.1" );
+ QTextStream t( &outFile ); // use a text stream
+ t.setEncoding( QTextStream::UnicodeUTF8 );
+ t <<datastream;
+ t << "\r\n\r\n";
+ outFile.close();
+
+ } else {
+ qDebug("Error open temp file ");
+ return false;
+ }
+ return true;
+
+}
void AddressBook::importFromFile( QString fileName, bool replaceLabel, bool removeOld )
{
if ( removeOld )
@@ -424,8 +492,11 @@ void AddressBook::importFromFile( QString fileName, bool replaceLabel, bool rem
KABC::VCardTool tool;
list = tool.parseVCards( data );
KABC::Addressee::List::Iterator it;
for ( it = list.begin(); it != list.end(); ++it ) {
+ QString id = (*it).custom( "KADDRESSBOOK", "X-ExternalID" );
+ if ( !id.isEmpty() )
+ (*it).setIDStr(id );
(*it).setResource( 0 );
if ( replaceLabel )
(*it).removeVoice();
if ( removeOld )
@@ -479,17 +550,61 @@ void AddressBook::preparePhoneSync( QString currentSyncDevice, bool isPreSync )
(*ait).setExternalUID( id );
(*ait).setOriginalExternalUID( id );
if ( isPreSync )
(*ait).setTempSyncStat( SYNC_TEMPSTATE_NEW_EXTERNAL );
- else
+ else {
(*ait).setTempSyncStat( SYNC_TEMPSTATE_NEW_ID );
+ (*ait).setID( currentSyncDevice,id );
+
+ }
+ }
+}
+void AddressBook::findNewExtIds( QString fileName, QString currentSyncDevice )
+{
+
+ setUntagged();
+ KABC::Addressee::List list;
+ QFile file( fileName );
+ file.open( IO_ReadOnly );
+ QByteArray rawData = file.readAll();
+ file.close();
+ QString data;
+
+ data = QString::fromUtf8( rawData.data(), rawData.size() + 1 );
+ KABC::VCardTool tool;
+ list = tool.parseVCards( data );
+ KABC::Addressee::List::Iterator it;
+ for ( it = list.begin(); it != list.end(); ++it ) {
+ Iterator ait;
+ for ( ait = begin(); ait != end(); ++ait ) {
+ if ( !(*ait).tagged() ) {
+ if ( (*ait).containsAdr(*it)) {
+ (*ait).setTagged(true);
+ QString id = (*it).custom( "KADDRESSBOOK", "X-ExternalID" );
+ (*it).setIDStr( ":");
+ (*it).setID( currentSyncDevice,id );
+ (*it).setExternalUID( id );
+ (*it).setTempSyncStat( SYNC_TEMPSTATE_NEW_ID );
+ (*it).setUid( ( (*ait).uid() ));
+ break;
+ }
+ }
+
+ }
+ if ( ait == end() )
+ qDebug("ERROR:: no ext ID found for uid: %s", (*it).uid().latin1());
+ }
+ clear();
+ for ( it = list.begin(); it != list.end(); ++it ) {
+ insertAddressee( (*it) );
}
}
+
bool AddressBook::saveABphone( QString fileName )
{
- smplifyAddressees();
+ //smplifyAddressees();
qDebug("saveABphone:: saving AB... ");
- if ( ! saveAB() )
+ if ( ! export2PhoneFormat( QStringList() ,fileName ) )
return false;
qDebug("saveABphone:: writing to phone... ");
if ( !PhoneAccess::writeToPhone( fileName) ) {
return false;
@@ -497,11 +612,8 @@ bool AddressBook::saveABphone( QString fileName )
qDebug("saveABphone:: re-reading from phone... ");
if ( !PhoneAccess::readFromPhone( fileName) ) {
return false;
}
- qDebug("reloading phone book... ");
- if ( !load() )
- return false;
return true;
}
bool AddressBook::saveAB()
{
@@ -515,22 +627,32 @@ bool AddressBook::saveAB()
}
}
KRES::Manager<Resource>::ActiveIterator it;
KRES::Manager<Resource> *manager = d->mManager;
+ qDebug("SaveAB::saving..." );
for ( it = manager->activeBegin(); it != manager->activeEnd(); ++it ) {
+ qDebug("SaveAB::checking resource..." );
+ if ( (*it)->readOnly() )
+ qDebug("readonly." );
+ if ( (*it)->isOpen() )
+ qDebug("open" );
+
if ( !(*it)->readOnly() && (*it)->isOpen() ) {
Ticket *ticket = requestSaveTicket( *it );
-// qDebug("StdAddressBook::save '%s'", (*it)->resourceName().latin1() );
+ qDebug("StdAddressBook::save '%s'", (*it)->resourceName().latin1() );
if ( !ticket ) {
- error( i18n( "Unable to save to resource '%1'. It is locked." )
+ qDebug( i18n( "Unable to save to resource '%1'. It is locked." )
.arg( (*it)->resourceName() ) );
return false;
}
//if ( !save( ticket ) )
if ( ticket->resource() ) {
if ( ! ticket->resource()->save( ticket ) )
ok = false;
+ else
+ qDebug("StdAddressBook::saved '%s'", ticket->resource()->resourceName().latin1() );
+
} else
ok = false;
}
@@ -592,9 +714,9 @@ Ticket *AddressBook::requestSaveTicket( Resource *resource )
}
return 0;
}
-
+//void insertAddressee( const Addressee &, bool setRev = true, bool takeResource = false);
void AddressBook::insertAddressee( const Addressee &a, bool setRev, bool takeResource )
{
if ( blockLSEchange && setRev && a.uid().left( 19 ) == QString("last-syncAddressee-") ) {
//qDebug("block insert ");
diff --git a/kabc/addressbook.h b/kabc/addressbook.h
index cc755d1..df9048b 100644
--- a/kabc/addressbook.h
+++ b/kabc/addressbook.h
@@ -145,11 +145,13 @@ class AddressBook : public QObject
bool saveABphone( QString fileName );
void smplifyAddressees();
void preparePhoneSync( QString currentSyncDevice, bool isPreSync );
void export2File( QString fileName );
+ bool export2PhoneFormat( QStringList uids ,QString fileName );
void importFromFile( QString fileName, bool replaceLabel = false, bool removeOld = false );
void setUntagged();
void removeUntagged();
+ void findNewExtIds( QString fileName, QString currentSyncDevice );
/**
Returns a iterator for first entry of address book.
*/
Iterator begin();
diff --git a/kabc/addressee.cpp b/kabc/addressee.cpp
index 607ae26..548305a 100644
--- a/kabc/addressee.cpp
+++ b/kabc/addressee.cpp
@@ -302,17 +302,23 @@ void Addressee::mergeContact( const Addressee& ad )
if ( mData->productId.isEmpty() ) mData->productId = ad.mData->productId;
if ( mData->sortString.isEmpty() ) mData->sortString = ad.mData->sortString;
if ( !mData->secrecy.isValid() ) mData->secrecy = ad.mData->secrecy;
if ( ( !mData->url.isValid() && ad.mData->url.isValid() ) ) mData->url = ad.mData->url ;
+ PhoneNumber::List phoneAD = phoneNumbers();
+ PhoneNumber::List::Iterator phoneItAD;
+ bool found = false;
+ for ( phoneItAD = phoneAD.begin(); phoneItAD != phoneAD.end(); ++phoneItAD ) {
+
+ }
// pending:
// merging phonenumbers
// merging addresses
// merging emails;
// merging categories;
// merging custom;
// merging keys
- qDebug("merge contact %s ", ad.uid().latin1());
+ //qDebug("merge contact %s ", ad.uid().latin1());
setUid( ad.uid() );
setRevision( ad.revision() );
}
@@ -332,16 +338,50 @@ bool Addressee::removeVoice()
}
return found;
}
+
+bool Addressee::containsAdr(const Addressee& ad )
+{
+ if ( ! ad.mData->familyName.isEmpty() ) if ( mData->familyName != ad.mData->familyName) return false;
+ if ( ! ad.mData->givenName.isEmpty() )if ( mData->givenName != ad.mData->givenName ) return false;
+ if ( ad.mData->url.isValid() ) if (mData->url != ad.mData->url) return false ;
+ if ( ! ad.mData->role.isEmpty() ) if (mData->role != ad.mData->role) return false ;
+ if ( ! ad.mData->organization.isEmpty() ) if (mData->organization != ad.mData->organization) return false ;
+ if ( ! ad.mData->note.isEmpty() ) if (mData->note != ad.mData->note) return false ;
+ if ( ! ad.mData->title .isEmpty() ) if (mData->title != ad.mData->title ) return false ;
+
+ // compare phone numbers
+ PhoneNumber::List phoneN = ad.phoneNumbers();
+ PhoneNumber::List::Iterator phoneIt;
+ bool found = false;
+ for ( phoneIt = phoneN.begin(); phoneIt != phoneN.end(); ++phoneIt ) {
+ bool found = false;
+ PhoneNumber::List phoneL = ad.phoneNumbers();
+ PhoneNumber::List::Iterator phoneItL;
+ for ( phoneItL = phoneL.begin(); phoneItL != phoneL.end(); ++phoneItL ) {
+ if ( ( *phoneItL ).number() == ( *phoneIt ).number() ) {
+ found = true;
+ break;
+ }
+ }
+ if ( ! found )
+ return false;
+ }
+ return true;
+
+}
void Addressee::simplifyAddresses()
{
- if ( mData->addresses.count() < 3 ) return ;
+ int max = 2;
+ if ( mData->url.isValid() )
+ max = 1;
+ if ( mData->addresses.count() <= max ) return ;
int count = 0;
Address::List list;
Address::List::Iterator it;
for( it = mData->addresses.begin(); it != mData->addresses.end(); ++it ) {
- if ( count > 1 )
+ if ( count >= max )
list.append( *it );
++count;
}
for( it = list.begin(); it != list.end(); ++it ) {
diff --git a/kabc/addressee.h b/kabc/addressee.h
index 0aa2c51..03138f6 100644
--- a/kabc/addressee.h
+++ b/kabc/addressee.h
@@ -121,8 +121,9 @@ class Addressee
void simplifyAddresses();
void simplifyPhoneNumbers();
void simplifyPhoneNumberTypes();
bool removeVoice();
+ bool containsAdr(const Addressee& addr );
/**
Set unique identifier.
*/
diff --git a/kabc/phonenumber.cpp b/kabc/phonenumber.cpp
index e5abc0e..6e94c7e 100644
--- a/kabc/phonenumber.cpp
+++ b/kabc/phonenumber.cpp
@@ -71,12 +71,10 @@ bool PhoneNumber::simplifyNumber()
QString Number;
int i;
Number = mNumber.stripWhiteSpace ();
mNumber = "";
- if ( Number.at(0) == '+' )
- mNumber += "+";
for ( i = 0; i < Number.length(); ++i) {
- if ( Number.at(i).isDigit() )
+ if ( Number.at(i).isDigit() || Number.at(i) == '+'|| Number.at(i) == '*'|| Number.at(i) == '#' )
mNumber += Number.at(i);
}
return ( mNumber.length() > 0 );
}
diff --git a/kaddressbook/kabcore.cpp b/kaddressbook/kabcore.cpp
index a7967cb..cd261f6 100644
--- a/kaddressbook/kabcore.cpp
+++ b/kaddressbook/kabcore.cpp
@@ -184,10 +184,10 @@ class KAex2phonePrefs : public QDialog
temphb = new QHBox( this );
new QLabel( i18n("Model(opt.): "), temphb );
mPhoneModel = new QLineEdit( temphb);
lay->addWidget( temphb );
- mWriteToSim= new QCheckBox( i18n("Write Contacts to SIM card\n(if not, write to phone memory)"), this );
- lay->addWidget( mWriteToSim );
+ // mWriteToSim = new QCheckBox( i18n("Write Contacts to SIM card\n(if not, write to phone memory)"), this );
+ // lay->addWidget( mWriteToSim );
lay->addWidget(lab = new QLabel( i18n("NOTE: This will remove all old\ncontact data on phone!"), this ) );
lab->setAlignment (AlignHCenter );
QPushButton * ok = new QPushButton( i18n("Export to mobile phone!"), this );
lay->addWidget( ok );
@@ -693,76 +693,21 @@ void KABCore::export2phone()
if ( uids.isEmpty() )
return;
#ifdef _WIN32_
- QString fileName = locateLocal("tmp", "tempfile.vcf");
+ QString fileName = locateLocal("tmp", "phonefile.vcf");
#else
- QString fileName = "/tmp/kdepimtemp.vcf";
+ QString fileName = "/tmp/phonefile.vcf";
#endif
- KABC::VCardConverter converter;
- QString description;
- QString datastream;
- for( QStringList::ConstIterator it = uids.begin(); it != uids.end(); ++it ) {
- KABC::Addressee a = mAddressBook->findByUid( *it );
-
- if ( a.isEmpty() )
- continue;
- a.simplifyEmails();
- a.simplifyPhoneNumbers();
- a.simplifyPhoneNumberTypes();
- a.simplifyAddresses();
-
- if (description.isEmpty())
- description = a.formattedName();
- QString vcard;
- QString vcardnew;
- converter.addresseeToVCard( a, vcard );
- int start = 0;
- int next;
- while ( (next = vcard.find("TYPE=", start) )>= 0 ) {
- int semi = vcard.find(";", next);
- int dopp = vcard.find(":", next);
- int sep;
- if ( semi < dopp && semi >= 0 )
- sep = semi ;
- else
- sep = dopp;
- vcardnew +=vcard.mid( start, next - start);
- vcardnew +=vcard.mid( next+5,sep -next -5 ).upper();
- start = sep;
- }
- vcardnew += vcard.mid( start,vcard.length() );
- vcard = "";
- start = 0;
- while ( (next = vcardnew.find("ADR", start) )>= 0 ) {
- int sep = vcardnew.find(":", next);
- vcard +=vcardnew.mid( start, next - start+3);
- start = sep;
- }
- vcard += vcardnew.mid( start,vcardnew.length() );
- vcard.replace ( QRegExp(";;;") , "" );
- vcard.replace ( QRegExp(";;") , "" );
- datastream += vcard;
-
- }
- QFile outFile(fileName);
- if ( outFile.open(IO_WriteOnly) ) {
- datastream.replace ( QRegExp("VERSION:3.0") , "VERSION:2.1" );
- QTextStream t( &outFile ); // use a text stream
- t.setEncoding( QTextStream::UnicodeUTF8 );
- t <<datastream;
- outFile.close();
- if ( PhoneAccess::writeToPhone( fileName ) )
- qDebug("Export okay ");
- else
- qDebug("Error export contacts ");
-
- } else {
- qDebug("Error open temp file ");
+ if ( ! mAddressBook->export2PhoneFormat( uids ,fileName ) )
return;
- }
-
+
+ if ( PhoneAccess::writeToPhone( fileName ) )
+ qDebug("Export okay ");
+ else
+ qDebug("Error export contacts ");
+
#if 0
setCaption( i18n("Writing to phone..."));
@@ -2842,8 +2787,9 @@ bool KABCore::syncExternal(KSyncManager* manager, QString resource)
abLocal.preExternSync( mAddressBook ,mCurrentSyncDevice );
syncOK = synchronizeAddressbooks( mAddressBook, &abLocal, syncManager->mSyncAlgoPrefs );
if ( syncOK ) {
if ( syncManager->mWriteBackFile ) {
+ abLocal.removeSyncAddressees( false );
abLocal.saveAB();
abLocal.postExternSync( mAddressBook,mCurrentSyncDevice );
}
}
@@ -2874,19 +2820,21 @@ bool KABCore::syncPhone()
return false;
}
AddressBook abLocal( fileName,"syncContact");
bool syncOK = false;
- if ( abLocal.load() ) {
+ {
+ abLocal.importFromFile( fileName );
qDebug("AB phone loaded ,sync device %s",mCurrentSyncDevice.latin1());
mGlobalSyncMode = SYNC_MODE_EXTERNAL;
abLocal.preparePhoneSync( mCurrentSyncDevice, true );
abLocal.preExternSync( mAddressBook ,mCurrentSyncDevice );
syncOK = synchronizeAddressbooks( mAddressBook, &abLocal, syncManager->mSyncAlgoPrefs );
if ( syncOK ) {
if ( syncManager->mWriteBackFile ) {
+ abLocal.removeSyncAddressees( true );
abLocal.saveABphone( fileName );
- abLocal.preparePhoneSync( mCurrentSyncDevice, false );
- abLocal.preExternSync( mAddressBook ,mCurrentSyncDevice );
+ abLocal.findNewExtIds( fileName, mCurrentSyncDevice );
+ //abLocal.preparePhoneSync( mCurrentSyncDevice, false );
abLocal.postExternSync( mAddressBook,mCurrentSyncDevice );
}
}
setModified();
diff --git a/libkdepim/ksyncprefsdialog.cpp b/libkdepim/ksyncprefsdialog.cpp
index 84cc448..cf8f996 100644
--- a/libkdepim/ksyncprefsdialog.cpp
+++ b/libkdepim/ksyncprefsdialog.cpp
@@ -199,9 +199,9 @@ void KSyncPrefsDialog::setupSyncAlgTab()
phoneWidget = new QVBox( topFrame);
topLayout->addMultiCellWidget(phoneWidget, iii,iii,0,1);
++iii;
- mWriteContactToSIM= new QCheckBox( i18n("Sync contacts with phone SIM card (If not, sync with phone memory)"), phoneWidget );
+ mWriteContactToSIM = 0;//new QCheckBox( i18n("Sync contacts with phone SIM card (If not, sync with phone memory)"), phoneWidget );
QHBox* temphb = new QHBox( phoneWidget );
new QLabel( i18n("I/O device: "), temphb );
mPhoneDevice = new QLineEdit( temphb);
button = new QPushButton( i18n("Help..."), temphb );
@@ -412,9 +412,10 @@ void KSyncPrefsDialog::profileChanged( int item )
mRemotePostcommandPWM->setText(prof->getPostSyncCommandPWM());
mLocalTempFilePWM->setText(prof->getLocalTempFilePWM());
mRemoteFilePWM->setText(prof->getRemoteFileNamePWM()) ;
- mWriteContactToSIM->setChecked( prof->getWriteContactToSIM());
+ if ( mWriteContactToSIM )
+ mWriteContactToSIM->setChecked( prof->getWriteContactToSIM());
mPhoneDevice->setText(prof->getPhoneDevice());
mPhoneConnection->setText(prof->getPhoneConnection());
mPhoneModel->setText(prof->getPhoneModel());
@@ -579,10 +580,10 @@ void KSyncPrefsDialog::saveProfile()
prof->setIsPhoneSync( mIsPhone->isChecked() );
prof->setIsPiSync( mIsPi->isChecked() );
prof->setWriteBackFuture(mWriteBackFuture->isChecked());
prof->setWriteBackFutureWeeks(mWriteBackFutureWeeks->value());
-
- prof->setWriteContactToSIM(mWriteContactToSIM->isChecked());
+ if ( mWriteContactToSIM )
+ prof->setWriteContactToSIM(mWriteContactToSIM->isChecked());
prof->setPhoneDevice( mPhoneDevice->text() );
prof->setPhoneConnection( mPhoneConnection->text() );
prof->setPhoneModel( mPhoneModel->text() );
@@ -714,9 +715,9 @@ void KSyncPrefsDialog::helpDevice()
KMessageBox::information(this,hint,i18n("KDE-Pim sync config"));
}
void KSyncPrefsDialog::helpModel()
{
- QString hint = i18n("Leave empty or\ninsert name of phone model:\n");
+ QString hint = i18n("Recommended: Leave empty!\n(Such that model can\nbe auto detected)\nOr insert name of model:\n");
hint += "E.g. for Nokia 6310i:\n6310i\nAlso possible:\nobex\nfor Obex connection";
KMessageBox::information(this,hint,i18n("KDE-Pim sync config"));
}