← Back to team overview

openlp-core team mailing list archive

[Merge] lp:~trb143/openlp/service-delete into lp:openlp

 

Tim Bentley has proposed merging lp:~trb143/openlp/service-delete into lp:openlp.

Requested reviews:
  OpenLP Core (openlp-core)

For more details, see:
https://code.launchpad.net/~trb143/openlp/service-delete/+merge/104919

Allow delete key to work for deleting service items.
-- 
https://code.launchpad.net/~trb143/openlp/service-delete/+merge/104919
Your team OpenLP Core is requested to review the proposed merge of lp:~trb143/openlp/service-delete into lp:openlp.
=== modified file 'openlp/core/ui/servicemanager.py'
--- openlp/core/ui/servicemanager.py	2012-05-05 12:24:25 +0000
+++ openlp/core/ui/servicemanager.py	2012-05-07 14:34:27 +0000
@@ -64,6 +64,9 @@
             elif event.key() == QtCore.Qt.Key_Down:
                 self.serviceManager.onMoveSelectionDown()
                 event.accept()
+            elif event.key() == QtCore.Qt.Key_Delete:
+                self.serviceManager.onDeleteFromService()
+                event.accept()
             event.ignore()
         else:
             event.ignore()
@@ -218,6 +221,7 @@
             icon=u':/general/general_delete.png',
             tooltip=translate('OpenLP.ServiceManager',
             'Delete the selected item from the service.'),
+            shortcuts=[QtCore.Qt.Key_Delete],
             triggers=self.onDeleteFromService)
         self.orderToolbar.addSeparator()
         self.serviceManagerList.expand = self.orderToolbar.addToolbarAction(
@@ -1317,10 +1321,10 @@
 
     def findServiceItem(self):
         """
-        Finds the selected ServiceItem in the list and returns the position of
-        the serviceitem and its selected child item. For example, if the third
-        child item (in the Slidecontroller known as slide) in the second service
-        item is selected this will return::
+        Finds the first selected ServiceItem in the list and returns the
+        position of the serviceitem and its selected child item. For example,
+        if the third child item (in the Slidecontroller known as slide) in the
+        second service item is selected this will return::
 
             (1, 2)
         """
@@ -1334,8 +1338,10 @@
             else:
                 serviceItem = parentitem.data(0, QtCore.Qt.UserRole).toInt()[0]
                 serviceItemChild = item.data(0, QtCore.Qt.UserRole).toInt()[0]
-        # Adjust for zero based arrays.
-        serviceItem -= 1
+            # Adjust for zero based arrays.
+            serviceItem -= 1
+            # Only process the first item on the list for this method.
+            break
         return serviceItem, serviceItemChild
 
     def dragEnterEvent(self, event):


Follow ups