-rw-r--r-- | kaddressbook/kabcore.cpp | 8 | ||||
-rw-r--r-- | libkdepim/ksyncmanager.cpp | 4 |
2 files changed, 9 insertions, 3 deletions
diff --git a/kaddressbook/kabcore.cpp b/kaddressbook/kabcore.cpp index 15cab73..b7edccd 100644 --- a/kaddressbook/kabcore.cpp +++ b/kaddressbook/kabcore.cpp | |||
@@ -1789,17 +1789,19 @@ void KABCore::initGUI() | |||
1789 | #endif //KAB_NOSPLITTER | 1789 | #endif //KAB_NOSPLITTER |
1790 | */ | 1790 | */ |
1791 | 1791 | ||
1792 | syncManager = new KSyncManager((QWidget*)this, (KSyncInterface*)this, KSyncManager::KAPI, KABPrefs::instance(), syncMenu); | 1792 | syncManager = new KSyncManager((QWidget*)this, (KSyncInterface*)this, KSyncManager::KAPI, KABPrefs::instance(), syncMenu); |
1793 | syncManager->setBlockSave(false); | 1793 | syncManager->setBlockSave(false); |
1794 | 1794 | ||
1795 | connect(syncManager , SIGNAL( request_file() ), this, SLOT( syncFileRequest() ) ); | 1795 | connect(syncManager , SIGNAL( request_file() ), this, SLOT( syncFileRequest() ) ); |
1796 | connect(syncManager , SIGNAL( getFile( bool )), this, SLOT(getFile( bool ) ) ); | 1796 | connect(syncManager , SIGNAL( getFile( bool )), this, SLOT(getFile( bool ) ) ); |
1797 | syncManager->setDefaultFileName( sentSyncFile()); | 1797 | QString sync_file = sentSyncFile(); |
1798 | qDebug("KABCore::initGUI()::setting tmp sync file to:%s ",sync_file.latin1()); | ||
1799 | syncManager->setDefaultFileName( sync_file ); | ||
1798 | //connect(syncManager , SIGNAL( ), this, SLOT( ) ); | 1800 | //connect(syncManager , SIGNAL( ), this, SLOT( ) ); |
1799 | 1801 | ||
1800 | #endif //KAB_EMBEDDED | 1802 | #endif //KAB_EMBEDDED |
1801 | initActions(); | 1803 | initActions(); |
1802 | 1804 | ||
1803 | #ifdef KAB_EMBEDDED | 1805 | #ifdef KAB_EMBEDDED |
1804 | addActionsManually(); | 1806 | addActionsManually(); |
1805 | //US make sure the export and import menues are initialized before creating the xxPortManager. | 1807 | //US make sure the export and import menues are initialized before creating the xxPortManager. |
@@ -3001,16 +3003,18 @@ bool KABCore::synchronizeAddressbooks( KABC::AddressBook* local, KABC::AddressBo | |||
3001 | 3003 | ||
3002 | //this is a overwritten callbackmethods from the syncinterface | 3004 | //this is a overwritten callbackmethods from the syncinterface |
3003 | bool KABCore::sync(KSyncManager* manager, QString filename, int mode) | 3005 | bool KABCore::sync(KSyncManager* manager, QString filename, int mode) |
3004 | { | 3006 | { |
3005 | 3007 | ||
3006 | //pending prepare addresseeview for output | 3008 | //pending prepare addresseeview for output |
3007 | //pending detect, if remote file has REV field. if not switch to external sync | 3009 | //pending detect, if remote file has REV field. if not switch to external sync |
3008 | mGlobalSyncMode = SYNC_MODE_NORMAL; | 3010 | mGlobalSyncMode = SYNC_MODE_NORMAL; |
3011 | if ( manager != syncManager ) | ||
3012 | qDebug("KABCore::sync:: ERROR! :: manager != syncManager "); | ||
3009 | QString mCurrentSyncDevice = manager->getCurrentSyncDevice(); | 3013 | QString mCurrentSyncDevice = manager->getCurrentSyncDevice(); |
3010 | 3014 | ||
3011 | AddressBook abLocal(filename,"syncContact"); | 3015 | AddressBook abLocal(filename,"syncContact"); |
3012 | bool syncOK = false; | 3016 | bool syncOK = false; |
3013 | if ( abLocal.load() ) { | 3017 | if ( abLocal.load() ) { |
3014 | qDebug("AB loaded %s,sync mode %d",filename.latin1(), mode ); | 3018 | qDebug("AB loaded %s,sync mode %d",filename.latin1(), mode ); |
3015 | bool external = false; | 3019 | bool external = false; |
3016 | bool isXML = false; | 3020 | bool isXML = false; |
@@ -3068,16 +3072,18 @@ void KABCore::removeSyncInfo( QString syncProfile) | |||
3068 | 3072 | ||
3069 | 3073 | ||
3070 | //this is a overwritten callbackmethods from the syncinterface | 3074 | //this is a overwritten callbackmethods from the syncinterface |
3071 | bool KABCore::syncExternal(KSyncManager* manager, QString resource) | 3075 | bool KABCore::syncExternal(KSyncManager* manager, QString resource) |
3072 | { | 3076 | { |
3073 | if ( resource == "phone" ) | 3077 | if ( resource == "phone" ) |
3074 | return syncPhone(); | 3078 | return syncPhone(); |
3075 | disableBR( true ); | 3079 | disableBR( true ); |
3080 | if ( manager != syncManager ) | ||
3081 | qDebug("KABCore::syncExternal:: ERROR! :: manager != syncManager "); | ||
3076 | QString mCurrentSyncDevice = manager->getCurrentSyncDevice(); | 3082 | QString mCurrentSyncDevice = manager->getCurrentSyncDevice(); |
3077 | 3083 | ||
3078 | AddressBook abLocal( resource,"syncContact"); | 3084 | AddressBook abLocal( resource,"syncContact"); |
3079 | bool syncOK = false; | 3085 | bool syncOK = false; |
3080 | if ( abLocal.load() ) { | 3086 | if ( abLocal.load() ) { |
3081 | qDebug("AB sharp loaded ,sync device %s",mCurrentSyncDevice.latin1()); | 3087 | qDebug("AB sharp loaded ,sync device %s",mCurrentSyncDevice.latin1()); |
3082 | mGlobalSyncMode = SYNC_MODE_EXTERNAL; | 3088 | mGlobalSyncMode = SYNC_MODE_EXTERNAL; |
3083 | abLocal.preExternSync( mAddressBook ,mCurrentSyncDevice, false ); | 3089 | abLocal.preExternSync( mAddressBook ,mCurrentSyncDevice, false ); |
diff --git a/libkdepim/ksyncmanager.cpp b/libkdepim/ksyncmanager.cpp index c12ba1c..7c53948 100644 --- a/libkdepim/ksyncmanager.cpp +++ b/libkdepim/ksyncmanager.cpp | |||
@@ -395,17 +395,17 @@ void KSyncManager::enableQuick( bool ask ) | |||
395 | mPrefs->mPassiveSyncAutoStart = false; | 395 | mPrefs->mPassiveSyncAutoStart = false; |
396 | Q_UINT16 port = mPrefs->mPassiveSyncPort.toUInt(&ok); | 396 | Q_UINT16 port = mPrefs->mPassiveSyncPort.toUInt(&ok); |
397 | if ( ! ok ) { | 397 | if ( ! ok ) { |
398 | KMessageBox::information( 0, i18n("No valid port")); | 398 | KMessageBox::information( 0, i18n("No valid port")); |
399 | return; | 399 | return; |
400 | } | 400 | } |
401 | //qDebug("port %d ", port); | 401 | //qDebug("port %d ", port); |
402 | mServerSocket = new KServerSocket ( mPrefs->mPassiveSyncPw, port ,1 ); | 402 | mServerSocket = new KServerSocket ( mPrefs->mPassiveSyncPw, port ,1 ); |
403 | mServerSocket->setFileName( defaultFileName() ); | 403 | mServerSocket->setFileName( defaultFileName() );//bbb |
404 | //qDebug("connected "); | 404 | //qDebug("connected "); |
405 | if ( !mServerSocket->ok() ) { | 405 | if ( !mServerSocket->ok() ) { |
406 | KMessageBox::information( 0, i18n("Failed to bind or\nlisten to the port!")); | 406 | KMessageBox::information( 0, i18n("Failed to bind or\nlisten to the port!")); |
407 | delete mServerSocket; | 407 | delete mServerSocket; |
408 | mServerSocket = 0; | 408 | mServerSocket = 0; |
409 | return; | 409 | return; |
410 | } | 410 | } |
411 | mPrefs->mPassiveSyncAutoStart = autoStart; | 411 | mPrefs->mPassiveSyncAutoStart = autoStart; |
@@ -1232,17 +1232,17 @@ void KServerSocket::send_file() | |||
1232 | mSyncActionDialog->raise(); | 1232 | mSyncActionDialog->raise(); |
1233 | emit request_file(); | 1233 | emit request_file(); |
1234 | qApp->processEvents(); | 1234 | qApp->processEvents(); |
1235 | QString fileName = mFileName; | 1235 | QString fileName = mFileName; |
1236 | QFile file( fileName ); | 1236 | QFile file( fileName ); |
1237 | if (!file.open( IO_ReadOnly ) ) { | 1237 | if (!file.open( IO_ReadOnly ) ) { |
1238 | delete mSyncActionDialog; | 1238 | delete mSyncActionDialog; |
1239 | mSyncActionDialog = 0; | 1239 | mSyncActionDialog = 0; |
1240 | qDebug("KSS::error open file "); | 1240 | qDebug("KSS::error open sync file: %s ", fileName.latin1()); |
1241 | mSocket->close(); | 1241 | mSocket->close(); |
1242 | if ( mSocket->state() == QSocket::Idle ) | 1242 | if ( mSocket->state() == QSocket::Idle ) |
1243 | QTimer::singleShot( 10, this , SLOT ( discardClient())); | 1243 | QTimer::singleShot( 10, this , SLOT ( discardClient())); |
1244 | return ; | 1244 | return ; |
1245 | 1245 | ||
1246 | } | 1246 | } |
1247 | mSyncActionDialog->setCaption( i18n("Sending file...") ); | 1247 | mSyncActionDialog->setCaption( i18n("Sending file...") ); |
1248 | QTextStream ts( &file ); | 1248 | QTextStream ts( &file ); |