[Libreoffice-commits] core.git: Branch 'libreoffice-6-3' - vcl/inc vcl/qt5 vcl/unx
Jan-Marek Glogowski (via logerrit)
logerrit at kemper.freedesktop.org
Sat Jun 8 19:16:25 UTC 2019
vcl/inc/qt5/Qt5Instance.hxx | 5 +++++
vcl/qt5/Qt5Instance.cxx | 18 ++++++++++++++++--
vcl/unx/kde5/KDE5SalInstance.cxx | 25 +++++++------------------
vcl/unx/kde5/KDE5SalInstance.hxx | 20 ++++++--------------
4 files changed, 34 insertions(+), 34 deletions(-)
New commits:
commit 33ca4dbcc91164a3725263d8a8f61d9f2866da8f
Author: Jan-Marek Glogowski <glogow at fbihome.de>
AuthorDate: Sun Jun 2 20:17:49 2019 +0000
Commit: Jan-Marek Glogowski <glogow at fbihome.de>
CommitDate: Sat Jun 8 21:15:43 2019 +0200
Qt5/KDE5 always use either Qt5 or KDE5 pickers
And use RunInMain for both SalInstances and for both picker types,
as there is no reason to assume just the file and not the folder
picker can be called from the non-GUI thread.
Little drawback is the inclusion of Qt5FilePicker header in the
Qt5Instance header, as Qt's enums aren't forward-declarable.
Change-Id: Ie170d247a76134df9aff835393c71c9d6e907d32
Reviewed-on: https://gerrit.libreoffice.org/73416
Reviewed-by: Michael Weghorn <m.weghorn at posteo.de>
Tested-by: Jenkins
Reviewed-by: Jan-Marek Glogowski <glogow at fbihome.de>
(cherry picked from commit ca69a1e17782d88580f2449e0252be52c26cae42)
Reviewed-on: https://gerrit.libreoffice.org/73721
diff --git a/vcl/inc/qt5/Qt5Instance.hxx b/vcl/inc/qt5/Qt5Instance.hxx
index 52b45b12d2b8..c87f3c93c1ac 100644
--- a/vcl/inc/qt5/Qt5Instance.hxx
+++ b/vcl/inc/qt5/Qt5Instance.hxx
@@ -33,6 +33,8 @@
#include <memory>
#include <vector>
+#include "Qt5FilePicker.hxx"
+
class QApplication;
class SalYieldMutex;
class SalFrame;
@@ -74,6 +76,9 @@ Q_SIGNALS:
void ImplRunInMainSignal();
void deleteObjectLaterSignal(QObject* pObject);
+protected:
+ virtual Qt5FilePicker* createPicker(QFileDialog::FileMode);
+
public:
explicit Qt5Instance(std::unique_ptr<QApplication>& pQApp, bool bUseCairo = false);
virtual ~Qt5Instance() override;
diff --git a/vcl/qt5/Qt5Instance.cxx b/vcl/qt5/Qt5Instance.cxx
index 1949d426de69..a7b7aeb8638a 100644
--- a/vcl/qt5/Qt5Instance.cxx
+++ b/vcl/qt5/Qt5Instance.cxx
@@ -394,18 +394,32 @@ void Qt5Instance::ProcessEvent(SalUserEvent aEvent)
aEvent.m_pFrame->CallCallback(aEvent.m_nEvent, aEvent.m_pData);
}
+Qt5FilePicker* Qt5Instance::createPicker(QFileDialog::FileMode eMode)
+{
+ if (!IsMainThread())
+ {
+ SolarMutexGuard g;
+ Qt5FilePicker* pPicker;
+ RunInMainThread(std::function([&, this]() { pPicker = createPicker(eMode); }));
+ assert(pPicker);
+ return pPicker;
+ }
+
+ return new Qt5FilePicker(eMode);
+}
+
css::uno::Reference<css::ui::dialogs::XFilePicker2>
Qt5Instance::createFilePicker(const css::uno::Reference<css::uno::XComponentContext>&)
{
return css::uno::Reference<css::ui::dialogs::XFilePicker2>(
- new Qt5FilePicker(QFileDialog::ExistingFile));
+ createPicker(QFileDialog::ExistingFile));
}
css::uno::Reference<css::ui::dialogs::XFolderPicker2>
Qt5Instance::createFolderPicker(const css::uno::Reference<css::uno::XComponentContext>&)
{
return css::uno::Reference<css::ui::dialogs::XFolderPicker2>(
- new Qt5FilePicker(QFileDialog::Directory));
+ createPicker(QFileDialog::Directory));
}
css::uno::Reference<css::uno::XInterface>
diff --git a/vcl/unx/kde5/KDE5SalInstance.cxx b/vcl/unx/kde5/KDE5SalInstance.cxx
index 63ce689518f5..e2bd75277d23 100644
--- a/vcl/unx/kde5/KDE5SalInstance.cxx
+++ b/vcl/unx/kde5/KDE5SalInstance.cxx
@@ -50,34 +50,23 @@ SalFrame* KDE5SalInstance::CreateFrame(SalFrame* pParent, SalFrameStyleFlags nSt
return pRet;
}
-uno::Reference<ui::dialogs::XFilePicker2>
-KDE5SalInstance::createFilePicker(const uno::Reference<uno::XComponentContext>& xMSF)
+Qt5FilePicker* KDE5SalInstance::createPicker(QFileDialog::FileMode eMode)
{
if (!IsMainThread())
{
SolarMutexGuard g;
- uno::Reference<ui::dialogs::XFilePicker2> xRet;
- RunInMainThread(
- std::function([&xRet, this, xMSF]() { xRet = this->createFilePicker(xMSF); }));
- assert(xRet);
- return xRet;
+ Qt5FilePicker* pPicker;
+ RunInMainThread(std::function([&, this]() { pPicker = createPicker(eMode); }));
+ assert(pPicker);
+ return pPicker;
}
// In order to insert custom controls, KDE5FilePicker currently relies on KFileWidget
// being used in the native file picker, which is only the case for KDE Plasma.
// Therefore, return the plain qt5 one in order to not lose custom controls.
if (Application::GetDesktopEnvironment() == "KDE5")
- {
- return uno::Reference<ui::dialogs::XFilePicker2>(
- new KDE5FilePicker(QFileDialog::ExistingFile));
- }
- return Qt5Instance::createFilePicker(xMSF);
-}
-
-uno::Reference<ui::dialogs::XFolderPicker2>
-KDE5SalInstance::createFolderPicker(const uno::Reference<uno::XComponentContext>& /*xMSF*/)
-{
- return uno::Reference<ui::dialogs::XFolderPicker2>(new KDE5FilePicker(QFileDialog::Directory));
+ return new KDE5FilePicker(eMode);
+ return Qt5Instance::createPicker(eMode);
}
extern "C" {
diff --git a/vcl/unx/kde5/KDE5SalInstance.hxx b/vcl/unx/kde5/KDE5SalInstance.hxx
index 11276be3f4ec..53993a5ecc34 100644
--- a/vcl/unx/kde5/KDE5SalInstance.hxx
+++ b/vcl/unx/kde5/KDE5SalInstance.hxx
@@ -21,23 +21,15 @@
#include <qt5/Qt5Instance.hxx>
-class QApplication;
-
-class KDE5SalInstance : public Qt5Instance
+class KDE5SalInstance final : public Qt5Instance
{
-public:
- explicit KDE5SalInstance(std::unique_ptr<QApplication>& pQApp);
-
- virtual bool hasNativeFileSelection() const override { return true; }
+ Qt5FilePicker* createPicker(QFileDialog::FileMode) override;
- virtual css::uno::Reference<css::ui::dialogs::XFolderPicker2>
- createFolderPicker(const css::uno::Reference<css::uno::XComponentContext>&) override;
+ SalFrame* CreateFrame(SalFrame* pParent, SalFrameStyleFlags nStyle) override;
+ bool hasNativeFileSelection() const override { return true; }
-private:
- virtual SalFrame* CreateFrame(SalFrame* pParent, SalFrameStyleFlags nStyle) override;
-
- virtual css::uno::Reference<css::ui::dialogs::XFilePicker2>
- createFilePicker(const css::uno::Reference<css::uno::XComponentContext>&) override;
+public:
+ explicit KDE5SalInstance(std::unique_ptr<QApplication>& pQApp);
};
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
More information about the Libreoffice-commits
mailing list