Really fix service loading!

This commit is contained in:
Jon Tibble 2010-06-30 12:59:09 +01:00
parent 0b48e66466
commit 912516e8f0
2 changed files with 7 additions and 4 deletions

View File

@ -845,7 +845,10 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
recentFileCount = QtCore.QSettings().value( recentFileCount = QtCore.QSettings().value(
self.generalSettingsSection + u'/max recent files', self.generalSettingsSection + u'/max recent files',
QtCore.QVariant(4)).toInt()[0] 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)) self.recentFiles.insert(0, QtCore.QString(filename))
while self.recentFiles.count() > recentFileCount: while self.recentFiles.count() > recentFileCount:
self.recentFiles.removeLast() self.recentFiles.removeLast()

View File

@ -625,13 +625,13 @@ class ServiceManager(QtGui.QWidget):
def onLoadService(self, lastService=False): def onLoadService(self, lastService=False):
if lastService: if lastService:
filename = SettingsManager.get_last_dir( filename = self.parent.recentFiles[0]
self.parent.serviceSettingsSection)
else: else:
filename = QtGui.QFileDialog.getOpenFileName( filename = QtGui.QFileDialog.getOpenFileName(
self, translate('ServiceManager', 'Open Service'), self, translate('ServiceManager', 'Open Service'),
SettingsManager.get_last_dir( SettingsManager.get_last_dir(
self.parent.serviceSettingsSection), u'Services (*.osz)') self.parent.serviceSettingsSection), u'Services (*.osz)')
filename = QtCore.QDir.toNativeSeparators(filename)
self.loadService(filename) self.loadService(filename)
def loadService(self, filename=None): def loadService(self, filename=None):
@ -662,7 +662,7 @@ class ServiceManager(QtGui.QWidget):
name = filename.split(os.path.sep) name = filename.split(os.path.sep)
if filename: if filename:
SettingsManager.set_last_dir(self.parent.serviceSettingsSection, SettingsManager.set_last_dir(self.parent.serviceSettingsSection,
name[0]) os.path.split(filename)[0])
zip = None zip = None
file_to = None file_to = None
try: try: