From 0a661f5800b86df385cc23f4c9a8324bd0b50a5c Mon Sep 17 00:00:00 2001 From: zautrix Date: Thu, 07 Oct 2004 19:42:44 +0000 Subject: sync fix --- (limited to 'libkdepim/ksyncmanager.cpp') diff --git a/libkdepim/ksyncmanager.cpp b/libkdepim/ksyncmanager.cpp index 568c2a9..01309d5 100644 --- a/libkdepim/ksyncmanager.cpp +++ b/libkdepim/ksyncmanager.cpp @@ -1,21 +1,21 @@ /* - This file is part of KDE-Pim/Pi. - Copyright (c) 2004 Ulf Schenk - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public License - along with this library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. + This file is part of KDE-Pim/Pi. + Copyright (c) 2004 Ulf Schenk + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ // $Id$ @@ -73,7 +73,7 @@ KSyncManager::KSyncManager(QWidget* parent, KSyncInterface* implementation, Targ KSyncManager::~KSyncManager() { - delete bar; + delete bar; } @@ -165,7 +165,7 @@ void KSyncManager::slotSyncMenu( int action ) } if (blockSave()) - return; + return; setBlockSave(true); @@ -300,22 +300,22 @@ void KSyncManager::syncLocalFile() QString fn =mPrefs->mLastSyncedLocalFile; QString ext; - switch(mTargetApp) - { + switch(mTargetApp) + { case (KAPI): - ext = "(*.vcf)"; - break; + ext = "(*.vcf)"; + break; case (KOPI): - ext = "(*.ics/*.vcs)"; - break; + ext = "(*.ics/*.vcs)"; + break; case (PWMPI): - ext = "(*.pwm)"; - break; + ext = "(*.pwm)"; + break; default: - qDebug("KSyncManager::syncLocalFile: invalid apptype selected"); - break; + qDebug("KSyncManager::syncLocalFile: invalid apptype selected"); + break; - } + } fn =KFileDialog:: getOpenFileName( fn, i18n("Sync filename"+ext), mParent ); if ( fn == "" ) @@ -390,7 +390,7 @@ void KSyncManager::multiSync( bool askforPrefs ) mSyncAlgoPrefs = mPrefs->mRingSyncAlgoPrefs; if ( askforPrefs ) { edit_sync_options(); - mRingSyncAlgoPrefs = mSyncAlgoPrefs; + mPrefs->mRingSyncAlgoPrefs = mSyncAlgoPrefs; } mParent->topLevelWidget()->setCaption(i18n("Multiple sync started.") ); qApp->processEvents(); @@ -520,12 +520,12 @@ void KSyncManager::syncRemote( KSyncProfile* prof, bool ask) { QString question; if ( ask ) { - question = i18n("Do you really want\nto remote sync\nwith profile \n")+ prof->getName()+" ?\n"; - if ( QMessageBox::information( mParent, i18n("Sync"), - question, - i18n("Yes"), i18n("No"), - 0, 0 ) != 0 ) - return; + question = i18n("Do you really want\nto remote sync\nwith profile \n")+ prof->getName()+" ?\n"; + if ( QMessageBox::information( mParent, i18n("Sync"), + question, + i18n("Yes"), i18n("No"), + 0, 0 ) != 0 ) + return; } QString preCommand; @@ -739,25 +739,25 @@ void KSyncManager::syncPhone() void KSyncManager::showProgressBar(int percentage, QString caption, int total) { - if (!bar->isVisible()) - { - bar->setCaption (caption); - bar->setTotalSteps ( total ) ; + if (!bar->isVisible()) + { + bar->setCaption (caption); + bar->setTotalSteps ( total ) ; - bar->show(); - } + bar->show(); + } - bar->setProgress( percentage ); + bar->setProgress( percentage ); } void KSyncManager::hideProgressBar() { - bar->hide(); + bar->hide(); } bool KSyncManager::isProgressBarCanceled() { - return !bar->isVisible(); + return !bar->isVisible(); } QString KSyncManager::syncFileName() @@ -807,23 +807,23 @@ void KSyncManager::deleteCommandSocket(KCommandSocket*s, int state) //enum { success, errorW, errorR, quiet }; if ( state == KCommandSocket::errorR ||state == KCommandSocket::errorTO ) { - mParent->topLevelWidget()->setCaption( i18n("ERROR: Receiving remote file failed.") ); + mParent->topLevelWidget()->setCaption( i18n("ERROR: Receiving remote file failed.") ); delete s; - if ( state == KCommandSocket::errorR ) { - KCommandSocket* commandSocket = new KCommandSocket( mPassWordPiSync, mActiveSyncPort.toUInt(), mActiveSyncIP, this ); - connect( commandSocket, SIGNAL(commandFinished( KCommandSocket*, int)), this, SLOT(deleteCommandSocket(KCommandSocket*, int )) ); - commandSocket->sendStop(); - } + if ( state == KCommandSocket::errorR ) { + KCommandSocket* commandSocket = new KCommandSocket( mPassWordPiSync, mActiveSyncPort.toUInt(), mActiveSyncIP, this ); + connect( commandSocket, SIGNAL(commandFinished( KCommandSocket*, int)), this, SLOT(deleteCommandSocket(KCommandSocket*, int )) ); + commandSocket->sendStop(); + } return; } else if ( state == KCommandSocket::errorW ) { - mParent->topLevelWidget()->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->topLevelWidget()->setCaption( i18n("Pi-Sync succesful!") ); + mParent->topLevelWidget()->setCaption( i18n("Pi-Sync succesful!") ); } delete s; @@ -1156,15 +1156,15 @@ void KCommandSocket::readFileFromSocket() void KCommandSocket::deleteSocket() { if ( mTimerSocket->isActive () ) { - mTimerSocket->stop(); - KMessageBox::information( 0, i18n("ERROR:\nConnection to remote host timed out!\nDid you forgot to enable\nsyncing on remote host? ")); - mRetVal = errorTO; - if ( mSocket ) { - mSocket->close(); - if ( mSocket->state() == QSocket::Idle ) - deleteSocket(); - return; - } + mTimerSocket->stop(); + KMessageBox::information( 0, i18n("ERROR:\nConnection to remote host timed out!\nDid you forgot to enable\nsyncing on remote host? ")); + mRetVal = errorTO; + if ( mSocket ) { + mSocket->close(); + if ( mSocket->state() == QSocket::Idle ) + deleteSocket(); + return; + } } //qDebug("KCommandSocket::deleteSocket() %d", mRetVal ); if ( mSocket) -- cgit v0.9.0.2