Mercurial > octave-nkf
comparison libgui/src/settings-dialog.cc @ 19698:ff56a9899101
fix new shortcut dialog when applying new settings (fix #44196)
* settings-dialog.cc (write_changed_settings): new boolean parameter whether
settings dialog is closing or not, calling function for writing the shortcuts
with this parameter;
(button_clicked): calling write_changed_settings with new flag set to false
when button with accept role was clicked
* settings-dialog.h: write_changed_settings with boolean parameter
* shortcut-manager.cc (do_write_shortcuts): delete shortcut dialog only if
settings dialog is closing, setting to 0 after deletion;
(do_import_export): call do_write_shortcuts with new flag
* shortcut-manager.h: do_/write_shortcuts with new boolean parameter
author | Torsten <ttl@justmail.de> |
---|---|
date | Fri, 06 Feb 2015 22:55:01 +0100 |
parents | 5d0663bff506 |
children | 4197fc428c7d |
comparison
equal
deleted
inserted
replaced
19697:dfea01b3425f | 19698:ff56a9899101 |
---|---|
607 // place grid with elements into the tab | 607 // place grid with elements into the tab |
608 ui->terminal_colors_box->setLayout (style_grid); | 608 ui->terminal_colors_box->setLayout (style_grid); |
609 } | 609 } |
610 | 610 |
611 void | 611 void |
612 settings_dialog::write_changed_settings () | 612 settings_dialog::write_changed_settings (bool closing) |
613 { | 613 { |
614 QSettings *settings = resource_manager::get_settings (); | 614 QSettings *settings = resource_manager::get_settings (); |
615 // FIXME: what should happen if settings is 0? | 615 // FIXME: what should happen if settings is 0? |
616 | 616 |
617 // the icon set | 617 // the icon set |
821 ui->cb_prevent_readline_conflicts->isChecked ()); | 821 ui->cb_prevent_readline_conflicts->isChecked ()); |
822 int set = 0; | 822 int set = 0; |
823 if (ui->rb_sc_set2->isChecked ()) | 823 if (ui->rb_sc_set2->isChecked ()) |
824 set = 1; | 824 set = 1; |
825 settings->setValue ("shortcuts/set",set); | 825 settings->setValue ("shortcuts/set",set); |
826 shortcut_manager::write_shortcuts (0, settings); // 0: write both sets | 826 shortcut_manager::write_shortcuts (0, settings, closing); // 0: write both sets |
827 | 827 |
828 // settings dialog's geometry | 828 // settings dialog's geometry |
829 settings->setValue ("settings/last_tab",ui->tabWidget->currentIndex ()); | 829 settings->setValue ("settings/last_tab",ui->tabWidget->currentIndex ()); |
830 settings->setValue ("settings/geometry",saveGeometry ()); | 830 settings->setValue ("settings/geometry",saveGeometry ()); |
831 | 831 |
961 QDialogButtonBox::ButtonRole button_role = ui->button_box->buttonRole (button); | 961 QDialogButtonBox::ButtonRole button_role = ui->button_box->buttonRole (button); |
962 | 962 |
963 if (button_role == QDialogButtonBox::ApplyRole || | 963 if (button_role == QDialogButtonBox::ApplyRole || |
964 button_role == QDialogButtonBox::AcceptRole) | 964 button_role == QDialogButtonBox::AcceptRole) |
965 { | 965 { |
966 write_changed_settings (); | 966 write_changed_settings (button_role == QDialogButtonBox::AcceptRole); |
967 emit apply_new_settings (); | 967 emit apply_new_settings (); |
968 } | 968 } |
969 | 969 |
970 if (button_role == QDialogButtonBox::RejectRole || | 970 if (button_role == QDialogButtonBox::RejectRole || |
971 button_role == QDialogButtonBox::AcceptRole) | 971 button_role == QDialogButtonBox::AcceptRole) |