summaryrefslogtreecommitdiff
path: root/vcl
diff options
context:
space:
mode:
Diffstat (limited to 'vcl')
-rw-r--r--vcl/unx/kde5/KDE5FilePicker.cxx18
-rw-r--r--vcl/unx/kde5/KDE5FilePicker.hxx14
-rw-r--r--vcl/unx/kde5/KDE5FilePicker2.cxx36
3 files changed, 48 insertions, 20 deletions
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)
{