Commit b0dbdb96 authored by Urs Wolfer's avatar Urs Wolfer

* constructor taking QObject parent for consistency

* do not show password dialog again if it has been canceled

svn path=/trunk/KDE/kdenetwork/krdc/; revision=807442
parent a49ac7e6
......@@ -157,7 +157,8 @@ void VncClientThread::outputHandler(const char *format, ...)
outputErrorMessageString = i18n("VNC server closed connection.");
}
VncClientThread::VncClientThread()
VncClientThread::VncClientThread(QObject *parent)
: QThread(parent)
{
QMutexLocker locker(&mutex);
m_stopped = false;
......
......@@ -97,7 +97,7 @@ class VncClientThread: public QThread
Q_OBJECT
public:
explicit VncClientThread();
explicit VncClientThread(QObject *parent = 0);
~VncClientThread();
const QImage image(int x = 0, int y = 0, int w = 0, int h = 0);
void setImage(const QImage &img);
......
......@@ -46,6 +46,7 @@ VncView::VncView(QWidget *parent, const KUrl &url)
m_repaint(false),
m_quitFlag(false),
m_firstPasswordTry(true),
m_authenticaionCanceled(false),
m_dontSendClipboard(false),
m_horizontalFactor(1.0),
m_verticalFactor(1.0)
......@@ -165,6 +166,11 @@ void VncView::requestPassword()
{
kDebug(5011) << "request password";
if (m_authenticaionCanceled) {
startQuitting();
return;
}
setStatus(Authenticating);
#ifndef QTONLY
......@@ -184,11 +190,16 @@ void VncView::requestPassword()
}
#ifdef QTONLY
bool ok;
QString password = QInputDialog::getText(this, //krazy:exclude=qclasses
tr("Password required"),
tr("Please enter the password for the remote desktop:"),
QLineEdit::Password);
vncThread.setPassword(password);
QLineEdit::Password, QString(), &ok);
m_firstPasswordTry = false;
if (ok)
vncThread.setPassword(password);
else
m_authenticaionCanceled = true;
#else
KPasswordDialog dialog(this);
dialog.setPixmap(KIcon("dialog-password").pixmap(48));
......@@ -197,6 +208,9 @@ void VncView::requestPassword()
if (dialog.exec() == KPasswordDialog::Accepted) {
m_firstPasswordTry = false;
vncThread.setPassword(dialog.password());
} else {
kDebug(5011) << "password dialog not accepted";
m_authenticaionCanceled = true;
}
#endif
}
......
......@@ -83,6 +83,7 @@ private:
bool m_repaint;
bool m_quitFlag;
bool m_firstPasswordTry;
bool m_authenticaionCanceled;
bool m_dontSendClipboard;
qreal m_horizontalFactor;
qreal m_verticalFactor;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment