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

Jan-Marek Glogowski (via logerrit) logerrit at kemper.freedesktop.org
Thu Dec 5 11:29:53 UTC 2019


 vcl/inc/qt5/Qt5FilePicker.hxx |    7 +++----
 vcl/unx/kf5/KF5FilePicker.cxx |   22 ----------------------
 vcl/unx/kf5/KF5FilePicker.hxx |    7 ++++---
 3 files changed, 7 insertions(+), 29 deletions(-)

New commits:
commit c0cdb01ef33042be76251c4a353e0582a0838e0e
Author:     Jan-Marek Glogowski <jan-marek.glogowski at extern.cib.de>
AuthorDate: Tue Dec 3 06:54:14 2019 +0000
Commit:     Jan-Marek Glogowski <glogow at fbihome.de>
CommitDate: Thu Dec 5 12:28:37 2019 +0100

    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 at posteo.de>
    Tested-by: Jenkins

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: */


More information about the Libreoffice-commits mailing list