Kaydet (Commit) 6b052ccf authored tarafından Katarina Behrens's avatar Katarina Behrens

Implement enableControl, signal+slot

Change-Id: I84f81f689167ec332772c706b0d0c6d7562b5ac8
üst 4add71a1
......@@ -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))
{
......
......@@ -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);
......
......@@ -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) {}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment