summaryrefslogtreecommitdiffabout
authorzautrix <zautrix>2004-10-04 22:10:20 (UTC)
committer zautrix <zautrix>2004-10-04 22:10:20 (UTC)
commitc22811d11414872fc0525350a8a1afdae61be346 (patch) (side-by-side diff)
treedaafa0c4333022d44dafb2945ba36ff58d5c45d1
parentf53ef630b9299ceae666e64da8ce022813795ed6 (diff)
downloadkdepimpi-c22811d11414872fc0525350a8a1afdae61be346.zip
kdepimpi-c22811d11414872fc0525350a8a1afdae61be346.tar.gz
kdepimpi-c22811d11414872fc0525350a8a1afdae61be346.tar.bz2
many sync fixes
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--korganizer/mainwindow.cpp94
-rw-r--r--korganizer/mainwindow.h2
-rw-r--r--libkdepim/ksyncprefsdialog.cpp6
3 files changed, 31 insertions, 71 deletions
diff --git a/korganizer/mainwindow.cpp b/korganizer/mainwindow.cpp
index bce2a54..fe7e6d3 100644
--- a/korganizer/mainwindow.cpp
+++ b/korganizer/mainwindow.cpp
@@ -874,5 +874,2 @@ 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 );
@@ -954,2 +951,7 @@ int MainWindow::ringSync()
syncPhone();
+ } else if ( temp->getIsPiSync() ) {
+ mPassWordPiSync = temp->getRemotePw();
+ KOPrefs::instance()->mActiveSyncPort = temp->getRemotePort();
+ KOPrefs::instance()->mActiveSyncIP = temp->getRemoteIP();
+ syncPi();
} else
@@ -1038,10 +1040,2 @@ void MainWindow::slotSyncMenu( int action )
}
- if ( action == 4 ) {
- performQuick();
- return;
- }
- if ( action == 5 ) {
- performQuickQuick();
- return;
- }
@@ -1084,2 +1078,7 @@ void MainWindow::slotSyncMenu( int action )
syncPhone();
+ } else if ( temp->getIsPiSync() ) {
+ mPassWordPiSync = temp->getRemotePw();
+ KOPrefs::instance()->mActiveSyncPort = temp->getRemotePort();
+ KOPrefs::instance()->mActiveSyncIP = temp->getRemoteIP();
+ syncPi();
} else
@@ -1957,43 +1956,4 @@ 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();
@@ -2379,3 +2339,3 @@ void KServerSocket::newConnection ( int socket )
{
- qDebug("KServerSocket:New connection %d ", socket);
+ // qDebug("KServerSocket:New connection %d ", socket);
if ( mSocket ) {
@@ -2393,5 +2353,4 @@ void KServerSocket::discardClient()
{
- qDebug(" KServerSocket::discardClient()");
+ //qDebug(" KServerSocket::discardClient()");
if ( mSocket ) {
- qDebug("delete ");
delete mSocket;
@@ -2407,6 +2366,5 @@ void KServerSocket::readClient()
}
- 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" ) {
@@ -2442,3 +2400,3 @@ void KServerSocket::send_file()
{
- qDebug("MainWindow::sendFile(QSocket* s) ");
+ //qDebug("MainWindow::sendFile(QSocket* s) ");
if ( mSyncActionDialog )
@@ -2480,4 +2438,3 @@ void KServerSocket::send_file()
file.close();
- mSyncActionDialog->setCaption( i18n("Waiting to get back synced file") );
- qDebug("file sent ");
+ mSyncActionDialog->setCaption( i18n("Waiting for synced file...") );
mSocket->close();
@@ -2498,3 +2455,3 @@ void KServerSocket::readBackFileFromSocket()
{
- qDebug("readBackFileFromSocket() %d ", piTime.elapsed ());
+ //qDebug("readBackFileFromSocket() %d ", piTime.elapsed ());
while ( mSocket->canReadLine () ) {
@@ -2503,3 +2460,3 @@ void KServerSocket::readBackFileFromSocket()
piFileString += line;
- qDebug("readline: %s ", line.latin1());
+ //qDebug("readline: %s ", line.latin1());
mSyncActionDialog->setCaption( i18n("Received %1 bytes").arg( piFileString.length() ) );
@@ -2509,3 +2466,3 @@ void KServerSocket::readBackFileFromSocket()
// wait for more
- qDebug("waitformore ");
+ //qDebug("waitformore ");
QTimer::singleShot( 100, this , SLOT (readBackFileFromSocket( ) ));
@@ -2528,3 +2485,2 @@ void KServerSocket::readBackFileFromSocket()
ts.setCodec( QTextCodec::codecForName("utf8") );
- qDebug("finish ");
mSyncActionDialog->setCaption( i18n("Writing file to disk...") );
@@ -2583,2 +2539,3 @@ void KCommandSocket::writeFile( QString fileName )
}
+ mSocket->connectToHost( mHost, mPort );
QTextStream ts2( &file2 );
@@ -2591,2 +2548,3 @@ void KCommandSocket::writeFile( QString fileName )
}
+ mRetVal= true;
mSocket->close();
@@ -2603,2 +2561,3 @@ void KCommandSocket::sendStop()
}
+ mSocket->connectToHost( mHost, mPort );
QTextStream os2( mSocket );
@@ -2625,3 +2584,3 @@ void KCommandSocket::readFileFromSocket()
{
- qDebug("readBackFileFromSocket() %d ", mTime.elapsed ());
+ //qDebug("readBackFileFromSocket() %d ", mTime.elapsed ());
while ( mSocket->canReadLine () ) {
@@ -2630,3 +2589,3 @@ void KCommandSocket::readFileFromSocket()
mFileString += line;
- qDebug("readline: %s ", line.latin1());
+ //qDebug("readline: %s ", line.latin1());
}
@@ -2634,3 +2593,3 @@ void KCommandSocket::readFileFromSocket()
// wait for more
- qDebug("waitformore ");
+ //qDebug("waitformore ");
QTimer::singleShot( 100, this , SLOT (readFileFromSocket( ) ));
@@ -2651,3 +2610,2 @@ void KCommandSocket::readFileFromSocket()
ts.setCodec( QTextCodec::codecForName("utf8") );
- qDebug("finish ");
ts << mFileString;
@@ -2670,3 +2628,3 @@ void KCommandSocket::deleteSocket()
}
- qDebug("KCommandSocket::deleteSocket() %d", mRetVal );
+ //qDebug("KCommandSocket::deleteSocket() %d", mRetVal );
if ( mSocket)
diff --git a/korganizer/mainwindow.h b/korganizer/mainwindow.h
index 5a67765..f8b2334 100644
--- a/korganizer/mainwindow.h
+++ b/korganizer/mainwindow.h
@@ -149,2 +149,3 @@ class MainWindow : public QMainWindow
void syncPhone();
+ void syncPi();
void syncLocalFile();
@@ -177,3 +178,2 @@ class MainWindow : public QMainWindow
void enableQuick();
- void performQuick();
void performQuickQuick();
diff --git a/libkdepim/ksyncprefsdialog.cpp b/libkdepim/ksyncprefsdialog.cpp
index f05c846..0caa27e 100644
--- a/libkdepim/ksyncprefsdialog.cpp
+++ b/libkdepim/ksyncprefsdialog.cpp
@@ -192,3 +192,3 @@ void KSyncPrefsDialog::setupSyncAlgTab()
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) ) );
@@ -458,3 +458,4 @@ void KSyncPrefsDialog::profileChanged( int item )
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 );
@@ -579,2 +580,3 @@ void KSyncPrefsDialog::saveProfile()
prof->setIsPhoneSync( mIsPhone->isChecked() );
+ prof->setIsPiSync( mIsPi->isChecked() );
prof->setWriteBackFuture(mWriteBackFuture->isChecked());