[Libreoffice-commits] core.git: Branch 'feature/qt5+kde5' - vcl/unx
Katarina Behrens
Katarina.Behrens at cib.de
Mon Jun 11 13:25:46 UTC 2018
vcl/unx/kde5/KDE5FilePicker.cxx | 18 ------------------
vcl/unx/kde5/KDE5FilePicker.hxx | 14 ++++++++++++++
vcl/unx/kde5/KDE5FilePicker2.cxx | 36 ++++++++++++++++++++++++++++++++++--
3 files changed, 48 insertions(+), 20 deletions(-)
New commits:
commit 857524324f3c4f99fb96ebe0b9b04d25d1febe62
Author: Katarina Behrens <Katarina.Behrens at cib.de>
Date: Mon Jun 11 15:22:07 2018 +0200
Implement appendFilter[Group], signal+slot
Change-Id: I0a195de54a8631c2218f6704ca564c0c9f06becf
diff --git a/vcl/unx/kde5/KDE5FilePicker.cxx b/vcl/unx/kde5/KDE5FilePicker.cxx
index dd5f3c0ecc45..be8a6050426e 100644
--- a/vcl/unx/kde5/KDE5FilePicker.cxx
+++ b/vcl/unx/kde5/KDE5FilePicker.cxx
@@ -57,24 +57,6 @@ QString KDE5FilePicker::getDisplayDirectory() const { return _dialog->directoryU
QList<QUrl> KDE5FilePicker::getSelectedFiles() const { return _dialog->selectedUrls(); }
-void KDE5FilePicker::appendFilter(const QString& title, const QString& filter)
-{
- QString t = title;
- QString f = filter;
- // '/' need to be escaped else they are assumed to be mime types by kfiledialog
- //see the docs
- t.replace("/", "\\/");
-
- // openoffice gives us filters separated by ';' qt dialogs just want space separated
- f.replace(";", " ");
-
- // make sure "*.*" is not used as "all files"
- f.replace("*.*", "*");
-
- _filters << QStringLiteral("%1 (%2)").arg(t, f);
- _titleToFilters[t] = _filters.constLast();
-}
-
void KDE5FilePicker::setCurrentFilter(const QString& title)
{
_currentFilter = _titleToFilters.value(title);
diff --git a/vcl/unx/kde5/KDE5FilePicker.hxx b/vcl/unx/kde5/KDE5FilePicker.hxx
index 675becf0bf68..a5ab496a289b 100644
--- a/vcl/unx/kde5/KDE5FilePicker.hxx
+++ b/vcl/unx/kde5/KDE5FilePicker.hxx
@@ -176,6 +176,9 @@ Q_SIGNALS:
void setDisplayDirectorySignal(const OUString& rDir);
void setValueSignal(sal_Int16 nControlId, sal_Int16 nControlAction,
const css::uno::Any& rValue);
+ void appendFilterSignal(const OUString& rTitle, const OUString& rFilter);
+ void appendFilterGroupSignal(const OUString& rTitle,
+ const css::uno::Sequence<css::beans::StringPair>& rFilters);
private Q_SLOTS:
void setTitleSlot(const OUString& rTitle) { return setTitle(rTitle); }
@@ -184,6 +187,17 @@ private Q_SLOTS:
{
return setValue(nControlAction, nControlAction, rValue);
}
+
+ void appendFilterSlot(const OUString& rTitle, const OUString& rFilter)
+ {
+ return appendFilter(rTitle, rFilter);
+ }
+
+ void appendFilterGroupSlot(const OUString& rTitle,
+ const css::uno::Sequence<css::beans::StringPair>& rFilters)
+ {
+ return appendFilterGroup(rTitle, rFilters);
+ }
};
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/unx/kde5/KDE5FilePicker2.cxx b/vcl/unx/kde5/KDE5FilePicker2.cxx
index ab3cc61191ed..c75c56c21095 100644
--- a/vcl/unx/kde5/KDE5FilePicker2.cxx
+++ b/vcl/unx/kde5/KDE5FilePicker2.cxx
@@ -107,6 +107,10 @@ KDE5FilePicker::KDE5FilePicker(QFileDialog::FileMode eMode)
Qt::BlockingQueuedConnection);
connect(this, &KDE5FilePicker::setValueSignal, this, &KDE5FilePicker::setValueSlot,
Qt::BlockingQueuedConnection);
+ connect(this, &KDE5FilePicker::appendFilterSignal, this, &KDE5FilePicker::appendFilterSlot,
+ Qt::BlockingQueuedConnection);
+ connect(this, &KDE5FilePicker::appendFilterGroupSignal, this,
+ &KDE5FilePicker::appendFilterGroupSlot, Qt::BlockingQueuedConnection);
qApp->installEventFilter(this);
setMultiSelectionMode(false);
@@ -183,7 +187,29 @@ uno::Sequence<OUString> SAL_CALL KDE5FilePicker::getSelectedFiles()
return seq;
}
-void SAL_CALL KDE5FilePicker::appendFilter(const OUString& title, const OUString& filter) {}
+void SAL_CALL KDE5FilePicker::appendFilter(const OUString& title, const OUString& filter)
+{
+ if (qApp->thread() != QThread::currentThread())
+ {
+ SolarMutexReleaser aReleaser;
+ return Q_EMIT appendFilterSignal(title, filter);
+ }
+
+ QString t(toQString(title));
+ QString f(toQString(filter));
+ // '/' need to be escaped else they are assumed to be mime types by kfiledialog
+ //see the docs
+ t.replace("/", "\\/");
+
+ // libreoffice separates by filters by ';' qt dialogs by space
+ f.replace(";", " ");
+
+ // make sure "*.*" is not used as "all files"
+ f.replace("*.*", "*");
+
+ _filters << QStringLiteral("%1 (%2)").arg(t, f);
+ _titleToFilters[t] = _filters.constLast();
+}
void SAL_CALL KDE5FilePicker::setCurrentFilter(const OUString& title) {}
@@ -193,9 +219,15 @@ OUString SAL_CALL KDE5FilePicker::getCurrentFilter()
return filter;
}
-void SAL_CALL KDE5FilePicker::appendFilterGroup(const OUString& /*rGroupTitle*/,
+void SAL_CALL KDE5FilePicker::appendFilterGroup(const OUString& rGroupTitle,
const uno::Sequence<beans::StringPair>& filters)
{
+ if (qApp->thread() != QThread::currentThread())
+ {
+ SolarMutexReleaser aReleaser;
+ return Q_EMIT appendFilterGroupSignal(rGroupTitle, filters);
+ }
+
const sal_uInt16 length = filters.getLength();
for (sal_uInt16 i = 0; i < length; ++i)
{
More information about the Libreoffice-commits
mailing list