Fix the service saving

Fixes: https://launchpad.net/bugs/696313
This commit is contained in:
Tim Bentley 2011-01-02 13:57:55 +00:00
parent 1031ea40d9
commit c487d7f33d
2 changed files with 17 additions and 6 deletions

View File

@ -701,7 +701,6 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
if QtCore.QSettings().value(
self.generalSettingsSection + u'/auto open',
QtCore.QVariant(False)).toBool():
#self.ServiceManagerContents.onLoadService(True)
self.ServiceManagerContents.loadLastFile()
view_mode = QtCore.QSettings().value(u'%s/view mode' % \
self.generalSettingsSection, u'default')

View File

@ -109,12 +109,12 @@ class ServiceManager(QtGui.QWidget):
self.suffixes = []
self.dropPosition = 0
self.expandTabs = False
#is a new service and has not been saved
# is a new service and has not been saved
self._modified = False
self._fileName = u''
self.serviceNoteForm = ServiceNoteForm(self.parent)
self.serviceItemEditForm = ServiceItemEditForm(self.parent)
#start with the layout
# start with the layout
self.layout = QtGui.QVBoxLayout(self)
self.layout.setSpacing(0)
self.layout.setMargin(0)
@ -305,6 +305,8 @@ class ServiceManager(QtGui.QWidget):
"""
self._fileName = unicode(fileName)
self.parent.setServiceModified(self.isModified, self.shortFileName())
QtCore.QSettings(). \
setValue(u'service/last file',QtCore.QVariant(fileName))
def fileName(self):
"""
@ -390,6 +392,8 @@ class ServiceManager(QtGui.QWidget):
self.serviceItems = []
self.setFileName(u'')
self.setModified(False)
QtCore.QSettings(). \
setValue(u'service/last file',QtCore.QVariant(u''))
def saveFile(self):
"""
@ -530,13 +534,21 @@ class ServiceManager(QtGui.QWidget):
self.setFileName(fileName)
self.parent.addRecentFile(fileName)
self.setModified(False)
QtCore.QSettings(). \
setValue(u'service/last file',QtCore.QVariant(fileName))
# Refresh Plugin lists
Receiver.send_message(u'plugin_list_refresh')
def loadLastFile(self):
if not self.parent.recentFiles:
return
self.loadFile(self.parent.recentFiles[0])
"""
Load the last service item from the service manager when the
service was last closed. Can be blank if there was no service
present.
"""
fileName = QtCore.QSettings(). \
value(u'service/last file',QtCore.QVariant(u'')).toString()
if fileName:
self.loadFile(fileName)
def contextMenu(self, point):
item = self.serviceManagerList.itemAt(point)