Implement note renaming
This commit is contained in:
parent
2a2e608bde
commit
b23765b998
|
@ -84,6 +84,12 @@ class ItemManager:
|
||||||
content=content)
|
content=content)
|
||||||
self.syncItems()
|
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):
|
def deleteNote(self, uuid):
|
||||||
item = self.items[uuid]
|
item = self.items[uuid]
|
||||||
item['deleted'] = True
|
item['deleted'] = True
|
||||||
|
|
14
sn_fuse.py
14
sn_fuse.py
|
@ -66,7 +66,6 @@ class StandardNotesFUSE(LoggingMixIn, Operations):
|
||||||
def truncate(self, path, length, fh=None):
|
def truncate(self, path, length, fh=None):
|
||||||
note, uuid = self._pathToNote(path)
|
note, uuid = self._pathToNote(path)
|
||||||
text = note['text'][:length]
|
text = note['text'][:length]
|
||||||
|
|
||||||
self.item_manager.writeNote(uuid, text)
|
self.item_manager.writeNote(uuid, text)
|
||||||
|
|
||||||
def write(self, path, data, offset, fh):
|
def write(self, path, data, offset, fh):
|
||||||
|
@ -79,7 +78,6 @@ class StandardNotesFUSE(LoggingMixIn, Operations):
|
||||||
raise FuseOSError(errno.EIO)
|
raise FuseOSError(errno.EIO)
|
||||||
|
|
||||||
self.item_manager.writeNote(uuid, text)
|
self.item_manager.writeNote(uuid, text)
|
||||||
|
|
||||||
return len(data)
|
return len(data)
|
||||||
|
|
||||||
def create(self, path, mode):
|
def create(self, path, mode):
|
||||||
|
@ -98,7 +96,6 @@ class StandardNotesFUSE(LoggingMixIn, Operations):
|
||||||
|
|
||||||
def unlink(self, path):
|
def unlink(self, path):
|
||||||
note, uuid = self._pathToNote(path)
|
note, uuid = self._pathToNote(path)
|
||||||
|
|
||||||
self.item_manager.deleteNote(uuid)
|
self.item_manager.deleteNote(uuid)
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
|
@ -108,10 +105,16 @@ class StandardNotesFUSE(LoggingMixIn, Operations):
|
||||||
|
|
||||||
def utimens(self, path, times=None):
|
def utimens(self, path, times=None):
|
||||||
note, uuid = self._pathToNote(path)
|
note, uuid = self._pathToNote(path)
|
||||||
|
|
||||||
self.item_manager.touchNote(uuid)
|
self.item_manager.touchNote(uuid)
|
||||||
return 0
|
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):
|
def chmod(self, path, mode):
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
|
@ -124,9 +127,6 @@ class StandardNotesFUSE(LoggingMixIn, Operations):
|
||||||
def readlink(self, path):
|
def readlink(self, path):
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
def rename(self, old, new):
|
|
||||||
return 0
|
|
||||||
|
|
||||||
def rmdir(self, path):
|
def rmdir(self, path):
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user