summaryrefslogtreecommitdiffstats
path: root/Swift
diff options
context:
space:
mode:
Diffstat (limited to 'Swift')
-rw-r--r--Swift/QtUI/MUCSearch/QtMUCSearchWindow.cpp13
-rw-r--r--Swift/QtUI/MUCSearch/QtMUCSearchWindow.h1
2 files changed, 14 insertions, 0 deletions
diff --git a/Swift/QtUI/MUCSearch/QtMUCSearchWindow.cpp b/Swift/QtUI/MUCSearch/QtMUCSearchWindow.cpp
index de8ceb6..52fbf8c 100644
--- a/Swift/QtUI/MUCSearch/QtMUCSearchWindow.cpp
+++ b/Swift/QtUI/MUCSearch/QtMUCSearchWindow.cpp
@@ -38,9 +38,12 @@ QtMUCSearchWindow::QtMUCSearchWindow() {
ui_.results_->setAnimated(true);
ui_.results_->setAlternatingRowColors(true);
connect(ui_.service_, SIGNAL(activated(const QString&)), this, SLOT(handleSearch(const QString&)));
+ connect(ui_.results_->selectionModel(), SIGNAL(selectionChanged (const QItemSelection&, const QItemSelection&)), this, SLOT(handleSelectionChanged (const QItemSelection&, const QItemSelection&)));
+ connect(ui_.results_, SIGNAL(activated(const QModelIndex&)), this, SLOT(handleActivated(const QModelIndex&)));
connect(ui_.results_, SIGNAL(activated(const QModelIndex&)), this, SLOT(handleActivated(const QModelIndex&)));
// Not using a button box, because i can't seem to be able to make the ok button non-default (on mac)
connect(ui_.okButton, SIGNAL(clicked()), this, SLOT(accept()));
+ ui_.okButton->setEnabled(false);
connect(ui_.cancelButton, SIGNAL(clicked()), this, SLOT(reject()));
throbber_ = new QLabel("Searching", ui_.results_);
@@ -164,4 +167,14 @@ void QtMUCSearchWindow::reject() {
QDialog::reject();
}
+void QtMUCSearchWindow::handleSelectionChanged(const QItemSelection& selection, const QItemSelection&) {
+ if (selection.indexes().size() > 0) {
+ ui_.okButton->setEnabled(dynamic_cast<MUCSearchRoomItem*>(static_cast<MUCSearchItem*>(selection.indexes()[0].internalPointer())));
+ }
+ else {
+ ui_.okButton->setEnabled(false);
+ }
+}
+
+
}
diff --git a/Swift/QtUI/MUCSearch/QtMUCSearchWindow.h b/Swift/QtUI/MUCSearch/QtMUCSearchWindow.h
index cb4585d..c7661c2 100644
--- a/Swift/QtUI/MUCSearch/QtMUCSearchWindow.h
+++ b/Swift/QtUI/MUCSearch/QtMUCSearchWindow.h
@@ -37,6 +37,7 @@ namespace Swift {
void handleSearch(const QString&);
void handleActivated(const QModelIndex& index);
void updateThrobberPosition();
+ void handleSelectionChanged (const QItemSelection&, const QItemSelection&);
private:
Ui::QtMUCSearchWindow ui_;