author | zautrix <zautrix> | 2004-10-04 22:10:20 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2004-10-04 22:10:20 (UTC) |
commit | c22811d11414872fc0525350a8a1afdae61be346 (patch) (unidiff) | |
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() | |||
873 | } | 873 | } |
874 | syncMenu->insertSeparator(); | 874 | syncMenu->insertSeparator(); |
875 | syncMenu->insertItem( i18n("New Pi-Sync!"), 4 ); | ||
876 | syncMenu->insertItem( i18n("Quick Pi-Sync!"), 5 ); | ||
877 | syncMenu->insertSeparator(); | ||
878 | syncMenu->insertItem( i18n("Multiple sync"), 1 ); | 875 | syncMenu->insertItem( i18n("Multiple sync"), 1 ); |
879 | syncMenu->insertSeparator(); | 876 | syncMenu->insertSeparator(); |
@@ -953,5 +950,10 @@ int MainWindow::ringSync() | |||
953 | KOPrefs::instance()->mPhoneModel = temp->getPhoneModel( ); | 950 | KOPrefs::instance()->mPhoneModel = temp->getPhoneModel( ); |
954 | syncPhone(); | 951 | syncPhone(); |
955 | } else | 952 | } else if ( temp->getIsPiSync() ) { |
953 | mPassWordPiSync = temp->getRemotePw(); | ||
954 | KOPrefs::instance()->mActiveSyncPort = temp->getRemotePort(); | ||
955 | KOPrefs::instance()->mActiveSyncIP = temp->getRemoteIP(); | ||
956 | syncPi(); | ||
957 | } else | ||
956 | syncRemote( temp, false ); | 958 | syncRemote( temp, false ); |
957 | 959 | ||
@@ -1037,12 +1039,4 @@ void MainWindow::slotSyncMenu( int action ) | |||
1037 | return; | 1039 | return; |
1038 | } | 1040 | } |
1039 | if ( action == 4 ) { | ||
1040 | performQuick(); | ||
1041 | return; | ||
1042 | } | ||
1043 | if ( action == 5 ) { | ||
1044 | performQuickQuick(); | ||
1045 | return; | ||
1046 | } | ||
1047 | 1041 | ||
1048 | if (mBlockSaveFlag) | 1042 | if (mBlockSaveFlag) |
@@ -1083,5 +1077,10 @@ void MainWindow::slotSyncMenu( int action ) | |||
1083 | KOPrefs::instance()->mPhoneModel = temp->getPhoneModel( ); | 1077 | KOPrefs::instance()->mPhoneModel = temp->getPhoneModel( ); |
1084 | syncPhone(); | 1078 | syncPhone(); |
1085 | } else | 1079 | } else if ( temp->getIsPiSync() ) { |
1080 | mPassWordPiSync = temp->getRemotePw(); | ||
1081 | KOPrefs::instance()->mActiveSyncPort = temp->getRemotePort(); | ||
1082 | KOPrefs::instance()->mActiveSyncIP = temp->getRemoteIP(); | ||
1083 | syncPi(); | ||
1084 | } else | ||
1086 | syncRemote( temp ); | 1085 | syncRemote( temp ); |
1087 | 1086 | ||
@@ -1956,45 +1955,6 @@ void MainWindow::getFile( bool success ) | |||
1956 | 1955 | ||
1957 | 1956 | ||
1958 | void MainWindow::performQuick() | 1957 | void MainWindow::syncPi() |
1959 | { | 1958 | { |
1960 | |||
1961 | setCaption( i18n("Please input connection settings") ); | ||
1962 | QString retfile = ""; | ||
1963 | QDialog dia ( this, "input-dialog", true ); | ||
1964 | QLineEdit lab ( &dia ); | ||
1965 | QVBoxLayout lay( &dia ); | ||
1966 | QLabel label ( i18n("IP address\n(Example: 192.168.0.40)"), &dia ); | ||
1967 | lay.addWidget( &label); | ||
1968 | lab.setText( KOPrefs::instance()->mActiveSyncIP ); | ||
1969 | lay.setMargin(7); | ||
1970 | lay.setSpacing(7); | ||
1971 | lay.addWidget( &lab); | ||
1972 | QLabel label2 ( i18n("Port number (Default: 9197)"), &dia ); | ||
1973 | lay.addWidget( &label2); | ||
1974 | QLineEdit lab2 ( &dia ); | ||
1975 | lab2.setText( KOPrefs::instance()->mActiveSyncPort ); | ||
1976 | lay.addWidget( &lab2); | ||
1977 | |||
1978 | QLineEdit lepw ( &dia ); | ||
1979 | lepw.setText( mPassWordPiSync ); | ||
1980 | QLabel label3 ( i18n("Password to enable\naccess to remote:"), &dia ); | ||
1981 | lay.addWidget( &label3); | ||
1982 | lay.addWidget( &lepw); | ||
1983 | |||
1984 | dia.setFixedSize( 230,200 ); | ||
1985 | dia.setCaption( i18n("Enter port for Pi-Sync ") ); | ||
1986 | QPushButton pb ( "OK", &dia); | ||
1987 | lay.addWidget( &pb ); | ||
1988 | connect(&pb, SIGNAL( clicked() ), &dia, SLOT ( accept() ) ); | ||
1989 | dia.show(); | ||
1990 | int res = dia.exec(); | ||
1991 | if ( !res ) { | ||
1992 | setCaption( i18n("Syncing cancelled!") ); | ||
1993 | return; | ||
1994 | } | ||
1995 | mPassWordPiSync = lepw.text(); | ||
1996 | dia.hide(); | ||
1997 | KOPrefs::instance()->mActiveSyncPort = lab2.text(); | ||
1998 | KOPrefs::instance()->mActiveSyncIP = lab.text(); | ||
1999 | qApp->processEvents(); | 1959 | qApp->processEvents(); |
2000 | performQuickQuick(); | 1960 | performQuickQuick(); |
@@ -2378,5 +2338,5 @@ KServerSocket:: KServerSocket ( QString pw, Q_UINT16 port, int backlog, QObject | |||
2378 | void KServerSocket::newConnection ( int socket ) | 2338 | void KServerSocket::newConnection ( int socket ) |
2379 | { | 2339 | { |
2380 | qDebug("KServerSocket:New connection %d ", socket); | 2340 | // qDebug("KServerSocket:New connection %d ", socket); |
2381 | if ( mSocket ) { | 2341 | if ( mSocket ) { |
2382 | qDebug("KServerSocket::newConnection Socket deleted! "); | 2342 | qDebug("KServerSocket::newConnection Socket deleted! "); |
@@ -2392,7 +2352,6 @@ void KServerSocket::newConnection ( int socket ) | |||
2392 | void KServerSocket::discardClient() | 2352 | void KServerSocket::discardClient() |
2393 | { | 2353 | { |
2394 | qDebug(" KServerSocket::discardClient()"); | 2354 | //qDebug(" KServerSocket::discardClient()"); |
2395 | if ( mSocket ) { | 2355 | if ( mSocket ) { |
2396 | qDebug("delete "); | ||
2397 | delete mSocket; | 2356 | delete mSocket; |
2398 | mSocket = 0; | 2357 | mSocket = 0; |
@@ -2406,8 +2365,7 @@ void KServerSocket::readClient() | |||
2406 | return; | 2365 | return; |
2407 | } | 2366 | } |
2408 | qDebug("KServerSocket readClient()"); | 2367 | //qDebug("KServerSocket readClient()"); |
2409 | if ( mSocket->canReadLine() ) { | 2368 | if ( mSocket->canReadLine() ) { |
2410 | QStringList tokens = QStringList::split( QRegExp("[ \r\n][ \r\n]*"), mSocket->readLine() ); | 2369 | QStringList tokens = QStringList::split( QRegExp("[ \r\n][ \r\n]*"), mSocket->readLine() ); |
2411 | qDebug("KServerSocket socket->canReadLine()"); | ||
2412 | if ( tokens[0] == "GET" ) { | 2370 | if ( tokens[0] == "GET" ) { |
2413 | if ( tokens[1] == mPassWord ) | 2371 | if ( tokens[1] == mPassWord ) |
@@ -2441,5 +2399,5 @@ void KServerSocket::end_connect() | |||
2441 | void KServerSocket::send_file() | 2399 | void KServerSocket::send_file() |
2442 | { | 2400 | { |
2443 | qDebug("MainWindow::sendFile(QSocket* s) "); | 2401 | //qDebug("MainWindow::sendFile(QSocket* s) "); |
2444 | if ( mSyncActionDialog ) | 2402 | if ( mSyncActionDialog ) |
2445 | delete mSyncActionDialog; | 2403 | delete mSyncActionDialog; |
@@ -2479,6 +2437,5 @@ void KServerSocket::send_file() | |||
2479 | //os << ts.read(); | 2437 | //os << ts.read(); |
2480 | file.close(); | 2438 | file.close(); |
2481 | mSyncActionDialog->setCaption( i18n("Waiting to get back synced file") ); | 2439 | mSyncActionDialog->setCaption( i18n("Waiting for synced file...") ); |
2482 | qDebug("file sent "); | ||
2483 | mSocket->close(); | 2440 | mSocket->close(); |
2484 | if ( mSocket->state() == QSocket::Idle ) | 2441 | if ( mSocket->state() == QSocket::Idle ) |
@@ -2497,10 +2454,10 @@ void KServerSocket::get_file() | |||
2497 | void KServerSocket::readBackFileFromSocket() | 2454 | void KServerSocket::readBackFileFromSocket() |
2498 | { | 2455 | { |
2499 | qDebug("readBackFileFromSocket() %d ", piTime.elapsed ()); | 2456 | //qDebug("readBackFileFromSocket() %d ", piTime.elapsed ()); |
2500 | while ( mSocket->canReadLine () ) { | 2457 | while ( mSocket->canReadLine () ) { |
2501 | piTime.restart(); | 2458 | piTime.restart(); |
2502 | QString line = mSocket->readLine (); | 2459 | QString line = mSocket->readLine (); |
2503 | piFileString += line; | 2460 | piFileString += line; |
2504 | qDebug("readline: %s ", line.latin1()); | 2461 | //qDebug("readline: %s ", line.latin1()); |
2505 | mSyncActionDialog->setCaption( i18n("Received %1 bytes").arg( piFileString.length() ) ); | 2462 | mSyncActionDialog->setCaption( i18n("Received %1 bytes").arg( piFileString.length() ) ); |
2506 | 2463 | ||
@@ -2508,5 +2465,5 @@ void KServerSocket::readBackFileFromSocket() | |||
2508 | if ( piTime.elapsed () < 3000 ) { | 2465 | if ( piTime.elapsed () < 3000 ) { |
2509 | // wait for more | 2466 | // wait for more |
2510 | qDebug("waitformore "); | 2467 | //qDebug("waitformore "); |
2511 | QTimer::singleShot( 100, this , SLOT (readBackFileFromSocket( ) )); | 2468 | QTimer::singleShot( 100, this , SLOT (readBackFileFromSocket( ) )); |
2512 | return; | 2469 | return; |
@@ -2527,5 +2484,4 @@ void KServerSocket::readBackFileFromSocket() | |||
2527 | QTextStream ts ( &file ); | 2484 | QTextStream ts ( &file ); |
2528 | ts.setCodec( QTextCodec::codecForName("utf8") ); | 2485 | ts.setCodec( QTextCodec::codecForName("utf8") ); |
2529 | qDebug("finish "); | ||
2530 | mSyncActionDialog->setCaption( i18n("Writing file to disk...") ); | 2486 | mSyncActionDialog->setCaption( i18n("Writing file to disk...") ); |
2531 | ts << piFileString; | 2487 | ts << piFileString; |
@@ -2582,4 +2538,5 @@ void KCommandSocket::writeFile( QString fileName ) | |||
2582 | connect( mSocket, SIGNAL(delayedCloseFinished ()), this, SLOT(deleteSocket()) ); | 2538 | connect( mSocket, SIGNAL(delayedCloseFinished ()), this, SLOT(deleteSocket()) ); |
2583 | } | 2539 | } |
2540 | mSocket->connectToHost( mHost, mPort ); | ||
2584 | QTextStream ts2( &file2 ); | 2541 | QTextStream ts2( &file2 ); |
2585 | ts2.setCodec( QTextCodec::codecForName("utf8") ); | 2542 | ts2.setCodec( QTextCodec::codecForName("utf8") ); |
@@ -2590,4 +2547,5 @@ void KCommandSocket::writeFile( QString fileName ) | |||
2590 | os2 << ts2.readLine() << "\n"; | 2547 | os2 << ts2.readLine() << "\n"; |
2591 | } | 2548 | } |
2549 | mRetVal= true; | ||
2592 | mSocket->close(); | 2550 | mSocket->close(); |
2593 | if ( mSocket->state() == QSocket::Idle ) | 2551 | if ( mSocket->state() == QSocket::Idle ) |
@@ -2602,4 +2560,5 @@ void KCommandSocket::sendStop() | |||
2602 | connect( mSocket, SIGNAL(delayedCloseFinished ()), this, SLOT(deleteSocket()) ); | 2560 | connect( mSocket, SIGNAL(delayedCloseFinished ()), this, SLOT(deleteSocket()) ); |
2603 | } | 2561 | } |
2562 | mSocket->connectToHost( mHost, mPort ); | ||
2604 | QTextStream os2( mSocket ); | 2563 | QTextStream os2( mSocket ); |
2605 | os2.setCodec( QTextCodec::codecForName("utf8") ); | 2564 | os2.setCodec( QTextCodec::codecForName("utf8") ); |
@@ -2624,14 +2583,14 @@ void KCommandSocket::startReadFileFromSocket() | |||
2624 | void KCommandSocket::readFileFromSocket() | 2583 | void KCommandSocket::readFileFromSocket() |
2625 | { | 2584 | { |
2626 | qDebug("readBackFileFromSocket() %d ", mTime.elapsed ()); | 2585 | //qDebug("readBackFileFromSocket() %d ", mTime.elapsed ()); |
2627 | while ( mSocket->canReadLine () ) { | 2586 | while ( mSocket->canReadLine () ) { |
2628 | mTime.restart(); | 2587 | mTime.restart(); |
2629 | QString line = mSocket->readLine (); | 2588 | QString line = mSocket->readLine (); |
2630 | mFileString += line; | 2589 | mFileString += line; |
2631 | qDebug("readline: %s ", line.latin1()); | 2590 | //qDebug("readline: %s ", line.latin1()); |
2632 | } | 2591 | } |
2633 | if ( mTime.elapsed () < 3000 ) { | 2592 | if ( mTime.elapsed () < 3000 ) { |
2634 | // wait for more | 2593 | // wait for more |
2635 | qDebug("waitformore "); | 2594 | //qDebug("waitformore "); |
2636 | QTimer::singleShot( 100, this , SLOT (readFileFromSocket( ) )); | 2595 | QTimer::singleShot( 100, this , SLOT (readFileFromSocket( ) )); |
2637 | return; | 2596 | return; |
@@ -2650,5 +2609,4 @@ void KCommandSocket::readFileFromSocket() | |||
2650 | QTextStream ts ( &file ); | 2609 | QTextStream ts ( &file ); |
2651 | ts.setCodec( QTextCodec::codecForName("utf8") ); | 2610 | ts.setCodec( QTextCodec::codecForName("utf8") ); |
2652 | qDebug("finish "); | ||
2653 | ts << mFileString; | 2611 | ts << mFileString; |
2654 | file.close(); | 2612 | file.close(); |
@@ -2669,5 +2627,5 @@ void KCommandSocket::deleteSocket() | |||
2669 | mRetVal = false; | 2627 | mRetVal = false; |
2670 | } | 2628 | } |
2671 | qDebug("KCommandSocket::deleteSocket() %d", mRetVal ); | 2629 | //qDebug("KCommandSocket::deleteSocket() %d", mRetVal ); |
2672 | if ( mSocket) | 2630 | if ( mSocket) |
2673 | delete mSocket; | 2631 | 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 | |||
148 | void syncSharp(); | 148 | void syncSharp(); |
149 | void syncPhone(); | 149 | void syncPhone(); |
150 | void syncPi(); | ||
150 | void syncLocalFile(); | 151 | void syncLocalFile(); |
151 | bool syncWithFile( QString, bool ); | 152 | bool syncWithFile( QString, bool ); |
@@ -176,5 +177,4 @@ class MainWindow : public QMainWindow | |||
176 | int mCurrentSyncProfile; | 177 | int mCurrentSyncProfile; |
177 | void enableQuick(); | 178 | void enableQuick(); |
178 | void performQuick(); | ||
179 | void performQuickQuick(); | 179 | void performQuickQuick(); |
180 | void syncRemote( KSyncProfile* , bool ask = true); | 180 | 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() | |||
191 | ++iii; | 191 | ++iii; |
192 | mIsLocal = new QRadioButton ( i18n("Local file"), gr ); | 192 | mIsLocal = new QRadioButton ( i18n("Local file"), gr ); |
193 | mIsPi = new QRadioButton ( i18n("Quick Pi-Sync"), gr ); | 193 | mIsPi = new QRadioButton ( i18n("Pi-Sync ( direct Kx/Pi to Kx/Pi sync )"), gr ); |
194 | connect (mIsPi, SIGNAL( toggled(bool)), this, SLOT (kindChanged(bool) ) ); | 194 | connect (mIsPi, SIGNAL( toggled(bool)), this, SLOT (kindChanged(bool) ) ); |
195 | mIsNotLocal = new QRadioButton ( i18n("Remote file (w down/upload command)"), gr ); | 195 | mIsNotLocal = new QRadioButton ( i18n("Remote file (w down/upload command)"), gr ); |
@@ -457,5 +457,6 @@ void KSyncPrefsDialog::profileChanged( int item ) | |||
457 | mIsLocal->setChecked(prof->getIsLocalFileSync()) ; | 457 | mIsLocal->setChecked(prof->getIsLocalFileSync()) ; |
458 | mIsPhone->setChecked(prof->getIsPhoneSync()) ; | 458 | mIsPhone->setChecked(prof->getIsPhoneSync()) ; |
459 | mIsNotLocal->setChecked(!prof->getIsLocalFileSync() && !prof->getIsPhoneSync() ); | 459 | mIsPi->setChecked(prof->getIsPiSync()) ; |
460 | mIsNotLocal->setChecked(!prof->getIsLocalFileSync() && !prof->getIsPhoneSync() &&!prof->getIsPiSync() ); | ||
460 | proGr->setEnabled( item > 2 ); | 461 | proGr->setEnabled( item > 2 ); |
461 | if ( item < 3 ) { | 462 | if ( item < 3 ) { |
@@ -578,4 +579,5 @@ void KSyncPrefsDialog::saveProfile() | |||
578 | prof->setIsLocalFileSync( mIsLocal->isChecked() ); | 579 | prof->setIsLocalFileSync( mIsLocal->isChecked() ); |
579 | prof->setIsPhoneSync( mIsPhone->isChecked() ); | 580 | prof->setIsPhoneSync( mIsPhone->isChecked() ); |
581 | prof->setIsPiSync( mIsPi->isChecked() ); | ||
580 | prof->setWriteBackFuture(mWriteBackFuture->isChecked()); | 582 | prof->setWriteBackFuture(mWriteBackFuture->isChecked()); |
581 | prof->setWriteBackFutureWeeks(mWriteBackFutureWeeks->value()); | 583 | prof->setWriteBackFutureWeeks(mWriteBackFutureWeeks->value()); |