openlp-core team mailing list archive
-
openlp-core team
-
Mailing list archive
-
Message #09996
[Merge] lp:~smpettit/openlp/custom-delete into lp:openlp
Stevan Pettit has proposed merging lp:~smpettit/openlp/custom-delete into lp:openlp.
Requested reviews:
OpenLP Core (openlp-core)
For more details, see:
https://code.launchpad.net/~smpettit/openlp/custom-delete/+merge/64252
Added code to openlp/plugins/custom/lib/customtab.py to allow the user to set an option if they want delete confirmation for Custom slides or not.
Added code to openlp/plugins/custom/lib/mediaitem.py to ask for delete confirmation when deleting a Custom slide if the user has set the option.
--
https://code.launchpad.net/~smpettit/openlp/custom-delete/+merge/64252
Your team OpenLP Core is requested to review the proposed merge of lp:~smpettit/openlp/custom-delete into lp:openlp.
=== modified file 'openlp/plugins/custom/lib/customtab.py'
--- openlp/plugins/custom/lib/customtab.py 2011-05-26 17:11:22 +0000
+++ openlp/plugins/custom/lib/customtab.py 2011-06-10 20:48:42 +0000
@@ -47,17 +47,32 @@
self.displayFooterCheckBox.setObjectName(u'displayFooterCheckBox')
self.customModeLayout.addRow(self.displayFooterCheckBox)
self.leftLayout.addWidget(self.customModeGroupBox)
+ QtCore.QObject.connect(self.displayFooterCheckBox,
+ QtCore.SIGNAL(u'stateChanged(int)'),
+ self.onDisplayFooterCheckBoxChanged)
+ self.customUIGroupBox = QtGui.QGroupBox(self.leftColumn)
+ self.customUIGroupBox.setObjectName(u'customUIGroupBox')
+ self.customUILayout = QtGui.QFormLayout(self.customUIGroupBox)
+ self.customUILayout.setObjectName(u'customUILayout')
+ self.confirmDeleteCheckBox = QtGui.QCheckBox(self.customUIGroupBox)
+ self.confirmDeleteCheckBox.setObjectName(u'confirmDeleteCheckBox')
+ self.customUILayout.addRow(self.confirmDeleteCheckBox)
+ self.leftLayout.addWidget(self.customUIGroupBox)
+ QtCore.QObject.connect(self.confirmDeleteCheckBox,
+ QtCore.SIGNAL(u'stateChanged(int)'),
+ self.onConfirmDeleteCheckBoxChanged)
self.leftLayout.addStretch()
self.rightLayout.addStretch()
- QtCore.QObject.connect(self.displayFooterCheckBox,
- QtCore.SIGNAL(u'stateChanged(int)'),
- self.onDisplayFooterCheckBoxChanged)
-
+
def retranslateUi(self):
self.customModeGroupBox.setTitle(translate('CustomPlugin.CustomTab',
'Custom Display'))
self.displayFooterCheckBox.setText(
translate('CustomPlugin.CustomTab', 'Display footer'))
+ self.customUIGroupBox.setTitle(translate('CustomPlugin.CustomTab',
+ 'UI Settings'))
+ self.confirmDeleteCheckBox.setText(
+ translate('CustomPlugin.CustomTab', 'Confirm delete'))
def onDisplayFooterCheckBoxChanged(self, check_state):
self.displayFooter = False
@@ -65,12 +80,24 @@
if check_state == QtCore.Qt.Checked:
self.displayFooter = True
+ def onConfirmDeleteCheckBoxChanged(self, check_state):
+ self.confirmDelete = False
+ # we have a set value convert to True/False
+ if check_state == QtCore.Qt.Checked:
+ self.confirmDelete = True
+
def load(self):
self.displayFooter = QtCore.QSettings().value(
self.settingsSection + u'/display footer',
QtCore.QVariant(True)).toBool()
self.displayFooterCheckBox.setChecked(self.displayFooter)
+ self.confirmDelete = QtCore.QSettings().value(
+ self.settingsSection + u'/confirm delete',
+ QtCore.QVariant(True)).toBool()
+ self.confirmDeleteCheckBox.setChecked(self.confirmDelete)
def save(self):
QtCore.QSettings().setValue(self.settingsSection + u'/display footer',
QtCore.QVariant(self.displayFooter))
+ QtCore.QSettings().setValue(self.settingsSection + u'/confirm delete',
+ QtCore.QVariant(self.confirmDelete))
=== modified file 'openlp/plugins/custom/lib/mediaitem.py'
--- openlp/plugins/custom/lib/mediaitem.py 2011-06-01 21:06:45 +0000
+++ openlp/plugins/custom/lib/mediaitem.py 2011-06-10 20:48:42 +0000
@@ -200,6 +200,20 @@
Remove a custom item from the list and database
"""
if check_item_selected(self.listView, UiStrings().SelectDelete):
+ self.confirmDelete = QtCore.QSettings().value(
+ self.settingsSection + u'/confirm delete',
+ QtCore.QVariant(u'False')).toBool()
+ items = self.listView.selectedIndexes()
+ if self.confirmDelete:
+ if QtGui.QMessageBox.question(self,
+ translate('CustomPlugin.MediaItem', 'Delete Custom(s)?'),
+ translate('CustomPlugin.MediaItem',
+ 'Are you sure you want to delete the %n selected custom(s)?', '',
+ QtCore.QCoreApplication.CodecForTr, len(items)),
+ QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Ok |
+ QtGui.QMessageBox.Cancel),
+ QtGui.QMessageBox.Ok) == QtGui.QMessageBox.Cancel:
+ return
row_list = [item.row() for item in self.listView.selectedIndexes()]
row_list.sort(reverse=True)
id_list = [(item.data(QtCore.Qt.UserRole)).toInt()[0]
Follow ups