summaryrefslogtreecommitdiff
path: root/vcl/unx/kde5/KDE5FilePicker2.cxx
diff options
context:
space:
mode:
authorKatarina Behrens <Katarina.Behrens@cib.de>2018-06-11 15:22:07 +0200
committerKatarina Behrens <Katarina.Behrens@cib.de>2018-06-18 15:27:59 +0200
commita9d1eb47243ad736b463232b3ede82b3d87c9526 (patch)
treed6fd2878bf0e3f0a8719b36c370a554f30b56365 /vcl/unx/kde5/KDE5FilePicker2.cxx
parent113b340f2728f8011d2812353f0b511ea2350eb8 (diff)
Implement appendFilter[Group], signal+slot
Change-Id: I0a195de54a8631c2218f6704ca564c0c9f06becf
Diffstat (limited to 'vcl/unx/kde5/KDE5FilePicker2.cxx')
-rw-r--r--vcl/unx/kde5/KDE5FilePicker2.cxx36
1 files changed, 34 insertions, 2 deletions
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)
{