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

Katarina Behrens Katarina.Behrens at cib.de
Thu Jun 14 15:10:45 UTC 2018


 vcl/unx/kde5/KDE5FilePicker.cxx  |   27 ---------------------------
 vcl/unx/kde5/KDE5FilePicker.hxx  |   11 ++++++++++-
 vcl/unx/kde5/KDE5FilePicker2.cxx |   37 ++++++++++++++++++++++++++++++++++++-
 3 files changed, 46 insertions(+), 29 deletions(-)

New commits:
commit cf04394a10f27218475b4a6aab0a5a705841cf2e
Author: Katarina Behrens <Katarina.Behrens at cib.de>
Date:   Thu Jun 14 17:09:45 2018 +0200

    Fix copy&pasta
    
    Change-Id: I493fa7a14557a919fab6bc6cf9f955507488af6d

diff --git a/vcl/unx/kde5/KDE5FilePicker.hxx b/vcl/unx/kde5/KDE5FilePicker.hxx
index 3a6f2e9b94c4..4fae59304fed 100644
--- a/vcl/unx/kde5/KDE5FilePicker.hxx
+++ b/vcl/unx/kde5/KDE5FilePicker.hxx
@@ -197,7 +197,7 @@ private Q_SLOTS:
     OUString getDisplayDirectorySlot() { return getDisplayDirectory(); }
     void setValueSlot(sal_Int16 nControlId, sal_Int16 nControlAction, const css::uno::Any& rValue)
     {
-        return setValue(nControlAction, nControlAction, rValue);
+        return setValue(nControlId, nControlAction, rValue);
     }
 
     css::uno::Any getValueSlot(sal_Int16 nControlId, sal_Int16 nControlAction)
commit 16646bc1d2dc9b8127ff9120c8b6f8a94c7616d2
Author: Katarina Behrens <Katarina.Behrens at cib.de>
Date:   Thu Jun 14 17:08:17 2018 +0200

    Implement get|setLabel, signal+slot
    
    Change-Id: I0188f7609b7a934949ffdf0a6e64547b08ff03a8

diff --git a/vcl/unx/kde5/KDE5FilePicker.cxx b/vcl/unx/kde5/KDE5FilePicker.cxx
index 95eb6a5c3ba7..7a30359ef580 100644
--- a/vcl/unx/kde5/KDE5FilePicker.cxx
+++ b/vcl/unx/kde5/KDE5FilePicker.cxx
@@ -46,33 +46,6 @@ KDE5FilePicker::~KDE5FilePicker()
     delete _dialog;
 }
 
-/*void KDE5FilePicker::setLabel(sal_Int16 controlId, const QString& label)
-{
-    if (_customWidgets.contains(controlId))
-    {
-        QCheckBox* cb = dynamic_cast<QCheckBox*>(_customWidgets.value(controlId));
-        if (cb)
-            cb->setText(label);
-    }
-    else
-        qWarning() << "set label on unknown control" << controlId;
-}
-
-QString KDE5FilePicker::getLabel(sal_Int16 controlId) const
-{
-    QString label;
-    if (_customWidgets.contains(controlId))
-    {
-        QCheckBox* cb = dynamic_cast<QCheckBox*>(_customWidgets.value(controlId));
-        if (cb)
-            label = cb->text();
-    }
-    else
-        qWarning() << "get label on unknown control" << controlId;
-
-    return label;
-}*/
-
 void KDE5FilePicker::setWinId(sal_uIntPtr winId) { _winId = winId; }
 
 bool KDE5FilePicker::eventFilter(QObject* o, QEvent* e)
diff --git a/vcl/unx/kde5/KDE5FilePicker.hxx b/vcl/unx/kde5/KDE5FilePicker.hxx
index fd0ed95da27a..3a6f2e9b94c4 100644
--- a/vcl/unx/kde5/KDE5FilePicker.hxx
+++ b/vcl/unx/kde5/KDE5FilePicker.hxx
@@ -180,6 +180,8 @@ Q_SIGNALS:
                         const css::uno::Any& rValue);
     css::uno::Any getValueSignal(sal_Int16 nControlId, sal_Int16 nControlAction);
     void enableControlSignal(sal_Int16 nControlId, sal_Bool bEnable);
+    void setLabelSignal(sal_Int16 nControlId, const OUString& rLabel);
+    OUString getLabelSignal(sal_Int16 nControlId);
     void appendFilterSignal(const OUString& rTitle, const OUString& rFilter);
     void appendFilterGroupSignal(const OUString& rTitle,
                                  const css::uno::Sequence<css::beans::StringPair>& rFilters);
@@ -208,6 +210,13 @@ private Q_SLOTS:
         return enableControl(nControlId, bEnable);
     }
 
+    void setLabelSlot(sal_Int16 nControId, const OUString& rLabel)
+    {
+        return setLabel(nControId, rLabel);
+    }
+
+    OUString getLabelSlot(sal_Int16 nControlId) { return getLabel(nControlId); }
+
     void appendFilterSlot(const OUString& rTitle, const OUString& rFilter)
     {
         return appendFilter(rTitle, rFilter);
diff --git a/vcl/unx/kde5/KDE5FilePicker2.cxx b/vcl/unx/kde5/KDE5FilePicker2.cxx
index ad229c880001..72519f656bec 100644
--- a/vcl/unx/kde5/KDE5FilePicker2.cxx
+++ b/vcl/unx/kde5/KDE5FilePicker2.cxx
@@ -115,6 +115,10 @@ KDE5FilePicker::KDE5FilePicker(QFileDialog::FileMode eMode)
             Qt::BlockingQueuedConnection);
     connect(this, &KDE5FilePicker::getValueSignal, this, &KDE5FilePicker::getValueSlot,
             Qt::BlockingQueuedConnection);
+    connect(this, &KDE5FilePicker::setLabelSignal, this, &KDE5FilePicker::setLabelSlot,
+            Qt::BlockingQueuedConnection);
+    connect(this, &KDE5FilePicker::getLabelSignal, this, &KDE5FilePicker::getLabelSlot,
+            Qt::BlockingQueuedConnection);
     connect(this, &KDE5FilePicker::enableControlSignal, this, &KDE5FilePicker::enableControlSlot,
             Qt::BlockingQueuedConnection);
     connect(this, &KDE5FilePicker::appendFilterSignal, this, &KDE5FilePicker::appendFilterSlot,
@@ -374,11 +378,42 @@ void SAL_CALL KDE5FilePicker::enableControl(sal_Int16 controlId, sal_Bool enable
         SAL_WARN("vcl.kde5", "enable on unknown control" << controlId);
 }
 
-void SAL_CALL KDE5FilePicker::setLabel(sal_Int16 controlId, const OUString& label) {}
+void SAL_CALL KDE5FilePicker::setLabel(sal_Int16 controlId, const OUString& label)
+{
+    if (qApp->thread() != QThread::currentThread())
+    {
+        SolarMutexReleaser aReleaser;
+        return Q_EMIT setLabelSignal(controlId, label);
+    }
+
+    if (_customWidgets.contains(controlId))
+    {
+        QCheckBox* cb = dynamic_cast<QCheckBox*>(_customWidgets.value(controlId));
+        if (cb)
+            cb->setText(toQString(label));
+    }
+    else
+        SAL_WARN("vcl.kde5", "set label on unknown control" << controlId);
+}
 
 OUString SAL_CALL KDE5FilePicker::getLabel(sal_Int16 controlId)
 {
+    if (qApp->thread() != QThread::currentThread())
+    {
+        SolarMutexReleaser aReleaser;
+        return Q_EMIT getLabelSignal(controlId);
+    }
+
     OUString label;
+    if (_customWidgets.contains(controlId))
+    {
+        QCheckBox* cb = dynamic_cast<QCheckBox*>(_customWidgets.value(controlId));
+        if (cb)
+            label = toOUString(cb->text());
+    }
+    else
+        SAL_WARN("vcl.kde5", "get label on unknown control" << controlId);
+
     return label;
 }
 


More information about the Libreoffice-commits mailing list