[Libreoffice-commits] core.git: Branch 'feature/qt5+kde5' - 2 commits - vcl/unx
Katarina Behrens
Katarina.Behrens at cib.de
Tue Jun 12 14:37:25 UTC 2018
Rebased ref, commits from common ancestor:
commit 4dd64053fa3d5b9f3e8d55aa0d2b31768d3f8474
Author: Katarina Behrens <Katarina.Behrens at cib.de>
Date: Tue Jun 12 16:25:25 2018 +0200
Implement getSelectedFiles, signal+slot
this finally makes fpicker usable
Change-Id: Iedf7ed8de04947ffbc0e88348c95f2a937a8e69e
diff --git a/vcl/unx/kde5/KDE5FilePicker.cxx b/vcl/unx/kde5/KDE5FilePicker.cxx
index a8486bbcb6b2..2e9f3bd66752 100644
--- a/vcl/unx/kde5/KDE5FilePicker.cxx
+++ b/vcl/unx/kde5/KDE5FilePicker.cxx
@@ -55,8 +55,6 @@ void KDE5FilePicker::setDefaultName(const QString& name) { _dialog->selectUrl(QU
QString KDE5FilePicker::getDisplayDirectory() const { return _dialog->directoryUrl().url(); }
-QList<QUrl> KDE5FilePicker::getSelectedFiles() const { return _dialog->selectedUrls(); }
-
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 d4d6cae229cc..36cfb4263a11 100644
--- a/vcl/unx/kde5/KDE5FilePicker.hxx
+++ b/vcl/unx/kde5/KDE5FilePicker.hxx
@@ -181,6 +181,7 @@ Q_SIGNALS:
const css::uno::Sequence<css::beans::StringPair>& rFilters);
void setCurrentFilterSignal(const OUString& rFilter);
OUString getCurrentFilterSignal();
+ css::uno::Sequence<OUString> getSelectedFilesSignal();
private Q_SLOTS:
void setTitleSlot(const OUString& rTitle) { return setTitle(rTitle); }
@@ -203,6 +204,7 @@ private Q_SLOTS:
void setCurrentFilterSlot(const OUString& rFilter) { return setCurrentFilter(rFilter); }
OUString getCurrentFilterSlot() { return getCurrentFilter(); }
+ css::uno::Sequence<OUString> getSelectedFilesSlot() { return getFiles(); }
};
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/unx/kde5/KDE5FilePicker2.cxx b/vcl/unx/kde5/KDE5FilePicker2.cxx
index 05e9c61976e2..da068240a502 100644
--- a/vcl/unx/kde5/KDE5FilePicker2.cxx
+++ b/vcl/unx/kde5/KDE5FilePicker2.cxx
@@ -115,6 +115,8 @@ KDE5FilePicker::KDE5FilePicker(QFileDialog::FileMode eMode)
&KDE5FilePicker::setCurrentFilterSlot, Qt::BlockingQueuedConnection);
connect(this, &KDE5FilePicker::getCurrentFilterSignal, this,
&KDE5FilePicker::getCurrentFilterSlot, Qt::BlockingQueuedConnection);
+ connect(this, &KDE5FilePicker::getSelectedFilesSignal, this,
+ &KDE5FilePicker::getSelectedFilesSlot, Qt::BlockingQueuedConnection);
qApp->installEventFilter(this);
setMultiSelectionMode(false);
@@ -187,7 +189,21 @@ uno::Sequence<OUString> SAL_CALL KDE5FilePicker::getFiles()
uno::Sequence<OUString> SAL_CALL KDE5FilePicker::getSelectedFiles()
{
- uno::Sequence<OUString> seq;
+ if (qApp->thread() != QThread::currentThread())
+ {
+ SolarMutexReleaser aReleaser;
+ return Q_EMIT getSelectedFilesSignal();
+ }
+
+ QList<QUrl> aURLs = _dialog->selectedUrls();
+ uno::Sequence<OUString> seq(aURLs.size());
+
+ size_t i = 0;
+ for (auto& aURL : aURLs)
+ {
+ seq[i++] = toOUString(aURL.toString());
+ }
+
return seq;
}
commit 64d69910115df2a9b58d4940976bd2aa104b6aee
Author: Katarina Behrens <Katarina.Behrens at cib.de>
Date: Tue Jun 12 12:54:59 2018 +0200
Implement get|setCurrentFilter, signal+slot
Change-Id: I1fb29b673e5cb474de7230407b7924844b1460e0
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;
}
More information about the Libreoffice-commits
mailing list