summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKevin Smith <git@kismith.co.uk>2010-11-16 23:16:54 (GMT)
committerKevin Smith <git@kismith.co.uk>2010-11-16 23:22:13 (GMT)
commit9c3d535b1dc82ff600862a1210993c362fda9b8e (patch)
tree76676afe8e4c70ffa88b98b4880862b3113902a6 /Swift/QtUI/MUCSearch
parent2c5ef44b56d9c45254ea331a53fb6d8fe6efe7d1 (diff)
downloadswift-9c3d535b1dc82ff600862a1210993c362fda9b8e.zip
swift-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')
-rw-r--r--Swift/QtUI/MUCSearch/QtMUCSearchWindow.cpp21
-rw-r--r--Swift/QtUI/MUCSearch/QtMUCSearchWindow.h2
-rw-r--r--Swift/QtUI/MUCSearch/QtMUCSearchWindow.ui6
3 files changed, 22 insertions, 7 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());
diff --git a/Swift/QtUI/MUCSearch/QtMUCSearchWindow.h b/Swift/QtUI/MUCSearch/QtMUCSearchWindow.h
index c0a8e72..27ccdcb 100644
--- a/Swift/QtUI/MUCSearch/QtMUCSearchWindow.h
+++ b/Swift/QtUI/MUCSearch/QtMUCSearchWindow.h
@@ -24,9 +24,11 @@ namespace Swift {
virtual void setMUC(const String& nick);
virtual void clearList();
virtual void addService(const MUCService& service);
+ virtual void addSavedServices(const std::vector<JID>& services);
virtual void show();
private slots:
+ void handleSearch(const QString& text);
void handleSearch();
void handleJoin();
void handleSelected(const QModelIndex& current);
diff --git a/Swift/QtUI/MUCSearch/QtMUCSearchWindow.ui b/Swift/QtUI/MUCSearch/QtMUCSearchWindow.ui
index 134807f..ef2524b 100644
--- a/Swift/QtUI/MUCSearch/QtMUCSearchWindow.ui
+++ b/Swift/QtUI/MUCSearch/QtMUCSearchWindow.ui
@@ -74,9 +74,9 @@
</widget>
</item>
<item>
- <widget class="QLineEdit" name="service_">
- <property name="text">
- <string/>
+ <widget class="QComboBox" name="service_">
+ <property name="editable">
+ <bool>true</bool>
</property>
</widget>
</item>