diff options
author | Remko Tronçon <git@el-tramo.be> | 2011-01-16 19:56:10 (GMT) |
---|---|---|
committer | Remko Tronçon <git@el-tramo.be> | 2011-01-20 21:40:49 (GMT) |
commit | 004dfd8d4305b767b624be10072597ef3e311753 (patch) | |
tree | 7f9a70ce336e9eca3bc78397640530939e55fa20 /Swift/QtUI/QtJoinMUCWindow.cpp | |
parent | 03d69bfd11549e1c8dcbf3b5300029ba9892cf8a (diff) | |
download | swift-contrib-004dfd8d4305b767b624be10072597ef3e311753.zip swift-contrib-004dfd8d4305b767b624be10072597ef3e311753.tar.bz2 |
Use a dedicated Join MUC dialog.
Diffstat (limited to 'Swift/QtUI/QtJoinMUCWindow.cpp')
-rw-r--r-- | Swift/QtUI/QtJoinMUCWindow.cpp | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/Swift/QtUI/QtJoinMUCWindow.cpp b/Swift/QtUI/QtJoinMUCWindow.cpp new file mode 100644 index 0000000..55b285b --- /dev/null +++ b/Swift/QtUI/QtJoinMUCWindow.cpp @@ -0,0 +1,53 @@ +/* + * Copyright (c) 2010 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" + +namespace Swift { + +QtJoinMUCWindow::QtJoinMUCWindow() { + ui.setupUi(this); + connect(ui.room, SIGNAL(returnPressed()), this, SLOT(handleJoin())); + connect(ui.searchButton, SIGNAL(clicked()), this, SLOT(handleSearch())); + connect(ui.joinButton, SIGNAL(clicked()), this, SLOT(handleJoin())); +} + +void QtJoinMUCWindow::handleJoin() { + if (ui.room->text().isEmpty()) { + // TODO: Error + return; + } + if (ui.nickName->text().isEmpty()) { + // TODO: Error + return; + } + + lastSetNick = Q2PSTRING(ui.nickName->text()); + JID room(Q2PSTRING(ui.room->text())); + onJoinMUC(room, lastSetNick, ui.joinAutomatically->isChecked()); + hide(); +} + +void QtJoinMUCWindow::handleSearch() { + onSearchMUC(); +} + +void QtJoinMUCWindow::setNick(const String& nick) { + ui.nickName->setText(P2QSTRING(nick)); + lastSetNick = nick; +} + +void QtJoinMUCWindow::setMUC(const String& nick) { + ui.room->setText(P2QSTRING(nick)); +} + +void QtJoinMUCWindow::show() { + QWidget::show(); + QWidget::activateWindow(); +} + +} |