diff --git a/openlp/core/lib/settings.py b/openlp/core/lib/settings.py index ba1e63fb9..116aac442 100644 --- a/openlp/core/lib/settings.py +++ b/openlp/core/lib/settings.py @@ -227,10 +227,7 @@ class Settings(QtCore.QSettings): u'user interface/live splitter geometry': QtCore.QByteArray(), u'user interface/main window state': QtCore.QByteArray(), u'media/players': u'webkit', - u'media/override player': QtCore.Qt.Unchecked, - # Old settings (not used anymore). Have to be here, so that old setting.config backups can be imported. - u'advanced/stylesheet fix': u'', - u'servicemanager/last directory': u'' + u'media/override player': QtCore.Qt.Unchecked } __file_path__ = u'' __obsolete_settings__ = [ @@ -243,7 +240,8 @@ class Settings(QtCore.QSettings): (u'bibles/last directory 1', u'bibles/last directory import', []), (u'songusage/last directory 1', u'songusage/last directory export', []), (u'advanced/stylesheet fix', u'', []), - (u'media/background color', u'players/background color', []) + (u'media/background color', u'players/background color', []), + (u'songs/ccli number', u'general/ccli number', []) ] @staticmethod diff --git a/openlp/core/ui/mainwindow.py b/openlp/core/ui/mainwindow.py index 6ab3f7f0a..0fb171c04 100644 --- a/openlp/core/ui/mainwindow.py +++ b/openlp/core/ui/mainwindow.py @@ -40,7 +40,7 @@ from datetime import datetime from PyQt4 import QtCore, QtGui from openlp.core.lib import Renderer, build_icon, OpenLPDockWidget, PluginManager, Receiver, translate, ImageManager, \ - PluginStatus, Registry, Settings, ScreenList + PluginStatus, Registry, Settings, ScreenList, check_directory_exists from openlp.core.lib.ui import UiStrings, create_action from openlp.core.ui import AboutForm, SettingsForm, ServiceManager, ThemeManager, SlideController, PluginForm, \ MediaDockManager, ShortcutListForm, FormattingTagForm @@ -819,8 +819,15 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow): # Add plugin sections. for plugin in self.pluginManager.plugins: setting_sections.extend([plugin.name]) + # Copy the settings file to the tmp dir, because we do not want to overwrite the original one. + temp_directory = os.path.join(unicode(gettempdir()), u'openlp') + check_directory_exists(temp_directory) + temp_config = os.path.join(temp_directory, os.path.basename(import_file_name)) + shutil.copyfile(import_file_name, temp_config) settings = Settings() - import_settings = Settings(import_file_name, Settings.IniFormat) + import_settings = Settings(temp_config, Settings.IniFormat) + # Remove/rename old settings to prepare the import. + import_settings.remove_obsolete_settings() # Lets do a basic sanity check. If it contains this string we can # assume it was created by OpenLP and so we'll load what we can # from it, and just silently ignore anything we don't recognise