vcl/unx/kde5/KDE5FilePicker.cxx | 25 +------------------------ vcl/unx/kde5/KDE5FilePicker.hxx | 12 ++++++++++++ vcl/unx/kde5/KDE5FilePicker2.cxx | 32 +++++++++++++++++++++++++++++++- 3 files changed, 44 insertions(+), 25 deletions(-)
New commits: commit 7a3f11b994568e6d8706817f15cb28e217005d14 Author: Katarina Behrens <[email protected]> Date: Thu Jun 14 14:21:35 2018 +0200 Implement enableControl, signal+slot Change-Id: I84f81f689167ec332772c706b0d0c6d7562b5ac8 diff --git a/vcl/unx/kde5/KDE5FilePicker.cxx b/vcl/unx/kde5/KDE5FilePicker.cxx index f69eb3435aa0..95eb6a5c3ba7 100644 --- a/vcl/unx/kde5/KDE5FilePicker.cxx +++ b/vcl/unx/kde5/KDE5FilePicker.cxx @@ -46,15 +46,7 @@ KDE5FilePicker::~KDE5FilePicker() delete _dialog; } -/*void KDE5FilePicker::enableControl(sal_Int16 controlId, bool enable) -{ - if (_customWidgets.contains(controlId)) - _customWidgets.value(controlId)->setEnabled(enable); - else - qWarning() << "enable on unknown control" << controlId; -} - -void KDE5FilePicker::setLabel(sal_Int16 controlId, const QString& label) +/*void KDE5FilePicker::setLabel(sal_Int16 controlId, const QString& label) { if (_customWidgets.contains(controlId)) { diff --git a/vcl/unx/kde5/KDE5FilePicker.hxx b/vcl/unx/kde5/KDE5FilePicker.hxx index da2dd7a09d16..fd0ed95da27a 100644 --- a/vcl/unx/kde5/KDE5FilePicker.hxx +++ b/vcl/unx/kde5/KDE5FilePicker.hxx @@ -179,6 +179,7 @@ Q_SIGNALS: void setValueSignal(sal_Int16 nControlId, sal_Int16 nControlAction, const css::uno::Any& rValue); css::uno::Any getValueSignal(sal_Int16 nControlId, sal_Int16 nControlAction); + void enableControlSignal(sal_Int16 nControlId, sal_Bool bEnable); void appendFilterSignal(const OUString& rTitle, const OUString& rFilter); void appendFilterGroupSignal(const OUString& rTitle, const css::uno::Sequence<css::beans::StringPair>& rFilters); @@ -202,6 +203,11 @@ private Q_SLOTS: return getValue(nControlId, nControlAction); } + void enableControlSlot(sal_Int16 nControlId, sal_Bool bEnable) + { + return enableControl(nControlId, bEnable); + } + 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 75488e88041b..ad229c880001 100644 --- a/vcl/unx/kde5/KDE5FilePicker2.cxx +++ b/vcl/unx/kde5/KDE5FilePicker2.cxx @@ -115,6 +115,8 @@ KDE5FilePicker::KDE5FilePicker(QFileDialog::FileMode eMode) Qt::BlockingQueuedConnection); connect(this, &KDE5FilePicker::getValueSignal, this, &KDE5FilePicker::getValueSlot, Qt::BlockingQueuedConnection); + connect(this, &KDE5FilePicker::enableControlSignal, this, &KDE5FilePicker::enableControlSlot, + Qt::BlockingQueuedConnection); connect(this, &KDE5FilePicker::appendFilterSignal, this, &KDE5FilePicker::appendFilterSlot, Qt::BlockingQueuedConnection); connect(this, &KDE5FilePicker::appendFilterGroupSignal, this, @@ -358,7 +360,19 @@ uno::Any SAL_CALL KDE5FilePicker::getValue(sal_Int16 controlId, sal_Int16 nContr return uno::Any(value); } -void SAL_CALL KDE5FilePicker::enableControl(sal_Int16 controlId, sal_Bool enable) {} +void SAL_CALL KDE5FilePicker::enableControl(sal_Int16 controlId, sal_Bool enable) +{ + if (qApp->thread() != QThread::currentThread()) + { + SolarMutexReleaser aReleaser; + return Q_EMIT enableControlSignal(controlId, enable); + } + + if (_customWidgets.contains(controlId)) + _customWidgets.value(controlId)->setEnabled(enable); + else + SAL_WARN("vcl.kde5", "enable on unknown control" << controlId); +} void SAL_CALL KDE5FilePicker::setLabel(sal_Int16 controlId, const OUString& label) {} commit ff9e4f1f7ac84df15ecbf57f8ce56105e6985b05 Author: Katarina Behrens <[email protected]> Date: Thu Jun 14 12:36:48 2018 +0200 Implement getValue, signal+slot Change-Id: Ic009ea5dc3ca3bf791d3348fce8d007022598c49 diff --git a/vcl/unx/kde5/KDE5FilePicker.cxx b/vcl/unx/kde5/KDE5FilePicker.cxx index 231e045f4ef5..f69eb3435aa0 100644 --- a/vcl/unx/kde5/KDE5FilePicker.cxx +++ b/vcl/unx/kde5/KDE5FilePicker.cxx @@ -46,22 +46,7 @@ KDE5FilePicker::~KDE5FilePicker() delete _dialog; } -/*bool KDE5FilePicker::getValue(sal_Int16 controlId, sal_Int16 nControlAction) const -{ - bool ret = false; - if (_customWidgets.contains(controlId)) - { - QCheckBox* cb = dynamic_cast<QCheckBox*>(_customWidgets.value(controlId)); - if (cb) - ret = cb->isChecked(); - } - else - qWarning() << "get value on unknown control" << controlId; - - return ret; -} - -void KDE5FilePicker::enableControl(sal_Int16 controlId, bool enable) +/*void KDE5FilePicker::enableControl(sal_Int16 controlId, bool enable) { if (_customWidgets.contains(controlId)) _customWidgets.value(controlId)->setEnabled(enable); diff --git a/vcl/unx/kde5/KDE5FilePicker.hxx b/vcl/unx/kde5/KDE5FilePicker.hxx index 8fbc24f73a63..da2dd7a09d16 100644 --- a/vcl/unx/kde5/KDE5FilePicker.hxx +++ b/vcl/unx/kde5/KDE5FilePicker.hxx @@ -178,6 +178,7 @@ Q_SIGNALS: OUString getDisplayDirectorySignal(); void setValueSignal(sal_Int16 nControlId, sal_Int16 nControlAction, const css::uno::Any& rValue); + css::uno::Any getValueSignal(sal_Int16 nControlId, sal_Int16 nControlAction); void appendFilterSignal(const OUString& rTitle, const OUString& rFilter); void appendFilterGroupSignal(const OUString& rTitle, const css::uno::Sequence<css::beans::StringPair>& rFilters); @@ -196,6 +197,11 @@ private Q_SLOTS: return setValue(nControlAction, nControlAction, rValue); } + css::uno::Any getValueSlot(sal_Int16 nControlId, sal_Int16 nControlAction) + { + return getValue(nControlId, nControlAction); + } + 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 87119f9e6bc9..75488e88041b 100644 --- a/vcl/unx/kde5/KDE5FilePicker2.cxx +++ b/vcl/unx/kde5/KDE5FilePicker2.cxx @@ -113,6 +113,8 @@ KDE5FilePicker::KDE5FilePicker(QFileDialog::FileMode eMode) &KDE5FilePicker::setMultiSelectionSlot, Qt::BlockingQueuedConnection); connect(this, &KDE5FilePicker::setValueSignal, this, &KDE5FilePicker::setValueSlot, Qt::BlockingQueuedConnection); + connect(this, &KDE5FilePicker::getValueSignal, this, &KDE5FilePicker::getValueSlot, + Qt::BlockingQueuedConnection); connect(this, &KDE5FilePicker::appendFilterSignal, this, &KDE5FilePicker::appendFilterSlot, Qt::BlockingQueuedConnection); connect(this, &KDE5FilePicker::appendFilterGroupSignal, this, @@ -329,6 +331,12 @@ void SAL_CALL KDE5FilePicker::setValue(sal_Int16 controlId, sal_Int16 nControlAc uno::Any SAL_CALL KDE5FilePicker::getValue(sal_Int16 controlId, sal_Int16 nControlAction) { + if (qApp->thread() != QThread::currentThread()) + { + SolarMutexReleaser aReleaser; + return Q_EMIT getValueSignal(controlId, nControlAction); + } + if (CHECKBOX_AUTOEXTENSION == controlId) // We ignore this one and rely on QFileDialog to provide the function. // Always return false, to pretend we do not support this, otherwise @@ -338,6 +346,14 @@ uno::Any SAL_CALL KDE5FilePicker::getValue(sal_Int16 controlId, sal_Int16 nContr return uno::Any(false); bool value = false; + if (_customWidgets.contains(controlId)) + { + QCheckBox* cb = dynamic_cast<QCheckBox*>(_customWidgets.value(controlId)); + if (cb) + value = cb->isChecked(); + } + else + SAL_WARN("vcl.kde5", "get value on unknown control" << controlId); return uno::Any(value); } _______________________________________________ Libreoffice-commits mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
