Also fall back to direct write for Android content: URLs in QSaveFile
We cannot rename into content: URLs, so that is the only option, and this is particularly relevant here as the native file dialog will give us content: URLs by default for saving to. Change-Id: Ie96fcfc404a0842d397c7d1554e3c76f06bb3074 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This commit is contained in:
parent
02c0d67e3b
commit
23cfdf74cb
@ -244,9 +244,15 @@ bool QSaveFile::open(OpenMode mode)
|
||||
return false;
|
||||
};
|
||||
|
||||
bool requiresDirectWrite = false;
|
||||
#ifdef Q_OS_WIN
|
||||
// check if it is an Alternate Data Stream
|
||||
if (d->finalFileName == d->fileName && d->fileName.indexOf(QLatin1Char(':'), 2) > 1) {
|
||||
requiresDirectWrite = d->finalFileName == d->fileName && d->fileName.indexOf(QLatin1Char(':'), 2) > 1;
|
||||
#elif defined(Q_OS_ANDROID)
|
||||
// check if it is a content:// URL
|
||||
requiresDirectWrite = d->fileName.startsWith(QLatin1String("content://"));
|
||||
#endif
|
||||
if (requiresDirectWrite) {
|
||||
// yes, we can't rename onto it...
|
||||
if (d->directWriteFallback) {
|
||||
if (openDirectly())
|
||||
@ -256,14 +262,12 @@ bool QSaveFile::open(OpenMode mode)
|
||||
d->fileEngine = 0;
|
||||
} else {
|
||||
QString msg =
|
||||
QSaveFile::tr("QSaveFile cannot open '%1' without direct write fallback "
|
||||
"enabled: path contains an Alternate Data Stream specifier")
|
||||
.arg(QDir::toNativeSeparators(d->fileName));
|
||||
QSaveFile::tr("QSaveFile cannot open '%1' without direct write fallback enabled.")
|
||||
.arg(QDir::toNativeSeparators(d->fileName));
|
||||
d->setError(QFileDevice::OpenError, msg);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
|
||||
d->fileEngine = new QTemporaryFileEngine(&d->finalFileName, QTemporaryFileEngine::Win32NonShared);
|
||||
// if the target file exists, we'll copy its permissions below,
|
||||
|
Loading…
x
Reference in New Issue
Block a user