From 1738040b8713bf8c8326caa885cb4ccdca35b55b Mon Sep 17 00:00:00 2001 From: Jon Tibble Date: Tue, 20 Jul 2010 12:02:03 +0100 Subject: [PATCH] Save Song Book (Bug #607030) --- openlp/plugins/songs/forms/editsongform.py | 33 +++++++++++----------- 1 file changed, 16 insertions(+), 17 deletions(-) diff --git a/openlp/plugins/songs/forms/editsongform.py b/openlp/plugins/songs/forms/editsongform.py index c0db7b741..f2dc826e9 100644 --- a/openlp/plugins/songs/forms/editsongform.py +++ b/openlp/plugins/songs/forms/editsongform.py @@ -382,23 +382,7 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog): self.TopicsListView.takeItem(row) def onSongBookComboChanged(self, item): - item = int(self.SongbookCombo.currentIndex()) - text = unicode(self.SongbookCombo.currentText()) - if item == 0 and text: - if QtGui.QMessageBox.question(self, - translate('SongsPlugin.EditSongForm', 'Add Book'), - translate('SongsPlugin.EditSongForm', 'This song book does ' - 'not exist, do you want to add it?'), - QtGui.QMessageBox.Yes | QtGui.QMessageBox.No, - QtGui.QMessageBox.Yes) == QtGui.QMessageBox.Yes: - book = Book.populate(name=text) - self.songmanager.save_object(book) - self.song.book = book - self.loadBooks() - else: - return - elif item >= 1: - item = int(self.SongbookCombo.currentIndex()) + if item >= 1: self.song.song_book_id = \ (self.SongbookCombo.itemData(item)).toInt()[0] else: @@ -616,6 +600,21 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog): def accept(self): log.debug(u'accept') + item = int(self.SongbookCombo.currentIndex()) + text = unicode(self.SongbookCombo.currentText()) + if item == 0 and text: + if QtGui.QMessageBox.question(self, + translate('SongsPlugin.EditSongForm', 'Add Book'), + translate('SongsPlugin.EditSongForm', 'This song book does ' + 'not exist, do you want to add it?'), + QtGui.QMessageBox.Yes | QtGui.QMessageBox.No, + QtGui.QMessageBox.Yes) == QtGui.QMessageBox.Yes: + book = Book.populate(name=text) + self.songmanager.save_object(book) + self.song.book = book + self.loadBooks() + else: + return if self.saveSong(): Receiver.send_message(u'songs_load_list') self.close()