diff options
Diffstat (limited to 'Swift/QtUI')
-rw-r--r-- | Swift/QtUI/QtHighlightEditor.cpp | 17 | ||||
-rw-r--r-- | Swift/QtUI/QtHighlightEditor.h | 4 | ||||
-rw-r--r-- | Swift/QtUI/QtHighlightEditor.ui | 15 |
3 files changed, 20 insertions, 16 deletions
diff --git a/Swift/QtUI/QtHighlightEditor.cpp b/Swift/QtUI/QtHighlightEditor.cpp index df9f6b2..c6e4319 100644 --- a/Swift/QtUI/QtHighlightEditor.cpp +++ b/Swift/QtUI/QtHighlightEditor.cpp @@ -5,7 +5,7 @@ */ /* - * Copyright (c) 2014 Isode Limited. + * Copyright (c) 2014-2015 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ @@ -38,6 +38,7 @@ QtHighlightEditor::QtHighlightEditor(QtSettingsProvider* settings, QWidget* pare connect(ui_.buttonBox->button(QDialogButtonBox::Apply), SIGNAL(clicked()), SLOT(onApplyButtonClick())); connect(ui_.buttonBox->button(QDialogButtonBox::Cancel), SIGNAL(clicked()), SLOT(onCancelButtonClick())); connect(ui_.buttonBox->button(QDialogButtonBox::Ok), SIGNAL(clicked()), SLOT(onOkButtonClick())); + connect(ui_.buttonBox->button(QDialogButtonBox::RestoreDefaults), SIGNAL(clicked()), SLOT(onResetToDefaultRulesClicked())); connect(ui_.noColorRadio, SIGNAL(clicked()), SLOT(colorOtherSelect())); connect(ui_.customColorRadio, SIGNAL(clicked()), SLOT(colorCustomSelect())); @@ -122,6 +123,8 @@ void QtHighlightEditor::show() selectRow(0); } + updateResetToDefaultRulesVisibility(); + /* prepare default states */ widgetClick(); @@ -246,6 +249,8 @@ void QtHighlightEditor::onCurrentRowChanged(int currentRow) } previousRow_ = currentRow; + + updateResetToDefaultRulesVisibility(); } void QtHighlightEditor::onApplyButtonClick() @@ -350,6 +355,12 @@ void QtHighlightEditor::selectSoundFile() ui_.soundFile->setText(path); } +void QtHighlightEditor::onResetToDefaultRulesClicked() { + highlightManager_->resetToDefaultRulesList(); + populateList(); + updateResetToDefaultRulesVisibility(); +} + void QtHighlightEditor::handleOnUserSelected(const Contact::ref& contact) { /* this might seem like it should be standard behaviour for the suggesting input box, but is not desirable in all cases */ if (contact->jid.isValid()) { @@ -539,4 +550,8 @@ void QtHighlightEditor::ruleToDialog(const HighlightRule& rule) setChildWidgetStates(); } +void QtHighlightEditor::updateResetToDefaultRulesVisibility() { + ui_.buttonBox->button(QDialogButtonBox::RestoreDefaults)->setVisible(!highlightManager_->isDefaultRulesList()); +} + } diff --git a/Swift/QtUI/QtHighlightEditor.h b/Swift/QtUI/QtHighlightEditor.h index ad51820..bcceb72 100644 --- a/Swift/QtUI/QtHighlightEditor.h +++ b/Swift/QtUI/QtHighlightEditor.h @@ -5,7 +5,7 @@ */ /* - * Copyright (c) 2014 Isode Limited. + * Copyright (c) 2014-2015 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ @@ -51,6 +51,7 @@ namespace Swift { void disableDialog(); void handleContactSuggestionRequested(const QString& text); void selectSoundFile(); + void onResetToDefaultRulesClicked(); private: void handleOnUserSelected(const Contact::ref& contact); @@ -59,6 +60,7 @@ namespace Swift { int getSelectedRow() const; HighlightRule ruleFromDialog(); void ruleToDialog(const HighlightRule& rule); + void updateResetToDefaultRulesVisibility(); Ui::QtHighlightEditor ui_; QtSettingsProvider* settings_; diff --git a/Swift/QtUI/QtHighlightEditor.ui b/Swift/QtUI/QtHighlightEditor.ui index 775771f..6d2338d 100644 --- a/Swift/QtUI/QtHighlightEditor.ui +++ b/Swift/QtUI/QtHighlightEditor.ui @@ -444,22 +444,9 @@ <item> <layout class="QHBoxLayout" name="horizontalLayout_9"> <item> - <spacer name="horizontalSpacer_4"> - <property name="orientation"> - <enum>Qt::Horizontal</enum> - </property> - <property name="sizeHint" stdset="0"> - <size> - <width>40</width> - <height>20</height> - </size> - </property> - </spacer> - </item> - <item> <widget class="QDialogButtonBox" name="buttonBox"> <property name="standardButtons"> - <set>QDialogButtonBox::Apply|QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set> + <set>QDialogButtonBox::Apply|QDialogButtonBox::Cancel|QDialogButtonBox::Ok|QDialogButtonBox::RestoreDefaults</set> </property> </widget> </item> |