diff options
author | Tobias Markmann <tm@ayena.de> | 2015-05-20 22:15:32 (GMT) |
---|---|---|
committer | Tobias Markmann <tm@ayena.de> | 2015-05-20 22:20:00 (GMT) |
commit | d1823afd38df62887b0c5e9f1f01a50ab84f77ba (patch) | |
tree | 9c79c6474d5b54b7d89fc72008599e886fd46476 /Swift/QtUI/QtJoinMUCWindow.cpp | |
parent | 79af3d5aed669839a916f8973953b608e4177e9b (diff) | |
download | swift-d1823afd38df62887b0c5e9f1f01a50ab84f77ba.zip swift-d1823afd38df62887b0c5e9f1f01a50ab84f77ba.tar.bz2 |
Usability improvements to "Enter Room" dialog
Require valid room JID to proceed with entering a room.
Provide user feedback via tooltips on invalid input in the room and
nickname field.
Test-Information:
Tested with invalid room JID and empty nickanme on OS X 10.9.5
and Qt 5.4.0.
Change-Id: I8d8c75f5712f27cc72cce2d6dd16dbbea4fb504a
Diffstat (limited to 'Swift/QtUI/QtJoinMUCWindow.cpp')
-rw-r--r-- | Swift/QtUI/QtJoinMUCWindow.cpp | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/Swift/QtUI/QtJoinMUCWindow.cpp b/Swift/QtUI/QtJoinMUCWindow.cpp index d111756..53944da 100644 --- a/Swift/QtUI/QtJoinMUCWindow.cpp +++ b/Swift/QtUI/QtJoinMUCWindow.cpp @@ -1,17 +1,18 @@ /* * Copyright (c) 2010-2015 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ - #include <Swift/QtUI/QtJoinMUCWindow.h> #include <boost/smart_ptr/make_shared.hpp> +#include <QToolTip> + #include <Swift/Controllers/UIEvents/JoinMUCUIEvent.h> #include <Swift/Controllers/UIEvents/UIEventStream.h> namespace Swift { @@ -29,21 +30,22 @@ QtJoinMUCWindow::QtJoinMUCWindow(UIEventStream* uiEventStream) : uiEventStream(u // the placeholder when a widget is focused for some reason. // Tracked upstream as QTBUG-33237 and fixed with Qt 5.2.0. ui.nickName->setFocus(); #endif ui.instantRoom->setChecked(true); ui.nickName->setValidator(new NickValidator(this)); + ui.room->setValidator(new RoomJIDValidator(this)); } void QtJoinMUCWindow::handleJoin() { - if (ui.room->text().isEmpty()) { - // TODO: Error + if (ui.room->text().isEmpty() || !ui.room->hasAcceptableInput()) { + QToolTip::showText(ui.room->mapToGlobal(QPoint()), tr("Please enter a valid room address."), ui.room); return; } - if (ui.nickName->text().isEmpty()) { - // TODO: Error + if (ui.nickName->text().isEmpty() || !ui.nickName->hasAcceptableInput()) { + QToolTip::showText(ui.nickName->mapToGlobal(QPoint()), tr("Please enter a valid nickname."), ui.nickName); return; } lastSetNick = Q2PSTRING(ui.nickName->text()); std::string password = Q2PSTRING(ui.password->text()); JID room(Q2PSTRING(ui.room->text())); |