Blame SOURCES/0001-Resolves-rhbz-1715109-add-All-files-to-the-graphic-i.patch

bf2fec
From bcb05a5daba9aafdc3921322676f33e055413f9f Mon Sep 17 00:00:00 2001
bf2fec
From: =?UTF-8?q?Caol=C3=A1n=20McNamara?= <caolanm@redhat.com>
bf2fec
Date: Fri, 31 May 2019 15:33:00 +0100
bf2fec
Subject: [PATCH] Resolves: rhbz#1715109 add All files to the graphic import
bf2fec
 dialog
bf2fec
MIME-Version: 1.0
bf2fec
Content-Type: text/plain; charset=UTF-8
bf2fec
Content-Transfer-Encoding: 8bit
bf2fec
bf2fec
to pick up things without extensions, for consistency with file->open
bf2fec
bf2fec
Reviewed-on: https://gerrit.libreoffice.org/73276
bf2fec
Tested-by: Jenkins
bf2fec
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
bf2fec
Tested-by: Caolán McNamara <caolanm@redhat.com>
bf2fec
(cherry picked from commit c6c14f6ae7f6d7768b450e7776db917bb662f3cf)
bf2fec
bf2fec
Change-Id: Ib119fb0d053d1d288eee7cd17fa4f12dcb9956d7
bf2fec
---
bf2fec
 sfx2/source/dialog/filedlghelper.cxx | 20 ++++++++++++++++----
bf2fec
 1 file changed, 16 insertions(+), 4 deletions(-)
bf2fec
bf2fec
diff --git a/sfx2/source/dialog/filedlghelper.cxx b/sfx2/source/dialog/filedlghelper.cxx
bf2fec
index 3820ee4107c9..737dcb278a2a 100644
bf2fec
--- a/sfx2/source/dialog/filedlghelper.cxx
bf2fec
+++ b/sfx2/source/dialog/filedlghelper.cxx
bf2fec
@@ -1872,11 +1872,23 @@ void FileDialogHelper_Impl::addGraphicFilter()
bf2fec
 
bf2fec
     try
bf2fec
     {
bf2fec
-        OUString aAllFilterName = SfxResId( STR_SFX_IMPORT_ALL );
bf2fec
-        aAllFilterName = ::sfx2::addExtension( aAllFilterName, aExtensions, bIsInOpenMode, *this );
bf2fec
+        // if the extension is not "All files", insert "All images"
bf2fec
+        if (aExtensions != FILEDIALOG_FILTER_ALL)
bf2fec
+        {
bf2fec
+            OUString aAllFilterName = SfxResId(STR_SFX_IMPORT_ALL);
bf2fec
+            aAllFilterName = ::sfx2::addExtension( aAllFilterName, aExtensions, bIsInOpenMode, *this );
bf2fec
+            xFltMgr->appendFilter( aAllFilterName, aExtensions );
bf2fec
+            maSelectFilter = aAllFilterName; // and make it the default
bf2fec
+        }
bf2fec
+
bf2fec
+        // rhbz#1715109 always include All files *.* or *
bf2fec
+        OUString aAllFilesName = SfxResId( STR_SFX_FILTERNAME_ALL );
bf2fec
+        aAllFilesName = ::sfx2::addExtension( aAllFilesName, FILEDIALOG_FILTER_ALL, bIsInOpenMode, *this );
bf2fec
+        xFltMgr->appendFilter( aAllFilesName, FILEDIALOG_FILTER_ALL );
bf2fec
 
bf2fec
-        xFltMgr->appendFilter( aAllFilterName, aExtensions );
bf2fec
-        maSelectFilter = aAllFilterName;
bf2fec
+        // if the extension is "All files", make that the default
bf2fec
+        if (aExtensions == FILEDIALOG_FILTER_ALL)
bf2fec
+            maSelectFilter = aAllFilesName;
bf2fec
     }
bf2fec
     catch( const IllegalArgumentException& )
bf2fec
     {
bf2fec
-- 
bf2fec
2.21.0
bf2fec