Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit bb67bc0

Browse files
committedAug 19, 2024·
[a11y] Move server URL from status label to Account button
The URL in the status label of the account settings page was not always accessible by keyboard. The label will now only show the connection status, and the "Manage Account" button has a new entry for "Open in Web Browser".
1 parent 382861e commit bb67bc0

File tree

2 files changed

+23
-39
lines changed

2 files changed

+23
-39
lines changed
 

‎src/gui/accountsettings.cpp

+18-19
Original file line numberDiff line numberDiff line change
@@ -96,20 +96,21 @@ AccountSettings::AccountSettings(const AccountStatePtr &accountState, QWidget *p
9696
});
9797
}
9898

99-
ui->connectLabel->clear();
99+
ui->connectionStatusLabel->clear();
100100

101101
connect(_accountState.data(), &AccountState::stateChanged, this, &AccountSettings::slotAccountStateChanged);
102102
slotAccountStateChanged();
103103

104-
connect(ui->accountToolButton, &QToolButton::clicked, this, [this] {
104+
connect(ui->manageAccountButton, &QToolButton::clicked, this, [this] {
105105
QMenu *menu = new QMenu(this);
106106
menu->setAttribute(Qt::WA_DeleteOnClose);
107107
menu->setAccessibleName(tr("Account options menu"));
108108
menu->addAction(_accountState->isSignedOut() ? tr("Log in") : tr("Log out"), this, &AccountSettings::slotToggleSignInState);
109109
auto *reconnectAction = menu->addAction(tr("Reconnect"), this, [this] { _accountState->checkConnectivity(true); });
110110
reconnectAction->setEnabled(!_accountState->isConnected() && !_accountState->isSignedOut());
111+
menu->addAction(CommonStrings::showInWebBrowser(), this, [this] { QDesktopServices::openUrl(_accountState->account()->url()); });
111112
menu->addAction(tr("Remove"), this, &AccountSettings::slotDeleteAccount);
112-
menu->popup(mapToGlobal(ui->accountToolButton->pos()));
113+
menu->popup(mapToGlobal(ui->manageAccountButton->pos()));
113114

114115
// set the focus for accessability
115116
menu->setFocus();
@@ -125,7 +126,7 @@ AccountSettings::AccountSettings(const AccountStatePtr &accountState, QWidget *p
125126
}
126127
});
127128
connect(ui->stackedWidget, &QStackedWidget::currentChanged, this,
128-
[this] { ui->accountToolButton->setEnabled(ui->stackedWidget->currentWidget() == ui->quickWidget); });
129+
[this] { ui->manageAccountButton->setEnabled(ui->stackedWidget->currentWidget() == ui->quickWidget); });
129130
ui->stackedWidget->setCurrentWidget(ui->quickWidget);
130131
}
131132

@@ -357,14 +358,14 @@ void AccountSettings::slotDisableVfsCurrentFolder(Folder *folder)
357358
void AccountSettings::showConnectionLabel(const QString &message, QStringList errors)
358359
{
359360
if (errors.isEmpty()) {
360-
ui->connectLabel->setText(message);
361-
ui->connectLabel->setToolTip(QString());
361+
ui->connectionStatusLabel->setText(message);
362+
ui->connectionStatusLabel->setToolTip(QString());
362363
} else {
363364
errors.prepend(message);
364365
const QString msg = errors.join(QLatin1String("\n"));
365366
qCDebug(lcAccountSettings) << msg;
366-
ui->connectLabel->setText(msg);
367-
ui->connectLabel->setToolTip(QString());
367+
ui->connectionStatusLabel->setText(msg);
368+
ui->connectionStatusLabel->setToolTip(QString());
368369
}
369370
ui->accountStatus->setVisible(!message.isEmpty());
370371
ui->warningLabel->setVisible(!errors.isEmpty());
@@ -471,42 +472,40 @@ void AccountSettings::slotAccountStateChanged()
471472

472473
switch (state) {
473474
case AccountState::PausedDueToMetered:
474-
showConnectionLabel(tr("Sync to %1 is paused due to metered internet connection.").arg(server));
475+
showConnectionLabel(tr("Sync is paused due to metered internet connection"));
475476
break;
476477
case AccountState::Connected: {
477478
QStringList errors;
478479
if (account->serverSupportLevel() != Account::ServerSupportLevel::Supported) {
479480
errors << tr("The server version %1 is unsupported! Proceed at your own risk.").arg(account->capabilities().status().versionString());
480481
}
481-
showConnectionLabel(tr("Connected to %1.").arg(server), errors);
482+
showConnectionLabel(tr("Connected"), errors);
482483
break;
483484
}
484485
case AccountState::ServiceUnavailable:
485-
showConnectionLabel(tr("Server %1 is temporarily unavailable.").arg(server));
486+
showConnectionLabel(tr("Server is temporarily unavailable"));
486487
break;
487488
case AccountState::MaintenanceMode:
488-
showConnectionLabel(tr("Server %1 is currently in maintenance mode.").arg(server));
489+
showConnectionLabel(tr("Server is currently in maintenance mode"));
489490
break;
490491
case AccountState::SignedOut:
491-
showConnectionLabel(tr("Signed out from %1.").arg(server));
492+
showConnectionLabel(tr("Signed out"));
492493
break;
493494
case AccountState::AskingCredentials: {
494-
showConnectionLabel(tr("Updating credentials for %1...").arg(server));
495+
showConnectionLabel(tr("Updating credentials..."));
495496
break;
496497
}
497498
case AccountState::Connecting:
498-
showConnectionLabel(tr("Connecting to: %1.").arg(server));
499+
showConnectionLabel(tr("Connecting..."));
499500
break;
500501
case AccountState::ConfigurationError:
501-
showConnectionLabel(tr("Server configuration error: %1.")
502-
.arg(server),
503-
_accountState->connectionErrors());
502+
showConnectionLabel(tr("Server configuration error"), _accountState->connectionErrors());
504503
break;
505504
case AccountState::NetworkError:
506505
// don't display the error to the user, https://github.com/owncloud/client/issues/9790
507506
[[fallthrough]];
508507
case AccountState::Disconnected:
509-
showConnectionLabel(tr("Disconnected from: %1.").arg(server));
508+
showConnectionLabel(tr("Disconnected"));
510509
break;
511510
}
512511
}

‎src/gui/accountsettings.ui

+5-20
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@
4444
<string/>
4545
</property>
4646
<property name="textFormat">
47-
<enum>Qt::TextFormat::AutoText</enum>
47+
<enum>Qt::PlainText</enum>
4848
</property>
4949
<property name="pixmap">
5050
<pixmap resource="../resources/client.qrc">:/client/resources/light/warning.svg</pixmap>
@@ -55,32 +55,26 @@
5555
</widget>
5656
</item>
5757
<item>
58-
<widget class="QLabel" name="connectLabel">
58+
<widget class="QLabel" name="connectionStatusLabel">
5959
<property name="sizePolicy">
6060
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred">
6161
<horstretch>0</horstretch>
6262
<verstretch>0</verstretch>
6363
</sizepolicy>
6464
</property>
6565
<property name="text">
66-
<string>Connected with &lt;server&gt; as &lt;user&gt;</string>
66+
<string notr="true">Connection Status</string>
6767
</property>
6868
<property name="textFormat">
69-
<enum>Qt::TextFormat::RichText</enum>
69+
<enum>Qt::PlainText</enum>
7070
</property>
7171
<property name="wordWrap">
7272
<bool>true</bool>
7373
</property>
74-
<property name="openExternalLinks">
75-
<bool>true</bool>
76-
</property>
77-
<property name="textInteractionFlags">
78-
<set>Qt::TextBrowserInteraction</set>
79-
</property>
8074
</widget>
8175
</item>
8276
<item>
83-
<widget class="QToolButton" name="accountToolButton">
77+
<widget class="QToolButton" name="manageAccountButton">
8478
<property name="text">
8579
<string>Manage Account</string>
8680
</property>
@@ -104,9 +98,6 @@
10498
<layout class="QVBoxLayout" name="verticalLayout_4">
10599
<item>
106100
<spacer name="verticalSpacer_2">
107-
<property name="orientation">
108-
<enum>Qt::Orientation::Vertical</enum>
109-
</property>
110101
<property name="sizeHint" stdset="0">
111102
<size>
112103
<width>20</width>
@@ -120,9 +111,6 @@
120111
<property name="text">
121112
<string>Preparing the account</string>
122113
</property>
123-
<property name="alignment">
124-
<set>Qt::AlignmentFlag::AlignCenter</set>
125-
</property>
126114
</widget>
127115
</item>
128116
<item>
@@ -134,9 +122,6 @@
134122
</item>
135123
<item>
136124
<spacer name="verticalSpacer_3">
137-
<property name="orientation">
138-
<enum>Qt::Orientation::Vertical</enum>
139-
</property>
140125
<property name="sizeHint" stdset="0">
141126
<size>
142127
<width>20</width>

0 commit comments

Comments
 (0)