changeset 28499:7a640885171a

maint: merge stable to default.
author Markus Mützel <markus.muetzel@gmx.de>
date Mon, 22 Jun 2020 21:41:15 +0200
parents 3b97c9637ea4 (current diff) 2de2b2ddd032 (diff)
children 9e9ddc90e88a
files libgui/src/find-files-dialog.cc libgui/src/gui-preferences-global.h libgui/src/m-editor/file-editor-tab.cc libgui/src/main-window.cc libgui/src/shortcut-manager.cc
diffstat 8 files changed, 25 insertions(+), 18 deletions(-) [+]
line wrap: on
line diff
--- 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
--- 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 =
--- 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));
--- 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
--- 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);
     }
 
--- 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&)),
--- 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&)),
--- 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)