summaryrefslogtreecommitdiffabout
Unidiff
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
@@ -368,48 +368,54 @@ bool AddressBook::load()
368bool AddressBook::save( Ticket *ticket ) 368bool AddressBook::save( Ticket *ticket )
369{ 369{
370 kdDebug(5700) << "AddressBook::save()"<< endl; 370 kdDebug(5700) << "AddressBook::save()"<< endl;
371 371
372 if ( ticket->resource() ) { 372 if ( ticket->resource() ) {
373 deleteRemovedAddressees(); 373 deleteRemovedAddressees();
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
380void AddressBook::export2File( QString fileName ) 380void 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 ) );
387 return ; 387 return ;
388 } 388 }
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
410bool AddressBook::export2PhoneFormat( QStringList uids ,QString fileName ) 416bool AddressBook::export2PhoneFormat( QStringList uids ,QString fileName )
411{ 417{
412 KABC::VCardConverter converter; 418 KABC::VCardConverter converter;
413 QString datastream; 419 QString datastream;
414 Iterator it; 420 Iterator it;
415 bool all = uids.isEmpty(); 421 bool all = uids.isEmpty();
diff --git a/kabc/addressbook.h b/kabc/addressbook.h
index 18c03b5..4a0d0a3 100644
--- a/kabc/addressbook.h
+++ b/kabc/addressbook.h
@@ -137,25 +137,25 @@ class AddressBook : public QObject
137 /** 137 /**
138 Save address book. The address book is saved to the file, the Ticket 138 Save address book. The address book is saved to the file, the Ticket
139 object has been requested for by @ref requestSaveTicket(). 139 object has been requested for by @ref requestSaveTicket().
140 140
141 @param ticket a ticket object returned by @ref requestSaveTicket() 141 @param ticket a ticket object returned by @ref requestSaveTicket()
142 */ 142 */
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 /**
156 Returns a iterator for first entry of address book. 156 Returns a iterator for first entry of address book.
157 */ 157 */
158 Iterator begin(); 158 Iterator begin();
159 159
160 /** 160 /**
161 Returns a const iterator for first entry of address book. 161 Returns a const iterator for first entry of address book.
diff --git a/kaddressbook/kabcore.cpp b/kaddressbook/kabcore.cpp
index 2dea619..5d377bf 100644
--- a/kaddressbook/kabcore.cpp
+++ b/kaddressbook/kabcore.cpp
@@ -1927,25 +1927,25 @@ void KABCore::initGUI()
1927 1927
1928 mDetails = new ViewContainer( this ); 1928 mDetails = new ViewContainer( this );
1929 1929
1930 topLayout->addWidget( viewSpace ); 1930 topLayout->addWidget( viewSpace );
1931// topLayout->setStretchFactor( mDetailsSplitter, 100 ); 1931// topLayout->setStretchFactor( mDetailsSplitter, 100 );
1932 topLayout->addWidget( mDetails ); 1932 topLayout->addWidget( mDetails );
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
1946#endif //KAB_EMBEDDED 1946#endif //KAB_EMBEDDED
1947 initActions(); 1947 initActions();
1948 1948
1949#ifdef KAB_EMBEDDED 1949#ifdef KAB_EMBEDDED
1950 addActionsManually(); 1950 addActionsManually();
1951 //US make sure the export and import menues are initialized before creating the xxPortManager. 1951 //US make sure the export and import menues are initialized before creating the xxPortManager.
@@ -3463,30 +3463,35 @@ bool KABCore::syncPhone()
3463void KABCore::getFile( bool success ) 3463void KABCore::getFile( bool success )
3464{ 3464{
3465 if ( ! success ) { 3465 if ( ! success ) {
3466 message( i18n("Error receiving file. Nothing changed!") ); 3466 message( i18n("Error receiving file. Nothing changed!") );
3467 return; 3467 return;
3468 } 3468 }
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}
3475void KABCore::syncFileRequest() 3475void 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}
3482QString KABCore::sentSyncFile() 3487QString 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
3487 return QString( "/tmp/copysyncab.vcf" ); 3492 return QString( "/tmp/copysyncab.vcf" );
3488#endif 3493#endif
3489} 3494}
3490 3495
3491void KABCore::setCaptionBack() 3496void KABCore::setCaptionBack()
3492{ 3497{
diff --git a/kaddressbook/kabcore.h b/kaddressbook/kabcore.h
index c4a0b3b..2d1505f 100644
--- a/kaddressbook/kabcore.h
+++ b/kaddressbook/kabcore.h
@@ -348,25 +348,25 @@ class KABCore : public QWidget, public KSyncInterface
348 void requestForNameEmailUidList(const QString& sourceChannel, const QString& sessionuid); 348 void requestForNameEmailUidList(const QString& sourceChannel, const QString& sessionuid);
349 void requestForDetails(const QString& sourceChannel, const QString& sessionuid, const QString& name, const QString& email, const QString& uid); 349 void requestForDetails(const QString& sourceChannel, const QString& sessionuid, const QString& name, const QString& email, const QString& uid);
350 void requestForBirthdayList(const QString& sourceChannel, const QString& sessionuid); 350 void requestForBirthdayList(const QString& sourceChannel, const QString& sessionuid);
351 351
352 352
353 signals: 353 signals:
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:
367 void updateToolBar(); 367 void updateToolBar();
368 void updateMainWindow(); 368 void updateMainWindow();
369 void receive( const QCString& cmsg, const QByteArray& data ); 369 void receive( const QCString& cmsg, const QByteArray& data );
370 void receiveStart( const QCString& cmsg, const QByteArray& data ); 370 void receiveStart( const QCString& cmsg, const QByteArray& data );
371 void toggleBeamReceive( ); 371 void toggleBeamReceive( );
372 void disableBR(bool); 372 void disableBR(bool);
diff --git a/libkdepim/ksyncmanager.cpp b/libkdepim/ksyncmanager.cpp
index f80c2a6..e615cbe 100644
--- a/libkdepim/ksyncmanager.cpp
+++ b/libkdepim/ksyncmanager.cpp
@@ -1455,25 +1455,25 @@ void KServerSocket::send_file()
1455 mSyncActionDialog->setFixedSize( 230, 300); 1455 mSyncActionDialog->setFixedSize( 230, 300);
1456 } else { 1456 } else {
1457 mSyncActionDialog->setFixedSize( 230, 200); 1457 mSyncActionDialog->setFixedSize( 230, 200);
1458 } 1458 }
1459 } else { 1459 } else {
1460 mSyncActionDialog->setFixedSize( 230, 120); 1460 mSyncActionDialog->setFixedSize( 230, 120);
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();
1474 error_connect("ERROR_FI\r\n\r\n"); 1474 error_connect("ERROR_FI\r\n\r\n");
1475 return ; 1475 return ;
1476 } 1476 }
1477 mSyncActionDialog->setCaption( i18n("Sending file...") ); 1477 mSyncActionDialog->setCaption( i18n("Sending file...") );
1478 QTextStream ts( &file ); 1478 QTextStream ts( &file );
1479 ts.setEncoding( QTextStream::Latin1 ); 1479 ts.setEncoding( QTextStream::Latin1 );