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

Katarina Behrens Katarina.Behrens at cib.de
Fri Jun 8 20:51:20 UTC 2018


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

New commits:
commit d0f6f32a5217106c14ba0a6e234c8ee90011894e
Author: Katarina Behrens <Katarina.Behrens at cib.de>
Date:   Fri Jun 8 22:49:26 2018 +0200

    Distinguish between open vs. save file dialog
    
    Change-Id: I1b9dee1a8cd4034f64c2c1b843cee1863a5dc1d9

diff --git a/vcl/unx/kde5/KDE5FilePicker.cxx b/vcl/unx/kde5/KDE5FilePicker.cxx
index 02135eaa4a9a..dd5f3c0ecc45 100644
--- a/vcl/unx/kde5/KDE5FilePicker.cxx
+++ b/vcl/unx/kde5/KDE5FilePicker.cxx
@@ -141,21 +141,6 @@ QString KDE5FilePicker::getLabel(sal_Int16 controlId) const
     return label;
 }*/
 
-/*void KDE5FilePicker::initialize(bool saveDialog)
-{
-    //default is opening
-    QFileDialog::AcceptMode operationMode
-        = saveDialog ? QFileDialog::AcceptSave : QFileDialog::AcceptOpen;
-
-    _dialog->setAcceptMode(operationMode);
-
-    if (saveDialog)
-    {
-        _dialog->setConfirmOverwrite(true);
-        _dialog->setFileMode(QFileDialog::AnyFile);
-    }
-}*/
-
 void KDE5FilePicker::setWinId(sal_uIntPtr winId) { _winId = winId; }
 
 bool KDE5FilePicker::eventFilter(QObject* o, QEvent* e)
diff --git a/vcl/unx/kde5/KDE5FilePicker2.cxx b/vcl/unx/kde5/KDE5FilePicker2.cxx
index a920b9f3cbb7..ab3cc61191ed 100644
--- a/vcl/unx/kde5/KDE5FilePicker2.cxx
+++ b/vcl/unx/kde5/KDE5FilePicker2.cxx
@@ -452,6 +452,19 @@ void SAL_CALL KDE5FilePicker::initialize(const uno::Sequence<uno::Any>& args)
             OSL_TRACE("Unknown templates %d", templateId);
             return;
     }
+
+    //default is opening
+    QFileDialog::AcceptMode operationMode
+        = saveDialog ? QFileDialog::AcceptSave : QFileDialog::AcceptOpen;
+
+    _dialog->setAcceptMode(operationMode);
+
+    if (saveDialog)
+    {
+        _dialog->setConfirmOverwrite(true);
+        _dialog->setFileMode(QFileDialog::AnyFile);
+    }
+
     setTitle(VclResId(saveDialog ? STR_FPICKER_SAVE : STR_FPICKER_OPEN));
 }
 
commit 5c628b4bd569eec4d7624e8f11c3b4d8812c4ec8
Author: Katarina Behrens <Katarina.Behrens at cib.de>
Date:   Fri Jun 8 22:40:45 2018 +0200

    Implement setValue of fpicker checkboxes, signal+slot
    
    Change-Id: I0d75ef9f5584935d05a0526a626145e00761efd9

diff --git a/vcl/unx/kde5/KDE5FilePicker.cxx b/vcl/unx/kde5/KDE5FilePicker.cxx
index d3939e1d7e1f..02135eaa4a9a 100644
--- a/vcl/unx/kde5/KDE5FilePicker.cxx
+++ b/vcl/unx/kde5/KDE5FilePicker.cxx
@@ -91,18 +91,6 @@ QString KDE5FilePicker::getCurrentFilter() const
     return filter;
 }
 
-void KDE5FilePicker::setValue(sal_Int16 controlId, sal_Int16 nControlAction, bool value)
-{
-    if (_customWidgets.contains(controlId))
-    {
-        QCheckBox* cb = dynamic_cast<QCheckBox*>(_customWidgets.value(controlId));
-        if (cb)
-            cb->setChecked(value);
-    }
-    else
-        qWarning() << "set value on unknown control" << controlId;
-}
-
 bool KDE5FilePicker::getValue(sal_Int16 controlId, sal_Int16 nControlAction) const
 {
     bool ret = false;
diff --git a/vcl/unx/kde5/KDE5FilePicker.hxx b/vcl/unx/kde5/KDE5FilePicker.hxx
index d303ba30a6ac..675becf0bf68 100644
--- a/vcl/unx/kde5/KDE5FilePicker.hxx
+++ b/vcl/unx/kde5/KDE5FilePicker.hxx
@@ -174,10 +174,16 @@ protected:
 Q_SIGNALS:
     void setTitleSignal(const OUString& rTitle);
     void setDisplayDirectorySignal(const OUString& rDir);
+    void setValueSignal(sal_Int16 nControlId, sal_Int16 nControlAction,
+                        const css::uno::Any& rValue);
 
 private Q_SLOTS:
     void setTitleSlot(const OUString& rTitle) { return setTitle(rTitle); }
     void setDisplayDirectorySlot(const OUString& rDir) { return setDisplayDirectory(rDir); }
+    void setValueSlot(sal_Int16 nControlId, sal_Int16 nControlAction, const css::uno::Any& rValue)
+    {
+        return setValue(nControlAction, nControlAction, rValue);
+    }
 };
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/unx/kde5/KDE5FilePicker2.cxx b/vcl/unx/kde5/KDE5FilePicker2.cxx
index 96b6a0fe3c4f..a920b9f3cbb7 100644
--- a/vcl/unx/kde5/KDE5FilePicker2.cxx
+++ b/vcl/unx/kde5/KDE5FilePicker2.cxx
@@ -105,6 +105,8 @@ KDE5FilePicker::KDE5FilePicker(QFileDialog::FileMode eMode)
     connect(this, &KDE5FilePicker::setDisplayDirectorySignal /*(const OUString&)*/, this,
             &KDE5FilePicker::setDisplayDirectorySlot /*(const OUString&)*/,
             Qt::BlockingQueuedConnection);
+    connect(this, &KDE5FilePicker::setValueSignal, this, &KDE5FilePicker::setValueSlot,
+            Qt::BlockingQueuedConnection);
 
     qApp->installEventFilter(this);
     setMultiSelectionMode(false);
@@ -205,6 +207,23 @@ void SAL_CALL KDE5FilePicker::appendFilterGroup(const OUString& /*rGroupTitle*/,
 void SAL_CALL KDE5FilePicker::setValue(sal_Int16 controlId, sal_Int16 nControlAction,
                                        const uno::Any& value)
 {
+    if (qApp->thread() != QThread::currentThread())
+    {
+        SolarMutexReleaser aReleaser;
+        return Q_EMIT setValueSignal(controlId, nControlAction, value);
+    }
+
+    if (_customWidgets.contains(controlId))
+    {
+        bool bChecked = false;
+        value >>= bChecked;
+
+        QCheckBox* cb = dynamic_cast<QCheckBox*>(_customWidgets.value(controlId));
+        if (cb)
+            cb->setChecked(bChecked);
+    }
+    else
+        SAL_WARN("vcl.kde5", "set value on unknown control " << controlId);
 }
 
 uno::Any SAL_CALL KDE5FilePicker::getValue(sal_Int16 controlId, sal_Int16 nControlAction)
@@ -433,7 +452,6 @@ void SAL_CALL KDE5FilePicker::initialize(const uno::Sequence<uno::Any>& args)
             OSL_TRACE("Unknown templates %d", templateId);
             return;
     }
-
     setTitle(VclResId(saveDialog ? STR_FPICKER_SAVE : STR_FPICKER_OPEN));
 }
 


More information about the Libreoffice-commits mailing list