forked from openlp/openlp
Fixed bug #599066 - Deleting bugs in media manager (custom, media, images, presentations).
bzr-revno: 896
This commit is contained in:
commit
7d7a08e085
@ -136,11 +136,14 @@ class CustomMediaItem(MediaManagerItem):
|
|||||||
if check_item_selected(self.ListView,
|
if check_item_selected(self.ListView,
|
||||||
translate('CustomPlugin.MediaItem',
|
translate('CustomPlugin.MediaItem',
|
||||||
'You must select an item to delete.')):
|
'You must select an item to delete.')):
|
||||||
item = self.ListView.currentItem()
|
row_list = [item.row() for item in self.ListView.selectedIndexes()]
|
||||||
item_id = (item.data(QtCore.Qt.UserRole)).toInt()[0]
|
row_list.sort(reverse=True)
|
||||||
self.parent.custommanager.delete_object(CustomSlide, item_id)
|
id_list = [(item.data(QtCore.Qt.UserRole)).toInt()[0]
|
||||||
row = self.ListView.row(item)
|
for item in self.ListView.selectedIndexes()]
|
||||||
self.ListView.takeItem(row)
|
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):
|
def generateSlideData(self, service_item, item=None):
|
||||||
raw_slides = []
|
raw_slides = []
|
||||||
|
@ -119,9 +119,10 @@ class ImageMediaItem(MediaManagerItem):
|
|||||||
"""
|
"""
|
||||||
if check_item_selected(self.ListView, translate('ImagePlugin.MediaItem',
|
if check_item_selected(self.ListView, translate('ImagePlugin.MediaItem',
|
||||||
'You must select an item to delete.')):
|
'You must select an item to delete.')):
|
||||||
items = self.ListView.selectedIndexes()
|
row_list = [item.row() for item in self.ListView.selectedIndexes()]
|
||||||
for item in items:
|
row_list.sort(reverse=True)
|
||||||
text = self.ListView.item(item.row())
|
for row in row_list:
|
||||||
|
text = self.ListView.item(row)
|
||||||
if text:
|
if text:
|
||||||
try:
|
try:
|
||||||
os.remove(os.path.join(self.servicePath,
|
os.remove(os.path.join(self.servicePath,
|
||||||
@ -129,9 +130,9 @@ class ImageMediaItem(MediaManagerItem):
|
|||||||
except OSError:
|
except OSError:
|
||||||
#if not present do not worry
|
#if not present do not worry
|
||||||
pass
|
pass
|
||||||
self.ListView.takeItem(item.row())
|
self.ListView.takeItem(row)
|
||||||
SettingsManager.set_list(self.settingsSection,
|
SettingsManager.set_list(self.settingsSection,
|
||||||
self.settingsSection, self.getFileList())
|
self.settingsSection, self.getFileList())
|
||||||
|
|
||||||
def loadList(self, list):
|
def loadList(self, list):
|
||||||
for file in list:
|
for file in list:
|
||||||
|
@ -143,9 +143,10 @@ class MediaMediaItem(MediaManagerItem):
|
|||||||
"""
|
"""
|
||||||
if check_item_selected(self.ListView, translate('MediaPlugin.MediaItem',
|
if check_item_selected(self.ListView, translate('MediaPlugin.MediaItem',
|
||||||
'You must select an item to delete.')):
|
'You must select an item to delete.')):
|
||||||
item = self.ListView.currentItem()
|
row_list = [item.row() for item in self.ListView.selectedIndexes()]
|
||||||
row = self.ListView.row(item)
|
row_list.sort(reverse=True)
|
||||||
self.ListView.takeItem(row)
|
for row in row_list:
|
||||||
|
self.ListView.takeItem(row)
|
||||||
SettingsManager.set_list(self.settingsSection,
|
SettingsManager.set_list(self.settingsSection,
|
||||||
self.settingsSection, self.getFileList())
|
self.settingsSection, self.getFileList())
|
||||||
|
|
||||||
|
@ -180,18 +180,22 @@ class PresentationMediaItem(MediaManagerItem):
|
|||||||
if check_item_selected(self.ListView,
|
if check_item_selected(self.ListView,
|
||||||
translate('PresentationPlugin.MediaItem',
|
translate('PresentationPlugin.MediaItem',
|
||||||
'You must select an item to delete.')):
|
'You must select an item to delete.')):
|
||||||
item = self.ListView.currentItem()
|
items = self.ListView.selectedIndexes()
|
||||||
row = self.ListView.row(item)
|
row_list = [item.row() for item in items]
|
||||||
self.ListView.takeItem(row)
|
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,
|
SettingsManager.set_list(self.settingsSection,
|
||||||
self.settingsSection, self.getFileList())
|
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):
|
def generateSlideData(self, service_item, item=None):
|
||||||
items = self.ListView.selectedIndexes()
|
items = self.ListView.selectedIndexes()
|
||||||
|
Loading…
Reference in New Issue
Block a user