Stevan Pettit has proposed merging lp:~smpettit/openlp/custom-delete into lp:openlp.
Requested reviews: Tim Bentley (trb143) For more details, see: https://code.launchpad.net/~smpettit/openlp/custom-delete/+merge/65975 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. Moved signal to end of the __init__ I am requesting this change because the person running OpenLP at church "accidentally" delete our Announcements custom containing 17 slides (all of which had to be retyped) -- https://code.launchpad.net/~smpettit/openlp/custom-delete/+merge/65975 Your team OpenLP Core is subscribed to branch lp:openlp.
=== modified file 'openlp/plugins/custom/lib/customtab.py' --- openlp/plugins/custom/lib/customtab.py 2011-06-12 16:02:52 +0000 +++ openlp/plugins/custom/lib/customtab.py 2011-06-27 13:02:29 +0000 @@ -47,17 +47,32 @@ self.displayFooterCheckBox.setObjectName(u'displayFooterCheckBox') self.customModeLayout.addRow(self.displayFooterCheckBox) self.leftLayout.addWidget(self.customModeGroupBox) + 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) self.leftLayout.addStretch() self.rightLayout.addStretch() QtCore.QObject.connect(self.displayFooterCheckBox, QtCore.SIGNAL(u'stateChanged(int)'), self.onDisplayFooterCheckBoxChanged) + QtCore.QObject.connect(self.confirmDeleteCheckBox, + QtCore.SIGNAL(u'stateChanged(int)'), + self.onConfirmDeleteCheckBoxChanged) 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-17 14:15:07 +0000 +++ openlp/plugins/custom/lib/mediaitem.py 2011-06-27 13:02:29 +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]
_______________________________________________ Mailing list: https://launchpad.net/~openlp-core Post to : openlp-core@lists.launchpad.net Unsubscribe : https://launchpad.net/~openlp-core More help : https://help.launchpad.net/ListHelp