From 912516e8f023ff9130d876011c9b91367fdf5e8d Mon Sep 17 00:00:00 2001 From: Jon Tibble Date: Wed, 30 Jun 2010 12:59:09 +0100 Subject: [PATCH] Really fix service loading! --- openlp/core/ui/mainwindow.py | 5 ++++- openlp/core/ui/servicemanager.py | 6 +++--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/openlp/core/ui/mainwindow.py b/openlp/core/ui/mainwindow.py index 7f1c0408b..f4d573d20 100644 --- a/openlp/core/ui/mainwindow.py +++ b/openlp/core/ui/mainwindow.py @@ -845,7 +845,10 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow): recentFileCount = QtCore.QSettings().value( self.generalSettingsSection + u'/max recent files', QtCore.QVariant(4)).toInt()[0] - if filename and filename not in self.recentFiles: + if filename: + position = self.recentFiles.indexOf(filename) + if position != -1: + self.recentFiles.removeAt(position) self.recentFiles.insert(0, QtCore.QString(filename)) while self.recentFiles.count() > recentFileCount: self.recentFiles.removeLast() diff --git a/openlp/core/ui/servicemanager.py b/openlp/core/ui/servicemanager.py index 1ee0d13a5..837415921 100644 --- a/openlp/core/ui/servicemanager.py +++ b/openlp/core/ui/servicemanager.py @@ -625,13 +625,13 @@ class ServiceManager(QtGui.QWidget): def onLoadService(self, lastService=False): if lastService: - filename = SettingsManager.get_last_dir( - self.parent.serviceSettingsSection) + filename = self.parent.recentFiles[0] else: filename = QtGui.QFileDialog.getOpenFileName( self, translate('ServiceManager', 'Open Service'), SettingsManager.get_last_dir( self.parent.serviceSettingsSection), u'Services (*.osz)') + filename = QtCore.QDir.toNativeSeparators(filename) self.loadService(filename) def loadService(self, filename=None): @@ -662,7 +662,7 @@ class ServiceManager(QtGui.QWidget): name = filename.split(os.path.sep) if filename: SettingsManager.set_last_dir(self.parent.serviceSettingsSection, - name[0]) + os.path.split(filename)[0]) zip = None file_to = None try: