Treat empty rename field as canceling the rename

This commit is contained in:
Asmageddon 2012-07-02 17:31:53 +02:00
parent 93a0040b68
commit 0c93d20980
1 changed files with 4 additions and 0 deletions

View File

@ -793,6 +793,8 @@ class TorrentDetail(BaseMode, component.Component):
client.core.rename_folder(torrent_id, folder, new_folder)
def _do_rename_file(self, torrent_id, file_idx, new_filename):
if not new_filename:
return
client.core.rename_files(torrent_id, [(file_idx, new_filename)])
def _show_rename_popup(self):
@ -811,6 +813,8 @@ class TorrentDetail(BaseMode, component.Component):
if _file[3]:
def do_rename(result):
if not result["new_foldername"]:
return
old_fname = self._get_full_folder_path(self.current_file_idx)
new_fname = "%s/%s/" % (old_fname.strip("/").rpartition("/")[0], result["new_foldername"])
self._do_rename_folder(tid, old_fname, new_fname)