X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=blobdiff_plain;f=src%2Fqtui%2Fcoresessionwidget.cpp;h=97993f4f5c18701be0355257a18bf0307f6e9f36;hp=68adfe5afea20fa3403ea5a41f8cb021ae3a96ab;hb=911f181e0e179eb51279c0880eb701a43163b8b5;hpb=68878dc8366f2f4a0afe132847aad9a51a80cdbf diff --git a/src/qtui/coresessionwidget.cpp b/src/qtui/coresessionwidget.cpp index 68adfe5a..97993f4f 100644 --- a/src/qtui/coresessionwidget.cpp +++ b/src/qtui/coresessionwidget.cpp @@ -45,7 +45,25 @@ void CoreSessionWidget::setData(QMap map) ui.labelSecure->setText(map["secure"].toBool() ? tr("Yes") : tr("No")); auto features = Quassel::Features{map["featureList"].toStringList(), static_cast(map["features"].toUInt())}; - ui.disconnectButton->setVisible(features.isEnabled(Quassel::Feature::RemoteDisconnect)); + if (features.isEnabled(Quassel::Feature::RemoteDisconnect)) { + // Both client and core support it, enable the button + ui.disconnectButton->setEnabled(true); + ui.disconnectButton->setToolTip(tr("End the client's session, disconnecting it")); + } else { + // For any active sessions to be displayed, the core must support this feature. We can + // assume the client doesn't support being remotely disconnected. + // + // (During the development of 0.13, there was a period of time where active sessions existed + // but did not provide the disconnect option. We can overlook this.) + + // Either core or client doesn't support it, disable the option + ui.disconnectButton->setEnabled(false); + // Assuming the client lacks support, set the tooltip accordingly + ui.disconnectButton->setToolTip( + QString("

%1

%2

").arg( + tr("End the client's session, disconnecting it"), + tr("This client does not support being remotely disconnected"))); + } bool success = false; _peerId = map["id"].toInt(&success); @@ -54,5 +72,10 @@ void CoreSessionWidget::setData(QMap map) void CoreSessionWidget::disconnectClicked() { + // Don't allow the End Session button to be spammed; Quassel's protocol isn't lossy and it + // should reach the destination eventually... + ui.disconnectButton->setEnabled(false); + ui.disconnectButton->setText(tr("Ending session...")); + emit disconnectClicked(_peerId); }