[Libreoffice-commits] core.git: Branch 'feature/qt5+kde5' - vcl/unx

Katarina Behrens Katarina.Behrens at cib.de
Wed Jun 20 11:01:52 UTC 2018


 vcl/unx/kde5/KDE5FilePicker.hxx  |    5 ++++-
 vcl/unx/kde5/KDE5FilePicker2.cxx |   20 +++++++++++++++++---
 2 files changed, 21 insertions(+), 4 deletions(-)

New commits:
commit bb883e06a3d4808d6d338f02c0bc4d8604c47e6d
Author: Katarina Behrens <Katarina.Behrens at cib.de>
Date:   Wed Jun 20 11:51:35 2018 +0200

    Implement getDirectory, signal+slot
    
    also factor some shared code out into separate func
    
    Change-Id: I49d25eeb4eb647b72dae78c42301091d198eeff4

diff --git a/vcl/unx/kde5/KDE5FilePicker.hxx b/vcl/unx/kde5/KDE5FilePicker.hxx
index 6f175cc375cf..d1a300be014c 100644
--- a/vcl/unx/kde5/KDE5FilePicker.hxx
+++ b/vcl/unx/kde5/KDE5FilePicker.hxx
@@ -157,6 +157,7 @@ public:
 private:
     //add a custom control widget to the file dialog
     void addCustomControl(sal_Int16 controlId);
+    OUString implGetDirectory();
 
     // emit XFilePickerListener controlStateChanged event
     void filterChanged();
@@ -171,6 +172,7 @@ Q_SIGNALS:
     void setDefaultNameSignal(const OUString& rName);
     void setDisplayDirectorySignal(const OUString& rDir);
     OUString getDisplayDirectorySignal();
+    OUString getDirectorySignal();
     void setValueSignal(sal_Int16 nControlId, sal_Int16 nControlAction,
                         const css::uno::Any& rValue);
     css::uno::Any getValueSignal(sal_Int16 nControlId, sal_Int16 nControlAction);
@@ -189,7 +191,8 @@ private Q_SLOTS:
     void setTitleSlot(const OUString& rTitle) { return setTitle(rTitle); }
     void setDefaultNameSlot(const OUString& rName) { return setDefaultName(rName); }
     void setDisplayDirectorySlot(const OUString& rDir) { return setDisplayDirectory(rDir); }
-    OUString getDisplayDirectorySlot() { return getDisplayDirectory(); }
+    OUString getDisplayDirectorySlot() { return implGetDirectory(); }
+    OUString getDirectorySlot() { return implGetDirectory(); }
     void setValueSlot(sal_Int16 nControlId, sal_Int16 nControlAction, const css::uno::Any& rValue)
     {
         return setValue(nControlId, nControlAction, rValue);
diff --git a/vcl/unx/kde5/KDE5FilePicker2.cxx b/vcl/unx/kde5/KDE5FilePicker2.cxx
index 56734b4d36e9..1bc9fa82f69f 100644
--- a/vcl/unx/kde5/KDE5FilePicker2.cxx
+++ b/vcl/unx/kde5/KDE5FilePicker2.cxx
@@ -227,8 +227,7 @@ OUString SAL_CALL KDE5FilePicker::getDisplayDirectory()
         return Q_EMIT getDisplayDirectorySignal();
     }
 
-    OUString dir = toOUString(_dialog->directoryUrl().url());
-    return dir;
+    return implGetDirectory();
 }
 
 uno::Sequence<OUString> SAL_CALL KDE5FilePicker::getFiles()
@@ -432,7 +431,16 @@ OUString SAL_CALL KDE5FilePicker::getLabel(sal_Int16 controlId)
     return label;
 }
 
-OUString SAL_CALL KDE5FilePicker::getDirectory() { return OUString(); }
+OUString SAL_CALL KDE5FilePicker::getDirectory()
+{
+    if (qApp->thread() != QThread::currentThread())
+    {
+        SolarMutexReleaser aReleaser;
+        return Q_EMIT getDirectorySignal();
+    }
+
+    return implGetDirectory();
+}
 
 void SAL_CALL KDE5FilePicker::setDescription(const OUString&) {}
 
@@ -530,6 +538,12 @@ void KDE5FilePicker::addCustomControl(sal_Int16 controlId)
     }
 }
 
+OUString KDE5FilePicker::implGetDirectory()
+{
+    OUString dir = toOUString(_dialog->directoryUrl().url());
+    return dir;
+}
+
 void SAL_CALL KDE5FilePicker::initialize(const uno::Sequence<uno::Any>& args)
 {
     // parameter checking


More information about the Libreoffice-commits mailing list