Implement note renaming

master
Tanner Collin 7 years ago
parent 2a2e608bde
commit b23765b998
  1. 6
      itemmanager.py
  2. 14
      sn_fuse.py

@ -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

@ -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

Loading…
Cancel
Save