summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'Swift/QtUI')
-rw-r--r--Swift/QtUI/QtHighlightEditor.cpp22
-rw-r--r--Swift/QtUI/QtHighlightEditor.h3
2 files changed, 21 insertions, 4 deletions
diff --git a/Swift/QtUI/QtHighlightEditor.cpp b/Swift/QtUI/QtHighlightEditor.cpp
index 8488d7d..134155c 100644
--- a/Swift/QtUI/QtHighlightEditor.cpp
+++ b/Swift/QtUI/QtHighlightEditor.cpp
@@ -76,7 +76,7 @@ QtHighlightEditor::QtHighlightEditor(QtSettingsProvider* settings, QWidget* pare
connect(ui_.soundFileButton, SIGNAL(clicked()), SLOT(selectSoundFile()));
- /* if these are not needed, then they should be removed */
- ui_.moveUpButton->setVisible(false);
- ui_.moveDownButton->setVisible(false);
+ /* allowing reordering items */
+ connect(ui_.moveUpButton, SIGNAL(clicked()), this, SLOT(onUpButtonClicked()));
+ connect(ui_.moveDownButton, SIGNAL(clicked()), this, SLOT(onDownButtonClicked()));
setWindowTitle(tr("Highlight Rules"));
@@ -196,4 +196,20 @@ void QtHighlightEditor::onDeleteButtonClicked()
}
+void QtHighlightEditor::onUpButtonClicked() {
+ const size_t moveFrom = ui_.listWidget->currentRow();
+ const size_t moveTo = moveFrom - 1;
+ highlightManager_->swapRules(moveFrom, moveTo);
+ populateList();
+ selectRow(moveTo);
+}
+
+void QtHighlightEditor::onDownButtonClicked() {
+ const size_t moveFrom = ui_.listWidget->currentRow();
+ const size_t moveTo = moveFrom + 1;
+ highlightManager_->swapRules(moveFrom, moveTo);
+ populateList();
+ selectRow(moveTo);
+}
+
void QtHighlightEditor::onCurrentRowChanged(int currentRow)
{
diff --git a/Swift/QtUI/QtHighlightEditor.h b/Swift/QtUI/QtHighlightEditor.h
index c7db464..e0595ad 100644
--- a/Swift/QtUI/QtHighlightEditor.h
+++ b/Swift/QtUI/QtHighlightEditor.h
@@ -41,4 +41,6 @@ namespace Swift {
void onNewButtonClicked();
void onDeleteButtonClicked();
+ void onUpButtonClicked();
+ void onDownButtonClicked();
void onCurrentRowChanged(int currentRow);
void onApplyButtonClick();
@@ -54,5 +56,4 @@ namespace Swift {
void handleOnUserSelected(const JID& jid);
void populateList();
- void updateChatPreview();
void selectRow(int row);
int getSelectedRow() const;