macOS: Remove DontConfirmOverwrite workaround

Does not work any more on recent macOS versions.

As a bonus, Qt now handles file names which contain
“___qt_very_unlikely_prefix_” correctly.

Pick-to: 5.15 6.0
Task-number: QTBUG-39791
Change-Id: I944a68efa18edc72939d953ab32ecb53d8f8e1c4
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
This commit is contained in:
Morten Johan Sørvig 2020-12-10 15:27:32 +01:00 committed by Tor Arne Vestbø
parent 9c56d4da2f
commit fded886ff4

View File

@ -331,14 +331,7 @@ static QString strippedText(QString s)
- (NSString *)panel:(id)sender userEnteredFilename:(NSString *)filename confirmed:(BOOL)okFlag
{
Q_UNUSED(sender);
if (!okFlag)
return filename;
if (!mOptions->testOption(QFileDialogOptions::DontConfirmOverwrite))
return filename;
// User has clicked save, and no overwrite confirmation should occur.
// To get the latter, we need to change the name we return (hence the prefix):
return [@"___qt_very_unlikely_prefix_" stringByAppendingString:filename];
return filename;
}
- (void)setNameFilters:(const QStringList &)filters hideDetails:(BOOL)hideDetails
@ -396,7 +389,7 @@ static QString strippedText(QString s)
if (fileInfo.suffix().isEmpty() && !defaultSuffix.isEmpty()) {
filename.append('.').append(defaultSuffix);
}
result << QUrl::fromLocalFile(filename.remove(QLatin1String("___qt_very_unlikely_prefix_")));
result << QUrl::fromLocalFile(filename);
return result;
}
}