Ask for confirmation when overwriting saved search
This commit is contained in:
parent
6930ea24a9
commit
4ab9e6caef
@ -21,6 +21,7 @@ browsing-change-note-type2 = Change Note Type...
|
||||
browsing-change-to = Change { $val } to:
|
||||
browsing-clear-unused = Clear Unused
|
||||
browsing-clear-unused-tags = Clear Unused Tags
|
||||
browsing-confirm-saved-search-overwrite = A saved search with the name { $name } already exists. Do you want to overwrite it?
|
||||
browsing-confirm-saved-searches-deletion =
|
||||
{ $count ->
|
||||
[one] Are you sure you want to delete the selected saved search?
|
||||
|
@ -1279,6 +1279,10 @@ class SidebarTreeView(QTreeView):
|
||||
filt = conf[old_name]
|
||||
except KeyError:
|
||||
return
|
||||
if new_name in conf and not askUser(
|
||||
tr(TR.BROWSING_CONFIRM_SAVED_SEARCH_OVERWRITE, name=new_name)
|
||||
):
|
||||
return
|
||||
conf[new_name] = filt
|
||||
del conf[old_name]
|
||||
self._set_saved_searches(conf)
|
||||
@ -1294,17 +1298,21 @@ class SidebarTreeView(QTreeView):
|
||||
)
|
||||
except InvalidInput as e:
|
||||
show_invalid_search_error(e)
|
||||
else:
|
||||
name = getOnlyText(tr(TR.BROWSING_PLEASE_GIVE_YOUR_FILTER_A_NAME))
|
||||
if not name:
|
||||
return
|
||||
conf = self._get_saved_searches()
|
||||
conf[name] = filt
|
||||
self._set_saved_searches(conf)
|
||||
self.refresh(
|
||||
lambda item: item.item_type == SidebarItemType.SAVED_SEARCH
|
||||
and item.name == name
|
||||
)
|
||||
return
|
||||
name = getOnlyText(tr(TR.BROWSING_PLEASE_GIVE_YOUR_FILTER_A_NAME))
|
||||
if not name:
|
||||
return
|
||||
conf = self._get_saved_searches()
|
||||
if name in conf and not askUser(
|
||||
tr(TR.BROWSING_CONFIRM_SAVED_SEARCH_OVERWRITE, name=name)
|
||||
):
|
||||
return
|
||||
conf[name] = filt
|
||||
self._set_saved_searches(conf)
|
||||
self.refresh(
|
||||
lambda item: item.item_type == SidebarItemType.SAVED_SEARCH
|
||||
and item.name == name
|
||||
)
|
||||
|
||||
def manage_notetype(self, item: SidebarItem) -> None:
|
||||
Models(
|
||||
|
Loading…
Reference in New Issue
Block a user