[Libreoffice-commits] core.git: vcl/unx

Caolán McNamara (via logerrit) logerrit at kemper.freedesktop.org
Thu Aug 26 12:42:32 UTC 2021


 vcl/unx/gtk3/fpicker/SalGtkFilePicker.cxx |   17 ++++++++++++++++-
 vcl/unx/gtk3/fpicker/SalGtkFilePicker.hxx |    2 ++
 2 files changed, 18 insertions(+), 1 deletion(-)

New commits:
commit 0e34a52d8db3ea9c9e60af7c7348793dbc5d4d59
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Thu Aug 26 10:03:09 2021 +0100
Commit:     Caolán McNamara <caolanm at redhat.com>
CommitDate: Thu Aug 26 14:41:55 2021 +0200

    Resolves: tdf#144084 if not initialized default to FILEOPEN_SIMPLE
    
    which is a problem since...
    
    commit 43335776cfc18cdc7addf33250cffc886d384186
    Author: Caolán McNamara <caolanm at redhat.com>
    Date:   Tue May 11 17:21:47 2021 +0100
    
        gtk[3|4] don't create File Dialog with buttons that need to be removed
    
        just create it without the offending buttons in the first place
    
    where we create without buttons because its hard, especially since gtk4,
    to remove unwanted buttons.
    
    Change-Id: Ib0337c412fa7e8210d3b1bf3261174c4ffac0a0a
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/121075
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/vcl/unx/gtk3/fpicker/SalGtkFilePicker.cxx b/vcl/unx/gtk3/fpicker/SalGtkFilePicker.cxx
index c6f1b72c9c0b..2e89fe670c24 100644
--- a/vcl/unx/gtk3/fpicker/SalGtkFilePicker.cxx
+++ b/vcl/unx/gtk3/fpicker/SalGtkFilePicker.cxx
@@ -88,6 +88,7 @@ SalGtkFilePicker::SalGtkFilePicker( const uno::Reference< uno::XComponentContext
     mnHID_SelectionChange( 0 ),
     bVersionWidthUnset( false ),
     mbPreviewState( false ),
+    mbInitialized(false),
     mHID_Preview( 0 ),
     m_pPreview( nullptr ),
     m_pPseudoFilter( nullptr )
@@ -899,6 +900,13 @@ sal_Int16 SAL_CALL SalGtkFilePicker::execute()
 {
     SolarMutexGuard g;
 
+    if (!mbInitialized)
+    {
+        // tdf#144084 if not initialized default to FILEOPEN_SIMPLE
+        impl_initialize(nullptr, FILEOPEN_SIMPLE);
+        assert(mbInitialized);
+    }
+
     OSL_ASSERT( m_pDialog != nullptr );
 
     sal_Int16 retVal = 0;
@@ -1644,7 +1652,12 @@ void SAL_CALL SalGtkFilePicker::initialize( const uno::Sequence<uno::Any>& aArgu
     sal_Int16 templateId = -1;
     aAny >>= templateId;
 
-    m_pParentWidget = GetParentWidget(aArguments);
+    impl_initialize(GetParentWidget(aArguments), templateId);
+}
+
+void SalGtkFilePicker::impl_initialize(GtkWidget* pParentWidget, sal_Int16 templateId)
+{
+    m_pParentWidget = pParentWidget;
 
     GtkFileChooserAction eAction = GTK_FILE_CHOOSER_ACTION_OPEN;
     OString sOpen = getOpenText();
@@ -1792,6 +1805,8 @@ void SAL_CALL SalGtkFilePicker::initialize( const uno::Sequence<uno::Any>& aArgu
             gtk_widget_show( m_pHBoxs[ nTVIndex ] );
         }
     }
+
+    mbInitialized = true;
 }
 
 void SalGtkFilePicker::preview_toggled_cb( GObject *cb, SalGtkFilePicker* pobjFP )
diff --git a/vcl/unx/gtk3/fpicker/SalGtkFilePicker.hxx b/vcl/unx/gtk3/fpicker/SalGtkFilePicker.hxx
index 4c07f1b9cc16..c412478e8aab 100644
--- a/vcl/unx/gtk3/fpicker/SalGtkFilePicker.hxx
+++ b/vcl/unx/gtk3/fpicker/SalGtkFilePicker.hxx
@@ -142,6 +142,7 @@ class SalGtkFilePicker : public SalGtkPicker, public SalGtkFilePicker_Base
         void impl_fileSelectionChanged( const css::ui::dialogs::FilePickerEvent& aEvent );
         void impl_directoryChanged( const css::ui::dialogs::FilePickerEvent& aEvent );
         void impl_controlStateChanged( const css::ui::dialogs::FilePickerEvent& aEvent );
+        void impl_initialize(GtkWidget* pParentWidget, sal_Int16 templateId);
 
     private:
         css::uno::Reference< css::ui::dialogs::XFilePickerListener >
@@ -195,6 +196,7 @@ class SalGtkFilePicker : public SalGtkPicker, public SalGtkFilePicker_Base
 
         bool bVersionWidthUnset;
         bool mbPreviewState;
+        bool mbInitialized;
         gulong mHID_Preview;
         GtkWidget* m_pPreview;
         GtkFileFilter* m_pPseudoFilter;


More information about the Libreoffice-commits mailing list