author | zautrix <zautrix> | 2005-12-02 09:10:14 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-12-02 09:10:14 (UTC) |
commit | 64be8d64fc26d1025a24150d065197ba5d608f3d (patch) (unidiff) | |
tree | 4f7b0c82641ac591af04f6fdd541b662d4727850 | |
parent | 2bd8aff44e90b6d58e2037771db8b38846addb3e (diff) | |
download | kdepimpi-64be8d64fc26d1025a24150d065197ba5d608f3d.zip kdepimpi-64be8d64fc26d1025a24150d065197ba5d608f3d.tar.gz kdepimpi-64be8d64fc26d1025a24150d065197ba5d608f3d.tar.bz2 |
more sync
-rw-r--r-- | kabc/addressbook.cpp | 24 | ||||
-rw-r--r-- | kabc/addressbook.h | 2 | ||||
-rw-r--r-- | kaddressbook/kabcore.cpp | 11 | ||||
-rw-r--r-- | kaddressbook/kabcore.h | 2 | ||||
-rw-r--r-- | libkdepim/ksyncmanager.cpp | 2 |
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 ) | |||
374 | return ticket->resource()->save( ticket ); | 374 | return ticket->resource()->save( ticket ); |
375 | } | 375 | } |
376 | 376 | ||
377 | return false; | 377 | return false; |
378 | } | 378 | } |
379 | // exports all Addressees, which are syncable | 379 | // exports all Addressees, which are syncable |
380 | void AddressBook::export2File( QString fileName ) | 380 | void AddressBook::export2File( QString fileName, QString resourceName ) |
381 | { | 381 | { |
382 | 382 | ||
383 | QFile outFile( fileName ); | 383 | QFile outFile( fileName ); |
384 | if ( !outFile.open( IO_WriteOnly ) ) { | 384 | if ( !outFile.open( IO_WriteOnly ) ) { |
385 | QString text = i18n( "<qt>Unable to open file <b>%1</b> for export.</qt>" ); | 385 | QString text = i18n( "<qt>Unable to open file <b>%1</b> for export.</qt>" ); |
386 | KMessageBox::error( 0, text.arg( fileName ) ); | 386 | KMessageBox::error( 0, text.arg( fileName ) ); |
@@ -389,21 +389,27 @@ void AddressBook::export2File( QString fileName ) | |||
389 | QTextStream t( &outFile ); | 389 | QTextStream t( &outFile ); |
390 | t.setEncoding( QTextStream::UnicodeUTF8 ); | 390 | t.setEncoding( QTextStream::UnicodeUTF8 ); |
391 | Iterator it; | 391 | Iterator it; |
392 | KABC::VCardConverter::Version version; | 392 | KABC::VCardConverter::Version version; |
393 | version = KABC::VCardConverter::v3_0; | 393 | version = KABC::VCardConverter::v3_0; |
394 | for ( it = begin(); it != end(); ++it ) { | 394 | for ( it = begin(); it != end(); ++it ) { |
395 | if ( (*it).resource() && (*it).resource()->includeInSync() ) { | 395 | if ( (*it).resource() ) { |
396 | if ( !(*it).IDStr().isEmpty() ) { | 396 | bool include = (*it).resource()->includeInSync(); |
397 | (*it).insertCustom( "KADDRESSBOOK", "X-ExternalID", (*it).IDStr() ); | 397 | if ( !resourceName.isEmpty() ) |
398 | include = (resourceName == (*it).resource()->name() ); | ||
399 | if ( include ) { | ||
400 | qDebug(QString ("Exporting resource %1 to file %2").arg( (*it).resource()->name() ).arg( fileName ) ); | ||
401 | if ( !(*it).IDStr().isEmpty() ) { | ||
402 | (*it).insertCustom( "KADDRESSBOOK", "X-ExternalID", (*it).IDStr() ); | ||
403 | } | ||
404 | KABC::VCardConverter converter; | ||
405 | QString vcard; | ||
406 | //Resource *resource() const; | ||
407 | converter.addresseeToVCard( *it, vcard, version ); | ||
408 | t << vcard << "\r\n"; | ||
398 | } | 409 | } |
399 | KABC::VCardConverter converter; | ||
400 | QString vcard; | ||
401 | //Resource *resource() const; | ||
402 | converter.addresseeToVCard( *it, vcard, version ); | ||
403 | t << vcard << "\r\n"; | ||
404 | } | 410 | } |
405 | } | 411 | } |
406 | t << "\r\n\r\n"; | 412 | t << "\r\n\r\n"; |
407 | outFile.close(); | 413 | outFile.close(); |
408 | } | 414 | } |
409 | // if QStringList uids is empty, all are exported | 415 | // 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 | |||
143 | bool save( Ticket *ticket ); | 143 | bool save( Ticket *ticket ); |
144 | bool saveAB( ); | 144 | bool saveAB( ); |
145 | bool saveABphone( QString fileName ); | 145 | bool saveABphone( QString fileName ); |
146 | void smplifyAddressees(); | 146 | void smplifyAddressees(); |
147 | void removeSyncInfo( QString syncProfile); | 147 | void removeSyncInfo( QString syncProfile); |
148 | void preparePhoneSync( QString currentSyncDevice, bool isPreSync ); | 148 | void preparePhoneSync( QString currentSyncDevice, bool isPreSync ); |
149 | void export2File( QString fileName ); | 149 | void export2File( QString fileName, QString resourceName = "" ); |
150 | bool export2PhoneFormat( QStringList uids ,QString fileName ); | 150 | bool export2PhoneFormat( QStringList uids ,QString fileName ); |
151 | int importFromFile( QString fileName, bool replaceLabel = false, bool removeOld = false ); | 151 | int importFromFile( QString fileName, bool replaceLabel = false, bool removeOld = false ); |
152 | void setUntagged( bool setNonSyncTagged = false ); | 152 | void setUntagged( bool setNonSyncTagged = false ); |
153 | void removeUntagged(); | 153 | void removeUntagged(); |
154 | void findNewExtIds( QString fileName, QString currentSyncDevice ); | 154 | void findNewExtIds( QString fileName, QString currentSyncDevice ); |
155 | /** | 155 | /** |
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() | |||
1933 | #endif //KAB_NOSPLITTER | 1933 | #endif //KAB_NOSPLITTER |
1934 | */ | 1934 | */ |
1935 | 1935 | ||
1936 | syncManager = new KSyncManager((QWidget*)this, (KSyncInterface*)this, KSyncManager::KAPI, KABPrefs::instance(), syncMenu); | 1936 | syncManager = new KSyncManager((QWidget*)this, (KSyncInterface*)this, KSyncManager::KAPI, KABPrefs::instance(), syncMenu); |
1937 | syncManager->setBlockSave(false); | 1937 | syncManager->setBlockSave(false); |
1938 | 1938 | ||
1939 | connect(syncManager , SIGNAL( request_file() ), this, SLOT( syncFileRequest() ) ); | 1939 | connect(syncManager , SIGNAL( request_file(const QString &) ), this, SLOT( syncFileRequest(const QString &) ) ); |
1940 | connect(syncManager , SIGNAL( getFile( bool )), this, SLOT(getFile( bool ) ) ); | 1940 | connect(syncManager , SIGNAL( getFile( bool )), this, SLOT(getFile( bool ) ) ); |
1941 | QString sync_file = sentSyncFile(); | 1941 | QString sync_file = sentSyncFile(); |
1942 | //qDebug("KABCore::initGUI()::setting tmp sync file to:%s ",sync_file.latin1()); | 1942 | //qDebug("KABCore::initGUI()::setting tmp sync file to:%s ",sync_file.latin1()); |
1943 | syncManager->setDefaultFileName( sync_file ); | 1943 | syncManager->setDefaultFileName( sync_file ); |
1944 | //connect(syncManager , SIGNAL( ), this, SLOT( ) ); | 1944 | //connect(syncManager , SIGNAL( ), this, SLOT( ) ); |
1945 | 1945 | ||
@@ -3469,18 +3469,23 @@ void KABCore::getFile( bool success ) | |||
3469 | int count = mAddressBook->importFromFile( sentSyncFile() , false, true ); | 3469 | int count = mAddressBook->importFromFile( sentSyncFile() , false, true ); |
3470 | if ( count ) | 3470 | if ( count ) |
3471 | setModified( true ); | 3471 | setModified( true ); |
3472 | message( i18n("Pi-Sync successful!") ); | 3472 | message( i18n("Pi-Sync successful!") ); |
3473 | mViewManager->refreshView(); | 3473 | mViewManager->refreshView(); |
3474 | } | 3474 | } |
3475 | void KABCore::syncFileRequest() | 3475 | void KABCore::syncFileRequest(const QString & resource) |
3476 | { | 3476 | { |
3477 | if ( KABPrefs::instance()->mPassiveSyncWithDesktop ) { | 3477 | if ( KABPrefs::instance()->mPassiveSyncWithDesktop ) { |
3478 | syncManager->slotSyncMenu( 999 ); | 3478 | syncManager->slotSyncMenu( 999 ); |
3479 | } | 3479 | } |
3480 | mAddressBook->export2File( sentSyncFile() ); | 3480 | |
3481 | if ( resource == "ALL" ) { | ||
3482 | mAddressBook->export2File( sentSyncFile() ); | ||
3483 | } | ||
3484 | else | ||
3485 | mAddressBook->export2File( sentSyncFile(), resource); | ||
3481 | } | 3486 | } |
3482 | QString KABCore::sentSyncFile() | 3487 | QString KABCore::sentSyncFile() |
3483 | { | 3488 | { |
3484 | #ifdef DESKTOP_VERSION | 3489 | #ifdef DESKTOP_VERSION |
3485 | return locateLocal( "tmp", "copysyncab.vcf" ); | 3490 | return locateLocal( "tmp", "copysyncab.vcf" ); |
3486 | #else | 3491 | #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 | |||
354 | void contactSelected( const QString &name ); | 354 | void contactSelected( const QString &name ); |
355 | void contactSelected( const QPixmap &pixmap ); | 355 | void contactSelected( const QPixmap &pixmap ); |
356 | public slots: | 356 | public slots: |
357 | void loadDataAfterStart(); | 357 | void loadDataAfterStart(); |
358 | void recieve(QString cmsg ); | 358 | void recieve(QString cmsg ); |
359 | void getFile( bool success ); | 359 | void getFile( bool success ); |
360 | void syncFileRequest(); | 360 | void syncFileRequest(const QString &); |
361 | void setDetailsVisible( bool visible ); | 361 | void setDetailsVisible( bool visible ); |
362 | void setDetailsToState(); | 362 | void setDetailsToState(); |
363 | 363 | ||
364 | void saveSettings(); | 364 | void saveSettings(); |
365 | 365 | ||
366 | private slots: | 366 | 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() | |||
1461 | } | 1461 | } |
1462 | } else | 1462 | } else |
1463 | mSyncActionDialog->setFixedSize( 230, 120); | 1463 | mSyncActionDialog->setFixedSize( 230, 120); |
1464 | mSyncActionDialog->show(); | 1464 | mSyncActionDialog->show(); |
1465 | mSyncActionDialog->raise(); | 1465 | mSyncActionDialog->raise(); |
1466 | emit request_file(mResource); | 1466 | emit request_file(mResource); |
1467 | emit request_file(); | 1467 | //emit request_file(); |
1468 | qApp->processEvents(); | 1468 | qApp->processEvents(); |
1469 | QString fileName = mFileName; | 1469 | QString fileName = mFileName; |
1470 | QFile file( fileName ); | 1470 | QFile file( fileName ); |
1471 | if (!file.open( IO_ReadOnly ) ) { | 1471 | if (!file.open( IO_ReadOnly ) ) { |
1472 | mErrorMessage = 0; | 1472 | mErrorMessage = 0; |
1473 | end_connect(); | 1473 | end_connect(); |