55 lines
2.3 KiB
Diff
55 lines
2.3 KiB
Diff
From 0f8c2d7922ca130971ac3a83ed86d8e552171389 Mon Sep 17 00:00:00 2001
|
|
From: Igor Janssen <alaves17@gmail.com>
|
|
Date: Sat, 10 Feb 2018 09:48:52 -0700
|
|
Subject: Fix bug #382437 "Regression in kdialog causes wrong file extension"
|
|
|
|
Summary:
|
|
BUG: 382437
|
|
One cause of the bug is commit at plasma-integration:
|
|
0dafb9403266d6064074250d44b74dc0db946cfb
|
|
//Make sure we always set a default mime filter in save mode
|
|
KFileWidget::setMimeFilter() documentation says a default mime filter
|
|
should be set if the dialog is being open in save mode.
|
|
Without a default filter, the dialog uses a custom item (created by
|
|
concatenating all the mime type filters) as default. This is not useful
|
|
because it means an additional click for the user to select a filter that can
|
|
actually be useful.
|
|
If the initiallySelectedMimeTypeFilter() is empty, we use the first mime
|
|
filter as fallback.//
|
|
|
|
Chrome opens kdialog with 2 mime types: application/octet-stream (means any file) and (for example) image/jpeg. But application/octet-stream is associated with *.bin extension. When you choose this mime extention becomes *.bin. That commit does this mime default (it's first).
|
|
This patch blocks changing extention to bin for "application/octet-stream" selected.
|
|
|
|
Test Plan: Tested with Google Chrome. Used Open/Save dialogs for files.
|
|
|
|
Reviewers: #plasma, dfaure
|
|
|
|
Reviewed By: dfaure
|
|
|
|
Subscribers: ngraham, aacid, broulik, plasma-devel, #frameworks
|
|
|
|
Tags: #frameworks, #plasma
|
|
|
|
Differential Revision: https://phabricator.kde.org/D10114
|
|
---
|
|
src/filewidgets/kfilewidget.cpp | 3 ++-
|
|
1 file changed, 2 insertions(+), 1 deletion(-)
|
|
|
|
diff --git a/src/filewidgets/kfilewidget.cpp b/src/filewidgets/kfilewidget.cpp
|
|
index aeb8dea..39c09b8 100644
|
|
--- a/src/filewidgets/kfilewidget.cpp
|
|
+++ b/src/filewidgets/kfilewidget.cpp
|
|
@@ -2258,7 +2258,8 @@ void KFileWidgetPrivate::updateAutoSelectExtension()
|
|
}
|
|
}
|
|
|
|
- if (!currentExtension.isEmpty() && extensionList.contains(QLatin1String("*.") + currentExtension)) {
|
|
+ if ((!currentExtension.isEmpty() && extensionList.contains(QLatin1String("*.") + currentExtension))
|
|
+ || filter == QStringLiteral("application/octet-stream")) {
|
|
extension = QLatin1Char('.') + currentExtension;
|
|
} else {
|
|
extension = defaultExtension;
|
|
--
|
|
cgit v0.11.2
|
|
|