Kaydet (Commit) 4add71a1 authored tarafından Katarina Behrens's avatar Katarina Behrens

Implement getValue, signal+slot

Change-Id: Ic009ea5dc3ca3bf791d3348fce8d007022598c49
üst 29e5096f
......@@ -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);
......
......@@ -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);
......
......@@ -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);
}
......
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