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

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