The editable flag for files is now respected by the editor, and trash files are not editable
This commit is contained in:
+4
-1
@@ -164,6 +164,7 @@ class GuiDocEditor(QTextEdit):
|
||||
# If we have a document open, we should reload it in case the font changed, otherwise
|
||||
# we just clear the editor entirely, which makes it read only.
|
||||
if self.theHandle is not None:
|
||||
# We must save the current handle as clearEditor() sets it to None
|
||||
tHandle = self.theHandle
|
||||
self.clearEditor()
|
||||
self.loadText(tHandle)
|
||||
@@ -194,9 +195,11 @@ class GuiDocEditor(QTextEdit):
|
||||
self._runCounter()
|
||||
self.wcTimer.start()
|
||||
self.setDocumentChanged(False)
|
||||
self.setReadOnly(False)
|
||||
self.theHandle = tHandle
|
||||
|
||||
if self.nwDocument.docEditable:
|
||||
self.setReadOnly(False)
|
||||
|
||||
return True
|
||||
|
||||
def saveText(self):
|
||||
|
||||
+13
-9
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user