diff options
author | Jan-Marek Glogowski <jan-marek.glogowski@extern.cib.de> | 2019-12-03 06:54:14 +0000 |
---|---|---|
committer | Jan-Marek Glogowski <glogow@fbihome.de> | 2019-12-06 16:20:40 +0100 |
commit | e536f28e9d7f640028461c5d02d3e50ef1102773 (patch) | |
tree | f08ddeb4d8143b85a334564002dec1cecbea3446 /vcl | |
parent | 1644fb345e41851fe9fa9d34544e7a1556e1afd6 (diff) |
KF5 drop KF5FilePicker::execute
To prevent calls to Qt5FilePicker::updateAutomaticFileExtension,
it is simply made virtual with an empty override. This is needed,
because the KF5 file picker has its own automatic extension
handling.
The main motivation is the fix for tdf#129071, which will result
in some major changes to XExecutableDialog::execute, so this will
prevent larger code duplication later.
Change-Id: I5f747f0828cb8a65b4e7043f3ee68ebd31973e6a
Reviewed-on: https://gerrit.libreoffice.org/84297
Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
Tested-by: Jenkins
(cherry picked from commit c0cdb01ef33042be76251c4a353e0582a0838e0e)
Reviewed-on: https://gerrit.libreoffice.org/84605
Reviewed-by: Jan-Marek Glogowski <glogow@fbihome.de>
Diffstat (limited to 'vcl')
-rw-r--r-- | vcl/inc/qt5/Qt5FilePicker.hxx | 7 | ||||
-rw-r--r-- | vcl/unx/kf5/KF5FilePicker.cxx | 22 | ||||
-rw-r--r-- | vcl/unx/kf5/KF5FilePicker.hxx | 7 |
3 files changed, 7 insertions, 29 deletions
diff --git a/vcl/inc/qt5/Qt5FilePicker.hxx b/vcl/inc/qt5/Qt5FilePicker.hxx index 6fb116875dd4..f88395c6acce 100644 --- a/vcl/inc/qt5/Qt5FilePicker.hxx +++ b/vcl/inc/qt5/Qt5FilePicker.hxx @@ -64,9 +64,11 @@ private: osl::Mutex m_aHelperMutex; ///< mutex used by the WeakComponentImplHelper + QStringList m_aNamedFilterList; ///< to keep the original sequence QHash<QString, QString> m_aTitleToFilterMap; // to retrieve the filename extension for a given filter QHash<QString, QString> m_aNamedFilterToExtensionMap; + QString m_aCurrentFilter; QGridLayout* m_pLayout; ///< layout for extra custom controls QHash<sal_Int16, QWidget*> m_aCustomWidgetsMap; ///< map of SAL control ID's to widget @@ -74,9 +76,6 @@ private: const bool m_bIsFolderPicker; protected: - QStringList m_aNamedFilterList; ///< to keep the original sequence - QString m_aCurrentFilter; - std::unique_ptr<QFileDialog> m_pFileDialog; ///< the file picker dialog QWidget* m_pExtraControls; ///< widget to contain extra custom controls @@ -165,7 +164,7 @@ private Q_SLOTS: // emit XFilePickerListener fileSelectionChanged event void currentChanged(const QString&); // (un)set automatic file extension - void updateAutomaticFileExtension(); + virtual void updateAutomaticFileExtension(); }; /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/unx/kf5/KF5FilePicker.cxx b/vcl/unx/kf5/KF5FilePicker.cxx index a7ecd938ccca..0d95cd0be304 100644 --- a/vcl/unx/kf5/KF5FilePicker.cxx +++ b/vcl/unx/kf5/KF5FilePicker.cxx @@ -70,28 +70,6 @@ KF5FilePicker::KF5FilePicker(css::uno::Reference<css::uno::XComponentContext> co qApp->installEventFilter(this); } -sal_Int16 SAL_CALL KF5FilePicker::execute() -{ - SolarMutexGuard g; - auto* pSalInst(static_cast<Qt5Instance*>(GetSalData()->m_pInstance)); - assert(pSalInst); - if (!pSalInst->IsMainThread()) - { - sal_Int16 ret; - pSalInst->RunInMainThread([&ret, this] { ret = execute(); }); - return ret; - } - - if (!m_aNamedFilterList.isEmpty()) - m_pFileDialog->setNameFilters(m_aNamedFilterList); - if (!m_aCurrentFilter.isEmpty()) - m_pFileDialog->selectNameFilter(m_aCurrentFilter); - - m_pFileDialog->show(); - //block and wait for user input - return m_pFileDialog->exec() == QFileDialog::Accepted ? 1 : 0; -} - // XFilePickerControlAccess void SAL_CALL KF5FilePicker::setValue(sal_Int16 controlId, sal_Int16 nControlAction, const uno::Any& value) diff --git a/vcl/unx/kf5/KF5FilePicker.hxx b/vcl/unx/kf5/KF5FilePicker.hxx index ee731a36a425..0886579cf459 100644 --- a/vcl/unx/kf5/KF5FilePicker.hxx +++ b/vcl/unx/kf5/KF5FilePicker.hxx @@ -35,9 +35,6 @@ public: explicit KF5FilePicker(css::uno::Reference<css::uno::XComponentContext> const& context, QFileDialog::FileMode); - // XExecutableDialog functions - virtual sal_Int16 SAL_CALL execute() override; - // XFilePickerControlAccess functions virtual void SAL_CALL setValue(sal_Int16 nControlId, sal_Int16 nControlAction, const css::uno::Any& rValue) override; @@ -56,6 +53,10 @@ private: //add a custom control widget to the file dialog void addCustomControl(sal_Int16 controlId) override; bool eventFilter(QObject* watched, QEvent* event) override; + +private Q_SLOTS: + // the KF5 file picker has its own automatic extension handling + void updateAutomaticFileExtension() override {} }; /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |