summaryrefslogtreecommitdiffabout
path: root/libkdepim/ksyncmanager.cpp
Side-by-side diff
Diffstat (limited to 'libkdepim/ksyncmanager.cpp') (more/less context) (show whitespace changes)
-rw-r--r--libkdepim/ksyncmanager.cpp24
1 files changed, 23 insertions, 1 deletions
diff --git a/libkdepim/ksyncmanager.cpp b/libkdepim/ksyncmanager.cpp
index 08a263c..5214fe7 100644
--- a/libkdepim/ksyncmanager.cpp
+++ b/libkdepim/ksyncmanager.cpp
@@ -1071,5 +1071,8 @@ void KSyncManager::deleteCommandSocket(KCommandSocket*s, int state)
{
//enum { success, errorW, errorR, quiet };
- if ( state == KCommandSocket::errorR ||state == KCommandSocket::errorTO ) {
+ if ( state == KCommandSocket::errorR ||state == KCommandSocket::errorTO ||state == KCommandSocket::errorPW ) {
+ if ( state == KCommandSocket::errorPW )
+ mParent->topLevelWidget()->setCaption( i18n("Wrong password: Receiving remote file failed.") );
+ else
mParent->topLevelWidget()->setCaption( i18n("ERROR: Receiving remote file failed.") );
delete s;
@@ -1202,4 +1205,13 @@ void KServerSocket::readClient()
}
}
+void KServerSocket::error_connect()
+{
+ QTextStream os( mSocket );
+ os.setEncoding( QTextStream::Latin1 );
+ os << "ERROR_PW\r\n\r\n";
+ mSocket->close();
+ if ( mSocket->state() == QSocket::Idle )
+ QTimer::singleShot( 10, this , SLOT ( discardClient()));
+}
void KServerSocket::end_connect()
{
@@ -1352,4 +1364,5 @@ KCommandSocket::KCommandSocket ( QString password, Q_UINT16 port, QString host,
mSocket = 0;
mFirst = false;
+ mFirstLine = true;
mPort = port;
mHost = host;
@@ -1449,4 +1462,5 @@ void KCommandSocket::startReadFileFromSocket()
mFileString = "";
mTime.start();
+ mFirstLine = true;
QTimer::singleShot( 1, this , SLOT (readFileFromSocket( ) ));
@@ -1458,4 +1472,12 @@ void KCommandSocket::readFileFromSocket()
mTime.restart();
QString line = mSocket->readLine ();
+ if ( mFirstLine ) {
+ mFirstLine = false;
+ if ( line.left( 8 ) == "ERROR_PW" ) {
+ mRetVal = errorPW;
+ deleteSocket();
+ return ;
+ }
+ }
mFileString += line;
//qDebug("readline: %s ", line.latin1());