← Back to team overview

openlp-core team mailing list archive

[Merge] lp:~googol-hush/openlp/suggestion into lp:openlp

 

googol has proposed merging lp:~googol-hush/openlp/suggestion into lp:openlp.

Requested reviews:
  OpenLP Core (openlp-core)

-- 
https://code.launchpad.net/~googol-hush/openlp/suggestion/+merge/28677
Your team OpenLP Core is requested to review the proposed merge of lp:~googol-hush/openlp/suggestion into lp:openlp.
=== modified file 'openlp/plugins/custom/lib/mediaitem.py'
--- openlp/plugins/custom/lib/mediaitem.py	2010-06-25 00:30:26 +0000
+++ openlp/plugins/custom/lib/mediaitem.py	2010-06-28 20:10:52 +0000
@@ -136,11 +136,14 @@
         if check_item_selected(self.ListView,
             translate('CustomPlugin.MediaItem',
             'You must select an item to delete.')):
-            item = self.ListView.currentItem()
-            item_id = (item.data(QtCore.Qt.UserRole)).toInt()[0]
-            self.parent.custommanager.delete_object(CustomSlide, item_id)
-            row = self.ListView.row(item)
-            self.ListView.takeItem(row)
+            row_list = [item.row() for item in self.ListView.selectedIndexes()]
+            row_list.sort(reverse=True)
+            id_list = [(item.data(QtCore.Qt.UserRole)).toInt()[0]
+                for item in self.ListView.selectedIndexes()]
+            for id in id_list:
+                self.parent.custommanager.delete_custom(id)
+            for row in row_list:
+                self.ListView.takeItem(row)
 
     def generateSlideData(self, service_item, item=None):
         raw_slides = []

=== modified file 'openlp/plugins/images/lib/mediaitem.py'
--- openlp/plugins/images/lib/mediaitem.py	2010-06-24 15:50:40 +0000
+++ openlp/plugins/images/lib/mediaitem.py	2010-06-28 20:10:52 +0000
@@ -119,9 +119,10 @@
         """
         if check_item_selected(self.ListView, translate('ImagePlugin.MediaItem',
             'You must select an item to delete.')):
-            items = self.ListView.selectedIndexes()
-            for item in items:
-                text = self.ListView.item(item.row())
+            row_list = [item.row() for item in self.ListView.selectedIndexes()]
+            row_list.sort(reverse=True)
+            for row in row_list:
+                text = self.ListView.item(row)
                 if text:
                     try:
                         os.remove(os.path.join(self.servicePath,
@@ -129,9 +130,9 @@
                     except OSError:
                         #if not present do not worry
                         pass
-                self.ListView.takeItem(item.row())
-                SettingsManager.set_list(self.settingsSection,
-                    self.settingsSection, self.getFileList())
+                self.ListView.takeItem(row)
+            SettingsManager.set_list(self.settingsSection,
+                self.settingsSection, self.getFileList())
 
     def loadList(self, list):
         for file in list:

=== modified file 'openlp/plugins/media/lib/mediaitem.py'
--- openlp/plugins/media/lib/mediaitem.py	2010-06-24 15:50:40 +0000
+++ openlp/plugins/media/lib/mediaitem.py	2010-06-28 20:10:52 +0000
@@ -143,9 +143,10 @@
         """
         if check_item_selected(self.ListView, translate('MediaPlugin.MediaItem',
             'You must select an item to delete.')):
-            item = self.ListView.currentItem()
-            row = self.ListView.row(item)
-            self.ListView.takeItem(row)
+            row_list = [item.row() for item in self.ListView.selectedIndexes()]
+            row_list.sort(reverse=True)
+            for row in row_list:
+                self.ListView.takeItem(row)
             SettingsManager.set_list(self.settingsSection,
                 self.settingsSection, self.getFileList())
 

=== modified file 'openlp/plugins/presentations/lib/mediaitem.py'
--- openlp/plugins/presentations/lib/mediaitem.py	2010-06-24 15:50:40 +0000
+++ openlp/plugins/presentations/lib/mediaitem.py	2010-06-28 20:10:52 +0000
@@ -180,18 +180,22 @@
         if check_item_selected(self.ListView,
             translate('PresentationPlugin.MediaItem',
             'You must select an item to delete.')):
-            item = self.ListView.currentItem()
-            row = self.ListView.row(item)
-            self.ListView.takeItem(row)
+            items = self.ListView.selectedIndexes()
+            row_list = [item.row() for item in items]
+            row_list.sort(reverse=True)
+            for item in items:
+                filepath = unicode(item.data(
+                    QtCore.Qt.UserRole).toString())
+                #not sure of this has errors
+                #John please can you look at .
+                for cidx in self.controllers:
+                    doc = self.controllers[cidx].add_doc(filepath)
+                    doc.presentation_deleted()
+                    doc.close_presentation()
+            for row in row_list:
+                self.ListView.takeItem(row)
             SettingsManager.set_list(self.settingsSection,
                 self.settingsSection, self.getFileList())
-            filepath = unicode(item.data(QtCore.Qt.UserRole).toString())
-            #not sure of this has errors
-            #John please can you look at .
-            for cidx in self.controllers:
-                doc = self.controllers[cidx].add_doc(filepath)
-                doc.presentation_deleted()
-                doc.close_presentation()
 
     def generateSlideData(self, service_item, item=None):
         items = self.ListView.selectedIndexes()


Follow ups