From e2bc785d2f98d2aeac6ab6a5e39ff4f6e679517b Mon Sep 17 00:00:00 2001 From: zautrix Date: Wed, 22 Sep 2004 23:36:37 +0000 Subject: bugfixes --- (limited to 'korganizer/mainwindow.cpp') diff --git a/korganizer/mainwindow.cpp b/korganizer/mainwindow.cpp index ebe761a..2e6b5c8 100644 --- a/korganizer/mainwindow.cpp +++ b/korganizer/mainwindow.cpp @@ -73,6 +73,7 @@ MainWindow::MainWindow( QWidget *parent, const char *name, QString msg) : setFont( QFont("Arial"), 14 ); #endif mCommandSocket = 0; + mCommandSocketFinish = 0; mSyncActionDialog = 0; mServerSocket = 0; mClosed = false; @@ -1981,7 +1982,6 @@ void MainWindow::sendFile(QSocket* socket) void MainWindow::getFile(QSocket* socket) { setCaption( i18n("Receiving synced file...") ); - qDebug("MainWindow::sendFile(QSocket* s) "); QString fileName = defaultFileName(); QFile file( fileName ); @@ -2068,10 +2068,12 @@ void MainWindow::performQuickQuick() setCaption( i18n("Sorry, no valid port.Syncing cancelled.") ); return; } - if ( mCommandSocket ) - delete mCommandSocket; - mCommandSocket = new QSocket( this ); - connect( mCommandSocket, SIGNAL(readyRead()), this, SLOT(readFileFromSocket()) ); + if ( !mCommandSocket ) { + mCommandSocket = new QSocket( this ); + // delete mCommandSocket; + //mCommandSocket = new QSocket( this ); + connect( mCommandSocket, SIGNAL(readyRead()), this, SLOT(readFileFromSocket()) ); + } QString host = KOPrefs::instance()->mActiveSyncIP; mCommandSocket->connectToHost( host, port ); QTextStream os( mCommandSocket ); @@ -2112,9 +2114,9 @@ QString fileName; } file.close(); mCommandSocket->close(); - delete mCommandSocket; + //delete mCommandSocket; setCaption( i18n("Remote file saved to temp file.") ); - mCommandSocket = 0; + //mCommandSocket = 0; mCurrentSyncProfile = 2 ; // last file mView->setSyncDevice(KOPrefs::instance()->mSyncProfileNames[mCurrentSyncProfile] ); mView->setSyncName( KOPrefs::instance()->mLocalMachineName ); @@ -2138,10 +2140,12 @@ QString fileName; return; } - mCommandSocket = new QSocket( this ); - QString host = KOPrefs::instance()->mActiveSyncIP; - mCommandSocket->connectToHost( KOPrefs::instance()->mActiveSyncIP, KOPrefs::instance()->mActiveSyncPort.toUInt() ); + if ( !mCommandSocketFinish ) { + mCommandSocketFinish = new QSocket( this ); + } + mCommandSocketFinish->connectToHost( KOPrefs::instance()->mActiveSyncIP, KOPrefs::instance()->mActiveSyncPort.toUInt() ); + QString host = KOPrefs::instance()->mActiveSyncIP; QFile file2( fileName ); if (!file2.open( IO_ReadOnly ) ) { setCaption( i18n("Error: Cannot open temp file for read.") ); @@ -2152,7 +2156,7 @@ QString fileName; setCaption( i18n("Sending back synced file...") ); QTextStream ts2( &file2 ); ts2.setCodec( QTextCodec::codecForName("utf8") ); - QTextStream os2( mCommandSocket ); + QTextStream os2( mCommandSocketFinish ); os2.setCodec( QTextCodec::codecForName("utf8") ); //os.setEncoding( QTextStream::UnicodeUTF8 ); if ( KOPrefs::instance()->mWriteBackFile ) { @@ -2163,10 +2167,10 @@ QString fileName; } else { os2 << "STOP\r\n"; } - mCommandSocket->close(); + mCommandSocketFinish->close(); file.close(); - delete mCommandSocket; - mCommandSocket = 0; + //delete ( mCommandSocket); + //mCommandSocket = 0; qDebug("Syncing succesful! "); setCaption( i18n("Easy-Pi-Sync succesful!") ); -- cgit v0.9.0.2