openlp-core team mailing list archive
-
openlp-core team
-
Mailing list archive
-
Message #11275
[Merge] lp:~googol/openlp/bug-818794 into lp:openlp
Andreas Preikschat has proposed merging lp:~googol/openlp/bug-818794 into lp:openlp.
Requested reviews:
OpenLP Core (openlp-core)
Related bugs:
Bug #818794 in OpenLP: ""Recent Files" in the "File" menu should have their own sub menu"
https://bugs.launchpad.net/openlp/+bug/818794
For more details, see:
https://code.launchpad.net/~googol/openlp/bug-818794/+merge/71169
Hello,
I have moved the "recent files" in the main menu to its own menu. (bug #818794) You can delete the list of recent files by clicking "Clear List" which is the last entry in the menu.
New stings:
&Recent Files (menu name)
Clear List (menu entry)
Clear the list of recent files. (status tooltip)
--
https://code.launchpad.net/~googol/openlp/bug-818794/+merge/71169
Your team OpenLP Core is requested to review the proposed merge of lp:~googol/openlp/bug-818794 into lp:openlp.
=== modified file 'openlp/core/ui/mainwindow.py'
--- openlp/core/ui/mainwindow.py 2011-08-05 05:52:44 +0000
+++ openlp/core/ui/mainwindow.py 2011-08-11 09:26:56 +0000
@@ -109,6 +109,8 @@
self.menuBar.setObjectName(u'menuBar')
self.fileMenu = QtGui.QMenu(self.menuBar)
self.fileMenu.setObjectName(u'fileMenu')
+ self.recentFilesMenu = QtGui.QMenu(self.fileMenu)
+ self.recentFilesMenu.setObjectName(u'recentFilesMenu')
self.fileImportMenu = QtGui.QMenu(self.fileMenu)
self.fileImportMenu.setObjectName(u'fileImportMenu')
self.fileExportMenu = QtGui.QMenu(self.fileMenu)
@@ -302,10 +304,11 @@
(self.importThemeItem, self.importLanguageItem))
add_actions(self.fileExportMenu,
(self.exportThemeItem, self.exportLanguageItem))
- self.fileMenuActions = (self.fileNewItem, self.fileOpenItem,
+ add_actions(self.fileMenu, (self.fileNewItem, self.fileOpenItem,
self.fileSaveItem, self.fileSaveAsItem, None,
- self.printServiceOrderItem, None, self.fileImportMenu.menuAction(),
- self.fileExportMenu.menuAction(), self.fileExitItem)
+ self.recentFilesMenu.menuAction(), None, self.printServiceOrderItem,
+ None, self.fileImportMenu.menuAction(),
+ self.fileExportMenu.menuAction(), self.fileExitItem))
add_actions(self.viewModeMenu, (self.modeDefaultItem,
self.modeSetupItem, self.modeLiveItem))
add_actions(self.viewMenu, (self.viewModeMenu.menuAction(),
@@ -346,7 +349,7 @@
self.mediaToolBox.setCurrentIndex(0)
# Connect up some signals and slots
QtCore.QObject.connect(self.fileMenu,
- QtCore.SIGNAL(u'aboutToShow()'), self.updateFileMenu)
+ QtCore.SIGNAL(u'aboutToShow()'), self.updateRecentFilesMenu)
QtCore.QMetaObject.connectSlotsByName(mainWindow)
# Hide the entry, as it does not have any functionality yet.
self.toolsAddToolItem.setVisible(False)
@@ -363,6 +366,8 @@
self.fileMenu.setTitle(translate('OpenLP.MainWindow', '&File'))
self.fileImportMenu.setTitle(translate('OpenLP.MainWindow', '&Import'))
self.fileExportMenu.setTitle(translate('OpenLP.MainWindow', '&Export'))
+ self.recentFilesMenu.setTitle(
+ translate('OpenLP.MainWindow', '&Recent Files'))
self.viewMenu.setTitle(translate('OpenLP.MainWindow', '&View'))
self.viewModeMenu.setTitle(translate('OpenLP.MainWindow', 'M&ode'))
self.toolsMenu.setTitle(translate('OpenLP.MainWindow', '&Tools'))
@@ -534,8 +539,8 @@
self.setupUi(self)
# Load settings after setupUi so default UI sizes are overwritten
self.loadSettings()
- # Once settings are loaded update FileMenu with recentFiles
- self.updateFileMenu()
+ # Once settings are loaded update the menu with the recent files.
+ self.updateRecentFilesMenu()
self.pluginForm = PluginForm(self)
# Set up signals and slots
QtCore.QObject.connect(self.importThemeItem,
@@ -1137,30 +1142,36 @@
QtCore.QVariant(self.controlSplitter.saveState()))
settings.endGroup()
- def updateFileMenu(self):
+ def updateRecentFilesMenu(self):
"""
- Updates the file menu with the latest list of service files accessed.
+ Updates the recent file menu with the latest list of service files
+ accessed.
"""
recentFileCount = QtCore.QSettings().value(
u'advanced/recent file count', QtCore.QVariant(4)).toInt()[0]
- self.fileMenu.clear()
- add_actions(self.fileMenu, self.fileMenuActions[:-1])
existingRecentFiles = [recentFile for recentFile in self.recentFiles
if QtCore.QFile.exists(recentFile)]
recentFilesToDisplay = existingRecentFiles[0:recentFileCount]
- if recentFilesToDisplay:
- self.fileMenu.addSeparator()
- for fileId, filename in enumerate(recentFilesToDisplay):
- log.debug('Recent file name: %s', filename)
- action = base_action(self, u'')
- action.setText(u'&%d %s' %
- (fileId + 1, QtCore.QFileInfo(filename).fileName()))
- action.setData(QtCore.QVariant(filename))
- self.connect(action, QtCore.SIGNAL(u'triggered()'),
- self.serviceManagerContents.onRecentServiceClicked)
- self.fileMenu.addAction(action)
- self.fileMenu.addSeparator()
- self.fileMenu.addAction(self.fileMenuActions[-1])
+ self.recentFilesMenu.clear()
+ for fileId, filename in enumerate(recentFilesToDisplay):
+ log.debug('Recent file name: %s', filename)
+ action = base_action(self, u'')
+ action.setText(u'&%d %s' %
+ (fileId + 1, QtCore.QFileInfo(filename).fileName()))
+ action.setData(QtCore.QVariant(filename))
+ self.connect(action, QtCore.SIGNAL(u'triggered()'),
+ self.serviceManagerContents.onRecentServiceClicked)
+ self.recentFilesMenu.addAction(action)
+ clearRecentFilesAction = base_action(self, u'')
+ clearRecentFilesAction.setText(
+ translate('OpenLP.MainWindow', 'Clear List',
+ 'Clear List of recent files'))
+ clearRecentFilesAction.setStatusTip(
+ translate('OpenLP.MainWindow', 'Clear the list of recent files.'))
+ add_actions(self.recentFilesMenu, (None, clearRecentFilesAction))
+ self.connect(clearRecentFilesAction, QtCore.SIGNAL(u'triggered()'),
+ self.recentFiles.clear)
+ clearRecentFilesAction.setEnabled(not self.recentFiles.isEmpty())
def addRecentFile(self, filename):
"""
Follow ups