diff --git a/openlp/core/lib/settings.py b/openlp/core/lib/settings.py index 3dfd15e6e..4bb1cda85 100644 --- a/openlp/core/lib/settings.py +++ b/openlp/core/lib/settings.py @@ -65,6 +65,11 @@ class Settings(QtCore.QSettings): object for accessing settings stored in that Ini file. """ __filePath__ = u'' + + __obsolete_settings__ = { + u'bibles/bookname language': u'bibles/book name language' + } + __default_settings__ = { u'advanced/x11 bypass wm': X11_BYPASS_DEFAULT, u'advanced/default service enabled': True, @@ -224,6 +229,19 @@ class Settings(QtCore.QSettings): """ Settings.__filePath__ = iniFile + @staticmethod + def remove_obsolete_settings(): + """ + This method is only called to clean up the config. It removes all changed keys, but before doing so, we copy + the value to the new key. + """ + for new_key, old_key in Settings.__obsolete_settings__.items(): + settings = Settings() + if settings.contains(old_key): + # Copy the value from the old_key to the new_key. + settings.setValue(new_key. settings.value(key)) + settings.remove(old_key) + def __init__(self, *args): if not args and Settings.__filePath__ and Settings.defaultFormat() == Settings.IniFormat: QtCore.QSettings.__init__(self, Settings.__filePath__, Settings.IniFormat) diff --git a/openlp/core/ui/mainwindow.py b/openlp/core/ui/mainwindow.py index 16ae98633..820d2f47f 100644 --- a/openlp/core/ui/mainwindow.py +++ b/openlp/core/ui/mainwindow.py @@ -471,6 +471,7 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow): self.playersSettingsSection = u'players' self.displayTagsSection = u'displayTags' self.headerSection = u'SettingsImport' + Settings.remove_obsolete_settings() self.serviceNotSaved = False self.aboutForm = AboutForm(self) self.mediaController = MediaController(self) diff --git a/openlp/plugins/bibles/bibleplugin.py b/openlp/plugins/bibles/bibleplugin.py index ade1178ef..f0f260909 100644 --- a/openlp/plugins/bibles/bibleplugin.py +++ b/openlp/plugins/bibles/bibleplugin.py @@ -41,6 +41,7 @@ from openlp.plugins.bibles.forms import BibleUpgradeForm log = logging.getLogger(__name__) + __default_settings__ = { u'bibles/db type': u'sqlite', u'bibles/status': PluginStatus.Inactive, @@ -50,8 +51,8 @@ __default_settings__ = { u'bibles/display brackets': DisplayStyle.NoBrackets, u'bibles/display new chapter': False, u'bibles/second bibles': True, - u'bibles/advanced bible': u'', # FIXME: check - u'bibles/quick bible': u'', # FIXME: check + u'bibles/advanced bible': u'', + u'bibles/quick bible': u'', u'bibles/proxy name': u'', u'bibles/proxy address': u'', u'bibles/proxy username': u'', @@ -113,13 +114,6 @@ class BiblePlugin(Plugin): QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Yes | QtGui.QMessageBox.No)) == \ QtGui.QMessageBox.Yes: self.onToolsUpgradeItemTriggered() - settings = Settings() - settings.beginGroup(self.settingsSection) - if settings.contains(u'bookname language'): - # FIXME: Will that cause crashes? - settings.setValue(u'book name language', settings.value(u'bookname language')) - settings.remove(u'bookname language') - settings.endGroup() def addImportMenuItem(self, import_menu): self.importBibleItem = create_action(import_menu, u'importBibleItem',