[Libreoffice-commits] core.git: Branch 'feature/qt5+kde5' - vcl/unx

Katarina Behrens Katarina.Behrens at cib.de
Tue Jun 12 11:03:23 UTC 2018


 vcl/unx/kde5/KDE5FilePicker.cxx  |   16 ----------------
 vcl/unx/kde5/KDE5FilePicker.hxx  |    5 +++++
 vcl/unx/kde5/KDE5FilePicker2.cxx |   16 ++++++++++++++--
 3 files changed, 19 insertions(+), 18 deletions(-)

New commits:
commit 89a570b0215865f4ade0778052cba6e8e5bca8e8
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..e73feeb13adb 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,19 @@ 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)
+{
+    _currentFilter = _titleToFilters.value(toQString(title));
+}
 
 OUString SAL_CALL KDE5FilePicker::getCurrentFilter()
 {
-    OUString filter;
+    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