# HG changeset patch # User Markus Mützel # Date 1592854875 -7200 # Node ID 7a640885171ad8b1b6e14b56142f78bc9203f64b # Parent 3b97c9637ea4fc9b108d36f464fd160365b250fc# Parent 2de2b2ddd03253daf664c8714ccd50daa24458a4 maint: merge stable to default. diff -r 3b97c9637ea4 -r 7a640885171a libgui/src/dialog.cc --- a/libgui/src/dialog.cc Mon Jun 22 14:13:17 2020 +0900 +++ b/libgui/src/dialog.cc Mon Jun 22 21:41:15 2020 +0200 @@ -668,8 +668,7 @@ // FIXME: Remove, if for all common KDE versions (bug #54607) is resolved. resource_manager& rmgr = oct_qobj.get_resource_manager (); gui_settings *settings = rmgr.get_settings (); - if (! settings->value (global_use_native_dialogs.key, - global_use_native_dialogs.def).toBool ()) + if (! settings->value (global_use_native_dialogs).toBool ()) setOption(QFileDialog::DontUseNativeDialog); if (multimode == "on") // uigetfile multiselect=on diff -r 3b97c9637ea4 -r 7a640885171a libgui/src/find-files-dialog.cc --- a/libgui/src/find-files-dialog.cc Mon Jun 22 14:13:17 2020 +0900 +++ b/libgui/src/find-files-dialog.cc Mon Jun 22 21:41:15 2020 +0200 @@ -312,8 +312,7 @@ // FIXME: Remove, if for all common KDE versions (bug #54607) is resolved. resource_manager& rmgr = m_octave_qobj.get_resource_manager (); gui_settings *settings = rmgr.get_settings (); - if (! settings->value (global_use_native_dialogs.key, - global_use_native_dialogs.def).toBool ()) + if (! settings->value (global_use_native_dialogs).toBool ()) opts = QFileDialog::DontUseNativeDialog; QString dir = diff -r 3b97c9637ea4 -r 7a640885171a libgui/src/gui-preferences-global.h --- a/libgui/src/gui-preferences-global.h Mon Jun 22 14:13:17 2020 +0900 +++ b/libgui/src/gui-preferences-global.h Mon Jun 22 21:41:15 2020 +0200 @@ -89,8 +89,18 @@ const gui_pref global_status_bar ("show_status_bar", QVariant (true)); +#if defined (Q_OS_MAC) +// prevent native file dialogs on MAC by setting the default "false" and +// setting the flag for ignoring the pref to "true" (3rd argument) +const gui_pref +global_use_native_dialogs ("use_native_file_dialogs", QVariant (false), true); +#elif defined (Q_OS_WIN32) +const gui_pref +global_use_native_dialogs ("use_native_file_dialogs", QVariant (false)); +#else const gui_pref global_use_native_dialogs ("use_native_file_dialogs", QVariant (true)); +#endif const gui_pref global_cursor_blinking ("cursor_blinking", QVariant (true)); diff -r 3b97c9637ea4 -r 7a640885171a libgui/src/gui-preferences.h --- a/libgui/src/gui-preferences.h Mon Jun 22 14:13:17 2020 +0900 +++ b/libgui/src/gui-preferences.h Mon Jun 22 21:41:15 2020 +0200 @@ -36,8 +36,9 @@ struct gui_pref { - gui_pref (const QString& key_arg, const QVariant& def_arg) - : key (key_arg), def (def_arg) + gui_pref (const QString& key_arg, const QVariant& def_arg, + const bool ignore_arg = false) + : key (key_arg), def (def_arg), ignore (ignore_arg) { } // No copying! @@ -50,6 +51,7 @@ const QString key; // the key name const QVariant def; // the default value + const bool ignore; // when true, ignore, i.e. always take default }; // The version for shortcuts, where the default value is stored as a diff -r 3b97c9637ea4 -r 7a640885171a libgui/src/gui-settings.h --- a/libgui/src/gui-settings.h Mon Jun 22 14:13:17 2020 +0900 +++ b/libgui/src/gui-settings.h Mon Jun 22 21:41:15 2020 +0200 @@ -62,6 +62,9 @@ QVariant value (const gui_pref& pref) const { + if (pref.ignore) + return pref.def; // ignore the current pref and always use default + return value (pref.key, pref.def); } diff -r 3b97c9637ea4 -r 7a640885171a libgui/src/m-editor/file-editor-tab.cc --- a/libgui/src/m-editor/file-editor-tab.cc Mon Jun 22 14:13:17 2020 +0900 +++ b/libgui/src/m-editor/file-editor-tab.cc Mon Jun 22 21:41:15 2020 +0200 @@ -2380,8 +2380,7 @@ // FIXME: Remove, if for all common KDE versions (bug #54607) is resolved. resource_manager& rmgr = m_octave_qobj.get_resource_manager (); gui_settings *settings = rmgr.get_settings (); - if (! settings->value (global_use_native_dialogs.key, - global_use_native_dialogs.def).toBool ()) + if (! settings->value (global_use_native_dialogs).toBool ()) fileDialog->setOption(QFileDialog::DontUseNativeDialog); connect (fileDialog, SIGNAL (filterSelected (const QString&)), diff -r 3b97c9637ea4 -r 7a640885171a libgui/src/main-window.cc --- a/libgui/src/main-window.cc Mon Jun 22 14:13:17 2020 +0900 +++ b/libgui/src/main-window.cc Mon Jun 22 21:41:15 2020 +0200 @@ -395,8 +395,7 @@ int opts = 0; // No options by default. resource_manager& rmgr = m_octave_qobj.get_resource_manager (); gui_settings *settings = rmgr.get_settings (); - if (! settings->value (global_use_native_dialogs.key, - global_use_native_dialogs.def).toBool ()) + if (! settings->value (global_use_native_dialogs).toBool ()) opts = QFileDialog::DontUseNativeDialog; QString file @@ -421,8 +420,7 @@ int opts = 0; // No options by default. resource_manager& rmgr = m_octave_qobj.get_resource_manager (); gui_settings *settings = rmgr.get_settings (); - if (! settings->value (global_use_native_dialogs.key, - global_use_native_dialogs.def).toBool ()) + if (! settings->value (global_use_native_dialogs).toBool ()) opts = QFileDialog::DontUseNativeDialog; QString file = file_arg; @@ -992,8 +990,7 @@ int opts = QFileDialog::ShowDirsOnly; resource_manager& rmgr = m_octave_qobj.get_resource_manager (); gui_settings *settings = rmgr.get_settings (); - if (! settings->value (global_use_native_dialogs.key, - global_use_native_dialogs.def).toBool ()) + if (! settings->value (global_use_native_dialogs).toBool ()) opts = QFileDialog::DontUseNativeDialog; QString dir @@ -1266,8 +1263,7 @@ fileDialog->setDirectory (m_current_directory_combo_box->itemText (0)); // FIXME: Remove, if for all common KDE versions (bug #54607) is resolved. - if (! settings->value (global_use_native_dialogs.key, - global_use_native_dialogs.def).toBool ()) + if (! settings->value (global_use_native_dialogs).toBool ()) fileDialog->setOption(QFileDialog::DontUseNativeDialog); connect (fileDialog, SIGNAL (filesSelected (const QStringList&)), diff -r 3b97c9637ea4 -r 7a640885171a libgui/src/shortcut-manager.cc --- a/libgui/src/shortcut-manager.cc Mon Jun 22 14:13:17 2020 +0900 +++ b/libgui/src/shortcut-manager.cc Mon Jun 22 21:41:15 2020 +0200 @@ -507,8 +507,7 @@ int opts = 0; // No options by default. resource_manager& rmgr = m_octave_qobj.get_resource_manager (); gui_settings *settings = rmgr.get_settings (); - if (! settings->value (global_use_native_dialogs.key, - global_use_native_dialogs.def).toBool ()) + if (! settings->value (global_use_native_dialogs).toBool ()) opts = QFileDialog::DontUseNativeDialog; if (action == OSC_IMPORT)