diff options
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())); |