author | zautrix <zautrix> | 2004-10-04 22:10:20 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2004-10-04 22:10:20 (UTC) |
commit | c22811d11414872fc0525350a8a1afdae61be346 (patch) (side-by-side diff) | |
tree | daafa0c4333022d44dafb2945ba36ff58d5c45d1 | |
parent | f53ef630b9299ceae666e64da8ce022813795ed6 (diff) | |
download | kdepimpi-c22811d11414872fc0525350a8a1afdae61be346.zip kdepimpi-c22811d11414872fc0525350a8a1afdae61be346.tar.gz kdepimpi-c22811d11414872fc0525350a8a1afdae61be346.tar.bz2 |
many sync fixes
-rw-r--r-- | korganizer/mainwindow.cpp | 98 | ||||
-rw-r--r-- | korganizer/mainwindow.h | 2 | ||||
-rw-r--r-- | libkdepim/ksyncprefsdialog.cpp | 6 |
3 files changed, 33 insertions, 73 deletions
diff --git a/korganizer/mainwindow.cpp b/korganizer/mainwindow.cpp index bce2a54..fe7e6d3 100644 --- a/korganizer/mainwindow.cpp +++ b/korganizer/mainwindow.cpp @@ -873,7 +873,4 @@ void MainWindow::fillSyncMenu() } syncMenu->insertSeparator(); - syncMenu->insertItem( i18n("New Pi-Sync!"), 4 ); - syncMenu->insertItem( i18n("Quick Pi-Sync!"), 5 ); - syncMenu->insertSeparator(); syncMenu->insertItem( i18n("Multiple sync"), 1 ); syncMenu->insertSeparator(); @@ -953,5 +950,10 @@ int MainWindow::ringSync() KOPrefs::instance()->mPhoneModel = temp->getPhoneModel( ); syncPhone(); - } else + } else if ( temp->getIsPiSync() ) { + mPassWordPiSync = temp->getRemotePw(); + KOPrefs::instance()->mActiveSyncPort = temp->getRemotePort(); + KOPrefs::instance()->mActiveSyncIP = temp->getRemoteIP(); + syncPi(); + } else syncRemote( temp, false ); @@ -1037,12 +1039,4 @@ void MainWindow::slotSyncMenu( int action ) return; } - if ( action == 4 ) { - performQuick(); - return; - } - if ( action == 5 ) { - performQuickQuick(); - return; - } if (mBlockSaveFlag) @@ -1083,5 +1077,10 @@ void MainWindow::slotSyncMenu( int action ) KOPrefs::instance()->mPhoneModel = temp->getPhoneModel( ); syncPhone(); - } else + } else if ( temp->getIsPiSync() ) { + mPassWordPiSync = temp->getRemotePw(); + KOPrefs::instance()->mActiveSyncPort = temp->getRemotePort(); + KOPrefs::instance()->mActiveSyncIP = temp->getRemoteIP(); + syncPi(); + } else syncRemote( temp ); @@ -1956,45 +1955,6 @@ void MainWindow::getFile( bool success ) -void MainWindow::performQuick() +void MainWindow::syncPi() { - - setCaption( i18n("Please input connection settings") ); - QString retfile = ""; - QDialog dia ( this, "input-dialog", true ); - QLineEdit lab ( &dia ); - QVBoxLayout lay( &dia ); - QLabel label ( i18n("IP address\n(Example: 192.168.0.40)"), &dia ); - lay.addWidget( &label); - lab.setText( KOPrefs::instance()->mActiveSyncIP ); - lay.setMargin(7); - lay.setSpacing(7); - lay.addWidget( &lab); - QLabel label2 ( i18n("Port number (Default: 9197)"), &dia ); - lay.addWidget( &label2); - QLineEdit lab2 ( &dia ); - lab2.setText( KOPrefs::instance()->mActiveSyncPort ); - lay.addWidget( &lab2); - - QLineEdit lepw ( &dia ); - lepw.setText( mPassWordPiSync ); - QLabel label3 ( i18n("Password to enable\naccess to remote:"), &dia ); - lay.addWidget( &label3); - lay.addWidget( &lepw); - - dia.setFixedSize( 230,200 ); - dia.setCaption( i18n("Enter port for Pi-Sync ") ); - QPushButton pb ( "OK", &dia); - lay.addWidget( &pb ); - connect(&pb, SIGNAL( clicked() ), &dia, SLOT ( accept() ) ); - dia.show(); - int res = dia.exec(); - if ( !res ) { - setCaption( i18n("Syncing cancelled!") ); - return; - } - mPassWordPiSync = lepw.text(); - dia.hide(); - KOPrefs::instance()->mActiveSyncPort = lab2.text(); - KOPrefs::instance()->mActiveSyncIP = lab.text(); qApp->processEvents(); performQuickQuick(); @@ -2378,5 +2338,5 @@ KServerSocket:: KServerSocket ( QString pw, Q_UINT16 port, int backlog, QObject void KServerSocket::newConnection ( int socket ) { - qDebug("KServerSocket:New connection %d ", socket); + // qDebug("KServerSocket:New connection %d ", socket); if ( mSocket ) { qDebug("KServerSocket::newConnection Socket deleted! "); @@ -2392,7 +2352,6 @@ void KServerSocket::newConnection ( int socket ) void KServerSocket::discardClient() { - qDebug(" KServerSocket::discardClient()"); + //qDebug(" KServerSocket::discardClient()"); if ( mSocket ) { - qDebug("delete "); delete mSocket; mSocket = 0; @@ -2406,8 +2365,7 @@ void KServerSocket::readClient() return; } - qDebug("KServerSocket readClient()"); + //qDebug("KServerSocket readClient()"); if ( mSocket->canReadLine() ) { QStringList tokens = QStringList::split( QRegExp("[ \r\n][ \r\n]*"), mSocket->readLine() ); - qDebug("KServerSocket socket->canReadLine()"); if ( tokens[0] == "GET" ) { if ( tokens[1] == mPassWord ) @@ -2441,5 +2399,5 @@ void KServerSocket::end_connect() void KServerSocket::send_file() { - qDebug("MainWindow::sendFile(QSocket* s) "); + //qDebug("MainWindow::sendFile(QSocket* s) "); if ( mSyncActionDialog ) delete mSyncActionDialog; @@ -2479,6 +2437,5 @@ void KServerSocket::send_file() //os << ts.read(); file.close(); - mSyncActionDialog->setCaption( i18n("Waiting to get back synced file") ); - qDebug("file sent "); + mSyncActionDialog->setCaption( i18n("Waiting for synced file...") ); mSocket->close(); if ( mSocket->state() == QSocket::Idle ) @@ -2497,10 +2454,10 @@ void KServerSocket::get_file() void KServerSocket::readBackFileFromSocket() { - qDebug("readBackFileFromSocket() %d ", piTime.elapsed ()); + //qDebug("readBackFileFromSocket() %d ", piTime.elapsed ()); while ( mSocket->canReadLine () ) { piTime.restart(); QString line = mSocket->readLine (); piFileString += line; - qDebug("readline: %s ", line.latin1()); + //qDebug("readline: %s ", line.latin1()); mSyncActionDialog->setCaption( i18n("Received %1 bytes").arg( piFileString.length() ) ); @@ -2508,5 +2465,5 @@ void KServerSocket::readBackFileFromSocket() if ( piTime.elapsed () < 3000 ) { // wait for more - qDebug("waitformore "); + //qDebug("waitformore "); QTimer::singleShot( 100, this , SLOT (readBackFileFromSocket( ) )); return; @@ -2527,5 +2484,4 @@ void KServerSocket::readBackFileFromSocket() QTextStream ts ( &file ); ts.setCodec( QTextCodec::codecForName("utf8") ); - qDebug("finish "); mSyncActionDialog->setCaption( i18n("Writing file to disk...") ); ts << piFileString; @@ -2582,4 +2538,5 @@ void KCommandSocket::writeFile( QString fileName ) connect( mSocket, SIGNAL(delayedCloseFinished ()), this, SLOT(deleteSocket()) ); } + mSocket->connectToHost( mHost, mPort ); QTextStream ts2( &file2 ); ts2.setCodec( QTextCodec::codecForName("utf8") ); @@ -2590,4 +2547,5 @@ void KCommandSocket::writeFile( QString fileName ) os2 << ts2.readLine() << "\n"; } + mRetVal= true; mSocket->close(); if ( mSocket->state() == QSocket::Idle ) @@ -2602,4 +2560,5 @@ void KCommandSocket::sendStop() connect( mSocket, SIGNAL(delayedCloseFinished ()), this, SLOT(deleteSocket()) ); } + mSocket->connectToHost( mHost, mPort ); QTextStream os2( mSocket ); os2.setCodec( QTextCodec::codecForName("utf8") ); @@ -2624,14 +2583,14 @@ void KCommandSocket::startReadFileFromSocket() void KCommandSocket::readFileFromSocket() { - qDebug("readBackFileFromSocket() %d ", mTime.elapsed ()); + //qDebug("readBackFileFromSocket() %d ", mTime.elapsed ()); while ( mSocket->canReadLine () ) { mTime.restart(); QString line = mSocket->readLine (); mFileString += line; - qDebug("readline: %s ", line.latin1()); + //qDebug("readline: %s ", line.latin1()); } if ( mTime.elapsed () < 3000 ) { // wait for more - qDebug("waitformore "); + //qDebug("waitformore "); QTimer::singleShot( 100, this , SLOT (readFileFromSocket( ) )); return; @@ -2650,5 +2609,4 @@ void KCommandSocket::readFileFromSocket() QTextStream ts ( &file ); ts.setCodec( QTextCodec::codecForName("utf8") ); - qDebug("finish "); ts << mFileString; file.close(); @@ -2669,5 +2627,5 @@ void KCommandSocket::deleteSocket() mRetVal = false; } - qDebug("KCommandSocket::deleteSocket() %d", mRetVal ); + //qDebug("KCommandSocket::deleteSocket() %d", mRetVal ); if ( mSocket) delete mSocket; diff --git a/korganizer/mainwindow.h b/korganizer/mainwindow.h index 5a67765..f8b2334 100644 --- a/korganizer/mainwindow.h +++ b/korganizer/mainwindow.h @@ -148,4 +148,5 @@ class MainWindow : public QMainWindow void syncSharp(); void syncPhone(); + void syncPi(); void syncLocalFile(); bool syncWithFile( QString, bool ); @@ -176,5 +177,4 @@ class MainWindow : public QMainWindow int mCurrentSyncProfile; void enableQuick(); - void performQuick(); void performQuickQuick(); void syncRemote( KSyncProfile* , bool ask = true); diff --git a/libkdepim/ksyncprefsdialog.cpp b/libkdepim/ksyncprefsdialog.cpp index f05c846..0caa27e 100644 --- a/libkdepim/ksyncprefsdialog.cpp +++ b/libkdepim/ksyncprefsdialog.cpp @@ -191,5 +191,5 @@ void KSyncPrefsDialog::setupSyncAlgTab() ++iii; mIsLocal = new QRadioButton ( i18n("Local file"), gr ); - mIsPi = new QRadioButton ( i18n("Quick Pi-Sync"), gr ); + mIsPi = new QRadioButton ( i18n("Pi-Sync ( direct Kx/Pi to Kx/Pi sync )"), gr ); connect (mIsPi, SIGNAL( toggled(bool)), this, SLOT (kindChanged(bool) ) ); mIsNotLocal = new QRadioButton ( i18n("Remote file (w down/upload command)"), gr ); @@ -457,5 +457,6 @@ void KSyncPrefsDialog::profileChanged( int item ) mIsLocal->setChecked(prof->getIsLocalFileSync()) ; mIsPhone->setChecked(prof->getIsPhoneSync()) ; - mIsNotLocal->setChecked(!prof->getIsLocalFileSync() && !prof->getIsPhoneSync() ); + mIsPi->setChecked(prof->getIsPiSync()) ; + mIsNotLocal->setChecked(!prof->getIsLocalFileSync() && !prof->getIsPhoneSync() &&!prof->getIsPiSync() ); proGr->setEnabled( item > 2 ); if ( item < 3 ) { @@ -578,4 +579,5 @@ void KSyncPrefsDialog::saveProfile() prof->setIsLocalFileSync( mIsLocal->isChecked() ); prof->setIsPhoneSync( mIsPhone->isChecked() ); + prof->setIsPiSync( mIsPi->isChecked() ); prof->setWriteBackFuture(mWriteBackFuture->isChecked()); prof->setWriteBackFutureWeeks(mWriteBackFutureWeeks->value()); |