← Back to team overview

openlp-core team mailing list archive

[Merge] lp:~m2j/openlp/cleanups into lp:openlp

 

Meinert Jordan has proposed merging lp:~m2j/openlp/cleanups into lp:openlp.

Requested reviews:
  Raoul Snyman (raoul-snyman)

For more details, see:
https://code.launchpad.net/~m2j/openlp/cleanups/+merge/94927

This are some cleanups. 

There were five methods to create a action in OpenLP, so I thought: Why not add a sixth method. ;)
Well, I was a bit surprised of the freeze as I was just about merging my editior into the OpenLP source tree. Therefore I didn't had the chance yet to go through the sources and replace the current action creation methods where it makes sense.

Some paths are handled through Pythons os.path instead of Qts methods (we use os.path at most places of the code so it is more consistent)
The path seperator in zip files is always a slash (/): http://www.pkware.com/documents/casestudies/APPNOTE.TXT
-- 
https://code.launchpad.net/~m2j/openlp/cleanups/+merge/94927
Your team OpenLP Core is subscribed to branch lp:openlp.
=== modified file 'openlp/core/lib/searchedit.py'
--- openlp/core/lib/searchedit.py	2011-12-27 10:33:55 +0000
+++ openlp/core/lib/searchedit.py	2012-02-28 09:34:28 +0000
@@ -30,7 +30,7 @@
 from PyQt4 import QtCore, QtGui
 
 from openlp.core.lib import build_icon
-from openlp.core.lib.ui import icon_action
+from openlp.core.lib.ui import create_action
 
 log = logging.getLogger(__name__)
 
@@ -150,12 +150,9 @@
         menu = QtGui.QMenu(self)
         first = None
         for identifier, icon, title in items:
-            action = icon_action(menu, u'', icon)
-            action.setText(title)
-            action.setData(QtCore.QVariant(identifier))
+            action = create_action(menu, u'', text=title, icon=icon,
+                data=identifier, triggers=self._onMenuActionTriggered)
             menu.addAction(action)
-            QtCore.QObject.connect(action, QtCore.SIGNAL(u'triggered(bool)'),
-                self._onMenuActionTriggered)
             if first is None:
                 first = action
                 self._currentSearchType = identifier

=== modified file 'openlp/core/lib/spelltextedit.py'
--- openlp/core/lib/spelltextedit.py	2011-12-27 10:33:55 +0000
+++ openlp/core/lib/spelltextedit.py	2012-02-28 09:34:28 +0000
@@ -40,7 +40,7 @@
 from PyQt4 import QtCore, QtGui
 
 from openlp.core.lib import translate, FormattingTags
-from openlp.core.lib.ui import checkable_action
+from openlp.core.lib.ui import create_action
 
 log = logging.getLogger(__name__)
 
@@ -90,9 +90,8 @@
             lang_menu = QtGui.QMenu(
                 translate('OpenLP.SpellTextEdit', 'Language:'))
             for lang in enchant.list_languages():
-                action = checkable_action(
-                    lang_menu, lang, lang == self.dictionary.tag)
-                action.setText(lang)
+                action = create_action(lang_menu, lang, text=lang,
+                    checked=lang == self.dictionary.tag)
                 lang_menu.addAction(action)
             popupMenu.insertSeparator(popupMenu.actions()[0])
             popupMenu.insertMenu(popupMenu.actions()[0], lang_menu)

=== modified file 'openlp/core/lib/ui.py'
--- openlp/core/lib/ui.py	2011-12-27 10:33:55 +0000
+++ openlp/core/lib/ui.py	2012-02-28 09:34:28 +0000
@@ -280,99 +280,93 @@
         QtCore.SIGNAL(u'clicked()'), parent.onDownButtonClicked)
     return up_button, down_button
 
-def base_action(parent, name, category=None):
+def create_action(parent, name, **kwargs):
     """
-    Return the most basic action with the object name set.
+    Return an action with the object name set and the given parameters.
+
+    ``parent``
+        A QtCore.QObject for the actions parent (required).
+
+    ``name``
+        A string which is set as object name (required).
+
+    ``text``
+        A string for the action text.
+
+    ``icon``
+        Either a QIcon, a resource string, or a file location string for the
+        action icon.
+
+    ``tooltip``
+        A string for the action tool tip.
+
+    ``statustip``
+        A string for the action status tip.
+
+    ``checked``
+        A bool for the state. If ``None`` the Action is not checkable.
+
+    ``enabled``
+        False in case the action should be disabled.
+
+    ``visible``
+        False in case the action should be hidden.
+
+    ``data``
+        Data which is set as QVariant type.
+
+    ``shortcuts``
+        A QList<QKeySequence> (or a list of strings) which are set as shortcuts.
+
+    ``context``
+        A context for the shortcut execution (only will be set together with
+        ``shortcuts``).
 
     ``category``
-        The category the action should be listed in the shortcut dialog. If you
-        not wish, that this action is added to the shortcut dialog, then do not
-        state any.
-    """
-    action = QtGui.QAction(parent)
-    action.setObjectName(name)
-    if category is not None:
-        action_list = ActionList.get_instance()
-        action_list.add_action(action, category)
-    return action
-
-def checkable_action(parent, name, checked=None, category=None):
-    """
-    Return a standard action with the checkable attribute set.
-    """
-    action = base_action(parent, name, category)
-    action.setCheckable(True)
-    if checked is not None:
-        action.setChecked(checked)
-    return action
-
-def icon_action(parent, name, icon, checked=None, category=None):
-    """
-    Return a standard action with an icon.
-    """
-    if checked is not None:
-        action = checkable_action(parent, name, checked, category)
-    else:
-        action = base_action(parent, name, category)
-    action.setIcon(build_icon(icon))
-    return action
-
-def shortcut_action(parent, name, shortcuts, function, icon=None, checked=None,
-    category=None, context=QtCore.Qt.WindowShortcut):
-    """
-    Return a shortcut enabled action.
-    """
-    action = QtGui.QAction(parent)
-    action.setObjectName(name)
-    if icon is not None:
-        action.setIcon(build_icon(icon))
-    if checked is not None:
+        A category the action should be listed in the shortcut dialog.
+
+    ``triggers``
+        A slot which is connected to the actions ``triggered()`` slot.
+    """
+    action = QtGui.QAction(parent)
+    action.setObjectName(name)
+    if kwargs.get(u'text'):
+        action.setText(kwargs.pop(u'text'))
+    if kwargs.get(u'icon'):
+        action.setIcon(build_icon(kwargs.pop(u'icon')))
+    if kwargs.get(u'tooltip'):
+        action.setToolTip(kwargs.pop(u'tooltip'))
+    if kwargs.get(u'statustip'):
+        action.setStatusTip(kwargs.pop(u'statustip'))
+    if kwargs.get(u'checked') is not None:
         action.setCheckable(True)
-        action.setChecked(checked)
-    if shortcuts:
-        action.setShortcuts(shortcuts)
-        action.setShortcutContext(context)
-    action_list = ActionList.get_instance()
-    action_list.add_action(action, category)
-    QtCore.QObject.connect(action, QtCore.SIGNAL(u'triggered(bool)'), function)
+        action.setChecked(kwargs.pop(u'checked'))
+    if not kwargs.pop(u'enabled', True):
+        action.setEnabled(False)
+    if not kwargs.pop(u'visible', True):
+        action.setVisible(False)
+    if u'data' in kwargs:
+        action.setData(QtCore.QVariant(kwargs.pop(u'data')))
+    if kwargs.get(u'shortcuts'):
+        action.setShortcuts(kwargs.pop(u'shortcuts'))
+        action.setShortcutContext(kwargs.pop(u'context',
+            QtCore.Qt.WindowShortcut))
+    if kwargs.get(u'category'):
+        action_list = ActionList.get_instance()
+        action_list.add_action(action, kwargs.pop(u'category'))
+    if kwargs.get(u'triggers'):
+        QtCore.QObject.connect(action, QtCore.SIGNAL(u'triggered(bool)'),
+            kwargs.pop(u'triggers'))
+    for key in kwargs.keys():
+        if key not in [u'text', u'icon', u'tooltip', u'statustip', u'checked',
+            u'shortcuts', u'context', u'category', u'triggers']:
+            log.warn(u'Parameter %s was not consumed in create_action().', key)
     return action
 
 def context_menu_action(base, icon, text, slot, shortcuts=None, category=None,
     context=QtCore.Qt.WidgetShortcut):
-    """
-    Utility method to help build context menus.
-
-    ``base``
-        The parent menu to add this menu item to
-
-    ``icon``
-        An icon for this action
-
-    ``text``
-        The text to display for this action
-
-    ``slot``
-        The code to run when this action is triggered
-
-    ``shortcuts``
-        The action's shortcuts.
-
-    ``category``
-        The category the shortcut should be listed in the shortcut dialog. If
-        left to ``None``, then the action will be hidden in the shortcut dialog.
-
-    ``context``
-        The context the shortcut is valid.
-    """
-    action = QtGui.QAction(text, base)
-    if icon:
-        action.setIcon(build_icon(icon))
-    QtCore.QObject.connect(action, QtCore.SIGNAL(u'triggered(bool)'), slot)
-    if shortcuts is not None:
-        action.setShortcuts(shortcuts)
-        action.setShortcutContext(context)
-        action_list = ActionList.get_instance()
-        action_list.add_action(action)
+    action = create_action(parent=base, name=u'', text=text, icon=icon,
+        shortcuts=shortcuts, context=context, category=category, triggers=slot)
     base.addAction(action)
     return action
 
@@ -400,7 +394,7 @@
     ``base``
         The menu object to add the separator to
     """
-    action = QtGui.QAction(u'', base)
+    action = QtGui.QAction(base)
     action.setSeparator(True)
     base.addAction(action)
     return action

=== modified file 'openlp/core/ui/exceptionform.py'
--- openlp/core/ui/exceptionform.py	2012-01-18 13:50:06 +0000
+++ openlp/core/ui/exceptionform.py	2012-02-28 09:34:28 +0000
@@ -150,7 +150,7 @@
             translate('OpenLP.ExceptionForm',
             'Text files (*.txt *.log *.text)'))
         if filename:
-            filename = unicode(QtCore.QDir.toNativeSeparators(filename))
+            filename = unicode(filename).replace(u'/', os.path.sep)
             SettingsManager.set_last_dir(self.settingsSection, os.path.dirname(
                 filename))
             report_text = report_text % self._createReport()

=== modified file 'openlp/core/ui/firsttimelanguageform.py'
--- openlp/core/ui/firsttimelanguageform.py	2011-12-27 10:33:55 +0000
+++ openlp/core/ui/firsttimelanguageform.py	2012-02-28 09:34:28 +0000
@@ -27,6 +27,7 @@
 
 from PyQt4 import QtGui
 
+from openlp.core.lib.ui import create_action
 from openlp.core.utils import LanguageManager
 from firsttimelanguagedialog import Ui_FirstTimeLanguageDialog
 
@@ -55,8 +56,7 @@
             LanguageManager.set_language(False, False)
         else:
             LanguageManager.auto_language = False
-            action = QtGui.QAction(None)
-            action.setObjectName(unicode(self.languageComboBox.currentText()))
+            action = create_action(None, self.languageComboBox.currentText())
             LanguageManager.set_language(action, False)
         return QtGui.QDialog.accept(self)
 

=== modified file 'openlp/core/ui/mainwindow.py'
--- openlp/core/ui/mainwindow.py	2012-02-06 17:35:41 +0000
+++ openlp/core/ui/mainwindow.py	2012-02-28 09:34:28 +0000
@@ -36,8 +36,7 @@
 
 from openlp.core.lib import Renderer, build_icon, OpenLPDockWidget, \
     PluginManager, Receiver, translate, ImageManager, PluginStatus
-from openlp.core.lib.ui import UiStrings, base_action, checkable_action, \
-    icon_action, shortcut_action
+from openlp.core.lib.ui import UiStrings, create_action
 from openlp.core.lib import SlideLimits
 from openlp.core.ui import AboutForm, SettingsForm, ServiceManager, \
     ThemeManager, SlideController, PluginForm, MediaDockManager, \
@@ -179,75 +178,84 @@
         action_list = ActionList.get_instance()
         action_list.add_category(unicode(UiStrings().File),
             CategoryOrder.standardMenu)
-        self.fileNewItem = shortcut_action(mainWindow, u'fileNewItem',
-            [QtGui.QKeySequence(u'Ctrl+N')],
-            self.serviceManagerContents.onNewServiceClicked,
-            u':/general/general_new.png', category=unicode(UiStrings().File))
-        self.fileOpenItem = shortcut_action(mainWindow, u'fileOpenItem',
-            [QtGui.QKeySequence(u'Ctrl+O')],
-            self.serviceManagerContents.onLoadServiceClicked,
-            u':/general/general_open.png', category=unicode(UiStrings().File))
-        self.fileSaveItem = shortcut_action(mainWindow, u'fileSaveItem',
-            [QtGui.QKeySequence(u'Ctrl+S')],
-            self.serviceManagerContents.saveFile,
-            u':/general/general_save.png', category=unicode(UiStrings().File))
-        self.fileSaveAsItem = shortcut_action(mainWindow, u'fileSaveAsItem',
-            [QtGui.QKeySequence(u'Ctrl+Shift+S')],
-            self.serviceManagerContents.saveFileAs,
-            category=unicode(UiStrings().File))
-        self.printServiceOrderItem = shortcut_action(mainWindow,
-            u'printServiceItem', [QtGui.QKeySequence(u'Ctrl+P')],
-            self.serviceManagerContents.printServiceOrder,
-            category=unicode(UiStrings().File))
-        self.fileExitItem = shortcut_action(mainWindow, u'fileExitItem',
-            [QtGui.QKeySequence(u'Alt+F4')], mainWindow.close,
-            u':/system/system_exit.png', category=unicode(UiStrings().File))
+        self.fileNewItem = create_action(mainWindow, u'fileNewItem',
+            icon=u':/general/general_new.png',
+            shortcuts=[QtGui.QKeySequence(u'Ctrl+N')],
+            category=unicode(UiStrings().File),
+            triggers=self.serviceManagerContents.onNewServiceClicked)
+        self.fileOpenItem = create_action(mainWindow, u'fileOpenItem',
+            icon=u':/general/general_open.png',
+            shortcuts=[QtGui.QKeySequence(u'Ctrl+O')],
+            category=unicode(UiStrings().File),
+            triggers=self.serviceManagerContents.onLoadServiceClicked)
+        self.fileSaveItem = create_action(mainWindow, u'fileSaveItem',
+            icon=u':/general/general_save.png',
+            shortcuts=[QtGui.QKeySequence(u'Ctrl+S')],
+            category=unicode(UiStrings().File),
+            triggers=self.serviceManagerContents.saveFile)
+        self.fileSaveAsItem = create_action(mainWindow, u'fileSaveAsItem',
+            shortcuts=[QtGui.QKeySequence(u'Ctrl+Shift+S')],
+            category=unicode(UiStrings().File),
+            triggers=self.serviceManagerContents.saveFileAs)
+        self.printServiceOrderItem = create_action(mainWindow,
+            u'printServiceItem', shortcuts=[QtGui.QKeySequence(u'Ctrl+P')],
+            category=unicode(UiStrings().File),
+            triggers=self.serviceManagerContents.printServiceOrder)
+        self.fileExitItem = create_action(mainWindow, u'fileExitItem',
+            icon=u':/system/system_exit.png',
+            shortcuts=[QtGui.QKeySequence(u'Alt+F4')],
+            category=unicode(UiStrings().File),
+            triggers=mainWindow.close)
         action_list.add_category(unicode(UiStrings().Import),
             CategoryOrder.standardMenu)
-        self.importThemeItem = base_action(
-            mainWindow, u'importThemeItem', unicode(UiStrings().Import))
-        self.importLanguageItem = base_action(
-            mainWindow, u'importLanguageItem')#, unicode(UiStrings().Import))
+        self.importThemeItem = create_action(mainWindow,
+            u'importThemeItem', category=unicode(UiStrings().Import))
+        self.importLanguageItem = create_action(mainWindow,
+            u'importLanguageItem')#, category=unicode(UiStrings().Import))
         action_list.add_category(unicode(UiStrings().Export),
             CategoryOrder.standardMenu)
-        self.exportThemeItem = base_action(
-            mainWindow, u'exportThemeItem', unicode(UiStrings().Export))
-        self.exportLanguageItem = base_action(
-            mainWindow, u'exportLanguageItem')#, unicode(UiStrings().Export))
+        self.exportThemeItem = create_action(mainWindow,
+            u'exportThemeItem', category=unicode(UiStrings().Export))
+        self.exportLanguageItem = create_action(mainWindow,
+            u'exportLanguageItem')#, category=unicode(UiStrings().Export))
         action_list.add_category(unicode(UiStrings().View),
             CategoryOrder.standardMenu)
-        self.viewMediaManagerItem = shortcut_action(mainWindow,
-            u'viewMediaManagerItem', [QtGui.QKeySequence(u'F8')],
-            self.toggleMediaManager, u':/system/system_mediamanager.png',
-            self.mediaManagerDock.isVisible(), unicode(UiStrings().View))
-        self.viewThemeManagerItem = shortcut_action(mainWindow,
-            u'viewThemeManagerItem', [QtGui.QKeySequence(u'F10')],
-            self.toggleThemeManager, u':/system/system_thememanager.png',
-            self.themeManagerDock.isVisible(), unicode(UiStrings().View))
-        self.viewServiceManagerItem = shortcut_action(mainWindow,
-            u'viewServiceManagerItem', [QtGui.QKeySequence(u'F9')],
-            self.toggleServiceManager, u':/system/system_servicemanager.png',
-            self.serviceManagerDock.isVisible(), unicode(UiStrings().View))
-        self.viewPreviewPanel = shortcut_action(mainWindow,
-            u'viewPreviewPanel', [QtGui.QKeySequence(u'F11')],
-            self.setPreviewPanelVisibility, checked=previewVisible,
-            category=unicode(UiStrings().View))
-        self.viewLivePanel = shortcut_action(mainWindow, u'viewLivePanel',
-            [QtGui.QKeySequence(u'F12')], self.setLivePanelVisibility,
-            checked=liveVisible, category=unicode(UiStrings().View))
-        self.lockPanel = shortcut_action(mainWindow, u'lockPanel',
-            None, self.setLockPanel,
-            checked=panelLocked, category=None)
+        self.viewMediaManagerItem = create_action(mainWindow,
+            u'viewMediaManagerItem', shortcuts=[QtGui.QKeySequence(u'F8')],
+            icon=u':/system/system_mediamanager.png',
+            checked=self.mediaManagerDock.isVisible(),
+            category=unicode(UiStrings().View),
+            triggers=self.toggleMediaManager)
+        self.viewThemeManagerItem = create_action(mainWindow,
+            u'viewThemeManagerItem', shortcuts=[QtGui.QKeySequence(u'F10')],
+            icon=u':/system/system_thememanager.png',
+            checked=self.themeManagerDock.isVisible(),
+            category=unicode(UiStrings().View),
+            triggers=self.toggleThemeManager)
+        self.viewServiceManagerItem = create_action(mainWindow,
+            u'viewServiceManagerItem', shortcuts=[QtGui.QKeySequence(u'F9')],
+            icon=u':/system/system_servicemanager.png',
+            checked=self.serviceManagerDock.isVisible(),
+            category=unicode(UiStrings().View),
+            triggers=self.toggleServiceManager)
+        self.viewPreviewPanel = create_action(mainWindow, u'viewPreviewPanel',
+            shortcuts=[QtGui.QKeySequence(u'F11')], checked=previewVisible,
+            category=unicode(UiStrings().View),
+            triggers=self.setPreviewPanelVisibility)
+        self.viewLivePanel = create_action(mainWindow, u'viewLivePanel',
+            shortcuts=[QtGui.QKeySequence(u'F12')], checked=liveVisible,
+            category=unicode(UiStrings().View),
+            triggers=self.setLivePanelVisibility)
+        self.lockPanel = create_action(mainWindow, u'lockPanel',
+            checked=panelLocked, triggers=self.setLockPanel)
         action_list.add_category(unicode(UiStrings().ViewMode),
             CategoryOrder.standardMenu)
-        self.modeDefaultItem = checkable_action(
-            mainWindow, u'modeDefaultItem',
-            category=unicode(UiStrings().ViewMode))
-        self.modeSetupItem = checkable_action(
-            mainWindow, u'modeSetupItem',
-            category=unicode(UiStrings().ViewMode))
-        self.modeLiveItem = checkable_action(
-            mainWindow, u'modeLiveItem', True, unicode(UiStrings().ViewMode))
+        self.modeDefaultItem = create_action(mainWindow, u'modeDefaultItem',
+            checked=False, category=unicode(UiStrings().ViewMode))
+        self.modeSetupItem = create_action(mainWindow, u'modeSetupItem',
+            checked=False, category=unicode(UiStrings().ViewMode))
+        self.modeLiveItem = create_action(mainWindow, u'modeLiveItem',
+            checked=True, category=unicode(UiStrings().ViewMode))
         self.modeGroup = QtGui.QActionGroup(mainWindow)
         self.modeGroup.addAction(self.modeDefaultItem)
         self.modeGroup.addAction(self.modeSetupItem)
@@ -255,25 +263,28 @@
         self.modeDefaultItem.setChecked(True)
         action_list.add_category(unicode(UiStrings().Tools),
             CategoryOrder.standardMenu)
-        self.toolsAddToolItem = icon_action(mainWindow, u'toolsAddToolItem',
-            u':/tools/tools_add.png', category=unicode(UiStrings().Tools))
-        self.toolsOpenDataFolder = icon_action(mainWindow,
-            u'toolsOpenDataFolder', u':/general/general_open.png',
-            category=unicode(UiStrings().Tools))
-        self.toolsFirstTimeWizard = icon_action(mainWindow,
-            u'toolsFirstTimeWizard', u':/general/general_revert.png',
-            category=unicode(UiStrings().Tools))
-        self.updateThemeImages = base_action(mainWindow,
+        self.toolsAddToolItem = create_action(mainWindow,
+            u'toolsAddToolItem', icon=u':/tools/tools_add.png',
+            category=unicode(UiStrings().Tools))
+        self.toolsOpenDataFolder = create_action(mainWindow,
+            u'toolsOpenDataFolder', icon=u':/general/general_open.png',
+            category=unicode(UiStrings().Tools))
+        self.toolsFirstTimeWizard = create_action(mainWindow,
+            u'toolsFirstTimeWizard', icon=u':/general/general_revert.png',
+            category=unicode(UiStrings().Tools))
+        self.updateThemeImages = create_action(mainWindow,
             u'updateThemeImages', category=unicode(UiStrings().Tools))
         action_list.add_category(unicode(UiStrings().Settings),
             CategoryOrder.standardMenu)
-        self.settingsPluginListItem = shortcut_action(mainWindow,
-            u'settingsPluginListItem', [QtGui.QKeySequence(u'Alt+F7')],
-            self.onPluginItemClicked, u':/system/settings_plugin_list.png',
-            category=unicode(UiStrings().Settings))
+        self.settingsPluginListItem = create_action(mainWindow,
+            u'settingsPluginListItem',
+            icon=u':/system/settings_plugin_list.png',
+            shortcuts=[QtGui.QKeySequence(u'Alt+F7')],
+            category=unicode(UiStrings().Settings),
+            triggers=self.onPluginItemClicked)
         # i18n Language Items
-        self.autoLanguageItem = checkable_action(mainWindow,
-            u'autoLanguageItem', LanguageManager.auto_language)
+        self.autoLanguageItem = create_action(mainWindow, u'autoLanguageItem',
+            checked=LanguageManager.auto_language)
         self.languageGroup = QtGui.QActionGroup(mainWindow)
         self.languageGroup.setExclusive(True)
         self.languageGroup.setObjectName(u'languageGroup')
@@ -281,44 +292,46 @@
         qmList = LanguageManager.get_qm_list()
         savedLanguage = LanguageManager.get_language()
         for key in sorted(qmList.keys()):
-            languageItem = checkable_action(
-                mainWindow, key, qmList[key] == savedLanguage)
+            languageItem = create_action(mainWindow, key,
+                checked=qmList[key] == savedLanguage)
             add_actions(self.languageGroup, [languageItem])
-        self.settingsShortcutsItem = icon_action(mainWindow,
+        self.settingsShortcutsItem = create_action(mainWindow,
             u'settingsShortcutsItem',
-            u':/system/system_configure_shortcuts.png',
+            icon=u':/system/system_configure_shortcuts.png',
             category=unicode(UiStrings().Settings))
         # Formatting Tags were also known as display tags.
-        self.formattingTagItem = icon_action(mainWindow,
-            u'displayTagItem', u':/system/tag_editor.png',
-            category=unicode(UiStrings().Settings))
-        self.settingsConfigureItem = icon_action(mainWindow,
-            u'settingsConfigureItem', u':/system/system_settings.png',
-            category=unicode(UiStrings().Settings))
-        self.settingsImportItem = base_action(mainWindow,
+        self.formattingTagItem = create_action(mainWindow,
+            u'displayTagItem', icon=u':/system/tag_editor.png',
+            category=unicode(UiStrings().Settings))
+        self.settingsConfigureItem = create_action(mainWindow,
+            u'settingsConfigureItem', icon=u':/system/system_settings.png',
+            category=unicode(UiStrings().Settings))
+        self.settingsImportItem = create_action(mainWindow,
            u'settingsImportItem', category=unicode(UiStrings().Settings))
-        self.settingsExportItem = base_action(mainWindow,
+        self.settingsExportItem = create_action(mainWindow,
            u'settingsExportItem', category=unicode(UiStrings().Settings))
         action_list.add_category(unicode(UiStrings().Help),
             CategoryOrder.standardMenu)
-        self.aboutItem = shortcut_action(mainWindow, u'aboutItem',
-            [QtGui.QKeySequence(u'Ctrl+F1')], self.onAboutItemClicked,
-            u':/system/system_about.png', category=unicode(UiStrings().Help))
+        self.aboutItem = create_action(mainWindow, u'aboutItem',
+            icon=u':/system/system_about.png',
+            shortcuts=[QtGui.QKeySequence(u'Ctrl+F1')],
+            category=unicode(UiStrings().Help),
+            triggers=self.onAboutItemClicked)
         if os.name == u'nt':
             self.localHelpFile = os.path.join(
                 AppLocation.get_directory(AppLocation.AppDir), 'OpenLP.chm')
-            self.offlineHelpItem = shortcut_action(
-                mainWindow, u'offlineHelpItem', [QtGui.QKeySequence(u'F1')],
-                self.onOfflineHelpClicked,
-                u':/system/system_help_contents.png',
-                category=unicode(UiStrings().Help))
-        self.onlineHelpItem = shortcut_action(
-            mainWindow, u'onlineHelpItem',
-            [QtGui.QKeySequence(u'Alt+F1')], self.onOnlineHelpClicked,
-            u':/system/system_online_help.png',
-            category=unicode(UiStrings().Help))
-        self.webSiteItem = base_action(
-            mainWindow, u'webSiteItem', category=unicode(UiStrings().Help))
+            self.offlineHelpItem = create_action(mainWindow, u'offlineHelpItem',
+                icon=u':/system/system_help_contents.png',
+                shortcuts=[QtGui.QKeySequence(u'F1')],
+                category=unicode(UiStrings().Help),
+                triggers=self.onOfflineHelpClicked)
+        self.onlineHelpItem = create_action(mainWindow, u'onlineHelpItem',
+            icon=u':/system/system_online_help.png',
+            shortcuts=[QtGui.QKeySequence(u'Alt+F1')],
+            category=unicode(UiStrings().Help),
+            triggers=self.onOnlineHelpClicked)
+        self.webSiteItem = create_action(mainWindow,
+            u'webSiteItem', category=unicode(UiStrings().Help))
         add_actions(self.fileImportMenu, (self.settingsImportItem, None,
             self.importThemeItem, self.importLanguageItem))
         add_actions(self.fileExportMenu, (self.settingsExportItem, None,
@@ -1378,27 +1391,24 @@
         recentFileCount = QtCore.QSettings().value(
             u'advanced/recent file count', QtCore.QVariant(4)).toInt()[0]
         existingRecentFiles = [recentFile for recentFile in self.recentFiles
-            if QtCore.QFile.exists(recentFile)]
+            if os.path.isfile(unicode(recentFile))]
         recentFilesToDisplay = existingRecentFiles[0:recentFileCount]
         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)
+            action =  create_action(self, u'',
+                text=u'&%d %s' % (fileId + 1, os.path.splitext(os.path.basename(
+                unicode(filename)))[0]), data=filename,
+                triggers=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.'))
+        clearRecentFilesAction =  create_action(self, u'',
+            text=translate('OpenLP.MainWindow', 'Clear List',
+            'Clear List of recent files'),
+            statustip=translate('OpenLP.MainWindow',
+            'Clear the list of recent files.'),
+            enabled=not self.recentFiles.isEmpty(),
+            triggers=self.recentFiles.clear)
         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):

=== modified file 'openlp/core/ui/servicemanager.py'
--- openlp/core/ui/servicemanager.py	2012-02-07 22:07:24 +0000
+++ openlp/core/ui/servicemanager.py	2012-02-28 09:34:28 +0000
@@ -683,7 +683,7 @@
                         'File is not a valid service.\n'
                         'The content encoding is not UTF-8.'))
                     continue
-                osfile = unicode(QtCore.QDir.toNativeSeparators(ucsfile))
+                osfile = ucsfile.replace(u'/', os.path.sep)
                 if not osfile.startswith(u'audio'):
                     osfile = os.path.split(osfile)[1]
                 log.debug(u'Extract file: %s', osfile)

=== modified file 'openlp/core/ui/slidecontroller.py'
--- openlp/core/ui/slidecontroller.py	2012-02-15 10:37:42 +0000
+++ openlp/core/ui/slidecontroller.py	2012-02-28 09:34:28 +0000
@@ -34,7 +34,7 @@
 
 from openlp.core.lib import OpenLPToolbar, Receiver, ItemCapabilities, \
     translate, build_icon, ServiceItem, build_html, PluginManager, ServiceItem
-from openlp.core.lib.ui import UiStrings, shortcut_action
+from openlp.core.lib.ui import UiStrings, create_action
 from openlp.core.lib import SlideLimits, ServiceItemAction
 from openlp.core.ui import HideMode, MainDisplay, Display, ScreenList
 from openlp.core.utils.actions import ActionList, CategoryOrder
@@ -191,24 +191,24 @@
             self.toolbar.addToolbarWidget(u'Hide Menu', self.hideMenu)
             self.hideMenu.setMenu(QtGui.QMenu(
                 translate('OpenLP.SlideController', 'Hide'), self.toolbar))
-            self.blankScreen = shortcut_action(self.hideMenu, u'blankScreen',
-                [QtCore.Qt.Key_Period], self.onBlankDisplay,
-                u':/slides/slide_blank.png', False,
-                unicode(UiStrings().LiveToolbar))
-            self.blankScreen.setText(
-                translate('OpenLP.SlideController', 'Blank Screen'))
-            self.themeScreen = shortcut_action(self.hideMenu, u'themeScreen',
-                [QtGui.QKeySequence(u'T')], self.onThemeDisplay,
-                u':/slides/slide_theme.png', False,
-                unicode(UiStrings().LiveToolbar))
-            self.themeScreen.setText(
-                translate('OpenLP.SlideController', 'Blank to Theme'))
-            self.desktopScreen = shortcut_action(self.hideMenu,
-                u'desktopScreen', [QtGui.QKeySequence(u'D')],
-                self.onHideDisplay, u':/slides/slide_desktop.png', False,
-                unicode(UiStrings().LiveToolbar))
-            self.desktopScreen.setText(
-                translate('OpenLP.SlideController', 'Show Desktop'))
+            self.blankScreen = create_action(self.hideMenu, u'blankScreen',
+                text=translate('OpenLP.SlideController', 'Blank Screen'),
+                icon=u':/slides/slide_blank.png', checked=False,
+                shortcuts=[QtCore.Qt.Key_Period],
+                category=unicode(UiStrings().LiveToolbar),
+                triggers=self.onBlankDisplay)
+            self.themeScreen = create_action(self.hideMenu, u'themeScreen',
+                text=translate('OpenLP.SlideController', 'Blank to Theme'),
+                icon=u':/slides/slide_theme.png', checked=False,
+                shortcuts=[QtGui.QKeySequence(u'T')],
+                category=unicode(UiStrings().LiveToolbar),
+                triggers=self.onThemeDisplay)
+            self.desktopScreen = create_action(self.hideMenu, u'desktopScreen',
+                text=translate('OpenLP.SlideController', 'Show Desktop'),
+                icon=u':/slides/slide_desktop.png', checked=False,
+                shortcuts=[QtGui.QKeySequence(u'D')],
+                category=unicode(UiStrings().LiveToolbar),
+                triggers=self.onHideDisplay)
             self.hideMenu.setDefaultAction(self.blankScreen)
             self.hideMenu.menu().addAction(self.blankScreen)
             self.hideMenu.menu().addAction(self.themeScreen)
@@ -224,16 +224,16 @@
             self.playSlidesMenu.setMenu(QtGui.QMenu(
                 translate('OpenLP.SlideController', 'Play Slides'),
                 self.toolbar))
-            self.playSlidesLoop = shortcut_action(self.playSlidesMenu,
-                u'playSlidesLoop', [], self.onPlaySlidesLoop,
-                u':/media/media_time.png', False,
-                unicode(UiStrings().LiveToolbar))
-            self.playSlidesLoop.setText(UiStrings().PlaySlidesInLoop)
-            self.playSlidesOnce = shortcut_action(self.playSlidesMenu,
-                u'playSlidesOnce', [], self.onPlaySlidesOnce,
-                u':/media/media_time.png', False,
-                unicode(UiStrings().LiveToolbar))
-            self.playSlidesOnce.setText(UiStrings().PlaySlidesToEnd)
+            self.playSlidesLoop = create_action(self.playSlidesMenu,
+                u'playSlidesLoop', text=UiStrings().PlaySlidesInLoop,
+                icon=u':/media/media_time.png', checked=False, shortcuts=[],
+                category=unicode(UiStrings().LiveToolbar),
+                triggers=self.onPlaySlidesLoop)
+            self.playSlidesOnce = create_action(self.playSlidesMenu,
+                u'playSlidesOnce', text=UiStrings().PlaySlidesToEnd,
+                icon=u':/media/media_time.png', checked=False, shortcuts=[],
+                category=unicode(UiStrings().LiveToolbar),
+                triggers=self.onPlaySlidesOnce)
             if QtCore.QSettings().value(self.parent().generalSettingsSection +
                 u'/enable slide loop', QtCore.QVariant(True)).toBool():
                 self.playSlidesMenu.setDefaultAction(self.playSlidesLoop)
@@ -328,86 +328,29 @@
             self.shortcutTimer = QtCore.QTimer()
             self.shortcutTimer.setObjectName(u'shortcutTimer')
             self.shortcutTimer.setSingleShot(True)
-            self.verseShortcut = shortcut_action(self, u'verseShortcut',
-                [QtGui.QKeySequence(u'V')], self.slideShortcutActivated,
-                category=unicode(UiStrings().LiveToolbar),
-                context=QtCore.Qt.WidgetWithChildrenShortcut)
-            self.verseShortcut.setText(translate(
-                'OpenLP.SlideController', 'Go to "Verse"'))
-            self.shortcut0 = shortcut_action(self, u'0',
-                [QtGui.QKeySequence(u'0')], self.slideShortcutActivated,
-                context=QtCore.Qt.WidgetWithChildrenShortcut)
-            self.shortcut1 = shortcut_action(self, u'1',
-                [QtGui.QKeySequence(u'1')], self.slideShortcutActivated,
-                context=QtCore.Qt.WidgetWithChildrenShortcut)
-            self.shortcut2 = shortcut_action(self, u'2',
-                [QtGui.QKeySequence(u'2')], self.slideShortcutActivated,
-                context=QtCore.Qt.WidgetWithChildrenShortcut)
-            self.shortcut3 = shortcut_action(self, u'3',
-                [QtGui.QKeySequence(u'3')], self.slideShortcutActivated,
-                context=QtCore.Qt.WidgetWithChildrenShortcut)
-            self.shortcut4 = shortcut_action(self, u'4',
-                [QtGui.QKeySequence(u'4')], self.slideShortcutActivated,
-                context=QtCore.Qt.WidgetWithChildrenShortcut)
-            self.shortcut5 = shortcut_action(self, u'5',
-                [QtGui.QKeySequence(u'5')], self.slideShortcutActivated,
-                context=QtCore.Qt.WidgetWithChildrenShortcut)
-            self.shortcut6 = shortcut_action(self, u'6',
-                [QtGui.QKeySequence(u'6')], self.slideShortcutActivated,
-                context=QtCore.Qt.WidgetWithChildrenShortcut)
-            self.shortcut7 = shortcut_action(self, u'7',
-                [QtGui.QKeySequence(u'7')], self.slideShortcutActivated,
-                context=QtCore.Qt.WidgetWithChildrenShortcut)
-            self.shortcut8 = shortcut_action(self, u'8',
-                [QtGui.QKeySequence(u'8')], self.slideShortcutActivated,
-                context=QtCore.Qt.WidgetWithChildrenShortcut)
-            self.shortcut9 = shortcut_action(self, u'9',
-                [QtGui.QKeySequence(u'9')], self.slideShortcutActivated,
-                context=QtCore.Qt.WidgetWithChildrenShortcut)
-            self.chorusShortcut = shortcut_action(self, u'chorusShortcut',
-                [QtGui.QKeySequence(u'C')], self.slideShortcutActivated,
-                category=unicode(UiStrings().LiveToolbar),
-                context=QtCore.Qt.WidgetWithChildrenShortcut)
-            self.chorusShortcut.setText(translate(
-                'OpenLP.SlideController', 'Go to "Chorus"'))
-            self.bridgeShortcut = shortcut_action(self, u'bridgeShortcut',
-                [QtGui.QKeySequence(u'B')], self.slideShortcutActivated,
-                category=unicode(UiStrings().LiveToolbar),
-                context=QtCore.Qt.WidgetWithChildrenShortcut)
-            self.bridgeShortcut.setText(translate(
-                'OpenLP.SlideController', 'Go to "Bridge"'))
-            self.preChorusShortcut = shortcut_action(self, u'preChorusShortcut',
-                [QtGui.QKeySequence(u'P')], self.slideShortcutActivated,
-                category=unicode(UiStrings().LiveToolbar),
-                context=QtCore.Qt.WidgetWithChildrenShortcut)
-            self.preChorusShortcut.setText(translate(
-                'OpenLP.SlideController', 'Go to "Pre-Chorus"'))
-            self.introShortcut = shortcut_action(self, u'introShortcut',
-                [QtGui.QKeySequence(u'I')], self.slideShortcutActivated,
-                category=unicode(UiStrings().LiveToolbar),
-                context=QtCore.Qt.WidgetWithChildrenShortcut)
-            self.introShortcut.setText(translate(
-                'OpenLP.SlideController', 'Go to "Intro"'))
-            self.endingShortcut = shortcut_action(self, u'endingShortcut',
-                [QtGui.QKeySequence(u'E')], self.slideShortcutActivated,
-                category=unicode(UiStrings().LiveToolbar),
-                context=QtCore.Qt.WidgetWithChildrenShortcut)
-            self.endingShortcut.setText(translate(
-                'OpenLP.SlideController', 'Go to "Ending"'))
-            self.otherShortcut = shortcut_action(self, u'otherShortcut',
-                [QtGui.QKeySequence(u'O')], self.slideShortcutActivated,
-                category=unicode(UiStrings().LiveToolbar),
-                context=QtCore.Qt.WidgetWithChildrenShortcut)
-            self.otherShortcut.setText(translate(
-                'OpenLP.SlideController', 'Go to "Other"'))
-            self.previewListWidget.addActions([
-                self.shortcut0, self.shortcut1, self.shortcut2, self.shortcut3,
-                self.shortcut4, self.shortcut5, self.shortcut6, self.shortcut7,
-                self.shortcut8, self.shortcut9, self.verseShortcut,
-                self.chorusShortcut, self.bridgeShortcut,
-                self.preChorusShortcut, self.introShortcut, self.endingShortcut,
-                self.otherShortcut
-            ])
+            shortcuts = [{u'key': u'V', u'configurable': True,
+                u'text': translate('OpenLP.SlideController', 'Go to "Verse"')},
+                {u'key': u'C', u'configurable': True,
+                u'text': translate('OpenLP.SlideController', 'Go to "Chorus"')},
+                {u'key': u'B', u'configurable': True,
+                u'text': translate('OpenLP.SlideController', 'Go to "Bridge"')},
+                {u'key': u'P', u'configurable': True,
+                u'text': translate('OpenLP.SlideController',
+                'Go to "Pre-Chorus"')},
+                {u'key': u'I', u'configurable': True,
+                u'text': translate('OpenLP.SlideController', 'Go to "Intro"')},
+                {u'key': u'E', u'configurable': True,
+                u'text': translate('OpenLP.SlideController', 'Go to "Ending"')},
+                {u'key': u'O', u'configurable': True,
+                u'text': translate('OpenLP.SlideController', 'Go to "Other"')}]
+            shortcuts += [{u'key': unicode(number)} for number in range(0, 10)]
+            self.previewListWidget.addActions([create_action(self,
+                u'shortcutAction_%s' % s[u'key'], text=s.get(u'text'),
+                shortcuts=[QtGui.QKeySequence(s[u'key'])],
+                context=QtCore.Qt.WidgetWithChildrenShortcut,
+                category=unicode(UiStrings().LiveToolbar) \
+                    if s.get(u'configurable') else None,
+                triggers=self.slideShortcutActivated) for s in shortcuts])
             QtCore.QObject.connect(
                 self.shortcutTimer, QtCore.SIGNAL(u'timeout()'),
                 self.slideShortcutActivated)
@@ -476,52 +419,37 @@
             SONGS_PLUGIN_AVAILABLE = True
         except ImportError:
             SONGS_PLUGIN_AVAILABLE = False
-        verse_type = unicode(self.sender().objectName())
-        if verse_type.startswith(u'verseShortcut'):
-            if SONGS_PLUGIN_AVAILABLE:
+        verse_type = \
+            unicode(self.sender().objectName())[len(u'shortcutAction_'):]
+        if SONGS_PLUGIN_AVAILABLE:
+            if verse_type == u'V':
                 self.current_shortcut = \
                     VerseType.TranslatedTags[VerseType.Verse]
-            else:
-                self.current_shortcut = u'V'
-        elif verse_type.startswith(u'chorusShortcut'):
-            if SONGS_PLUGIN_AVAILABLE:
+            elif verse_type == u'C':
                 self.current_shortcut = \
                     VerseType.TranslatedTags[VerseType.Chorus]
-            else:
-                self.current_shortcut = u'C'
-        elif verse_type.startswith(u'bridgeShortcut'):
-            if SONGS_PLUGIN_AVAILABLE:
+            elif verse_type == u'B':
                 self.current_shortcut = \
                     VerseType.TranslatedTags[VerseType.Bridge]
-            else:
-                self.current_shortcut = u'B'
-        elif verse_type.startswith(u'preChorusShortcut'):
-            if SONGS_PLUGIN_AVAILABLE:
+            elif verse_type == u'P':
                 self.current_shortcut = \
                     VerseType.TranslatedTags[VerseType.PreChorus]
-            else:
-                self.current_shortcut = u'P'
-        elif verse_type.startswith(u'introShortcut'):
-            if SONGS_PLUGIN_AVAILABLE:
+            elif verse_type == u'I':
                 self.current_shortcut = \
                     VerseType.TranslatedTags[VerseType.Intro]
-            else:
-                self.current_shortcut = u'I'
-        elif verse_type.startswith(u'endingShortcut'):
-            if SONGS_PLUGIN_AVAILABLE:
+            elif verse_type == u'E':
                 self.current_shortcut = \
                     VerseType.TranslatedTags[VerseType.Ending]
-            else:
-                self.current_shortcut = u'E'
-        elif verse_type.startswith(u'otherShortcut'):
-            if SONGS_PLUGIN_AVAILABLE:
+            elif verse_type == u'O':
                 self.current_shortcut = \
                     VerseType.TranslatedTags[VerseType.Other]
-            else:
-                self.current_shortcut = u'O'
+            elif verse_type.isnumeric():
+                self.current_shortcut += verse_type
+            self.current_shortcut = self.current_shortcut.upper()
         elif verse_type.isnumeric():
             self.current_shortcut += verse_type
-        self.current_shortcut = self.current_shortcut.upper()
+        else:
+            self.current_shortcut = verse_type
         keys = self.slideList.keys()
         matches = [match for match in keys
             if match.startswith(self.current_shortcut)]
@@ -559,24 +487,24 @@
             unicode(UiStrings().LiveToolbar), CategoryOrder.standardToolbar)
         action_list.add_action(self.previousItem)
         action_list.add_action(self.nextItem)
-        self.previousService = shortcut_action(parent, u'previousService',
-            [QtCore.Qt.Key_Left], self.servicePrevious,
-            category=unicode(UiStrings().LiveToolbar),
-            context=QtCore.Qt.WidgetWithChildrenShortcut)
-        self.previousService.setText(
-            translate('OpenLP.SlideController', 'Previous Service'))
-        self.nextService = shortcut_action(parent, 'nextService',
-            [QtCore.Qt.Key_Right], self.serviceNext,
-            category=unicode(UiStrings().LiveToolbar),
-            context=QtCore.Qt.WidgetWithChildrenShortcut)
-        self.nextService.setText(
-            translate('OpenLP.SlideController', 'Next Service'))
-        self.escapeItem = shortcut_action(parent, 'escapeItem',
-            [QtCore.Qt.Key_Escape], self.liveEscape,
-            category=unicode(UiStrings().LiveToolbar),
-            context=QtCore.Qt.WidgetWithChildrenShortcut)
-        self.escapeItem.setText(
-            translate('OpenLP.SlideController', 'Escape Item'))
+        self.previousService = create_action(parent, u'previousService',
+            text=translate('OpenLP.SlideController', 'Previous Service'),
+            shortcuts=[QtCore.Qt.Key_Left],
+            context=QtCore.Qt.WidgetWithChildrenShortcut,
+            category=unicode(UiStrings().LiveToolbar),
+            triggers=self.servicePrevious)
+        self.nextService = create_action(parent, 'nextService',
+            text=translate('OpenLP.SlideController', 'Next Service'),
+            shortcuts=[QtCore.Qt.Key_Right],
+            context=QtCore.Qt.WidgetWithChildrenShortcut,
+            category=unicode(UiStrings().LiveToolbar),
+            triggers=self.serviceNext)
+        self.escapeItem = create_action(parent, 'escapeItem',
+            text=translate('OpenLP.SlideController', 'Escape Item'),
+            shortcuts=[QtCore.Qt.Key_Escape],
+            context=QtCore.Qt.WidgetWithChildrenShortcut,
+            category=unicode(UiStrings().LiveToolbar),
+            triggers=self.liveEscape)
 
     def liveEscape(self):
         self.display.setVisible(False)

=== modified file 'openlp/core/ui/thememanager.py'
--- openlp/core/ui/thememanager.py	2012-01-18 13:50:06 +0000
+++ openlp/core/ui/thememanager.py	2012-02-28 09:34:28 +0000
@@ -544,7 +544,7 @@
                         log.exception(u'Theme file contains non utf-8 filename'
                             u' "%s"' % name.decode(u'utf-8', u'replace'))
                         raise Exception(u'validation')
-                    uname = unicode(QtCore.QDir.toNativeSeparators(uname))
+                    uname = uname.replace(u'/', os.path.sep)
                     splitname = uname.split(os.path.sep)
                     if splitname[-1] == u'' or len(splitname) == 1:
                         # is directory or preview file

=== modified file 'openlp/plugins/alerts/alertsplugin.py'
--- openlp/plugins/alerts/alertsplugin.py	2011-12-27 10:33:55 +0000
+++ openlp/plugins/alerts/alertsplugin.py	2012-02-28 09:34:28 +0000
@@ -31,7 +31,7 @@
 
 from openlp.core.lib import Plugin, StringContent, build_icon, translate
 from openlp.core.lib.db import Manager
-from openlp.core.lib.ui import icon_action, UiStrings
+from openlp.core.lib.ui import create_action, UiStrings
 from openlp.core.lib.theme import VerticalType
 from openlp.core.utils.actions import ActionList
 from openlp.plugins.alerts.lib import AlertsManager, AlertsTab
@@ -133,16 +133,12 @@
             use it as their parent.
         """
         log.info(u'add tools menu')
-        self.toolsAlertItem = icon_action(tools_menu, u'toolsAlertItem',
-            u':/plugins/plugin_alerts.png')
-        self.toolsAlertItem.setText(translate('AlertsPlugin', '&Alert'))
-        self.toolsAlertItem.setStatusTip(
-            translate('AlertsPlugin', 'Show an alert message.'))
-        self.toolsAlertItem.setShortcut(u'F7')
+        self.toolsAlertItem = create_action(tools_menu, u'toolsAlertItem',
+            text=translate('AlertsPlugin', '&Alert'),
+            icon=u':/plugins/plugin_alerts.png',
+            statustip=translate('AlertsPlugin', 'Show an alert message.'),
+            visible=False, shortcuts=u'F7', triggers=self.onAlertsTrigger)
         self.serviceManager.mainwindow.toolsMenu.addAction(self.toolsAlertItem)
-        QtCore.QObject.connect(self.toolsAlertItem,
-            QtCore.SIGNAL(u'triggered()'), self.onAlertsTrigger)
-        self.toolsAlertItem.setVisible(False)
 
     def initialise(self):
         log.info(u'Alerts Initialising')

=== modified file 'openlp/plugins/bibles/bibleplugin.py'
--- openlp/plugins/bibles/bibleplugin.py	2011-12-27 10:33:55 +0000
+++ openlp/plugins/bibles/bibleplugin.py	2012-02-28 09:34:28 +0000
@@ -30,7 +30,7 @@
 from PyQt4 import QtCore, QtGui
 
 from openlp.core.lib import Plugin, StringContent, build_icon, translate
-from openlp.core.lib.ui import base_action, UiStrings
+from openlp.core.lib.ui import create_action, UiStrings
 from openlp.core.utils.actions import ActionList
 from openlp.plugins.bibles.lib import BibleManager, BiblesTab, BibleMediaItem
 from openlp.plugins.bibles.forms import BibleUpgradeForm
@@ -93,19 +93,16 @@
                 self.onToolsUpgradeItemTriggered()
 
     def addImportMenuItem(self, import_menu):
-        self.importBibleItem = base_action(import_menu, u'importBibleItem')
-        self.importBibleItem.setText(translate('BiblesPlugin', '&Bible'))
+        self.importBibleItem = create_action(import_menu, u'importBibleItem',
+            text=translate('BiblesPlugin', '&Bible'), visible=False,
+            triggers=self.onBibleImportClick)
         import_menu.addAction(self.importBibleItem)
-        # signals and slots
-        QtCore.QObject.connect(self.importBibleItem,
-            QtCore.SIGNAL(u'triggered()'), self.onBibleImportClick)
-        self.importBibleItem.setVisible(False)
 
     def addExportMenuItem(self, export_menu):
-        self.exportBibleItem = base_action(export_menu, u'exportBibleItem')
-        self.exportBibleItem.setText(translate('BiblesPlugin', '&Bible'))
+        self.exportBibleItem = create_action(export_menu, u'exportBibleItem',
+            text=translate('BiblesPlugin', '&Bible'),
+            visible=False)
         export_menu.addAction(self.exportBibleItem)
-        self.exportBibleItem.setVisible(False)
 
     def addToolsMenuItem(self, tools_menu):
         """
@@ -117,17 +114,12 @@
             use it as their parent.
         """
         log.debug(u'add tools menu')
-        self.toolsUpgradeItem = QtGui.QAction(tools_menu)
-        self.toolsUpgradeItem.setObjectName(u'toolsUpgradeItem')
-        self.toolsUpgradeItem.setText(
-            translate('BiblesPlugin', '&Upgrade older Bibles'))
-        self.toolsUpgradeItem.setStatusTip(
-            translate('BiblesPlugin', 'Upgrade the Bible databases to the '
-            'latest format.'))
+        self.toolsUpgradeItem = create_action(tools_menu, u'toolsUpgradeItem',
+            text=translate('BiblesPlugin', '&Upgrade older Bibles'),
+            statustip=translate('BiblesPlugin',
+            'Upgrade the Bible databases to the latest format.'),
+            visible=False, triggers=self.onToolsUpgradeItemTriggered)
         tools_menu.addAction(self.toolsUpgradeItem)
-        QtCore.QObject.connect(self.toolsUpgradeItem,
-            QtCore.SIGNAL(u'triggered()'), self.onToolsUpgradeItemTriggered)
-        self.toolsUpgradeItem.setVisible(False)
 
     def onToolsUpgradeItemTriggered(self):
         """

=== modified file 'openlp/plugins/songs/songsplugin.py'
--- openlp/plugins/songs/songsplugin.py	2011-12-27 10:33:55 +0000
+++ openlp/plugins/songs/songsplugin.py	2012-02-28 09:34:28 +0000
@@ -34,7 +34,7 @@
 from openlp.core.lib import Plugin, StringContent, build_icon, translate, \
     Receiver
 from openlp.core.lib.db import Manager
-from openlp.core.lib.ui import UiStrings, base_action, icon_action
+from openlp.core.lib.ui import UiStrings, create_action
 from openlp.core.utils.actions import ActionList
 from openlp.plugins.songs.lib import clean_song, upgrade, SongMediaItem, \
     SongsTab
@@ -93,14 +93,12 @@
             use it as their parent.
         """
         # Main song import menu item - will eventually be the only one
-        self.songImportItem = base_action(import_menu, u'songImportItem')
-        self.songImportItem.setText(translate('SongsPlugin', '&Song'))
-        self.songImportItem.setToolTip(translate('SongsPlugin',
-            'Import songs using the import wizard.'))
+        self.songImportItem = create_action(import_menu, u'songImportItem',
+            text=translate('SongsPlugin', '&Song'),
+            tooltip=translate('SongsPlugin',
+            'Import songs using the import wizard.'),
+            triggers=self.onSongImportItemClicked)
         import_menu.addAction(self.songImportItem)
-        # Signals and slots
-        QtCore.QObject.connect(self.songImportItem,
-            QtCore.SIGNAL(u'triggered()'), self.onSongImportItemClicked)
 
     def addExportMenuItem(self, export_menu):
         """
@@ -112,14 +110,12 @@
             use it as their parent.
         """
         # Main song import menu item - will eventually be the only one
-        self.songExportItem = base_action(export_menu, u'songExportItem')
-        self.songExportItem.setText(translate('SongsPlugin', '&Song'))
-        self.songExportItem.setToolTip(translate('SongsPlugin',
-            'Exports songs using the export wizard.'))
+        self.songExportItem = create_action(export_menu, u'songExportItem',
+            text=translate('SongsPlugin', '&Song'),
+            tooltip=translate('SongsPlugin',
+            'Exports songs using the export wizard.'),
+            triggers=self.onSongExportItemClicked)
         export_menu.addAction(self.songExportItem)
-        # Signals and slots
-        QtCore.QObject.connect(self.songExportItem,
-            QtCore.SIGNAL(u'triggered()'), self.onSongExportItemClicked)
 
     def addToolsMenuItem(self, tools_menu):
         """
@@ -131,17 +127,13 @@
             use it as their parent.
         """
         log.info(u'add tools menu')
-        self.toolsReindexItem = icon_action(tools_menu, u'toolsReindexItem',
-            u':/plugins/plugin_songs.png')
-        self.toolsReindexItem.setText(
-            translate('SongsPlugin', '&Re-index Songs'))
-        self.toolsReindexItem.setStatusTip(
-            translate('SongsPlugin', 'Re-index the songs database to improve '
-            'searching and ordering.'))
+        self.toolsReindexItem = create_action(tools_menu, u'toolsReindexItem',
+            text=translate('SongsPlugin', '&Re-index Songs'),
+            icon=u':/plugins/plugin_songs.png',
+            statustip=translate('SongsPlugin',
+            'Re-index the songs database to improve searching and ordering.'),
+            visible=False, triggers=self.onToolsReindexItemTriggered)
         tools_menu.addAction(self.toolsReindexItem)
-        QtCore.QObject.connect(self.toolsReindexItem,
-            QtCore.SIGNAL(u'triggered()'), self.onToolsReindexItemTriggered)
-        self.toolsReindexItem.setVisible(False)
 
     def onToolsReindexItemTriggered(self):
         """

=== modified file 'openlp/plugins/songusage/songusageplugin.py'
--- openlp/plugins/songusage/songusageplugin.py	2011-12-27 10:33:55 +0000
+++ openlp/plugins/songusage/songusageplugin.py	2012-02-28 09:34:28 +0000
@@ -33,7 +33,7 @@
 from openlp.core.lib import Plugin, StringContent, Receiver, build_icon, \
     translate
 from openlp.core.lib.db import Manager
-from openlp.core.lib.ui import base_action, shortcut_action
+from openlp.core.lib.ui import create_action
 from openlp.core.utils.actions import ActionList
 from openlp.plugins.songusage.forms import SongUsageDetailForm, \
     SongUsageDeleteForm
@@ -73,24 +73,24 @@
         self.songUsageMenu.setTitle(translate(
             'SongUsagePlugin', '&Song Usage Tracking'))
         # SongUsage Delete
-        self.songUsageDelete = base_action(tools_menu, u'songUsageDelete')
-        self.songUsageDelete.setText(translate('SongUsagePlugin',
-            '&Delete Tracking Data'))
-        self.songUsageDelete.setStatusTip(translate('SongUsagePlugin',
-            'Delete song usage data up to a specified date.'))
+        self.songUsageDelete = create_action(tools_menu, u'songUsageDelete',
+            text=translate('SongUsagePlugin', '&Delete Tracking Data'),
+            statustip=translate('SongUsagePlugin',
+            'Delete song usage data up to a specified date.'),
+            triggers=self.onSongUsageDelete)
         # SongUsage Report
-        self.songUsageReport = base_action(tools_menu, u'songUsageReport')
-        self.songUsageReport.setText(
-            translate('SongUsagePlugin', '&Extract Tracking Data'))
-        self.songUsageReport.setStatusTip(
-            translate('SongUsagePlugin', 'Generate a report on song usage.'))
+        self.songUsageReport = create_action(tools_menu, u'songUsageReport',
+            text=translate('SongUsagePlugin', '&Extract Tracking Data'),
+            statustip=translate('SongUsagePlugin',
+            'Generate a report on song usage.'),
+            triggers=self.onSongUsageReport)
         # SongUsage activation
-        self.songUsageStatus = shortcut_action(tools_menu, u'songUsageStatus',
-            [QtCore.Qt.Key_F4], self.toggleSongUsageState, checked=False)
-        self.songUsageStatus.setText(translate(
-            'SongUsagePlugin', 'Toggle Tracking'))
-        self.songUsageStatus.setStatusTip(translate('SongUsagePlugin',
-            'Toggle the tracking of song usage.'))
+        self.songUsageStatus = create_action(tools_menu, u'songUsageStatus',
+            text=translate('SongUsagePlugin', 'Toggle Tracking'),
+            statustip=translate('SongUsagePlugin',
+            'Toggle the tracking of song usage.'), checked=False,
+            shortcuts=[QtCore.Qt.Key_F4],
+            triggers=self.toggleSongUsageState)
         # Add Menus together
         self.toolsMenu.addAction(self.songUsageMenu.menuAction())
         self.songUsageMenu.addAction(self.songUsageStatus)
@@ -114,10 +114,6 @@
         QtCore.QObject.connect(self.songUsageActiveButton,
             QtCore.SIGNAL(u'toggled(bool)'),
             self.toggleSongUsageState)
-        QtCore.QObject.connect(self.songUsageDelete,
-            QtCore.SIGNAL(u'triggered()'), self.onSongUsageDelete)
-        QtCore.QObject.connect(self.songUsageReport,
-            QtCore.SIGNAL(u'triggered()'), self.onSongUsageReport)
         self.songUsageMenu.menuAction().setVisible(False)
 
     def initialise(self):


Follow ups