summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2021-08-26 10:03:09 +0100
committerAdolfo Jayme Barrientos <fitojb@ubuntu.com>2021-08-26 21:54:16 +0200
commitfc5b74fec2d2a1748f89374bca3cde0a6b21b648 (patch)
tree3d3162af7cbc90c088c62980843c7f2969e74ac4
parentbump product version to 7.2.1.1.0+ (diff)
downloadcore-fc5b74fec2d2a1748f89374bca3cde0a6b21b648.tar.gz
core-fc5b74fec2d2a1748f89374bca3cde0a6b21b648.zip
Resolves: tdf#144084 if not initialized default to FILEOPEN_SIMPLE
which is a problem since... commit 43335776cfc18cdc7addf33250cffc886d384186 Author: Caolán McNamara <caolanm@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/+/121056 Reviewed-by: Michael Stahl <michael.stahl@allotropia.de> Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org> Reviewed-by: Adolfo Jayme Barrientos <fitojb@ubuntu.com> Tested-by: Adolfo Jayme Barrientos <fitojb@ubuntu.com>
-rw-r--r--vcl/unx/gtk3/fpicker/SalGtkFilePicker.cxx23
-rw-r--r--vcl/unx/gtk3/fpicker/SalGtkFilePicker.hxx2
2 files changed, 23 insertions, 2 deletions
diff --git a/vcl/unx/gtk3/fpicker/SalGtkFilePicker.cxx b/vcl/unx/gtk3/fpicker/SalGtkFilePicker.cxx
index 2b5081463403..a318a115f575 100644
--- a/vcl/unx/gtk3/fpicker/SalGtkFilePicker.cxx
+++ b/vcl/unx/gtk3/fpicker/SalGtkFilePicker.cxx
@@ -89,6 +89,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;
@@ -1610,6 +1618,8 @@ void SAL_CALL SalGtkFilePicker::initialize( const uno::Sequence<uno::Any>& aArgu
sal_Int16 templateId = -1;
aAny >>= templateId;
+ GtkWidget* pParentWidget = nullptr;
+
css::uno::Reference<css::awt::XWindow> xParentWindow;
if (aArguments.getLength() > 1)
{
@@ -1619,7 +1629,7 @@ void SAL_CALL SalGtkFilePicker::initialize( const uno::Sequence<uno::Any>& aArgu
if (xParentWindow.is())
{
if (SalGtkXWindow* pGtkXWindow = dynamic_cast<SalGtkXWindow*>(xParentWindow.get()))
- m_pParentWidget = pGtkXWindow->getGtkWidget();
+ pParentWidget = pGtkXWindow->getGtkWidget();
else
{
css::uno::Reference<css::awt::XSystemDependentWindowPeer> xSysDepWin(xParentWindow, css::uno::UNO_QUERY);
@@ -1630,11 +1640,18 @@ void SAL_CALL SalGtkFilePicker::initialize( const uno::Sequence<uno::Any>& aArgu
aAny = xSysDepWin->getWindowHandle(aProcessIdent, css::lang::SystemDependent::SYSTEM_XWINDOW);
css::awt::SystemDependentXWindow tmp;
aAny >>= tmp;
- m_pParentWidget = GetGtkSalData()->GetGtkDisplay()->findGtkWidgetForNativeHandle(tmp.WindowHandle);
+ pParentWidget = GetGtkSalData()->GetGtkDisplay()->findGtkWidgetForNativeHandle(tmp.WindowHandle);
}
}
}
+ impl_initialize(pParentWidget, templateId);
+}
+
+void SalGtkFilePicker::impl_initialize(GtkWidget* pParentWidget, sal_Int16 templateId)
+{
+ m_pParentWidget = pParentWidget;
+
GtkFileChooserAction eAction = GTK_FILE_CHOOSER_ACTION_OPEN;
OString sOpen = getOpenText();
OString sSave = getSaveText();
@@ -1781,6 +1798,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 5797a7a04e19..1c072c83c1a9 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 >
@@ -196,6 +197,7 @@ class SalGtkFilePicker : public SalGtkPicker, public SalGtkFilePicker_Base
bool bVersionWidthUnset;
bool mbPreviewState;
+ bool mbInitialized;
gulong mHID_Preview;
GtkWidget* m_pPreview;
GtkFileFilter* m_pPseudoFilter;