Unverified Commit 30a8a59a authored by Yichao Yu's avatar Yichao Yu
Browse files

Signal the main window about vnc disconnection

Summary:
When the client is quitted and have stopped trying to reconnect.

Previously, a failed connection will leave the main window in a "connected" state
and require manually pressing the "Disconnect" button before a new connection can be made.

Use of the `disconnected` signal copied from the RDP backend, which handles this correctly.

Test Plan: Tested behavior on 20.04 branch. Tested compilation also on master.

Reviewers: davidedmundson, uwolfer, ahmadsamir, murrant, cfeck

Reviewed By: uwolfer

Differential Revision: https://phabricator.kde.org/D29822
parent 35430818
......@@ -162,6 +162,11 @@ void VncView::updateConfiguration()
void VncView::startQuitting()
{
// Already quitted. No need to clean up again and also avoid triggering
// `disconnected` signal below.
if (m_quitFlag)
return;
qCDebug(KRDC) << "about to quit";
setStatus(Disconnecting);
......@@ -197,6 +202,10 @@ void VncView::startQuitting()
qCDebug(KRDC) << "Quit VNC thread success:" << quitSuccess;
// emit the disconnect siginal only after all the events are handled.
// Otherwise some error messages might be thrown away without
// showing to the user.
emit disconnected();
setStatus(Disconnected);
}
......@@ -207,6 +216,11 @@ bool VncView::isQuitting()
bool VncView::start()
{
// This flag is used to make sure `startQuitting` only run once.
// This should not matter for now but it is an easy way to make sure
// things works in case the object may get reused.
m_quitFlag = false;
QString vncHost = m_host;
int vncPort = m_port;
#ifdef LIBSSH_FOUND
......
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