mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
more fixes to prevent invalid names
This commit is contained in:
parent
cf684a052b
commit
77307904ff
@ -1276,6 +1276,12 @@ class TagsModel(QAbstractItemModel): # {{{
|
||||
return False
|
||||
item = index.internalPointer()
|
||||
if item.type == TagTreeItem.CATEGORY and item.category_key.startswith('@'):
|
||||
if val.find('.') >= 0:
|
||||
error_dialog(self.tags_view, _('Rename user category'),
|
||||
_('You cannot use periods in the name when '
|
||||
'renaming user categories'), show=True)
|
||||
return False
|
||||
|
||||
user_cats = self.db.prefs.get('user_categories', {})
|
||||
ckey = item.category_key[1:]
|
||||
dotpos = ckey.rfind('.')
|
||||
@ -1288,7 +1294,7 @@ class TagsModel(QAbstractItemModel): # {{{
|
||||
if len(c) == len(ckey):
|
||||
if nkey in user_cats:
|
||||
error_dialog(self.tags_view, _('Rename user category'),
|
||||
_('The name %s is already used'%nkey), show=True)
|
||||
_('The name %s is already used')%nkey, show=True)
|
||||
return False
|
||||
user_cats[nkey] = user_cats[ckey]
|
||||
del user_cats[ckey]
|
||||
|
Loading…
x
Reference in New Issue
Block a user