Permalink
Browse files

Enable Connect button on keyboard events too

The Connect button is only enabled when a jam session is clicked in the
server browser.  This breaks accessibility (e.g. screen readers) because
some navigation and input methods do not use mouse clicks.  Keyboard
navigation should also enable the Connect button.

Signed-off-by: Stefan Hajnoczi <stefanha@gmail.com>
  • Loading branch information...
stefanha committed Jul 13, 2017
1 parent 44212a5 commit 812ddf8a196df63256082551f63d6a7cf183f5af
Showing with 15 additions and 9 deletions.
  1. +1 −1 qtclient/ConnectDialog.cpp
  2. +1 −1 qtclient/JammrConnectDialog.cpp
  3. +11 −5 qtclient/ServerBrowser.cpp
  4. +2 −2 qtclient/ServerBrowser.h
@@ -26,7 +26,7 @@ ConnectDialog::ConnectDialog(QNetworkAccessManager *netManager, QWidget *parent)
: QDialog(parent)
{
serverBrowser = new NINJAMServerBrowser(netManager, this);
connect(serverBrowser, SIGNAL(serverItemClicked(const QString &)),
connect(serverBrowser, SIGNAL(serverItemSelected(const QString &)),
this, SLOT(setHost(const QString &)));
connect(serverBrowser, SIGNAL(serverItemActivated(const QString &)),
this, SLOT(onServerSelected(const QString &)));
@@ -34,7 +34,7 @@ JammrConnectDialog::JammrConnectDialog(QNetworkAccessManager *netManager_,
upgradeUrl(upgradeUrl_), reply(NULL)
{
serverBrowser = new JammrServerBrowser(netManager, this);
connect(serverBrowser, SIGNAL(serverItemClicked(const QString &)),
connect(serverBrowser, SIGNAL(serverItemSelected(const QString &)),
this, SLOT(setHost(const QString &)));
connect(serverBrowser, SIGNAL(serverItemActivated(const QString &)),
this, SLOT(onServerSelected(const QString &)));
View
@@ -29,8 +29,8 @@ ServerBrowser::ServerBrowser(QNetworkAccessManager *manager_, QWidget *parent)
setItemsExpandable(false);
setColumnWidth(0, 200);
connect(this, SIGNAL(itemClicked(QTreeWidgetItem*,int)),
this, SLOT(onItemClicked(QTreeWidgetItem*,int)));
connect(this, SIGNAL(itemSelectionChanged()),
this, SLOT(onItemSelectionChanged()));
connect(this, SIGNAL(itemActivated(QTreeWidgetItem*,int)),
this, SLOT(onItemActivated(QTreeWidgetItem*,int)));
}
@@ -46,10 +46,16 @@ void ServerBrowser::loadServerList(const QUrl &url)
}
void ServerBrowser::onItemClicked(QTreeWidgetItem *item, int column)
void ServerBrowser::onItemSelectionChanged()
{
Q_UNUSED(column);
emit serverItemClicked(item->data(0, Qt::UserRole).toString());
QTreeWidgetItem *item = currentItem();
QString hostname;
if (item) {
hostname = item->data(0, Qt::UserRole).toString();
}
emit serverItemSelected(hostname);
}
void ServerBrowser::onItemActivated(QTreeWidgetItem *item, int column)
View
@@ -42,12 +42,12 @@ class ServerBrowser : public QTreeWidget
virtual void parseServerList(QTextStream *stream) = 0;
signals:
void serverItemClicked(const QString &hostname);
void serverItemSelected(const QString &hostname);
void serverItemActivated(const QString &hostname);
private slots:
void completeDownloadServerList();
void onItemClicked(QTreeWidgetItem *item, int column);
void onItemSelectionChanged();
void onItemActivated(QTreeWidgetItem *item, int column);
protected:

0 comments on commit 812ddf8

Please sign in to comment.