summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'Swift/QtUI/MUCSearch/QtMUCSearchWindow.cpp')
-rw-r--r--Swift/QtUI/MUCSearch/QtMUCSearchWindow.cpp21
1 files changed, 17 insertions, 4 deletions
diff --git a/Swift/QtUI/MUCSearch/QtMUCSearchWindow.cpp b/Swift/QtUI/MUCSearch/QtMUCSearchWindow.cpp
index 0ccd558..c31230c 100644
--- a/Swift/QtUI/MUCSearch/QtMUCSearchWindow.cpp
+++ b/Swift/QtUI/MUCSearch/QtMUCSearchWindow.cpp
@@ -34,7 +34,7 @@ QtMUCSearchWindow::QtMUCSearchWindow(UIEventStream* eventStream) {
#ifdef SWIFT_PLATFORM_MACOSX
results_->setAlternatingRowColors(true);
#endif
- connect(service_, SIGNAL(returnPressed()), this, SLOT(handleSearch()));
+ connect(service_, SIGNAL(activated(const QString&)), this, SLOT(handleSearch(const QString&)));
connect(room_, SIGNAL(returnPressed()), this, SLOT(handleJoin()));
connect(nickName_, SIGNAL(returnPressed()), room_, SLOT(setFocus()));
connect(searchButton_, SIGNAL(clicked()), this, SLOT(handleSearch()));
@@ -47,6 +47,14 @@ QtMUCSearchWindow::~QtMUCSearchWindow() {
}
+void QtMUCSearchWindow::addSavedServices(const std::vector<JID>& services) {
+ service_->clear();
+ foreach (JID jid, services) {
+ service_->addItem(P2QSTRING(jid.toString()));
+ }
+ service_->clearEditText();
+}
+
void QtMUCSearchWindow::handleActivated(const QModelIndex& index) {
if (!index.isValid()) {
return;
@@ -69,13 +77,18 @@ void QtMUCSearchWindow::handleSelected(const QModelIndex& current) {
}
-void QtMUCSearchWindow::handleSearch() {
- if (service_->text().isEmpty()) {
+void QtMUCSearchWindow::handleSearch(const QString& text) {
+ if (text.isEmpty()) {
return;
}
- onAddService(JID(Q2PSTRING(service_->text())));
+ onAddService(JID(Q2PSTRING(text)));
}
+void QtMUCSearchWindow::handleSearch() {
+ handleSearch(service_->currentText());
+}
+
+
void QtMUCSearchWindow::handleJoin() {
if (room_->text().isEmpty()) {
handleSelected(results_->currentIndex());