summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKevin Smith <git@kismith.co.uk>2012-03-05 18:00:34 (GMT)
committerKevin Smith <git@kismith.co.uk>2012-03-05 18:17:49 (GMT)
commit651f10eee7bce78b95b61061b9aef6bb4ab81841 (patch)
treedbc10b7f2bbe90a07e6eb1bf15d17a5edc6843e9 /Swift/QtUI/QtJoinMUCWindow.cpp
parente1602cbe8c5fb1525bc66ecf5d7a939816f259c5 (diff)
downloadswift-contrib-651f10eee7bce78b95b61061b9aef6bb4ab81841.zip
swift-contrib-651f10eee7bce78b95b61061b9aef6bb4ab81841.tar.bz2
Check validity of MUC names in join dialog
Resolves: #868
Diffstat (limited to 'Swift/QtUI/QtJoinMUCWindow.cpp')
-rw-r--r--Swift/QtUI/QtJoinMUCWindow.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/Swift/QtUI/QtJoinMUCWindow.cpp b/Swift/QtUI/QtJoinMUCWindow.cpp
index 14777bd..4884bbd 100644
--- a/Swift/QtUI/QtJoinMUCWindow.cpp
+++ b/Swift/QtUI/QtJoinMUCWindow.cpp
@@ -1,62 +1,64 @@
/*
- * Copyright (c) 2010 Remko Tronçon
+ * Copyright (c) 2010-2012 Remko Tronçon
* Licensed under the GNU General Public License v3.
* See Documentation/Licenses/GPLv3.txt for more information.
*/
+
#include "QtJoinMUCWindow.h"
-#include "QtSwiftUtil.h"
#include <boost/smart_ptr/make_shared.hpp>
#include <Swift/Controllers/UIEvents/UIEventStream.h>
#include <Swift/Controllers/UIEvents/JoinMUCUIEvent.h>
namespace Swift {
+
QtJoinMUCWindow::QtJoinMUCWindow(UIEventStream* uiEventStream) : uiEventStream(uiEventStream) {
ui.setupUi(this);
#if QT_VERSION >= 0x040700
ui.room->setPlaceholderText(tr("someroom@rooms.example.com"));
#endif
connect(ui.room, SIGNAL(returnPressed()), this, SLOT(handleJoin()));
connect(ui.searchButton, SIGNAL(clicked()), this, SLOT(handleSearch()));
connect(ui.joinButton, SIGNAL(clicked()), this, SLOT(handleJoin()));
// FIXME: Temporarily set focus on the nickName field first, so that the
// placeholder for the room is visible. This is just because Qt hides
// the placeholder when a widget is focused for some reason.
ui.nickName->setFocus();
ui.instantRoom->setChecked(true);
+ ui.nickName->setValidator(new NickValidator(this));
}
void QtJoinMUCWindow::handleJoin() {
if (ui.room->text().isEmpty()) {
// TODO: Error
return;
}
if (ui.nickName->text().isEmpty()) {
// TODO: Error
return;
}
lastSetNick = Q2PSTRING(ui.nickName->text());
std::string password = Q2PSTRING(ui.password->text());
JID room(Q2PSTRING(ui.room->text()));
uiEventStream->send(boost::make_shared<JoinMUCUIEvent>(room, password, lastSetNick, ui.joinAutomatically->isChecked(), !ui.instantRoom->isChecked()));
hide();
}
void QtJoinMUCWindow::handleSearch() {
onSearchMUC();
}
void QtJoinMUCWindow::setNick(const std::string& nick) {
ui.nickName->setText(P2QSTRING(nick));
lastSetNick = nick;
}
void QtJoinMUCWindow::setMUC(const std::string& nick) {
ui.room->setText(P2QSTRING(nick));
}
void QtJoinMUCWindow::show() {
QWidget::show();
QWidget::activateWindow();