Fix #1360 (Error when cancelling "Load recipie from file" in add custom news source window)

This commit is contained in:
Kovid Goyal 2008-12-07 12:35:27 -08:00
parent acf525d22d
commit d1b5076360

View File

@ -228,16 +228,16 @@ class %(classname)s(%(base_class)s):
error_dialog(self, _('Invalid input'), error_dialog(self, _('Invalid input'),
_('<p>Could not create recipe. Error:<br>%s')%str(err)).exec_() _('<p>Could not create recipe. Error:<br>%s')%str(err)).exec_()
return return
try: try:
self.available_profiles.add_item(title, (title, src), replace=False) self.available_profiles.add_item(title, (title, src), replace=False)
except ValueError: except ValueError:
d = question_dialog(self, _('Replace recipe?'), d = question_dialog(self, _('Replace recipe?'),
_('A custom recipe named %s already exists. Do you want to replace it?')%title) _('A custom recipe named %s already exists. Do you want to replace it?')%title)
if d.exec_() == QMessageBox.Yes: if d.exec_() == QMessageBox.Yes:
self.available_profiles.add_item(title, (title, src), replace=True) self.available_profiles.add_item(title, (title, src), replace=True)
else: else:
return return
self.clear() self.clear()
def populate_options(self, profile): def populate_options(self, profile):
self.oldest_article.setValue(profile.oldest_article) self.oldest_article.setValue(profile.oldest_article)