-rw-r--r-- | korganizer/mainwindow.cpp | 115 |
1 files changed, 2 insertions, 113 deletions
diff --git a/korganizer/mainwindow.cpp b/korganizer/mainwindow.cpp index 5aa75f5..43ee2d7 100644 --- a/korganizer/mainwindow.cpp +++ b/korganizer/mainwindow.cpp @@ -1939,59 +1939,54 @@ void MainWindow::enableQuick() if ( !mServerSocket->ok() ) { qWarning("Failed to bind to port %d", port); delete mServerSocket; mServerSocket = 0; return; } connect( mServerSocket, SIGNAL ( saveFile() ), this, SLOT ( save() ) ); connect( mServerSocket, SIGNAL ( file_received( bool ) ), this, SLOT ( getFile( bool ) ) ); } void MainWindow::getFile( bool success ) { if ( ! success ) { setCaption( i18n("Error receiving file. Nothing changed!") ); return; } - // pending adjust time for watchSavedFile() - //mView->watchSavedFile(); + mView->watchSavedFile(); mView->openCalendar( defaultFileName() ); setCaption( i18n("Pi-Sync successful!") ); } void MainWindow::syncPi() { qApp->processEvents(); - performQuickQuick(); -} - -void MainWindow::performQuickQuick() -{ bool ok; Q_UINT16 port = KOPrefs::instance()->mActiveSyncPort.toUInt(&ok); if ( ! ok ) { setCaption( i18n("Sorry, no valid port.Syncing cancelled.") ); return; } KCommandSocket* commandSocket = new KCommandSocket( mPassWordPiSync, port, KOPrefs::instance()->mActiveSyncIP, this ); connect( commandSocket, SIGNAL(commandFinished( KCommandSocket*, int )), this, SLOT(deleteCommandSocket(KCommandSocket*, int)) ); setCaption( i18n("Sending request for remote file ...") ); commandSocket->readFile( syncFileName() ); } + void MainWindow::deleteCommandSocket(KCommandSocket*s, int state) { qDebug("MainWindow::deleteCommandSocket %d", state); //enum { success, errorW, errorR, quiet }; if ( state == KCommandSocket::errorR ) { setCaption( i18n("ERROR: Receiving remote file failed.") ); delete s; KCommandSocket* commandSocket = new KCommandSocket( mPassWordPiSync, KOPrefs::instance()->mActiveSyncPort.toUInt(), KOPrefs::instance()->mActiveSyncIP, this ); connect( commandSocket, SIGNAL(commandFinished( KCommandSocket*, int)), this, SLOT(deleteCommandSocket(KCommandSocket*, int )) ); commandSocket->sendStop(); return; } else if ( state == KCommandSocket::errorW ) { setCaption( i18n("ERROR:Writing back file failed.") ); @@ -2153,138 +2148,32 @@ void MainWindow::syncRemote( KSyncProfile* prof, bool ask) command = command.left( fi )+ pwd + command.mid( fi+5 ); } setCaption ( i18n( "Writing back file ..." ) ); result = system ( command ); qDebug("KO: Writing back file result: %d ", result); if ( result != 0 ) { setCaption ( i18n( "Writing back file result: " )+QString::number( result ) ); return; } else { setCaption ( i18n( "Syncronization sucessfully completed" ) ); } } } return; } -void MainWindow::syncSSH() -{ - // not used anymore - QTime timer; - timer.start(); - //qDebug("MainWindow::syncssh() "); - KOPrefs *p = KOPrefs::instance(); - QString localFile = p->mLocalTempFile; - QString remoteIP = p->mRemoteIP; - QString remoteUser = p->mRemoteUser; - QString remoteFile = p->mRemoteFile; - if ( p->mUsePassWd && p->mRemotePassWd.length() > 0 ) - remoteUser += ":" + p->mRemotePassWd; - - QString question = i18n("Do you really want\nto remote sync?\n \n") + - i18n("IP: " ) +remoteIP +"\n" + - i18n("User: " ) + remoteUser +"\n" ; - int maxlen = 30; - if ( QApplication::desktop()->width() > 320 ) - maxlen += 25; - if ( remoteFile.length() > maxlen ) - question += i18n("Remote file:\n..." ) + remoteFile.right(maxlen) +"\n"; - else - question += i18n("Remote file:\n " ) + remoteFile +"\n"; - if ( localFile.length() > maxlen ) - question += i18n("Local temp file:\n..." ) + localFile.right(maxlen) +"\n"; - else - question += i18n("Local temp file:\n " ) + localFile +"\n"; - - if ( QMessageBox::information( this, i18n("KO/Pi Sync"), - question, - i18n("Yes"), i18n("No"), - 0, 0 ) != 0 ) - return; - // if ( !p->mUsePassWd ) { - // QString pass = getPassword(); - // if ( pass.length() > 0 ) - // remoteUser += ":" + pass; - // } - QString command = "scp " + remoteUser + "@" + remoteIP +":" + remoteFile +" " +localFile; - setCaption ( i18n( "Copy remote file to local machine..." ) ); - int fileSize = 0; - int result = system ( command ); - // 0 : okay - // 256: no such file or dir - // - qDebug("KO: Remote copy result(0 = okay): %d ",result ); - if ( result != 0 ) { - int len = maxlen; - while ( len < command.length() ) { - command.insert( len , "\n" ); - len += maxlen +2; - } - question = i18n("Sorry, the copy command failed!\nCommand was:\n%1\n \nTry command on console to get more\ndetailed info about the reason.\n").arg (command) ; - QMessageBox::information( this, i18n("KO/Pi Sync - ERROR"), - question, - i18n("Okay!")) ; - setCaption ("KO/Pi"); - return; - } - - - setCaption ( i18n( "Copying succeed." ) ); - //mView->setSyncDevice("ssh-scp" ); - if ( syncWithFile(localFile , true ) ) { -// Event* e = mView->getLastSyncEvent(); -// e->setReadOnly( false ); -// e->setLocation( KOPrefs::instance()->mSyncProfileNames[mCurrentSyncProfile]); -// e->setReadOnly( true ); - if ( KOPrefs::instance()->mWriteBackFile ) { - command = "scp " + localFile +" " +remoteUser + "@" + remoteIP +":" + remoteFile ; - setCaption ( i18n( "Writing back file ..." ) ); - result = system ( command ); - if ( result != 0 ) { - int len = maxlen; - while ( len < command.length() ) { - command.insert( len , "\n" ); - len += maxlen +2; - } - question = i18n("Sorry, the copy back command failed!\nCommand was:\n%1\n \nTry command on console to get more\ndetailed info about the reason.\n").arg (command) ; - QMessageBox::information( this, i18n("KO/Pi Sync - ERROR"), - question, - i18n("Okay!")) ; - setCaption ("KO/Pi"); - return; - } else { - setCaption ( i18n( "Syncronization sucessfully completed" ) ); - } - } - } - return; -#if 0 - system ("scp zaurus@192.168.0.65:/home/zaurus/Applications/korganizer/mycalendar.ics /home/polo/Applications/korganizer/z_sync.ics"); - while ( timer.elapsed() < 5000 ) - qApp->processEvents(); - - qDebug("MainWindow::merging) "); - mView->syncCalendar( "/home/polo/Applications/korganizer/z_sync.ics", 0 ); - while ( mBlockSaveFlag ) - qApp->processEvents(); - save(); - system ("scp /home/polo/Applications/korganizer/mycalendar.ics zaurus@192.168.0.65:/home/zaurus/Applications/korganizer/mycalendar.ics"); -#endif - -} - void MainWindow::syncSharp() { if ( mCalendarModifiedFlag ) save(); mView->syncSharp(); slotModifiedChanged( true ); } void MainWindow::syncPhone() { if ( mCalendarModifiedFlag ) save(); mView->syncPhone(); slotModifiedChanged( true ); |