summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'Swift/QtUI')
-rw-r--r--Swift/QtUI/UserSearch/QtUserSearchResultsPage.cpp11
-rw-r--r--Swift/QtUI/UserSearch/QtUserSearchResultsPage.h1
-rw-r--r--Swift/QtUI/UserSearch/QtUserSearchResultsPage.ui9
-rw-r--r--Swift/QtUI/UserSearch/QtUserSearchWindow.cpp2
4 files changed, 22 insertions, 1 deletions
diff --git a/Swift/QtUI/UserSearch/QtUserSearchResultsPage.cpp b/Swift/QtUI/UserSearch/QtUserSearchResultsPage.cpp
index bc6933e7..dcd79d2 100644
--- a/Swift/QtUI/UserSearch/QtUserSearchResultsPage.cpp
+++ b/Swift/QtUI/UserSearch/QtUserSearchResultsPage.cpp
@@ -15,12 +15,23 @@ QtUserSearchResultsPage::QtUserSearchResultsPage() {
connect(results_, SIGNAL(clicked(const QModelIndex&)), this, SLOT(emitCompletenessCheck()));
connect(results_, SIGNAL(entered(const QModelIndex&)), this, SLOT(emitCompletenessCheck()));
results_->setExpandsOnDoubleClick(false);
+ setNoResults(false);
}
bool QtUserSearchResultsPage::isComplete() const {
return results_->currentIndex().isValid();
}
+void QtUserSearchResultsPage::setNoResults(bool noResults) {
+ if (noResults) {
+ results_->setEnabled(false);
+ noResults_->show();
+ } else {
+ results_->setEnabled(true);
+ noResults_->hide();
+ }
+}
+
void QtUserSearchResultsPage::emitCompletenessCheck() {
emit completeChanged();
}
diff --git a/Swift/QtUI/UserSearch/QtUserSearchResultsPage.h b/Swift/QtUI/UserSearch/QtUserSearchResultsPage.h
index 2bb4fa5..ec52bf9 100644
--- a/Swift/QtUI/UserSearch/QtUserSearchResultsPage.h
+++ b/Swift/QtUI/UserSearch/QtUserSearchResultsPage.h
@@ -16,6 +16,7 @@ namespace Swift {
public:
QtUserSearchResultsPage();
virtual bool isComplete() const;
+ void setNoResults(bool noResults);
signals:
void onUserTriggersContinue();
public slots:
diff --git a/Swift/QtUI/UserSearch/QtUserSearchResultsPage.ui b/Swift/QtUI/UserSearch/QtUserSearchResultsPage.ui
index ceb15e1..cf99e3f 100644
--- a/Swift/QtUI/UserSearch/QtUserSearchResultsPage.ui
+++ b/Swift/QtUI/UserSearch/QtUserSearchResultsPage.ui
@@ -14,13 +14,20 @@
<string/>
</property>
<layout class="QGridLayout" name="layout">
- <item row="0" column="0">
+ <item row="1" column="0">
<widget class="QTreeView" name="results_">
<property name="rootIsDecorated">
<bool>false</bool>
</property>
</widget>
</item>
+ <item row="0" column="0">
+ <widget class="QLabel" name="noResults_">
+ <property name="text">
+ <string>No results.</string>
+ </property>
+ </widget>
+ </item>
</layout>
</widget>
<resources/>
diff --git a/Swift/QtUI/UserSearch/QtUserSearchWindow.cpp b/Swift/QtUI/UserSearch/QtUserSearchWindow.cpp
index b8a44e5..2b11d02 100644
--- a/Swift/QtUI/UserSearch/QtUserSearchWindow.cpp
+++ b/Swift/QtUI/UserSearch/QtUserSearchWindow.cpp
@@ -253,6 +253,7 @@ void QtUserSearchWindow::setResults(const std::vector<UserSearchResult>& results
resultsPage_->results_->setHeaderHidden(true);
delete model_;
model_ = newModel;
+ resultsPage_->setNoResults(model_->rowCount() == 0);
}
void QtUserSearchWindow::setResultsForm(Form::ref results) {
@@ -264,6 +265,7 @@ void QtUserSearchWindow::setResultsForm(Form::ref results) {
resultsPage_->results_->header()->setResizeMode(QHeaderView::ResizeToContents);
delete model_;
model_ = newModel;
+ resultsPage_->setNoResults(model_->rowCount() == 0);
}
void QtUserSearchWindow::setSelectedService(const JID& jid) {