Commit fc69e4ef authored by Eike Ziller's avatar Eike Ziller

Fix that it was not possible to save with arbitrary file extension

On Windows.

Task-number: QTCREATORBUG-15862
Change-Id: I5cc76662e4996bfa26eece09f2e30dc3ce873eb5
Reviewed-by: David Schulz's avatarDavid Schulz <>
parent 53d45de8
......@@ -59,7 +59,11 @@
#include <algorithm>
#include <functional>
static const char ALL_FILES_FILTER[] = QT_TRANSLATE_NOOP("Core", "All Files (*)");
#ifdef Q_OS_WIN
static struct {const char *source; const char *comment; } ALL_FILES_FILTER = QT_TRANSLATE_NOOP3("Core", "All Files (*.*)", "On Windows");
static struct {const char *source; const char *comment; } ALL_FILES_FILTER = QT_TRANSLATE_NOOP3("Core", "All Files (*)", "On Linux/macOS");
using namespace Utils;
using namespace Utils::Internal;
......@@ -348,8 +352,7 @@ QString MimeDatabase::allFiltersString(QString *allFilesFilter)
foreach (const QString &filter, uniqueFilters)
static const QString allFiles =
QCoreApplication::translate("Core", ALL_FILES_FILTER);
const QString allFiles = allFilesFilterString();
if (allFilesFilter)
*allFilesFilter = allFiles;
......@@ -359,6 +362,11 @@ QString MimeDatabase::allFiltersString(QString *allFilesFilter)
return filters.join(QLatin1String(";;"));
QString MimeDatabase::allFilesFilterString()
return QCoreApplication::translate("Core", ALL_FILES_FILTER.source, ALL_FILES_FILTER.comment);
QStringList MimeDatabase::allGlobPatterns()
MimeDatabase mdb;
......@@ -91,6 +91,7 @@ public:
// Qt Creator additions
static void addMimeTypes(const QString &fileName);
static QString allFiltersString(QString *allFilesFilter = 0);
static QString allFilesFilterString();
static QStringList allGlobPatterns();
static QMap<int, QList<Internal::MimeMagicRule> > magicRulesForMimeType(const MimeType &mimeType); // priority -> rules
static void setGlobPatternsForMimeType(const MimeType &mimeType, const QStringList &patterns);
......@@ -199,8 +199,6 @@ const char SETTINGS_DEFAULTTEXTENCODING[] = "General/DefaultFileEncoding";
const char SETTINGS_THEME[] = "Core/CreatorTheme";
const char DEFAULT_THEME[] = "flat";
const char ALL_FILES_FILTER[] = QT_TRANSLATE_NOOP("Core", "All Files (*)");
const char TR_CLEAR_MENU[] = QT_TRANSLATE_NOOP("Core", "Clear Menu");
const char DEFAULT_BUILD_DIRECTORY[] = "../build-%{CurrentProject:Name}-%{CurrentKit:FileSystemName}-%{CurrentBuild:Name}";
......@@ -696,8 +696,7 @@ QString DocumentManager::getSaveFileName(const QString &title, const QString &pa
// specified. Otherwise the suffix must be one available in the selected filter. If
// the name already ends with such suffix nothing needs to be done. But if not, the
// first one from the filter is appended.
if (selectedFilter && *selectedFilter != QCoreApplication::translate(
"Core", Constants::ALL_FILES_FILTER)) {
if (selectedFilter && *selectedFilter != MimeDatabase::allFilesFilterString()) {
// Mime database creates filter strings like this: Anything here (*.foo *.bar)
QRegExp regExp(QLatin1String(".*\\s+\\((.*)\\)$"));
const int index = regExp.lastIndexIn(*selectedFilter);
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment