forked from qt-creator/qt-creator
IDocument: Simplify permission changes
Take care of handling file permission changes centrally. TextDocument had its own, caching implementation of tracking the backing file's read-only state. Move that into IDocument directly. IDocument::reload with a permission-only change is not a very interesting case, but every subclass needed to add handling of it. Instead, remove TypePermission from the file-change types, and handle it separately via the now unified checkPermissions() implementation. IDocument::reloadBehavior already was never called with TypePermission. Change-Id: I321d47ba6193bc878efa9bb50ba7a739fa492745 Reviewed-by: David Schulz <david.schulz@qt.io>
This commit is contained in:
@@ -68,7 +68,6 @@ public:
|
||||
|
||||
enum ChangeType {
|
||||
TypeContents,
|
||||
TypePermissions,
|
||||
TypeRemoved
|
||||
};
|
||||
|
||||
@@ -104,7 +103,7 @@ public:
|
||||
void setUniqueDisplayName(const QString &name);
|
||||
QString uniqueDisplayName() const;
|
||||
|
||||
virtual bool isFileReadOnly() const;
|
||||
bool isFileReadOnly() const;
|
||||
bool isTemporary() const;
|
||||
void setTemporary(bool temporary);
|
||||
|
||||
@@ -123,7 +122,7 @@ public:
|
||||
virtual ReloadBehavior reloadBehavior(ChangeTrigger state, ChangeType type) const;
|
||||
virtual bool reload(QString *errorString, ReloadFlag flag, ChangeType type);
|
||||
|
||||
virtual void checkPermissions();
|
||||
void checkPermissions();
|
||||
|
||||
bool autoSave(QString *errorString, const QString &filePath);
|
||||
void setRestoredFrom(const QString &name);
|
||||
|
||||
Reference in New Issue
Block a user