diff options
author | Katarina Behrens <Katarina.Behrens@cib.de> | 2018-06-12 12:54:59 +0200 |
---|---|---|
committer | Katarina Behrens <Katarina.Behrens@cib.de> | 2018-06-18 15:27:59 +0200 |
commit | db62a779d7ae9a2a321b6756b72064631af6aa04 (patch) | |
tree | d4d5184626bc99d39acae32d5ebd5ff7070de452 /vcl | |
parent | a9d1eb47243ad736b463232b3ede82b3d87c9526 (diff) |
Implement get|setCurrentFilter, signal+slot
Change-Id: I1fb29b673e5cb474de7230407b7924844b1460e0
Diffstat (limited to 'vcl')
-rw-r--r-- | vcl/unx/kde5/KDE5FilePicker.cxx | 16 | ||||
-rw-r--r-- | vcl/unx/kde5/KDE5FilePicker.hxx | 5 | ||||
-rw-r--r-- | vcl/unx/kde5/KDE5FilePicker2.cxx | 28 |
3 files changed, 31 insertions, 18 deletions
diff --git a/vcl/unx/kde5/KDE5FilePicker.cxx b/vcl/unx/kde5/KDE5FilePicker.cxx index be8a6050426e..a8486bbcb6b2 100644 --- a/vcl/unx/kde5/KDE5FilePicker.cxx +++ b/vcl/unx/kde5/KDE5FilePicker.cxx @@ -57,22 +57,6 @@ QString KDE5FilePicker::getDisplayDirectory() const { return _dialog->directoryU QList<QUrl> KDE5FilePicker::getSelectedFiles() const { return _dialog->selectedUrls(); } -void KDE5FilePicker::setCurrentFilter(const QString& title) -{ - _currentFilter = _titleToFilters.value(title); -} - -QString KDE5FilePicker::getCurrentFilter() const -{ - QString filter = _titleToFilters.key(_dialog->selectedNameFilter()); - - //default if not found - if (filter.isEmpty()) - filter = "ODF Text Document (.odt)"; - - return filter; -} - bool KDE5FilePicker::getValue(sal_Int16 controlId, sal_Int16 nControlAction) const { bool ret = false; diff --git a/vcl/unx/kde5/KDE5FilePicker.hxx b/vcl/unx/kde5/KDE5FilePicker.hxx index a5ab496a289b..d4d6cae229cc 100644 --- a/vcl/unx/kde5/KDE5FilePicker.hxx +++ b/vcl/unx/kde5/KDE5FilePicker.hxx @@ -179,6 +179,8 @@ Q_SIGNALS: void appendFilterSignal(const OUString& rTitle, const OUString& rFilter); void appendFilterGroupSignal(const OUString& rTitle, const css::uno::Sequence<css::beans::StringPair>& rFilters); + void setCurrentFilterSignal(const OUString& rFilter); + OUString getCurrentFilterSignal(); private Q_SLOTS: void setTitleSlot(const OUString& rTitle) { return setTitle(rTitle); } @@ -198,6 +200,9 @@ private Q_SLOTS: { return appendFilterGroup(rTitle, rFilters); } + + void setCurrentFilterSlot(const OUString& rFilter) { return setCurrentFilter(rFilter); } + OUString getCurrentFilterSlot() { return getCurrentFilter(); } }; /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/unx/kde5/KDE5FilePicker2.cxx b/vcl/unx/kde5/KDE5FilePicker2.cxx index c75c56c21095..05e9c61976e2 100644 --- a/vcl/unx/kde5/KDE5FilePicker2.cxx +++ b/vcl/unx/kde5/KDE5FilePicker2.cxx @@ -111,6 +111,10 @@ KDE5FilePicker::KDE5FilePicker(QFileDialog::FileMode eMode) Qt::BlockingQueuedConnection); connect(this, &KDE5FilePicker::appendFilterGroupSignal, this, &KDE5FilePicker::appendFilterGroupSlot, Qt::BlockingQueuedConnection); + connect(this, &KDE5FilePicker::setCurrentFilterSignal, this, + &KDE5FilePicker::setCurrentFilterSlot, Qt::BlockingQueuedConnection); + connect(this, &KDE5FilePicker::getCurrentFilterSignal, this, + &KDE5FilePicker::getCurrentFilterSlot, Qt::BlockingQueuedConnection); qApp->installEventFilter(this); setMultiSelectionMode(false); @@ -211,11 +215,31 @@ void SAL_CALL KDE5FilePicker::appendFilter(const OUString& title, const OUString _titleToFilters[t] = _filters.constLast(); } -void SAL_CALL KDE5FilePicker::setCurrentFilter(const OUString& title) {} +void SAL_CALL KDE5FilePicker::setCurrentFilter(const OUString& title) +{ + if (qApp->thread() != QThread::currentThread()) + { + SolarMutexReleaser aReleaser; + return Q_EMIT setCurrentFilterSignal(title); + } + + _currentFilter = _titleToFilters.value(toQString(title)); +} OUString SAL_CALL KDE5FilePicker::getCurrentFilter() { - OUString filter; + if (qApp->thread() != QThread::currentThread()) + { + SolarMutexReleaser aReleaser; + return Q_EMIT getCurrentFilterSignal(); + } + + OUString filter = toOUString(_titleToFilters.key(_dialog->selectedNameFilter())); + + //default if not found + if (filter.isEmpty()) + filter = "ODF Text Document (.odt)"; + return filter; } |