From 43c82cc5393522d2c34f34a4339cb6a1d1c6c555 Mon Sep 17 00:00:00 2001 From: zautrix Date: Thu, 07 Oct 2004 11:44:35 +0000 Subject: sync fixes --- diff --git a/kaddressbook/kabcore.cpp b/kaddressbook/kabcore.cpp index 6404410..fa80f5c 100644 --- a/kaddressbook/kabcore.cpp +++ b/kaddressbook/kabcore.cpp @@ -2858,12 +2858,14 @@ bool KABCore::syncExternal(KSyncManager* manager, QString resource) void KABCore::getFile( bool success ) { + qDebug("KABCore::getFile "); + QTimer::singleShot( 15000, this , SLOT ( setCaptionBack())); if ( ! success ) { setCaption( i18n("Error receiving file. Nothing changed!") ); return; } mAddressBook->importFromFile( sentSyncFile() ); - setCaption( i18n("Pi-Sync successful!") ); + topLevelWidget()->setCaption( i18n("Pi-Sync successful!") ); } void KABCore::syncFileRequest() { @@ -2872,10 +2874,14 @@ void KABCore::syncFileRequest() QString KABCore::sentSyncFile() { #ifdef _WIN32_ - return locateLocal( "tmp", "syncab.ics" ); + return locateLocal( "tmp", "copysyncab.vcf" ); #else - return QString( "/tmp/kapitempfile.vcf" ); + return QString( "/tmp/copysyncab.vcf" ); #endif } +void KABCore::setCaptionBack() +{ + topLevelWidget()->setCaption( i18n("KAddressbook/Pi") ); +} diff --git a/kaddressbook/kabcore.h b/kaddressbook/kabcore.h index 987369d..c628399 100644 --- a/kaddressbook/kabcore.h +++ b/kaddressbook/kabcore.h @@ -349,6 +349,7 @@ class KABCore : public QWidget, public KSyncInterface // void slotSyncMenu( int ); private slots: void setJumpButtonBarVisible( bool visible ); + void setCaptionBack(); void importFromOL(); void extensionModified( const KABC::Addressee::List &list ); void extensionChanged( int id ); diff --git a/libkdepim/ksyncmanager.cpp b/libkdepim/ksyncmanager.cpp index b360644..a663427 100644 --- a/libkdepim/ksyncmanager.cpp +++ b/libkdepim/ksyncmanager.cpp @@ -231,7 +231,7 @@ void KSyncManager::slotSyncMenu( int action ) mActiveSyncIP = temp->getRemoteIPPWM(); } syncPi(); - } + } else syncRemote( temp ); } @@ -349,9 +349,9 @@ bool KSyncManager::syncWithFile( QString fn , bool quick ) if ( result == 0 ) { //qDebug("Now sycing ... "); if ( ret = mImplementation->sync( this, fn, mSyncAlgoPrefs ) ) - mParent->setCaption( i18n("Synchronization successful") ); + mParent->topLevelWidget()->setCaption( i18n("Synchronization successful") ); else - mParent->setCaption( i18n("Sync cancelled or failed. Nothing synced.") ); + mParent->topLevelWidget()->setCaption( i18n("Sync cancelled or failed. Nothing synced.") ); if ( ! quick ) mLastSyncedLocalFile = fn; } @@ -376,7 +376,7 @@ void KSyncManager::multiSync( bool askforPrefs ) i18n("Yes"), i18n("No"), 0, 0 ) != 0 ) { setBlockSave(false); - mParent->setCaption(i18n("Aborted! Nothing synced!")); + mParent->topLevelWidget()->setCaption(i18n("Aborted! Nothing synced!")); return; } mCurrentSyncDevice = i18n("Multiple profiles") ; @@ -385,7 +385,7 @@ void KSyncManager::multiSync( bool askforPrefs ) edit_sync_options(); mRingSyncAlgoPrefs = mSyncAlgoPrefs; } - mParent->setCaption(i18n("Multiple sync started.") ); + mParent->topLevelWidget()->setCaption(i18n("Multiple sync started.") ); qApp->processEvents(); int num = ringSync() ; if ( num > 1 ) @@ -394,9 +394,9 @@ void KSyncManager::multiSync( bool askforPrefs ) if ( num ) emit save(); if ( num ) - mParent->setCaption(i18n("%1 profiles synced. Multiple sync completed!").arg(num) ); + mParent->topLevelWidget()->setCaption(i18n("%1 profiles synced. Multiple sync completed!").arg(num) ); else - mParent->setCaption(i18n("Nothing synced! No profiles defined for multisync!")); + mParent->topLevelWidget()->setCaption(i18n("Nothing synced! No profiles defined for multisync!")); return; } int KSyncManager::ringSync() @@ -433,7 +433,7 @@ int KSyncManager::ringSync() if ( includeInRingSync && ( i < 1 || i > 2 )) { - mParent->setCaption(i18n("Profile ")+syncProfileNames[mCurrentSyncProfile]+ i18n(" is synced ... ")); + mParent->topLevelWidget()->setCaption(i18n("Profile ")+syncProfileNames[mCurrentSyncProfile]+ i18n(" is synced ... ")); ++syncedProfiles; // mAskForPreferences = temp->getAskForPreferences(); mWriteBackFile = temp->getWriteBackFile(); @@ -478,7 +478,7 @@ int KSyncManager::ringSync() } } timer.start(); - mParent->setCaption(i18n("Multiple sync in progress ... please wait!") ); + mParent->topLevelWidget()->setCaption(i18n("Multiple sync in progress ... please wait!") ); while ( timer.elapsed () < 2000 ) { qApp->processEvents(); #ifndef _WIN32_ @@ -541,7 +541,7 @@ void KSyncManager::syncRemote( KSyncProfile* prof, bool ask) int maxlen = 30; if ( QApplication::desktop()->width() > 320 ) maxlen += 25; - mParent->setCaption ( i18n( "Copy remote file to local machine..." ) ); + mParent->topLevelWidget()->setCaption ( i18n( "Copy remote file to local machine..." ) ); int fileSize = 0; int result = system ( preCommand ); // 0 : okay @@ -558,10 +558,10 @@ void KSyncManager::syncRemote( KSyncProfile* prof, bool ask) QMessageBox::information( mParent, i18n("Sync - ERROR"), question, i18n("Okay!")) ; - mParent->setCaption (""); + mParent->topLevelWidget()->setCaption (""); return; } - mParent->setCaption ( i18n( "Copying succeed." ) ); + mParent->topLevelWidget()->setCaption ( i18n( "Copying succeed." ) ); //qDebug(" file **%s** ",prof->getLocalTempFile().latin1() ); @@ -578,14 +578,14 @@ void KSyncManager::syncRemote( KSyncProfile* prof, bool ask) postCommand = postCommand.left( fi )+ pwd + postCommand.mid( fi+5 ); } - mParent->setCaption ( i18n( "Writing back file ..." ) ); + mParent->topLevelWidget()->setCaption ( i18n( "Writing back file ..." ) ); result = system ( postCommand ); qDebug("Writing back file result: %d ", result); if ( result != 0 ) { - mParent->setCaption ( i18n( "Writing back file result: " )+QString::number( result ) ); + mParent->topLevelWidget()->setCaption ( i18n( "Writing back file result: " )+QString::number( result ) ); return; } else { - mParent->setCaption ( i18n( "Syncronization sucessfully completed" ) ); + mParent->topLevelWidget()->setCaption ( i18n( "Syncronization sucessfully completed" ) ); } } } @@ -749,13 +749,13 @@ QString KSyncManager::syncFileName() switch(mTargetApp) { case (KAPI): - fn = "addressbook.vcf"; + fn = "tempsyncab.vcf"; break; case (KOPI): - fn = "synccalendar.ics"; + fn = "tempsynccal.ics"; break; case (PWMPI): - fn = "manager.pwm"; + fn = "tempsyncpw.pwm"; break; default: break; @@ -773,12 +773,12 @@ void KSyncManager::syncPi() bool ok; Q_UINT16 port = mActiveSyncPort.toUInt(&ok); if ( ! ok ) { - mParent->setCaption( i18n("Sorry, no valid port.Syncing cancelled.") ); + mParent->topLevelWidget()->setCaption( i18n("Sorry, no valid port.Syncing cancelled.") ); return; } KCommandSocket* commandSocket = new KCommandSocket( mPassWordPiSync, port, mActiveSyncIP, this ); connect( commandSocket, SIGNAL(commandFinished( KCommandSocket*, int )), this, SLOT(deleteCommandSocket(KCommandSocket*, int)) ); - mParent->setCaption( i18n("Sending request for remote file ...") ); + mParent->topLevelWidget()->setCaption( i18n("Sending request for remote file ...") ); commandSocket->readFile( syncFileName() ); } @@ -788,7 +788,7 @@ void KSyncManager::deleteCommandSocket(KCommandSocket*s, int state) //enum { success, errorW, errorR, quiet }; if ( state == KCommandSocket::errorR ) { - mParent->setCaption( i18n("ERROR: Receiving remote file failed.") ); + mParent->topLevelWidget()->setCaption( i18n("ERROR: Receiving remote file failed.") ); delete s; KCommandSocket* commandSocket = new KCommandSocket( mPassWordPiSync, mActiveSyncPort.toUInt(), mActiveSyncIP, this ); connect( commandSocket, SIGNAL(commandFinished( KCommandSocket*, int)), this, SLOT(deleteCommandSocket(KCommandSocket*, int )) ); @@ -796,13 +796,13 @@ void KSyncManager::deleteCommandSocket(KCommandSocket*s, int state) return; } else if ( state == KCommandSocket::errorW ) { - mParent->setCaption( i18n("ERROR:Writing back file failed.") ); + mParent->topLevelWidget()->setCaption( i18n("ERROR:Writing back file failed.") ); } else if ( state == KCommandSocket::successR ) { QTimer::singleShot( 1, this , SLOT ( readFileFromSocket())); } else if ( state == KCommandSocket::successW ) { - mParent->setCaption( i18n("Pi-Sync succesful!") ); + mParent->topLevelWidget()->setCaption( i18n("Pi-Sync succesful!") ); } delete s; @@ -811,9 +811,9 @@ void KSyncManager::deleteCommandSocket(KCommandSocket*s, int state) void KSyncManager::readFileFromSocket() { QString fileName = syncFileName(); - mParent->setCaption( i18n("Remote file saved to temp file.") ); + mParent->topLevelWidget()->setCaption( i18n("Remote file saved to temp file.") ); if ( ! syncWithFile( fileName , true ) ) { - mParent->setCaption( i18n("Syncing failed.") ); + mParent->topLevelWidget()->setCaption( i18n("Syncing failed.") ); qDebug("Syncing failed "); return; } @@ -823,32 +823,10 @@ void KSyncManager::readFileFromSocket() commandSocket->writeFile( fileName ); else { commandSocket->sendStop(); - mParent->setCaption( i18n("Pi-Sync succesful!") ); + mParent->topLevelWidget()->setCaption( i18n("Pi-Sync succesful!") ); } } - - - - - - - - - - - - - - - - - - - - - - KServerSocket:: KServerSocket ( QString pw, Q_UINT16 port, int backlog, QObject * parent, const char * name ) : QServerSocket( port, backlog, parent, name ) { mPassWord = pw; @@ -938,6 +916,7 @@ void KServerSocket::send_file() lay->setSpacing(7); mSyncActionDialog->setFixedSize( 230, 120); mSyncActionDialog->show(); + mSyncActionDialog->raise(); qDebug("KSS::saving ... "); emit request_file(); qApp->processEvents(); diff --git a/libkdepim/ksyncmanager.h b/libkdepim/ksyncmanager.h index 0eb3323..aad48d9 100644 --- a/libkdepim/ksyncmanager.h +++ b/libkdepim/ksyncmanager.h @@ -159,13 +159,13 @@ class KSyncManager : public QObject public slots: void slotSyncMenu( int ); + void deleteCommandSocket(KCommandSocket*s, int state); + void readFileFromSocket(); private: // LR ******************************* // sync stuff! void syncPi(); - void deleteCommandSocket(KCommandSocket*s, int state); - void readFileFromSocket(); KServerSocket * mServerSocket; void enableQuick(); KPimPrefs* mPrefs; diff --git a/libkdepim/ksyncprefsdialog.cpp b/libkdepim/ksyncprefsdialog.cpp index 0caa27e..ee092b9 100644 --- a/libkdepim/ksyncprefsdialog.cpp +++ b/libkdepim/ksyncprefsdialog.cpp @@ -288,19 +288,19 @@ void KSyncPrefsDialog::setupSyncAlgTab() new QLabel( i18n("AddressBook:"), temphb); new QLabel( i18n("PWManager:"), temphb); - lab = new QLabel( i18n("Password for remote access:"), piWidget); + lab = new QLabel( i18n("Password for remote access: (could be the same for each)"), piWidget); temphb = new QHBox( piWidget ); mRemotePw = new QLineEdit(temphb); mRemotePwAB = new QLineEdit(temphb); mRemotePwPWM = new QLineEdit(temphb); - lab = new QLabel( i18n("Remote IP address:"), piWidget); + lab = new QLabel( i18n("Remote IP address: (could be the same for each)"), piWidget); temphb = new QHBox( piWidget ); mRemoteIP = new QLineEdit(temphb); mRemoteIPAB = new QLineEdit(temphb); mRemoteIPPWM = new QLineEdit(temphb); - lab = new QLabel( i18n("Remote port number:"), piWidget); + lab = new QLabel( i18n("Remote port number: (should be different for each)"), piWidget); temphb = new QHBox( piWidget ); mRemotePort = new QLineEdit(temphb); mRemotePortAB = new QLineEdit(temphb); -- cgit v0.9.0.2