[Libreoffice-commits] core.git: 3 commits - sc/qa vcl/unx
Jan-Marek Glogowski
glogow at fbihome.de
Thu Feb 6 10:04:49 PST 2014
sc/qa/unit/ucalc_formula.cxx | 4
vcl/unx/kde4/KDE4FilePicker.cxx | 285 +++++++++++++++-------------------------
vcl/unx/kde4/KDE4FilePicker.hxx | 4
3 files changed, 114 insertions(+), 179 deletions(-)
New commits:
commit 53ca207a700c9501e76c7770f6b1e3af89edd630
Author: Jan-Marek Glogowski <glogow at fbihome.de>
Date: Thu Feb 6 17:47:19 2014 +0000
Fix shadowed Test member variable
Change-Id: I2dbb8a643acb21dc023cf8555663083230b93d15
diff --git a/sc/qa/unit/ucalc_formula.cxx b/sc/qa/unit/ucalc_formula.cxx
index df3e4c1..411ed9e 100644
--- a/sc/qa/unit/ucalc_formula.cxx
+++ b/sc/qa/unit/ucalc_formula.cxx
@@ -566,14 +566,14 @@ void Test::testFormulaHashAndTag()
void Test::testFormulaTokenEquality()
{
- struct Test
+ struct FormulaTokenEqualityTest
{
const char* mpFormula1;
const char* mpFormula2;
bool mbEqual;
};
- Test aTests[] = {
+ FormulaTokenEqualityTest aTests[] = {
{ "R1C2", "R1C2", true },
{ "R1C2", "R1C3", false },
{ "R1C2", "R2C2", false },
commit a8d102c2406b8c027afb32d61271e0a2c301f133
Author: Jan-Marek Glogowski <glogow at fbihome.de>
Date: Thu Feb 6 16:05:37 2014 +0000
fdo#72187 Implement KDE4 picker notifications
This notifies the XFilePickerListener of filter changes and file
selection changes.
Change-Id: I749c5f7420f020a3a2fbb764acb5c45d40972cf1
diff --git a/vcl/unx/kde4/KDE4FilePicker.cxx b/vcl/unx/kde4/KDE4FilePicker.cxx
index f92142a..54f7458 100644
--- a/vcl/unx/kde4/KDE4FilePicker.cxx
+++ b/vcl/unx/kde4/KDE4FilePicker.cxx
@@ -189,7 +189,12 @@ KDE4FilePicker::KDE4FilePicker( const uno::Reference<uno::XComponentContext>& )
// Destructor proxy
connect( this, SIGNAL( cleanupProxySignal() ), this, SLOT( cleanupProxy() ), Qt::BlockingQueuedConnection );
+
connect( this, SIGNAL( checkProtocolSignal() ), this, SLOT( checkProtocol() ), Qt::BlockingQueuedConnection );
+
+ // XFilePickerListener notifications
+ connect( _dialog, SIGNAL( filterChanged(const QString&) ), this, SLOT( filterChanged(const QString&) ));
+ connect( _dialog, SIGNAL( selectionChanged() ), this, SLOT( selectionChanged() ));
}
KDE4FilePicker::~KDE4FilePicker()
@@ -783,6 +788,23 @@ void KDE4FilePicker::checkProtocol()
KMessageBox::error( _dialog, KIO::buildErrorString( KIO::ERR_UNSUPPORTED_PROTOCOL, _dialog->baseUrl().protocol()));
}
+void KDE4FilePicker::filterChanged(const QString &)
+{
+ FilePickerEvent aEvent;
+ aEvent.ElementId = LISTBOX_FILTER;
+ OSL_TRACE( "filter changed" );
+ if (m_xListener.is())
+ m_xListener->controlStateChanged( aEvent );
+}
+
+void KDE4FilePicker::selectionChanged()
+{
+ FilePickerEvent aEvent;
+ OSL_TRACE( "file selection changed" );
+ if (m_xListener.is())
+ m_xListener->fileSelectionChanged( aEvent );
+}
+
#include "KDE4FilePicker.moc"
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/unx/kde4/KDE4FilePicker.hxx b/vcl/unx/kde4/KDE4FilePicker.hxx
index 69e7eb2..6dc97df 100644
--- a/vcl/unx/kde4/KDE4FilePicker.hxx
+++ b/vcl/unx/kde4/KDE4FilePicker.hxx
@@ -230,6 +230,10 @@ private Q_SLOTS:
void cleanupProxy();
void checkProtocol();
+ // emit XFilePickerListener controlStateChanged event
+ void filterChanged(const QString &filter);
+ // emit XFilePickerListener fileSelectionChanged event
+ void selectionChanged();
};
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
commit 24e8b90d8a2864cfb60d3a5046be39410efe5c51
Author: Jan-Marek Glogowski <glogow at fbihome.de>
Date: Thu Feb 6 15:32:42 2014 +0000
Simplify control item switch statements
Just check the dynamic_cast result to verify check boxes.
Change-Id: I5f370e337e12719eb7ef0dd3512a0f46c76a981e
diff --git a/vcl/unx/kde4/KDE4FilePicker.cxx b/vcl/unx/kde4/KDE4FilePicker.cxx
index cb20be4..f92142a 100644
--- a/vcl/unx/kde4/KDE4FilePicker.cxx
+++ b/vcl/unx/kde4/KDE4FilePicker.cxx
@@ -443,86 +443,39 @@ void SAL_CALL KDE4FilePicker::setValue( sal_Int16 controlId, sal_Int16 nControlA
return Q_EMIT setValueSignal( controlId, nControlAction, value );
}
- QWidget* widget = _customWidgets[controlId];
-
- if (widget)
- {
- switch (controlId)
- {
- case ExtendedFilePickerElementIds::CHECKBOX_AUTOEXTENSION:
- // we actually rely on KFileDialog and ignore CHECKBOX_AUTOEXTENSION completely,
- // otherwise the checkbox would be duplicated
- break;
- case ExtendedFilePickerElementIds::CHECKBOX_PASSWORD:
- case ExtendedFilePickerElementIds::CHECKBOX_FILTEROPTIONS:
- case ExtendedFilePickerElementIds::CHECKBOX_READONLY:
- case ExtendedFilePickerElementIds::CHECKBOX_LINK:
- case ExtendedFilePickerElementIds::CHECKBOX_PREVIEW:
- case ExtendedFilePickerElementIds::CHECKBOX_SELECTION:
- {
- QCheckBox* cb = dynamic_cast<QCheckBox*>(widget);
- cb->setChecked(value.get<bool>());
- break;
- }
- case ExtendedFilePickerElementIds::PUSHBUTTON_PLAY:
- case ExtendedFilePickerElementIds::LISTBOX_VERSION:
- case ExtendedFilePickerElementIds::LISTBOX_TEMPLATE:
- case ExtendedFilePickerElementIds::LISTBOX_IMAGE_TEMPLATE:
- case ExtendedFilePickerElementIds::LISTBOX_VERSION_LABEL:
- case ExtendedFilePickerElementIds::LISTBOX_TEMPLATE_LABEL:
- case ExtendedFilePickerElementIds::LISTBOX_IMAGE_TEMPLATE_LABEL:
- case ExtendedFilePickerElementIds::LISTBOX_FILTER_SELECTOR:
- break;
- }
+ if (_customWidgets.contains( controlId )) {
+ QCheckBox* cb = dynamic_cast<QCheckBox*>( _customWidgets.value( controlId ));
+ if (cb)
+ cb->setChecked(value.get<bool>());
}
+ else
+ OSL_TRACE( "set label on unknown control %d", controlId );
}
uno::Any SAL_CALL KDE4FilePicker::getValue( sal_Int16 controlId, sal_Int16 nControlAction )
throw( uno::RuntimeException )
{
+ if (CHECKBOX_AUTOEXTENSION == controlId)
+ // We ignore this one and rely on KFileDialog to provide the function.
+ // Always return false, to pretend we do not support this, otherwise
+ // LO core would try to be smart and cut the extension in some places,
+ // interfering with KFileDialog's handling of it. KFileDialog also
+ // saves the value of the setting, so LO core is not needed for that either.
+ return uno::Any( false );
+
if( qApp->thread() != QThread::currentThread() ) {
SalYieldMutexReleaser release;
return Q_EMIT getValueSignal( controlId, nControlAction );
}
uno::Any res(false);
-
- QWidget* widget = _customWidgets[controlId];
-
- if (widget)
- {
- switch (controlId)
- {
- case ExtendedFilePickerElementIds::CHECKBOX_AUTOEXTENSION:
- // We ignore this one and rely on KFileDialog to provide the function.
- // Always return false, to pretend we do not support this, otherwise
- // LO core would try to be smart and cut the extension in some places,
- // interfering with KFileDialog's handling of it. KFileDialog also
- // saves the value of the setting, so LO core is not needed for that either.
- res = uno::Any( false );
- break;
- case ExtendedFilePickerElementIds::CHECKBOX_PASSWORD:
- case ExtendedFilePickerElementIds::CHECKBOX_FILTEROPTIONS:
- case ExtendedFilePickerElementIds::CHECKBOX_READONLY:
- case ExtendedFilePickerElementIds::CHECKBOX_LINK:
- case ExtendedFilePickerElementIds::CHECKBOX_PREVIEW:
- case ExtendedFilePickerElementIds::CHECKBOX_SELECTION:
- {
- QCheckBox* cb = dynamic_cast<QCheckBox*>(widget);
- res = uno::Any(cb->isChecked());
- break;
- }
- case ExtendedFilePickerElementIds::PUSHBUTTON_PLAY:
- case ExtendedFilePickerElementIds::LISTBOX_VERSION:
- case ExtendedFilePickerElementIds::LISTBOX_TEMPLATE:
- case ExtendedFilePickerElementIds::LISTBOX_IMAGE_TEMPLATE:
- case ExtendedFilePickerElementIds::LISTBOX_VERSION_LABEL:
- case ExtendedFilePickerElementIds::LISTBOX_TEMPLATE_LABEL:
- case ExtendedFilePickerElementIds::LISTBOX_IMAGE_TEMPLATE_LABEL:
- case ExtendedFilePickerElementIds::LISTBOX_FILTER_SELECTOR:
- break;
- }
+ if (_customWidgets.contains( controlId )) {
+ QCheckBox* cb = dynamic_cast<QCheckBox*>( _customWidgets.value( controlId ));
+ if (cb)
+ res = uno::Any(cb->isChecked());
}
+ else
+ OSL_TRACE( "get value on unknown control %d", controlId );
return res;
}
@@ -535,12 +488,10 @@ void SAL_CALL KDE4FilePicker::enableControl( sal_Int16 controlId, sal_Bool enabl
return Q_EMIT enableControlSignal( controlId, enable );
}
- QWidget* widget = _customWidgets[controlId];
-
- if (widget)
- {
- widget->setEnabled(enable);
- }
+ if (_customWidgets.contains( controlId ))
+ _customWidgets.value( controlId )->setEnabled( enable );
+ else
+ OSL_TRACE("enable unknown control %d", controlId );
}
void SAL_CALL KDE4FilePicker::setLabel( sal_Int16 controlId, const OUString &label )
@@ -551,35 +502,13 @@ void SAL_CALL KDE4FilePicker::setLabel( sal_Int16 controlId, const OUString &lab
return Q_EMIT setLabelSignal( controlId, label );
}
- QWidget* widget = _customWidgets[controlId];
-
- if (widget)
- {
- switch (controlId)
- {
- case ExtendedFilePickerElementIds::CHECKBOX_AUTOEXTENSION: // ignored
- case ExtendedFilePickerElementIds::CHECKBOX_PASSWORD:
- case ExtendedFilePickerElementIds::CHECKBOX_FILTEROPTIONS:
- case ExtendedFilePickerElementIds::CHECKBOX_READONLY:
- case ExtendedFilePickerElementIds::CHECKBOX_LINK:
- case ExtendedFilePickerElementIds::CHECKBOX_PREVIEW:
- case ExtendedFilePickerElementIds::CHECKBOX_SELECTION:
- {
- QCheckBox* cb = dynamic_cast<QCheckBox*>(widget);
- cb->setText(toQString(label));
- break;
- }
- case ExtendedFilePickerElementIds::PUSHBUTTON_PLAY:
- case ExtendedFilePickerElementIds::LISTBOX_VERSION:
- case ExtendedFilePickerElementIds::LISTBOX_TEMPLATE:
- case ExtendedFilePickerElementIds::LISTBOX_IMAGE_TEMPLATE:
- case ExtendedFilePickerElementIds::LISTBOX_VERSION_LABEL:
- case ExtendedFilePickerElementIds::LISTBOX_TEMPLATE_LABEL:
- case ExtendedFilePickerElementIds::LISTBOX_IMAGE_TEMPLATE_LABEL:
- case ExtendedFilePickerElementIds::LISTBOX_FILTER_SELECTOR:
- break;
- }
+ if (_customWidgets.contains( controlId )) {
+ QCheckBox* cb = dynamic_cast<QCheckBox*>( _customWidgets.value( controlId ));
+ if (cb)
+ cb->setText( toQString(label) );
}
+ else
+ OSL_TRACE( "set label on unknown control %d", controlId );
}
OUString SAL_CALL KDE4FilePicker::getLabel(sal_Int16 controlId)
@@ -590,36 +519,15 @@ OUString SAL_CALL KDE4FilePicker::getLabel(sal_Int16 controlId)
return Q_EMIT getLabelSignal( controlId );
}
- QWidget* widget = _customWidgets[controlId];
QString label;
-
- if (widget)
- {
- switch (controlId)
- {
- case ExtendedFilePickerElementIds::CHECKBOX_AUTOEXTENSION: // ignored
- case ExtendedFilePickerElementIds::CHECKBOX_PASSWORD:
- case ExtendedFilePickerElementIds::CHECKBOX_FILTEROPTIONS:
- case ExtendedFilePickerElementIds::CHECKBOX_READONLY:
- case ExtendedFilePickerElementIds::CHECKBOX_LINK:
- case ExtendedFilePickerElementIds::CHECKBOX_PREVIEW:
- case ExtendedFilePickerElementIds::CHECKBOX_SELECTION:
- {
- QCheckBox* cb = dynamic_cast<QCheckBox*>(widget);
- label = cb->text();
- break;
- }
- case ExtendedFilePickerElementIds::PUSHBUTTON_PLAY:
- case ExtendedFilePickerElementIds::LISTBOX_VERSION:
- case ExtendedFilePickerElementIds::LISTBOX_TEMPLATE:
- case ExtendedFilePickerElementIds::LISTBOX_IMAGE_TEMPLATE:
- case ExtendedFilePickerElementIds::LISTBOX_VERSION_LABEL:
- case ExtendedFilePickerElementIds::LISTBOX_TEMPLATE_LABEL:
- case ExtendedFilePickerElementIds::LISTBOX_IMAGE_TEMPLATE_LABEL:
- case ExtendedFilePickerElementIds::LISTBOX_FILTER_SELECTOR:
- break;
- }
+ if (_customWidgets.contains( controlId )) {
+ QCheckBox* cb = dynamic_cast<QCheckBox*>( _customWidgets.value( controlId ));
+ if (cb)
+ label = cb->text();
}
+ else
+ OSL_TRACE( "get label on unknown control %d", controlId );
+
return toOUString(label);
}
@@ -630,55 +538,55 @@ void KDE4FilePicker::addCustomControl(sal_Int16 controlId)
switch (controlId)
{
- case ExtendedFilePickerElementIds::CHECKBOX_AUTOEXTENSION:
+ case CHECKBOX_AUTOEXTENSION:
resId = STR_SVT_FILEPICKER_AUTO_EXTENSION;
break;
- case ExtendedFilePickerElementIds::CHECKBOX_PASSWORD:
+ case CHECKBOX_PASSWORD:
resId = STR_SVT_FILEPICKER_PASSWORD;
break;
- case ExtendedFilePickerElementIds::CHECKBOX_FILTEROPTIONS:
+ case CHECKBOX_FILTEROPTIONS:
resId = STR_SVT_FILEPICKER_FILTER_OPTIONS;
break;
- case ExtendedFilePickerElementIds::CHECKBOX_READONLY:
+ case CHECKBOX_READONLY:
resId = STR_SVT_FILEPICKER_READONLY;
break;
- case ExtendedFilePickerElementIds::CHECKBOX_LINK:
+ case CHECKBOX_LINK:
resId = STR_SVT_FILEPICKER_INSERT_AS_LINK;
break;
- case ExtendedFilePickerElementIds::CHECKBOX_PREVIEW:
+ case CHECKBOX_PREVIEW:
resId = STR_SVT_FILEPICKER_SHOW_PREVIEW;
break;
- case ExtendedFilePickerElementIds::CHECKBOX_SELECTION:
+ case CHECKBOX_SELECTION:
resId = STR_SVT_FILEPICKER_SELECTION;
break;
- case ExtendedFilePickerElementIds::PUSHBUTTON_PLAY:
+ case PUSHBUTTON_PLAY:
resId = STR_SVT_FILEPICKER_PLAY;
break;
- case ExtendedFilePickerElementIds::LISTBOX_VERSION:
+ case LISTBOX_VERSION:
resId = STR_SVT_FILEPICKER_VERSION;
break;
- case ExtendedFilePickerElementIds::LISTBOX_TEMPLATE:
+ case LISTBOX_TEMPLATE:
resId = STR_SVT_FILEPICKER_TEMPLATES;
break;
- case ExtendedFilePickerElementIds::LISTBOX_IMAGE_TEMPLATE:
+ case LISTBOX_IMAGE_TEMPLATE:
resId = STR_SVT_FILEPICKER_IMAGE_TEMPLATE;
break;
- case ExtendedFilePickerElementIds::LISTBOX_VERSION_LABEL:
- case ExtendedFilePickerElementIds::LISTBOX_TEMPLATE_LABEL:
- case ExtendedFilePickerElementIds::LISTBOX_IMAGE_TEMPLATE_LABEL:
- case ExtendedFilePickerElementIds::LISTBOX_FILTER_SELECTOR:
+ case LISTBOX_VERSION_LABEL:
+ case LISTBOX_TEMPLATE_LABEL:
+ case LISTBOX_IMAGE_TEMPLATE_LABEL:
+ case LISTBOX_FILTER_SELECTOR:
break;
}
switch (controlId)
{
- case ExtendedFilePickerElementIds::CHECKBOX_AUTOEXTENSION:
- case ExtendedFilePickerElementIds::CHECKBOX_PASSWORD:
- case ExtendedFilePickerElementIds::CHECKBOX_FILTEROPTIONS:
- case ExtendedFilePickerElementIds::CHECKBOX_READONLY:
- case ExtendedFilePickerElementIds::CHECKBOX_LINK:
- case ExtendedFilePickerElementIds::CHECKBOX_PREVIEW:
- case ExtendedFilePickerElementIds::CHECKBOX_SELECTION:
+ case CHECKBOX_AUTOEXTENSION:
+ case CHECKBOX_PASSWORD:
+ case CHECKBOX_FILTEROPTIONS:
+ case CHECKBOX_READONLY:
+ case CHECKBOX_LINK:
+ case CHECKBOX_PREVIEW:
+ case CHECKBOX_SELECTION:
{
QString label;
@@ -690,21 +598,22 @@ void KDE4FilePicker::addCustomControl(sal_Int16 controlId)
}
widget = new QCheckBox(label, _extraControls);
+
// the checkbox is created even for CHECKBOX_AUTOEXTENSION to simplify
// code, but the checkbox is hidden and ignored
- if( controlId == ExtendedFilePickerElementIds::CHECKBOX_AUTOEXTENSION )
+ if( controlId == CHECKBOX_AUTOEXTENSION )
widget->hide();
break;
}
- case ExtendedFilePickerElementIds::PUSHBUTTON_PLAY:
- case ExtendedFilePickerElementIds::LISTBOX_VERSION:
- case ExtendedFilePickerElementIds::LISTBOX_TEMPLATE:
- case ExtendedFilePickerElementIds::LISTBOX_IMAGE_TEMPLATE:
- case ExtendedFilePickerElementIds::LISTBOX_VERSION_LABEL:
- case ExtendedFilePickerElementIds::LISTBOX_TEMPLATE_LABEL:
- case ExtendedFilePickerElementIds::LISTBOX_IMAGE_TEMPLATE_LABEL:
- case ExtendedFilePickerElementIds::LISTBOX_FILTER_SELECTOR:
+ case PUSHBUTTON_PLAY:
+ case LISTBOX_VERSION:
+ case LISTBOX_TEMPLATE:
+ case LISTBOX_IMAGE_TEMPLATE:
+ case LISTBOX_VERSION_LABEL:
+ case LISTBOX_TEMPLATE_LABEL:
+ case LISTBOX_IMAGE_TEMPLATE_LABEL:
+ case LISTBOX_FILTER_SELECTOR:
break;
}
@@ -761,53 +670,53 @@ void SAL_CALL KDE4FilePicker::initialize( const uno::Sequence<uno::Any> &args )
case FILESAVE_AUTOEXTENSION:
operationMode = KFileDialog::Saving;
- addCustomControl( ExtendedFilePickerElementIds::CHECKBOX_AUTOEXTENSION );
+ addCustomControl( CHECKBOX_AUTOEXTENSION );
break;
case FILESAVE_AUTOEXTENSION_PASSWORD:
{
operationMode = KFileDialog::Saving;
- addCustomControl( ExtendedFilePickerElementIds::CHECKBOX_PASSWORD );
+ addCustomControl( CHECKBOX_PASSWORD );
break;
}
case FILESAVE_AUTOEXTENSION_PASSWORD_FILTEROPTIONS:
{
operationMode = KFileDialog::Saving;
- addCustomControl( ExtendedFilePickerElementIds::CHECKBOX_AUTOEXTENSION );
- addCustomControl( ExtendedFilePickerElementIds::CHECKBOX_PASSWORD );
- addCustomControl( ExtendedFilePickerElementIds::CHECKBOX_FILTEROPTIONS );
+ addCustomControl( CHECKBOX_AUTOEXTENSION );
+ addCustomControl( CHECKBOX_PASSWORD );
+ addCustomControl( CHECKBOX_FILTEROPTIONS );
break;
}
case FILESAVE_AUTOEXTENSION_SELECTION:
operationMode = KFileDialog::Saving;
- addCustomControl( ExtendedFilePickerElementIds::CHECKBOX_AUTOEXTENSION );
- addCustomControl( ExtendedFilePickerElementIds::CHECKBOX_SELECTION );
+ addCustomControl( CHECKBOX_AUTOEXTENSION );
+ addCustomControl( CHECKBOX_SELECTION );
break;
case FILESAVE_AUTOEXTENSION_TEMPLATE:
operationMode = KFileDialog::Saving;
- addCustomControl( ExtendedFilePickerElementIds::CHECKBOX_AUTOEXTENSION );
- addCustomControl( ExtendedFilePickerElementIds::LISTBOX_TEMPLATE );
+ addCustomControl( CHECKBOX_AUTOEXTENSION );
+ addCustomControl( LISTBOX_TEMPLATE );
break;
case FILEOPEN_LINK_PREVIEW_IMAGE_TEMPLATE:
- addCustomControl( ExtendedFilePickerElementIds::CHECKBOX_LINK );
- addCustomControl( ExtendedFilePickerElementIds::CHECKBOX_PREVIEW );
- addCustomControl( ExtendedFilePickerElementIds::LISTBOX_IMAGE_TEMPLATE );
+ addCustomControl( CHECKBOX_LINK );
+ addCustomControl( CHECKBOX_PREVIEW );
+ addCustomControl( LISTBOX_IMAGE_TEMPLATE );
break;
case FILEOPEN_PLAY:
- addCustomControl( ExtendedFilePickerElementIds::PUSHBUTTON_PLAY );
+ addCustomControl( PUSHBUTTON_PLAY );
break;
case FILEOPEN_READONLY_VERSION:
- addCustomControl( ExtendedFilePickerElementIds::CHECKBOX_READONLY );
- addCustomControl( ExtendedFilePickerElementIds::LISTBOX_VERSION );
+ addCustomControl( CHECKBOX_READONLY );
+ addCustomControl( LISTBOX_VERSION );
break;
case FILEOPEN_LINK_PREVIEW:
- addCustomControl( ExtendedFilePickerElementIds::CHECKBOX_LINK );
- addCustomControl( ExtendedFilePickerElementIds::CHECKBOX_PREVIEW );
+ addCustomControl( CHECKBOX_LINK );
+ addCustomControl( CHECKBOX_PREVIEW );
break;
default:
More information about the Libreoffice-commits
mailing list