summaryrefslogtreecommitdiffabout
Side-by-side diff
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--korganizer/koprefs.cpp1
-rw-r--r--korganizer/koprefs.h1
-rw-r--r--korganizer/mainwindow.cpp36
-rw-r--r--korganizer/mainwindow.h1
4 files changed, 23 insertions, 16 deletions
diff --git a/korganizer/koprefs.cpp b/korganizer/koprefs.cpp
index e0623d5..c28da9a 100644
--- a/korganizer/koprefs.cpp
+++ b/korganizer/koprefs.cpp
@@ -193,2 +193,3 @@ KOPrefs::KOPrefs() :
addItemString("PassiveSyncPort",&mPassiveSyncPort,"9197" );
+ addItemString("PassiveSyncPw",&mPassiveSyncPw,"abc" );
addItemString("ActiveSyncPort",&mActiveSyncPort,"9197" );
diff --git a/korganizer/koprefs.h b/korganizer/koprefs.h
index 7abd741..d9ac851 100644
--- a/korganizer/koprefs.h
+++ b/korganizer/koprefs.h
@@ -281,2 +281,3 @@ class KOPrefs : public KPimPrefs
QString mPassiveSyncPort;
+ QString mPassiveSyncPw;
QString mActiveSyncPort;
diff --git a/korganizer/mainwindow.cpp b/korganizer/mainwindow.cpp
index 7b666d1..de94b8c 100644
--- a/korganizer/mainwindow.cpp
+++ b/korganizer/mainwindow.cpp
@@ -1894,4 +1894,2 @@ void MainWindow::enableQuick()
{
- QString passWordPiSync = "bhdrvmk";
- QString retfile = "";
QDialog dia ( this, "input-dialog", true );
@@ -1907,3 +1905,3 @@ void MainWindow::enableQuick()
QLineEdit lepw ( &dia );
- lepw.setText( "abc" );
+ lepw.setText( KOPrefs::instance()->mPassiveSyncPw );
QLabel label2 ( i18n("Password to enable\naccess from remote:"), &dia );
@@ -1917,13 +1915,10 @@ void MainWindow::enableQuick()
dia.show();
- int res = dia.exec();
- if ( res )
- retfile = lab.text();
- else
+ if ( ! dia.exec() )
return;
dia.hide();
- passWordPiSync = lepw.text();
qApp->processEvents();
- KOPrefs::instance()->mPassiveSyncPort = retfile;
+ KOPrefs::instance()->mPassiveSyncPw = lepw.text();
+ KOPrefs::instance()->mPassiveSyncPort = lab.text();
bool ok;
- Q_UINT16 port = retfile.toUInt(&ok);
+ Q_UINT16 port = KOPrefs::instance()->mPassiveSyncPort.toUInt(&ok);
if ( ! ok ) {
@@ -1933,3 +1928,3 @@ void MainWindow::enableQuick()
//qDebug("port %d ", port);
- mServerSocket = new KServerSocket ( passWordPiSync, port ,1 );
+ mServerSocket = new KServerSocket ( KOPrefs::instance()->mPassiveSyncPw, port ,1 );
mServerSocket->setFileName( defaultFileName() );
@@ -1937,3 +1932,3 @@ void MainWindow::enableQuick()
if ( !mServerSocket->ok() ) {
- qWarning("Failed to bind to port %d", port);
+ KMessageBox::information( this, i18n("Failed to bind or\nlisten to the port!"));
delete mServerSocket;
@@ -2196,2 +2191,3 @@ KServerSocket:: KServerSocket ( QString pw, Q_UINT16 port, int backlog, QObject
mSyncActionDialog = 0;
+ blockRC = false;
};
@@ -2223,2 +2219,4 @@ void KServerSocket::readClient()
{
+ if ( blockRC )
+ return;
if ( mSocket == 0 ) {
@@ -2227,5 +2225,7 @@ void KServerSocket::readClient()
}
- //qDebug("KServerSocket readClient()");
+ qDebug("KServerSocket readClient()");
if ( mSocket->canReadLine() ) {
- QStringList tokens = QStringList::split( QRegExp("[ \r\n][ \r\n]*"), mSocket->readLine() );
+ QString line = mSocket->readLine();
+ qDebug("KServerSocket readline: %s ", line.latin1());
+ QStringList tokens = QStringList::split( QRegExp("[ \r\n][ \r\n]*"), line );
if ( tokens[0] == "GET" ) {
@@ -2240,5 +2240,7 @@ void KServerSocket::readClient()
if ( tokens[0] == "PUT" ) {
- if ( tokens[1] == mPassWord )
+ if ( tokens[1] == mPassWord ) {
//emit getFile( mSocket );
+ blockRC = true;
get_file();
+ }
else {
@@ -2266,3 +2268,3 @@ void KServerSocket::send_file()
mSyncActionDialog->setCaption(i18n("Received sync request"));
- QLabel* label = new QLabel( i18n("Synchronizing...\nDo not use this application!\n\nIf syncing fails you can close this dialog."), mSyncActionDialog );
+ QLabel* label = new QLabel( i18n("Synchronizing from remote ...\n\nDo not use this application!\n\nIf syncing fails\nyou can close this dialog."), mSyncActionDialog );
QVBoxLayout* lay = new QVBoxLayout( mSyncActionDialog );
@@ -2339,2 +2341,3 @@ void KServerSocket::readBackFileFromSocket()
emit file_received( false );
+ blockRC = false;
return ;
@@ -2355,2 +2358,3 @@ void KServerSocket::readBackFileFromSocket()
piFileString = "";
+ blockRC = false;
emit file_received( true );
diff --git a/korganizer/mainwindow.h b/korganizer/mainwindow.h
index ba627b9..7b24b88 100644
--- a/korganizer/mainwindow.h
+++ b/korganizer/mainwindow.h
@@ -49,2 +49,3 @@ private slots:
private :
+ bool blockRC;
void send_file();