summaryrefslogtreecommitdiffstats
path: root/vcl/qt5
diff options
context:
space:
mode:
authorMichael Weghorn <m.weghorn@posteo.de>2019-02-07 16:58:29 +0100
committerKatarina Behrens <Katarina.Behrens@cib.de>2019-05-22 10:18:06 +0200
commit54ca7549ff4c7d89a931fa190e3c974323b087ee (patch)
tree672b1b45f845fe138b819fafa535d4d815fb687e /vcl/qt5
parentKDE5FilePicker: Reuse custom controls from parent class (diff)
downloadcore-54ca7549ff4c7d89a931fa190e3c974323b087ee.tar.gz
core-54ca7549ff4c7d89a931fa190e3c974323b087ee.zip
Make 'setDefaultName()' work again for kde5 fpicker
Add an option to Qt5FilePicker constructor to say whether the QFileDialog should be a native one or not, since 'QFileDialog::selectFile' does not preselect the correct name in the native dialog any more if the 'QFileDialog::DontUseNativeDialog' option has ever been set, i.e. QFileDialog fileDialog; fileDialog.setOption(QFileDialog::DontUseNativeDialog); fileDialog.setOption(QFileDialog::DontUseNativeDialog, false); fileDialog.selectFile("test.txt"); will not properly set the name in the native file dialog, which broke 'setDefaultName' for the KDE5FilePicker. This makes it work again, even though I think that the underlying issue is a Qt bug (s. https://bugreports.qt.io/browse/QTBUG-73682 ). Change-Id: I99a1e7c97d594925d600fa8eaf3303f9013551c2 Reviewed-on: https://gerrit.libreoffice.org/68058 Tested-by: Jenkins Reviewed-by: Katarina Behrens <Katarina.Behrens@cib.de> (cherry picked from commit 1d01ebc84867af00825512a3a3cfd9d0fa15eea9) Reviewed-on: https://gerrit.libreoffice.org/72655
Diffstat (limited to 'vcl/qt5')
-rw-r--r--vcl/qt5/Qt5FilePicker.cxx7
1 files changed, 5 insertions, 2 deletions
diff --git a/vcl/qt5/Qt5FilePicker.cxx b/vcl/qt5/Qt5FilePicker.cxx
index 0d2025cec55b..dcfcc68f0888 100644
--- a/vcl/qt5/Qt5FilePicker.cxx
+++ b/vcl/qt5/Qt5FilePicker.cxx
@@ -76,13 +76,16 @@ uno::Sequence<OUString> FilePicker_getSupportedServiceNames()
}
}
-Qt5FilePicker::Qt5FilePicker(QFileDialog::FileMode eMode, bool bShowFileExtensionInFilterTitle)
+Qt5FilePicker::Qt5FilePicker(QFileDialog::FileMode eMode, bool bShowFileExtensionInFilterTitle,
+ bool bUseNativeDialog)
: Qt5FilePicker_Base(m_aHelperMutex)
, m_bShowFileExtensionInFilterTitle(bShowFileExtensionInFilterTitle)
, m_pFileDialog(new QFileDialog(nullptr, {}, QDir::homePath()))
, m_bIsFolderPicker(eMode == QFileDialog::Directory)
{
- m_pFileDialog->setOption(QFileDialog::DontUseNativeDialog);
+ if (!bUseNativeDialog)
+ m_pFileDialog->setOption(QFileDialog::DontUseNativeDialog);
+
m_pFileDialog->setFileMode(eMode);
m_pFileDialog->setWindowModality(Qt::ApplicationModal);