diff --git a/openlp/core/ui/servicemanager.py b/openlp/core/ui/servicemanager.py index e0443a478..96734bc47 100644 --- a/openlp/core/ui/servicemanager.py +++ b/openlp/core/ui/servicemanager.py @@ -67,7 +67,6 @@ class ServiceManagerList(QtGui.QTreeWidget): elif event.key() == QtCore.Qt.Key_Delete: self.serviceManager.onDeleteFromService() event.accept() - print "Key event " + unicode(event.key()) event.ignore() else: event.ignore() @@ -222,7 +221,7 @@ class ServiceManager(QtGui.QWidget): icon=u':/general/general_delete.png', tooltip=translate('OpenLP.ServiceManager', 'Delete the selected item from the service.'), - shortcuts=[QtCore.Qt.Key_Delete], category=UiStrings().Service, + shortcuts=[QtCore.Qt.Key_Delete], triggers=self.onDeleteFromService) self.orderToolbar.addSeparator() self.serviceManagerList.expand = self.orderToolbar.addToolbarAction( @@ -1322,7 +1321,32 @@ class ServiceManager(QtGui.QWidget): def findServiceItem(self): """ - Finds the selected ServiceItem in the list and returns the position of + 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) + """ + items = self.serviceManagerList.selectedItems() + serviceItem = 0 + serviceItemChild = -1 + for item in items: + parentitem = item.parent() + if parentitem is None: + serviceItem = item.data(0, QtCore.Qt.UserRole).toInt()[0] + 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 + # Only process the first item on the list for this method. + break + return serviceItem, serviceItemChild + + def findServiceItems(self): + """ + Finds all selected ServiceItems 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:: @@ -1339,8 +1363,10 @@ class ServiceManager(QtGui.QWidget): 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):