Fix bug #7035: Read-only status and compressed status not set correctly when an autosave or emergency file is loaded, or when the file is been converted by lyx2lyx.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@36497 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Vincent van Ravesteijn 2010-11-26 02:01:04 +00:00
parent 73a1a11018
commit 3508aaf2db

View File

@ -889,8 +889,8 @@ Buffer::ReadStatus Buffer::readFile(FileName const & fn)
} }
d->file_fully_loaded = true; d->file_fully_loaded = true;
d->read_only = !fname.isWritable(); d->read_only = !d->filename.isWritable();
params().compressed = fname.isZippedFile(); params().compressed = d->filename.isZippedFile();
saveCheckSum(); saveCheckSum();
return ReadSuccess; return ReadSuccess;
} }
@ -3659,6 +3659,13 @@ Buffer::ReadStatus Buffer::loadEmergency()
ReadStatus const ret_llf = loadThisLyXFile(emergencyFile); ReadStatus const ret_llf = loadThisLyXFile(emergencyFile);
bool const success = (ret_llf == ReadSuccess); bool const success = (ret_llf == ReadSuccess);
if (success) { if (success) {
if (isReadonly()) {
Alert::warning(_("File is read-only"),
bformat(_("An emergency file is succesfully loaded, "
"but the original file %1$s is marked read-only. "
"Please make sure to save the document as a different "
"file."), from_utf8(d->filename.absFileName())));
}
markDirty(); markDirty();
str = _("Document was successfully recovered."); str = _("Document was successfully recovered.");
} else } else
@ -3714,6 +3721,14 @@ Buffer::ReadStatus Buffer::loadAutosave()
ReadStatus const ret_llf = loadThisLyXFile(autosaveFile); ReadStatus const ret_llf = loadThisLyXFile(autosaveFile);
// the file is not saved if we load the autosave file. // the file is not saved if we load the autosave file.
if (ret_llf == ReadSuccess) { if (ret_llf == ReadSuccess) {
if (isReadonly()) {
Alert::warning(_("File is read-only"),
bformat(_("A backup file is succesfully loaded, "
"but the original file %1$s is marked read-only. "
"Please make sure to save the document as a "
"different file."),
from_utf8(d->filename.absFileName())));
}
markDirty(); markDirty();
return ReadSuccess; return ReadSuccess;
} }