Default handling allows editing and blocks deletes

This commit is contained in:
Tim Bentley 2009-08-07 18:30:12 +01:00
parent 06ff5ec618
commit 23b13ede2d

View File

@ -84,7 +84,7 @@ class ThemeManager(QtGui.QWidget):
def onEditTheme(self): def onEditTheme(self):
item = self.ThemeListWidget.currentItem() item = self.ThemeListWidget.currentItem()
if item is not None: if item is not None:
self.amendThemeForm.loadTheme(unicode(item.text())) self.amendThemeForm.loadTheme(unicode(item.data(QtCore.Qt.UserRole).toString()))
self.amendThemeForm.exec_() self.amendThemeForm.exec_()
def onDeleteTheme(self): def onDeleteTheme(self):
@ -92,7 +92,8 @@ class ThemeManager(QtGui.QWidget):
item = self.ThemeListWidget.currentItem() item = self.ThemeListWidget.currentItem()
if item is not None: if item is not None:
theme = unicode(item.text()) theme = unicode(item.text())
if theme == self.global_theme: # should be the same unless default
if theme != unicode(item.data(QtCore.Qt.UserRole).toString()):
QtGui.QMessageBox.critical(self, QtGui.QMessageBox.critical(self,
translate(u'ThemeManager', u'Error'), translate(u'ThemeManager', u'Error'),
translate(u'ThemeManager', u'You are unable to delete the default theme!'), translate(u'ThemeManager', u'You are unable to delete the default theme!'),