X-Git-Url: https://git.quassel-irc.org/?a=blobdiff_plain;f=src%2Fqtui%2Fcoresessionwidget.cpp;h=29f323e1afd78bc6806dd0baa1e7bb3e6af96194;hb=92fc8c5b119111a35ab8423c3cbde5b2a022badf;hp=d31122db21db2f2177ca0b96f808fb55d229cb69;hpb=7fe7ca0631d2e8327351806947a1e030eb203cf7;p=quassel.git diff --git a/src/qtui/coresessionwidget.cpp b/src/qtui/coresessionwidget.cpp index d31122db..29f323e1 100644 --- a/src/qtui/coresessionwidget.cpp +++ b/src/qtui/coresessionwidget.cpp @@ -22,6 +22,7 @@ #include "client.h" #include "coresessionwidget.h" +#include "util.h" CoreSessionWidget::CoreSessionWidget(QWidget *parent) @@ -36,8 +37,15 @@ void CoreSessionWidget::setData(QMap map) ui.sessionGroup->setTitle(map["remoteAddress"].toString()); ui.labelLocation->setText(map["location"].toString()); ui.labelClient->setText(map["clientVersion"].toString()); - ui.labelVersionDate->setText(map["clientVersionDate"].toString()); - ui.labelUptime->setText(map["connectedSince"].toDateTime().toLocalTime().toString(Qt::DateFormat::SystemLocaleShortDate)); + if (map["clientVersionDate"].toString().isEmpty()) { + ui.labelVersionDate->setText(QString("%1").arg(tr("Unknown date"))); + } + else { + ui.labelVersionDate->setText(tryFormatUnixEpoch(map["clientVersionDate"].toString(), + Qt::DateFormat::DefaultLocaleShortDate)); + } + ui.labelUptime->setText(map["connectedSince"].toDateTime() + .toLocalTime().toString(Qt::DateFormat::DefaultLocaleShortDate)); if (map["location"].toString().isEmpty()) { ui.labelLocation->hide(); ui.labelLocationTitle->hide(); @@ -50,28 +58,19 @@ void CoreSessionWidget::setData(QMap map) 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); - if (!Client::isCoreFeatureEnabled(Quassel::Feature::RemoteDisconnect)) { - // Until RemoteDisconnect was implemented, the Quassel core didn't forward client - // features. A client might support features and we'll never hear about it. - // This check shouldn't be necessary for later features if the core supports at least - // RemoteDisconnect. - - // Core doesn't support this feature (we don't know about the client) - ui.disconnectButton->setToolTip( - QString("

%1

%2
%3

").arg( - tr("End the client's session, disconnecting it"), - tr("Your Quassel core does not support this feature"), - tr("You need a Quassel core v0.13.0 or newer in order to end connected " - "sessions."))); - } else { - // Client doesn't support this feature - ui.disconnectButton->setToolTip( - QString("

%1

%2

").arg( - tr("End the client's session, disconnecting it"), - tr("This client does not support being remotely disconnected"))); - } + // 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;