-rw-r--r-- | kabc/addressbook.cpp | 10 | ||||
-rw-r--r-- | kabc/addressbook.h | 2 | ||||
-rw-r--r-- | kaddressbook/kabcore.cpp | 9 | ||||
-rw-r--r-- | kaddressbook/kabcore.h | 2 | ||||
-rw-r--r-- | libkdepim/ksyncmanager.cpp | 2 |
5 files changed, 18 insertions, 7 deletions
diff --git a/kabc/addressbook.cpp b/kabc/addressbook.cpp index f3744bc..e04f4b1 100644 --- a/kabc/addressbook.cpp +++ b/kabc/addressbook.cpp @@ -378,5 +378,5 @@ bool AddressBook::save( Ticket *ticket ) } // exports all Addressees, which are syncable -void AddressBook::export2File( QString fileName ) +void AddressBook::export2File( QString fileName, QString resourceName ) { @@ -393,5 +393,10 @@ void AddressBook::export2File( QString fileName ) version = KABC::VCardConverter::v3_0; for ( it = begin(); it != end(); ++it ) { - if ( (*it).resource() && (*it).resource()->includeInSync() ) { + if ( (*it).resource() ) { + bool include = (*it).resource()->includeInSync(); + if ( !resourceName.isEmpty() ) + include = (resourceName == (*it).resource()->name() ); + if ( include ) { + qDebug(QString ("Exporting resource %1 to file %2").arg( (*it).resource()->name() ).arg( fileName ) ); if ( !(*it).IDStr().isEmpty() ) { (*it).insertCustom( "KADDRESSBOOK", "X-ExternalID", (*it).IDStr() ); @@ -404,4 +409,5 @@ void AddressBook::export2File( QString fileName ) } } + } t << "\r\n\r\n"; outFile.close(); diff --git a/kabc/addressbook.h b/kabc/addressbook.h index 18c03b5..4a0d0a3 100644 --- a/kabc/addressbook.h +++ b/kabc/addressbook.h @@ -147,5 +147,5 @@ class AddressBook : public QObject void removeSyncInfo( QString syncProfile); void preparePhoneSync( QString currentSyncDevice, bool isPreSync ); - void export2File( QString fileName ); + void export2File( QString fileName, QString resourceName = "" ); bool export2PhoneFormat( QStringList uids ,QString fileName ); int importFromFile( QString fileName, bool replaceLabel = false, bool removeOld = false ); diff --git a/kaddressbook/kabcore.cpp b/kaddressbook/kabcore.cpp index 2dea619..5d377bf 100644 --- a/kaddressbook/kabcore.cpp +++ b/kaddressbook/kabcore.cpp @@ -1937,5 +1937,5 @@ void KABCore::initGUI() syncManager->setBlockSave(false); - connect(syncManager , SIGNAL( request_file() ), this, SLOT( syncFileRequest() ) ); + connect(syncManager , SIGNAL( request_file(const QString &) ), this, SLOT( syncFileRequest(const QString &) ) ); connect(syncManager , SIGNAL( getFile( bool )), this, SLOT(getFile( bool ) ) ); QString sync_file = sentSyncFile(); @@ -3473,11 +3473,16 @@ void KABCore::getFile( bool success ) mViewManager->refreshView(); } -void KABCore::syncFileRequest() +void KABCore::syncFileRequest(const QString & resource) { if ( KABPrefs::instance()->mPassiveSyncWithDesktop ) { syncManager->slotSyncMenu( 999 ); } + + if ( resource == "ALL" ) { mAddressBook->export2File( sentSyncFile() ); } + else + mAddressBook->export2File( sentSyncFile(), resource); +} QString KABCore::sentSyncFile() { diff --git a/kaddressbook/kabcore.h b/kaddressbook/kabcore.h index c4a0b3b..2d1505f 100644 --- a/kaddressbook/kabcore.h +++ b/kaddressbook/kabcore.h @@ -358,5 +358,5 @@ class KABCore : public QWidget, public KSyncInterface void recieve(QString cmsg ); void getFile( bool success ); - void syncFileRequest(); + void syncFileRequest(const QString &); void setDetailsVisible( bool visible ); void setDetailsToState(); diff --git a/libkdepim/ksyncmanager.cpp b/libkdepim/ksyncmanager.cpp index f80c2a6..e615cbe 100644 --- a/libkdepim/ksyncmanager.cpp +++ b/libkdepim/ksyncmanager.cpp @@ -1465,5 +1465,5 @@ void KServerSocket::send_file() mSyncActionDialog->raise(); emit request_file(mResource); - emit request_file(); + //emit request_file(); qApp->processEvents(); QString fileName = mFileName; |