diff options
-rw-r--r-- | Swift/QtUI/QtHighlightEditor.cpp | 25 | ||||
-rw-r--r-- | Swift/QtUI/QtHighlightEditor.h | 1 |
2 files changed, 22 insertions, 4 deletions
diff --git a/Swift/QtUI/QtHighlightEditor.cpp b/Swift/QtUI/QtHighlightEditor.cpp index 6bbd502..06695ec 100644 --- a/Swift/QtUI/QtHighlightEditor.cpp +++ b/Swift/QtUI/QtHighlightEditor.cpp @@ -21,6 +21,7 @@ #include <Swift/QtUI/QtSettingsProvider.h> #include <QTreeWidgetItem> +#include <QFileDialog> namespace Swift { @@ -217,6 +218,17 @@ void QtHighlightEditor::onDeleteButtonClicked() assert(selectedRow>=0 && selectedRow<ui_.listWidget->count()); delete ui_.listWidget->takeItem(selectedRow); highlightManager_->removeRule(selectedRow); + + if (!ui_.listWidget->count()) { + disableDialog(); + ui_.deleteButton->setEnabled(false); + } else { + if (selectedRow == ui_.listWidget->count()) { + selectRow(ui_.listWidget->count() - 1); + } else { + selectRow(selectedRow); + } + } } void QtHighlightEditor::onCurrentRowChanged(int currentRow) @@ -338,6 +350,11 @@ void QtHighlightEditor::handleContactSuggestionRequested(const QString& text) onContactSuggestionsRequested(stdText); } +void QtHighlightEditor::selectSoundFile() +{ + /* TODO: bring up standard Qt file selector here */ +} + void QtHighlightEditor::selectRow(int row) { for (int i = 0; i < ui_.listWidget->count(); ++i) { @@ -428,12 +445,12 @@ void QtHighlightEditor::ruleToDialog(const HighlightRule& rule) ui_.chatRadio->setEnabled(true); ui_.roomRadio->setEnabled(true); - if (rule.getMatchChat()) { - ui_.chatRadio->setChecked(true); - ui_.roomRadio->setChecked(false); - } else { + if (rule.getMatchMUC()) { ui_.chatRadio->setChecked(false); ui_.roomRadio->setChecked(true); + } else { + ui_.chatRadio->setChecked(true); + ui_.roomRadio->setChecked(false); } ui_.allMsgRadio->setEnabled(true); diff --git a/Swift/QtUI/QtHighlightEditor.h b/Swift/QtUI/QtHighlightEditor.h index 634f637..6d3d42d 100644 --- a/Swift/QtUI/QtHighlightEditor.h +++ b/Swift/QtUI/QtHighlightEditor.h @@ -47,6 +47,7 @@ namespace Swift { void widgetClick(); void disableDialog(); void handleContactSuggestionRequested(const QString& text); + void selectSoundFile(); private: |