diff options
author | Kevin Smith <git@kismith.co.uk> | 2010-11-16 23:16:54 (GMT) |
---|---|---|
committer | Kevin Smith <git@kismith.co.uk> | 2010-11-16 23:22:13 (GMT) |
commit | 9c3d535b1dc82ff600862a1210993c362fda9b8e (patch) | |
tree | 76676afe8e4c70ffa88b98b4880862b3113902a6 /Swift/QtUI/MUCSearch/QtMUCSearchWindow.cpp | |
parent | 2c5ef44b56d9c45254ea331a53fb6d8fe6efe7d1 (diff) | |
download | swift-contrib-9c3d535b1dc82ff600862a1210993c362fda9b8e.zip swift-contrib-9c3d535b1dc82ff600862a1210993c362fda9b8e.tar.bz2 |
Remember previous MUC service searches.
Resolves: #615
Release-Notes: The MUC Search will now remember previously searched services.
Diffstat (limited to 'Swift/QtUI/MUCSearch/QtMUCSearchWindow.cpp')
-rw-r--r-- | Swift/QtUI/MUCSearch/QtMUCSearchWindow.cpp | 21 |
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()); |