summaryrefslogtreecommitdiffabout
Side-by-side diff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--kabc/addressbook.cpp24
-rw-r--r--kabc/addressbook.h2
-rw-r--r--kaddressbook/kabcore.cpp11
-rw-r--r--kaddressbook/kabcore.h2
-rw-r--r--libkdepim/ksyncmanager.cpp2
5 files changed, 26 insertions, 15 deletions
diff --git a/kabc/addressbook.cpp b/kabc/addressbook.cpp
index f3744bc..e04f4b1 100644
--- a/kabc/addressbook.cpp
+++ b/kabc/addressbook.cpp
@@ -374,13 +374,13 @@ bool AddressBook::save( Ticket *ticket )
return ticket->resource()->save( ticket );
}
return false;
}
// exports all Addressees, which are syncable
-void AddressBook::export2File( QString fileName )
+void AddressBook::export2File( QString fileName, QString resourceName )
{
QFile outFile( fileName );
if ( !outFile.open( IO_WriteOnly ) ) {
QString text = i18n( "<qt>Unable to open file <b>%1</b> for export.</qt>" );
KMessageBox::error( 0, text.arg( fileName ) );
@@ -389,21 +389,27 @@ void AddressBook::export2File( QString fileName )
QTextStream t( &outFile );
t.setEncoding( QTextStream::UnicodeUTF8 );
Iterator it;
KABC::VCardConverter::Version version;
version = KABC::VCardConverter::v3_0;
for ( it = begin(); it != end(); ++it ) {
- if ( (*it).resource() && (*it).resource()->includeInSync() ) {
- if ( !(*it).IDStr().isEmpty() ) {
- (*it).insertCustom( "KADDRESSBOOK", "X-ExternalID", (*it).IDStr() );
+ 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() );
+ }
+ KABC::VCardConverter converter;
+ QString vcard;
+ //Resource *resource() const;
+ converter.addresseeToVCard( *it, vcard, version );
+ t << vcard << "\r\n";
}
- KABC::VCardConverter converter;
- QString vcard;
- //Resource *resource() const;
- converter.addresseeToVCard( *it, vcard, version );
- t << vcard << "\r\n";
}
}
t << "\r\n\r\n";
outFile.close();
}
// if QStringList uids is empty, all are exported
diff --git a/kabc/addressbook.h b/kabc/addressbook.h
index 18c03b5..4a0d0a3 100644
--- a/kabc/addressbook.h
+++ b/kabc/addressbook.h
@@ -143,13 +143,13 @@ class AddressBook : public QObject
bool save( Ticket *ticket );
bool saveAB( );
bool saveABphone( QString fileName );
void smplifyAddressees();
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 );
void setUntagged( bool setNonSyncTagged = false );
void removeUntagged();
void findNewExtIds( QString fileName, QString currentSyncDevice );
/**
diff --git a/kaddressbook/kabcore.cpp b/kaddressbook/kabcore.cpp
index 2dea619..5d377bf 100644
--- a/kaddressbook/kabcore.cpp
+++ b/kaddressbook/kabcore.cpp
@@ -1933,13 +1933,13 @@ void KABCore::initGUI()
#endif //KAB_NOSPLITTER
*/
syncManager = new KSyncManager((QWidget*)this, (KSyncInterface*)this, KSyncManager::KAPI, KABPrefs::instance(), syncMenu);
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();
//qDebug("KABCore::initGUI()::setting tmp sync file to:%s ",sync_file.latin1());
syncManager->setDefaultFileName( sync_file );
//connect(syncManager , SIGNAL( ), this, SLOT( ) );
@@ -3469,18 +3469,23 @@ void KABCore::getFile( bool success )
int count = mAddressBook->importFromFile( sentSyncFile() , false, true );
if ( count )
setModified( true );
message( i18n("Pi-Sync successful!") );
mViewManager->refreshView();
}
-void KABCore::syncFileRequest()
+void KABCore::syncFileRequest(const QString & resource)
{
if ( KABPrefs::instance()->mPassiveSyncWithDesktop ) {
syncManager->slotSyncMenu( 999 );
}
- mAddressBook->export2File( sentSyncFile() );
+
+ if ( resource == "ALL" ) {
+ mAddressBook->export2File( sentSyncFile() );
+ }
+ else
+ mAddressBook->export2File( sentSyncFile(), resource);
}
QString KABCore::sentSyncFile()
{
#ifdef DESKTOP_VERSION
return locateLocal( "tmp", "copysyncab.vcf" );
#else
diff --git a/kaddressbook/kabcore.h b/kaddressbook/kabcore.h
index c4a0b3b..2d1505f 100644
--- a/kaddressbook/kabcore.h
+++ b/kaddressbook/kabcore.h
@@ -354,13 +354,13 @@ class KABCore : public QWidget, public KSyncInterface
void contactSelected( const QString &name );
void contactSelected( const QPixmap &pixmap );
public slots:
void loadDataAfterStart();
void recieve(QString cmsg );
void getFile( bool success );
- void syncFileRequest();
+ void syncFileRequest(const QString &);
void setDetailsVisible( bool visible );
void setDetailsToState();
void saveSettings();
private slots:
diff --git a/libkdepim/ksyncmanager.cpp b/libkdepim/ksyncmanager.cpp
index f80c2a6..e615cbe 100644
--- a/libkdepim/ksyncmanager.cpp
+++ b/libkdepim/ksyncmanager.cpp
@@ -1461,13 +1461,13 @@ void KServerSocket::send_file()
}
} else
mSyncActionDialog->setFixedSize( 230, 120);
mSyncActionDialog->show();
mSyncActionDialog->raise();
emit request_file(mResource);
- emit request_file();
+ //emit request_file();
qApp->processEvents();
QString fileName = mFileName;
QFile file( fileName );
if (!file.open( IO_ReadOnly ) ) {
mErrorMessage = 0;
end_connect();