Implement note renaming

This commit is contained in:
Tanner Collin 2017-10-09 23:07:54 -06:00
parent 2a2e608bde
commit b23765b998
2 changed files with 13 additions and 7 deletions

View File

@ -84,6 +84,12 @@ class ItemManager:
content=content)
self.syncItems()
def renameNote(self, uuid, new_note_name):
item = self.items[uuid]
item['content']['title'] = new_note_name
item['dirty'] = True
self.syncItems()
def deleteNote(self, uuid):
item = self.items[uuid]
item['deleted'] = True

View File

@ -66,7 +66,6 @@ class StandardNotesFUSE(LoggingMixIn, Operations):
def truncate(self, path, length, fh=None):
note, uuid = self._pathToNote(path)
text = note['text'][:length]
self.item_manager.writeNote(uuid, text)
def write(self, path, data, offset, fh):
@ -79,7 +78,6 @@ class StandardNotesFUSE(LoggingMixIn, Operations):
raise FuseOSError(errno.EIO)
self.item_manager.writeNote(uuid, text)
return len(data)
def create(self, path, mode):
@ -98,7 +96,6 @@ class StandardNotesFUSE(LoggingMixIn, Operations):
def unlink(self, path):
note, uuid = self._pathToNote(path)
self.item_manager.deleteNote(uuid)
return 0
@ -108,10 +105,16 @@ class StandardNotesFUSE(LoggingMixIn, Operations):
def utimens(self, path, times=None):
note, uuid = self._pathToNote(path)
self.item_manager.touchNote(uuid)
return 0
def rename(self, old, new):
note, uuid = self._pathToNote(old)
new_path_parts = new.split('/')
new_note_name = new_path_parts[1]
self.item_manager.renameNote(uuid, new_note_name)
return 0
def chmod(self, path, mode):
return 0
@ -124,9 +127,6 @@ class StandardNotesFUSE(LoggingMixIn, Operations):
def readlink(self, path):
return 0
def rename(self, old, new):
return 0
def rmdir(self, path):
return 0