The editable flag for files is now respected by the editor, and trash files are not editable

This commit is contained in:
Veronica K. B. Olsen
2019-10-31 13:37:27 +01:00
parent 7969c58351
commit 9fea45b7df
6 changed files with 67 additions and 34 deletions
+13 -9
View File
@@ -41,8 +41,8 @@ class GuiDocTree(QTreeWidget):
self.theProject = theProject
# Tree Settings
self.theMap = None
self.orphRoot = None
self.theMap = None
self.orphRoot = None
self.clearTree()
@@ -97,15 +97,23 @@ class GuiDocTree(QTreeWidget):
return False
if itemClass is None and pHandle is not None:
itemClass = self.theProject.getItem(pHandle).itemClass
pItem = self.theProject.getItem(pHandle)
if pItem is not None:
itemClass = pItem.itemClass
if itemClass is None:
if itemType is not None:
if itemType == nwItemType.FILE:
self.makeAlert("Please select a location in the tree to add a document.", nwAlert.ERROR)
self.makeAlert(
"Please select a valid location in the tree to add a document.",
nwAlert.ERROR
)
return False
elif itemType == nwItemType.FOLDER:
self.makeAlert("Please select a location in the tree to add a folder.", nwAlert.ERROR)
self.makeAlert(
"Please select a valid location in the tree to add a folder.",
nwAlert.ERROR
)
return False
self.makeAlert("Failed to add new item.", nwAlert.BUG)
return False
@@ -141,10 +149,6 @@ class GuiDocTree(QTreeWidget):
self.makeAlert("Cannot add new files or folders to the trash folder.", nwAlert.ERROR)
return False
if pHandle == self.orphRoot:
self.makeAlert("Cannot add new files or folders to the orphaned folder.", nwAlert.ERROR)
return False
# If we're still here, add the file or folder
if itemType == nwItemType.FILE:
tHandle = self.theProject.newFile("New File", itemClass, pHandle)