← Back to team overview

openlp-core team mailing list archive

[Merge] lp:~orangeshirt/openlp/bibles into lp:openlp

 

Armin Köhler has proposed merging lp:~orangeshirt/openlp/bibles into lp:openlp.

Requested reviews:
  Tim Bentley (trb143)
  Raoul Snyman (raoul-snyman)

For more details, see:
https://code.launchpad.net/~orangeshirt/openlp/bibles/+merge/56054

Attention: It is not ready to merge, please review (again) and give me feedback - Thanks!

changed the behavior while importing bibles, in special webbibles they are now importing all there books while registering
Changed the local bible database (drop table "testament" and add a row book_reference_id in table "book")
moved csv files into a extended httpbooks.sqlite database - renamed to bibles_resources.sqlite
add two Dialog Windows which could pop up while importing, if the language or a book name is unknown
adapt many other things please look at the commit messeges

Still missing:
Migration for existing bibles
-- 
https://code.launchpad.net/~orangeshirt/openlp/bibles/+merge/56054
Your team OpenLP Core is subscribed to branch lp:openlp.
=== modified file 'openlp/plugins/bibles/forms/__init__.py'
--- openlp/plugins/bibles/forms/__init__.py	2011-03-24 19:04:02 +0000
+++ openlp/plugins/bibles/forms/__init__.py	2011-04-02 20:44:17 +0000
@@ -50,7 +50,8 @@
 them separate from the functionality, so that it is easier to recreate the GUI
 from the .ui files later if necessary.
 """
-
+from booknameform import BookNameForm
+from languageform import LanguageForm
 from bibleimportform import BibleImportForm
 
 __all__ = ['BibleImportForm']

=== modified file 'openlp/plugins/bibles/forms/bibleimportform.py'
--- openlp/plugins/bibles/forms/bibleimportform.py	2011-03-24 19:04:02 +0000
+++ openlp/plugins/bibles/forms/bibleimportform.py	2011-04-02 20:44:17 +0000
@@ -39,6 +39,8 @@
 from openlp.core.ui.wizard import OpenLPWizard, WizardStrings
 from openlp.core.utils import AppLocation, string_is_unicode
 from openlp.plugins.bibles.lib.manager import BibleFormat
+from openlp.plugins.bibles.lib.db import BiblesResourcesDB
+from openlp.plugins.bibles.forms import BookNameForm, LanguageForm
 
 log = logging.getLogger(__name__)
 
@@ -113,9 +115,10 @@
         QtCore.QObject.connect(self.osisBrowseButton,
             QtCore.SIGNAL(u'clicked()'),
             self.onOsisBrowseButtonClicked)
-        QtCore.QObject.connect(self.csvTestamentsButton,
-            QtCore.SIGNAL(u'clicked()'),
-            self.onCsvTestamentsBrowseButtonClicked)
+        #TODO: Delete unused code
+        #QtCore.QObject.connect(self.csvTestamentsButton,
+        #    QtCore.SIGNAL(u'clicked()'),
+        #    self.onCsvTestamentsBrowseButtonClicked)
         QtCore.QObject.connect(self.csvBooksButton,
             QtCore.SIGNAL(u'clicked()'),
             self.onCsvBooksBrowseButtonClicked)
@@ -176,6 +179,8 @@
         self.csvLayout = QtGui.QFormLayout(self.csvWidget)
         self.csvLayout.setMargin(0)
         self.csvLayout.setObjectName(u'CsvLayout')
+        #TODO: Delete unused code
+        '''
         self.csvTestamentsLabel = QtGui.QLabel(self.csvWidget)
         self.csvTestamentsLabel.setObjectName(u'CsvTestamentsLabel')
         self.csvTestamentsLayout = QtGui.QHBoxLayout()
@@ -183,11 +188,13 @@
         self.csvTestamentsEdit = QtGui.QLineEdit(self.csvWidget)
         self.csvTestamentsEdit.setObjectName(u'CsvTestamentsEdit')
         self.csvTestamentsLayout.addWidget(self.csvTestamentsEdit)
+        
         self.csvTestamentsButton = QtGui.QToolButton(self.csvWidget)
         self.csvTestamentsButton.setIcon(self.openIcon)
         self.csvTestamentsButton.setObjectName(u'CsvTestamentsButton')
         self.csvTestamentsLayout.addWidget(self.csvTestamentsButton)
         self.csvLayout.addRow(self.csvTestamentsLabel, self.csvTestamentsLayout)
+        '''
         self.csvBooksLabel = QtGui.QLabel(self.csvWidget)
         self.csvBooksLabel.setObjectName(u'CsvBooksLabel')
         self.csvBooksLayout = QtGui.QHBoxLayout()
@@ -372,8 +379,9 @@
             translate('BiblesPlugin.ImportWizardForm', 'Bible file:'))
         self.osisFileLabel.setText(
             translate('BiblesPlugin.ImportWizardForm', 'Bible file:'))
-        self.csvTestamentsLabel.setText(
-            translate('BiblesPlugin.ImportWizardForm', 'Testaments file:'))
+        #TODO: Delete unused code
+        #self.csvTestamentsLabel.setText(
+        #    translate('BiblesPlugin.ImportWizardForm', 'Testaments file:'))
         self.csvBooksLabel.setText(
             translate('BiblesPlugin.ImportWizardForm', 'Books file:'))
         self.csvVersesLabel.setText(
@@ -424,7 +432,8 @@
         # Align all QFormLayouts towards each other.
         labelWidth = max(self.formatLabel.minimumSizeHint().width(),
             self.osisFileLabel.minimumSizeHint().width(),
-            self.csvTestamentsLabel.minimumSizeHint().width(),
+            #TODO: Delete unused code
+            #self.csvTestamentsLabel.minimumSizeHint().width(),
             self.csvBooksLabel.minimumSizeHint().width(),
             self.csvVersesLabel.minimumSizeHint().width(),
             self.openSongFileLabel.minimumSizeHint().width(),
@@ -446,6 +455,8 @@
                     self.osisFileEdit.setFocus()
                     return False
             elif self.field(u'source_format').toInt()[0] == BibleFormat.CSV:
+                #TODO: Delete unused code
+                '''
                 if not self.field(u'csv_testamentsfile').toString():
                     answer = critical_error_message_box(UiStrings.NFSs,
                         translate('BiblesPlugin.ImportWizardForm',
@@ -454,6 +465,7 @@
                     if answer == QtGui.QMessageBox.No:
                         self.csvTestamentsEdit.setFocus()
                         return False
+                '''
                 if not self.field(u'csv_booksfile').toString():
                     critical_error_message_box(UiStrings.NFSs,
                         translate('BiblesPlugin.ImportWizardForm',
@@ -530,7 +542,8 @@
         """
         self.getFileName(WizardStrings.OpenTypeFile % WizardStrings.OSIS,
             self.osisFileEdit)
-
+    #TODO: Delete unused code
+    '''
     def onCsvTestamentsBrowseButtonClicked(self):
         """
         Show the file open dialog for the testaments CSV file.
@@ -538,7 +551,7 @@
         self.getFileName(WizardStrings.OpenTypeFile % WizardStrings.CSV,
             self.csvTestamentsEdit, u'%s (*.csv)'
             % translate('BiblesPlugin.ImportWizardForm', 'CSV File'))
-
+    '''
     def onCsvBooksBrowseButtonClicked(self):
         """
         Show the file open dialog for the books CSV file.
@@ -577,8 +590,9 @@
         """
         self.selectPage.registerField(u'source_format', self.formatComboBox)
         self.selectPage.registerField(u'osis_location', self.osisFileEdit)
-        self.selectPage.registerField(
-            u'csv_testamentsfile', self.csvTestamentsEdit)
+        #TODO: Delete unused code
+        #self.selectPage.registerField(
+        #    u'csv_testamentsfile', self.csvTestamentsEdit)
         self.selectPage.registerField(u'csv_booksfile', self.csvBooksEdit)
         self.selectPage.registerField(u'csv_versefile', self.csvVersesEdit)
         self.selectPage.registerField(u'opensong_file', self.openSongFileEdit)
@@ -607,7 +621,8 @@
         self.cancelButton.setVisible(True)
         self.setField(u'source_format', QtCore.QVariant(0))
         self.setField(u'osis_location', QtCore.QVariant(''))
-        self.setField(u'csv_testamentsfile', QtCore.QVariant(''))
+        #TODO: Delete unused code
+        #self.setField(u'csv_testamentsfile', QtCore.QVariant(''))
         self.setField(u'csv_booksfile', QtCore.QVariant(''))
         self.setField(u'csv_versefile', QtCore.QVariant(''))
         self.setField(u'opensong_file', QtCore.QVariant(''))
@@ -634,46 +649,27 @@
         """
         Load the lists of Crosswalk, BibleGateway and Bibleserver bibles.
         """
-        filepath = AppLocation.get_directory(AppLocation.PluginsDir)
-        filepath = os.path.join(filepath, u'bibles', u'resources')
         # Load Crosswalk Bibles.
-        self.loadBibleResourceFile(
-            os.path.join(filepath, u'crosswalkbooks.csv'),
-            WebDownload.Crosswalk)
+        self.loadBibleResource(WebDownload.Crosswalk)
         # Load BibleGateway Bibles.
-        self.loadBibleResourceFile(os.path.join(filepath, u'biblegateway.csv'),
-            WebDownload.BibleGateway)
+        self.loadBibleResource(WebDownload.BibleGateway)
         # Load and Bibleserver Bibles.
-        self.loadBibleResourceFile(os.path.join(filepath, u'bibleserver.csv'),
-            WebDownload.Bibleserver)
+        self.loadBibleResource(WebDownload.Bibleserver)
 
-    def loadBibleResourceFile(self, file_path_name, download_type):
+    def loadBibleResource(self, download_type):
         """
-        Loads a web bible resource file.
-
-        ``file_path_name``
-            The file to load including the file's path.
+        Loads a web bible from bible_resources.sqlite.
 
         ``download_type``
-            The WebDownload type this file is for.
+            The WebDownload type e.g. bibleserver.
         """
         self.web_bible_list[download_type] = {}
-        books_file = None
-        try:
-            books_file = open(file_path_name, 'rb')
-            dialect = csv.Sniffer().sniff(books_file.read(1024))
-            books_file.seek(0)
-            books_reader = csv.reader(books_file, dialect)
-            for line in books_reader:
-                ver = string_is_unicode(line[0])
-                name = string_is_unicode(line[1])
-                self.web_bible_list[download_type][ver] = name.strip()
-        except IOError:
-            log.exception(u'%s resources missing' %
-                WebDownload.Names[download_type])
-        finally:
-            if books_file:
-                books_file.close()
+        bibles = BiblesResourcesDB.get_webbibles(
+            WebDownload.Names[download_type])
+        for bible in bibles:
+            ver = bible[u'name']
+            name = bible[u'abbreviation']
+            self.web_bible_list[download_type][ver] = name.strip()
 
     def preWizard(self):
         """
@@ -707,11 +703,18 @@
             )
         elif bible_type == BibleFormat.CSV:
             # Import a CSV bible.
+            #TODO: Delete unused code
+            '''
             importer = self.manager.import_bible(BibleFormat.CSV,
                 name=license_version, testamentsfile=unicode(
                 self.field(u'csv_testamentsfile').toString()),
                 booksfile=unicode(self.field(u'csv_booksfile').toString()),
                 versefile=unicode(self.field(u'csv_versefile').toString())
+            '''
+            importer = self.manager.import_bible(BibleFormat.CSV,
+                name=license_version, 
+                booksfile=unicode(self.field(u'csv_booksfile').toString()),
+                versefile=unicode(self.field(u'csv_versefile').toString())
             )
         elif bible_type == BibleFormat.OpenSong:
             # Import an OpenSong bible.
@@ -756,3 +759,13 @@
                 'BiblesPlugin.ImportWizardForm', 'Your Bible import failed.'))
             del self.manager.db_cache[importer.name]
             delete_database(self.plugin.settingsSection, importer.file)
+
+    def bookNameDialog(self, name):
+        self.book_name = BookNameForm(self)
+        if self.book_name.exec_(name):
+            return unicode(self.book_name.requestComboBox.currentText())
+
+    def languageDialog(self):
+        self.language = LanguageForm(self)
+        if self.language.exec_():
+            return unicode(self.language.requestComboBox.currentText())

=== added file 'openlp/plugins/bibles/forms/booknamedialog.py'
--- openlp/plugins/bibles/forms/booknamedialog.py	1970-01-01 00:00:00 +0000
+++ openlp/plugins/bibles/forms/booknamedialog.py	2011-04-02 20:44:17 +0000
@@ -0,0 +1,95 @@
+# -*- coding: utf-8 -*-
+# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4
+
+###############################################################################
+# OpenLP - Open Source Lyrics Projection                                      #
+# --------------------------------------------------------------------------- #
+# Copyright (c) 2008-2011 Raoul Snyman                                        #
+# Portions copyright (c) 2008-2011 Tim Bentley, Jonathan Corwin, Michael      #
+# Gorven, Scott Guerrieri, Meinert Jordan, Armin Köhler, Andreas Preikschat,  #
+# Christian Richter, Philip Ridout, Maikel Stuivenberg, Martin Thompson, Jon  #
+# Tibble, Carsten Tinggaard, Frode Woldsund                                   #
+# --------------------------------------------------------------------------- #
+# This program is free software; you can redistribute it and/or modify it     #
+# under the terms of the GNU General Public License as published by the Free  #
+# Software Foundation; version 2 of the License.                              #
+#                                                                             #
+# This program is distributed in the hope that it will be useful, but WITHOUT #
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or       #
+# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for    #
+# more details.                                                               #
+#                                                                             #
+# You should have received a copy of the GNU General Public License along     #
+# with this program; if not, write to the Free Software Foundation, Inc., 59  #
+# Temple Place, Suite 330, Boston, MA 02111-1307 USA                          #
+###############################################################################
+
+from PyQt4 import QtCore, QtGui
+
+from openlp.core.lib import translate
+from openlp.core.lib.ui import create_accept_reject_button_box
+
+class Ui_BookNameDialog(object):
+    def setupUi(self, bookNameDialog):
+        bookNameDialog.setObjectName(u'BookNameDialog')
+        bookNameDialog.resize(400, 175)
+        sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Preferred, 
+            QtGui.QSizePolicy.MinimumExpanding)
+        sizePolicy.setHorizontalStretch(0)
+        sizePolicy.setVerticalStretch(0)
+        sizePolicy.setHeightForWidth(bookNameDialog.sizePolicy()
+            .hasHeightForWidth())
+        bookNameDialog.setSizePolicy(sizePolicy)
+        self.widget = QtGui.QWidget(bookNameDialog)
+        self.widget.setGeometry(QtCore.QRect(10, 15, 381, 151))
+        self.widget.setObjectName(u'widget')
+        self.verticalLayout = QtGui.QVBoxLayout(self.widget)
+        self.verticalLayout.setObjectName(u'verticalLayout')
+        self.headlineLabel = QtGui.QLabel(self.widget)
+        font = QtGui.QFont()
+        font.setFamily(u'Arial')
+        font.setPointSize(11)
+        font.setWeight(75)
+        font.setBold(True)
+        self.headlineLabel.setFont(font)
+        self.headlineLabel.setObjectName(u'HeadlineLabel')
+        self.verticalLayout.addWidget(self.headlineLabel)
+        self.infoLabel = QtGui.QLabel(self.widget)
+        self.infoLabel.setObjectName(u'InfoLabel')
+        self.verticalLayout.addWidget(self.infoLabel)
+        self.formLayout = QtGui.QFormLayout()
+        self.formLayout.setObjectName(u'formLayout')
+        self.requestLabel = QtGui.QLabel(self.widget)
+        self.requestLabel.setObjectName(u'RequestLabel')
+        self.formLayout.setWidget(0, QtGui.QFormLayout.LabelRole, 
+            self.requestLabel)
+        self.requestComboBox = QtGui.QComboBox(self.widget)
+        sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Preferred, 
+            QtGui.QSizePolicy.Fixed)
+        sizePolicy.setHorizontalStretch(0)
+        sizePolicy.setVerticalStretch(0)
+        sizePolicy.setHeightForWidth(self.requestComboBox.sizePolicy()
+            .hasHeightForWidth())
+        self.requestComboBox.setSizePolicy(sizePolicy)
+        self.requestComboBox.setObjectName(u'RequestComboBox')
+        self.formLayout.setWidget(0, QtGui.QFormLayout.FieldRole, 
+            self.requestComboBox)
+        self.verticalLayout.addLayout(self.formLayout)
+        spacerItem = QtGui.QSpacerItem(20, 40, QtGui.QSizePolicy.Minimum, 
+            QtGui.QSizePolicy.Expanding)
+        self.verticalLayout.addItem(spacerItem)
+        self.formLayout.addWidget(
+            create_accept_reject_button_box(bookNameDialog))
+        self.retranslateUi(bookNameDialog)
+        QtCore.QMetaObject.connectSlotsByName(bookNameDialog)
+
+    def retranslateUi(self, bookNameDialog):
+        bookNameDialog.setWindowTitle(
+            translate('BiblesPlugin.BookNameDialog', 'Choose Book'))
+        self.headlineLabel.setText(
+            translate('BiblesPlugin.BookNameDialog', 'Choose Book:'))
+        self.infoLabel.setText(translate('BiblesPlugin.BookNameDialog', 
+            'The following books cannot be clearly attributed. \n'
+            'Please choose the book it is.'))
+        self.requestLabel.setText(translate('BiblesPlugin.BookNameDialog', 
+            'Book:'))

=== added file 'openlp/plugins/bibles/forms/booknameform.py'
--- openlp/plugins/bibles/forms/booknameform.py	1970-01-01 00:00:00 +0000
+++ openlp/plugins/bibles/forms/booknameform.py	2011-04-02 20:44:17 +0000
@@ -0,0 +1,74 @@
+# -*- coding: utf-8 -*-
+# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4
+
+###############################################################################
+# OpenLP - Open Source Lyrics Projection                                      #
+# --------------------------------------------------------------------------- #
+# Copyright (c) 2008-2011 Raoul Snyman                                        #
+# Portions copyright (c) 2008-2011 Tim Bentley, Jonathan Corwin, Michael      #
+# Gorven, Scott Guerrieri, Meinert Jordan, Armin Köhler, Andreas Preikschat,  #
+# Christian Richter, Philip Ridout, Maikel Stuivenberg, Martin Thompson, Jon  #
+# Tibble, Carsten Tinggaard, Frode Woldsund                                   #
+# --------------------------------------------------------------------------- #
+# This program is free software; you can redistribute it and/or modify it     #
+# under the terms of the GNU General Public License as published by the Free  #
+# Software Foundation; version 2 of the License.                              #
+#                                                                             #
+# This program is distributed in the hope that it will be useful, but WITHOUT #
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or       #
+# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for    #
+# more details.                                                               #
+#                                                                             #
+# You should have received a copy of the GNU General Public License along     #
+# with this program; if not, write to the Free Software Foundation, Inc., 59  #
+# Temple Place, Suite 330, Boston, MA 02111-1307 USA                          #
+###############################################################################
+
+"""
+Module implementing BookNameForm.
+"""
+import logging
+
+from PyQt4.QtGui import QDialog
+
+from openlp.core.lib import translate
+from openlp.core.lib.ui import critical_error_message_box
+from openlp.plugins.bibles.forms.booknamedialog import \
+    Ui_BookNameDialog
+from openlp.plugins.bibles.lib.db import BiblesResourcesDB
+
+log = logging.getLogger(__name__)
+
+class BookNameForm(QDialog, Ui_BookNameDialog):
+    """
+    Class to manage a dialog which help the user to refer a book name a 
+    to a english book name
+    """
+    log.info(u'BookNameForm loaded')
+    
+    def __init__(self, parent = None):
+        """
+        Constructor
+        """
+        QDialog.__init__(self, parent)
+        self.setupUi(self)
+
+    def exec_(self, name):
+        items = []
+        self.requestComboBox.addItem(u'')
+        self.requestLabel.setText(
+            translate('BiblesPlugin.BookNameForm', name))
+        items = BiblesResourcesDB.get_books()
+        for item in items:
+            self.requestComboBox.addItem(item[u'name'])
+        return QDialog.exec_(self)
+    
+    def accept(self):
+        if self.requestComboBox.currentText() == u'':
+            critical_error_message_box(
+                message=translate('BiblesPlugin.BookNameForm',
+                'You need to choose a book.'))
+            self.requestComboBox.setFocus()
+            return False
+        else:
+            return QDialog.accept(self)

=== added file 'openlp/plugins/bibles/forms/languagedialog.py'
--- openlp/plugins/bibles/forms/languagedialog.py	1970-01-01 00:00:00 +0000
+++ openlp/plugins/bibles/forms/languagedialog.py	2011-04-02 20:44:17 +0000
@@ -0,0 +1,94 @@
+# -*- coding: utf-8 -*-
+# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4
+
+###############################################################################
+# OpenLP - Open Source Lyrics Projection                                      #
+# --------------------------------------------------------------------------- #
+# Copyright (c) 2008-2011 Raoul Snyman                                        #
+# Portions copyright (c) 2008-2011 Tim Bentley, Jonathan Corwin, Michael      #
+# Gorven, Scott Guerrieri, Meinert Jordan, Armin Köhler, Andreas Preikschat,  #
+# Christian Richter, Philip Ridout, Maikel Stuivenberg, Martin Thompson, Jon  #
+# Tibble, Carsten Tinggaard, Frode Woldsund                                   #
+# --------------------------------------------------------------------------- #
+# This program is free software; you can redistribute it and/or modify it     #
+# under the terms of the GNU General Public License as published by the Free  #
+# Software Foundation; version 2 of the License.                              #
+#                                                                             #
+# This program is distributed in the hope that it will be useful, but WITHOUT #
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or       #
+# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for    #
+# more details.                                                               #
+#                                                                             #
+# You should have received a copy of the GNU General Public License along     #
+# with this program; if not, write to the Free Software Foundation, Inc., 59  #
+# Temple Place, Suite 330, Boston, MA 02111-1307 USA                          #
+###############################################################################
+
+from PyQt4 import QtCore, QtGui
+
+from openlp.core.lib import translate
+from openlp.core.lib.ui import create_accept_reject_button_box
+
+class Ui_LanguageDialog(object):
+    def setupUi(self, languageDialog):
+        languageDialog.setObjectName(u'LanugageDialog')
+        languageDialog.resize(400, 175)
+        sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Preferred, 
+            QtGui.QSizePolicy.MinimumExpanding)
+        sizePolicy.setHorizontalStretch(0)
+        sizePolicy.setVerticalStretch(0)
+        sizePolicy.setHeightForWidth(languageDialog.sizePolicy()
+            .hasHeightForWidth())
+        languageDialog.setSizePolicy(sizePolicy)
+        self.widget = QtGui.QWidget(languageDialog)
+        self.widget.setGeometry(QtCore.QRect(10, 15, 381, 151))
+        self.widget.setObjectName(u'widget')
+        self.verticalLayout = QtGui.QVBoxLayout(self.widget)
+        self.verticalLayout.setObjectName(u'verticalLayout')
+        self.headlineLabel = QtGui.QLabel(self.widget)
+        font = QtGui.QFont()
+        font.setFamily(u'Arial')
+        font.setPointSize(11)
+        font.setWeight(75)
+        font.setBold(True)
+        self.headlineLabel.setFont(font)
+        self.headlineLabel.setObjectName(u'HeadlineLabel')
+        self.verticalLayout.addWidget(self.headlineLabel)
+        self.infoLabel = QtGui.QLabel(self.widget)
+        self.infoLabel.setObjectName(u'InfoLabel')
+        self.verticalLayout.addWidget(self.infoLabel)
+        self.formLayout = QtGui.QFormLayout()
+        self.formLayout.setObjectName(u'formLayout')
+        self.requestLabel = QtGui.QLabel(self.widget)
+        self.requestLabel.setObjectName(u'RequestLabel')
+        self.formLayout.setWidget(0, QtGui.QFormLayout.LabelRole, 
+            self.requestLabel)
+        self.requestComboBox = QtGui.QComboBox(self.widget)
+        sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Preferred, 
+            QtGui.QSizePolicy.Fixed)
+        sizePolicy.setHorizontalStretch(0)
+        sizePolicy.setVerticalStretch(0)
+        sizePolicy.setHeightForWidth(self.requestComboBox.sizePolicy()
+            .hasHeightForWidth())
+        self.requestComboBox.setSizePolicy(sizePolicy)
+        self.requestComboBox.setObjectName(u'RequestComboBox')
+        self.formLayout.setWidget(0, QtGui.QFormLayout.FieldRole, 
+            self.requestComboBox)
+        self.verticalLayout.addLayout(self.formLayout)
+        spacerItem = QtGui.QSpacerItem(20, 40, QtGui.QSizePolicy.Minimum, 
+            QtGui.QSizePolicy.Expanding)
+        self.verticalLayout.addItem(spacerItem)
+        self.formLayout.addWidget(
+            create_accept_reject_button_box(languageDialog))
+        self.retranslateUi(languageDialog)
+        QtCore.QMetaObject.connectSlotsByName(languageDialog)
+
+    def retranslateUi(self, languageDialog):
+        languageDialog.setWindowTitle(
+            translate('BiblesPlugin.LanguageDialog', 'Choose Language'))
+        self.headlineLabel.setText(
+            translate('BiblesPlugin.LanguageDialog', 'Choose Language:'))
+        self.infoLabel.setText(translate('BiblesPlugin.LanguageDialog', 
+            'Please choose the language the bible is.'))
+        self.requestLabel.setText(translate('BiblesPlugin.languageDialog', 
+            'Language:'))

=== added file 'openlp/plugins/bibles/forms/languageform.py'
--- openlp/plugins/bibles/forms/languageform.py	1970-01-01 00:00:00 +0000
+++ openlp/plugins/bibles/forms/languageform.py	2011-04-02 20:44:17 +0000
@@ -0,0 +1,71 @@
+# -*- coding: utf-8 -*-
+# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4
+
+###############################################################################
+# OpenLP - Open Source Lyrics Projection                                      #
+# --------------------------------------------------------------------------- #
+# Copyright (c) 2008-2011 Raoul Snyman                                        #
+# Portions copyright (c) 2008-2011 Tim Bentley, Jonathan Corwin, Michael      #
+# Gorven, Scott Guerrieri, Meinert Jordan, Armin Köhler, Andreas Preikschat,  #
+# Christian Richter, Philip Ridout, Maikel Stuivenberg, Martin Thompson, Jon  #
+# Tibble, Carsten Tinggaard, Frode Woldsund                                   #
+# --------------------------------------------------------------------------- #
+# This program is free software; you can redistribute it and/or modify it     #
+# under the terms of the GNU General Public License as published by the Free  #
+# Software Foundation; version 2 of the License.                              #
+#                                                                             #
+# This program is distributed in the hope that it will be useful, but WITHOUT #
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or       #
+# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for    #
+# more details.                                                               #
+#                                                                             #
+# You should have received a copy of the GNU General Public License along     #
+# with this program; if not, write to the Free Software Foundation, Inc., 59  #
+# Temple Place, Suite 330, Boston, MA 02111-1307 USA                          #
+###############################################################################
+
+"""
+Module implementing BookNameForm.
+"""
+import logging
+
+from PyQt4.QtGui import QDialog
+
+from openlp.core.lib import translate
+from openlp.core.lib.ui import critical_error_message_box
+from openlp.plugins.bibles.forms.languagedialog import \
+    Ui_LanguageDialog
+from openlp.plugins.bibles.lib.db import BiblesResourcesDB
+
+log = logging.getLogger(__name__)
+
+class LanguageForm(QDialog, Ui_LanguageDialog):
+    """
+    Class to manage a dialog which ask the user for a language.
+    """
+    log.info(u'LanguageForm loaded')
+    
+    def __init__(self, parent = None):
+        """
+        Constructor
+        """
+        QDialog.__init__(self, parent)
+        self.setupUi(self)
+
+    def exec_(self):
+        items = []
+        self.requestComboBox.addItem(u'')
+        items = BiblesResourcesDB.get_languages()
+        for item in items:
+            self.requestComboBox.addItem(item[u'name'])
+        return QDialog.exec_(self)
+    
+    def accept(self):
+        if self.requestComboBox.currentText() == u'':
+            critical_error_message_box(
+                message=translate('BiblesPlugin.LanguageForm',
+                'You need to choose a language.'))
+            self.requestComboBox.setFocus()
+            return False
+        else:
+            return QDialog.accept(self)

=== modified file 'openlp/plugins/bibles/lib/csvbible.py'
--- openlp/plugins/bibles/lib/csvbible.py	2011-03-24 19:04:02 +0000
+++ openlp/plugins/bibles/lib/csvbible.py	2011-04-02 20:44:17 +0000
@@ -70,7 +70,7 @@
 import csv
 
 from openlp.core.lib import Receiver, translate
-from openlp.plugins.bibles.lib.db import BibleDB, Testament
+from openlp.plugins.bibles.lib.db import BibleDB, BiblesResourcesDB#, Testament
 
 log = logging.getLogger(__name__)
 
@@ -86,13 +86,17 @@
         """
         log.info(self.__class__.__name__)
         BibleDB.__init__(self, parent, **kwargs)
+        self.parent = parent
+        #TODO: Delete unused code
+        '''
         try:
             self.testamentsfile = kwargs[u'testamentsfile']
         except KeyError:
             self.testamentsfile = None
+        '''
         self.booksfile = kwargs[u'booksfile']
         self.versesfile = kwargs[u'versefile']
-
+    '''
     def setup_testaments(self):
         """
         Overrides parent method so we can handle importing a testament file.
@@ -126,7 +130,7 @@
                 'BibleDB.Wizard', 'Importing testaments... done.')), 2)
         else:
             BibleDB.setup_testaments(self)
-
+    '''
     def do_import(self):
         """
         Import the bible books and verses.
@@ -135,6 +139,11 @@
         self.wizard.progressBar.setMinimum(0)
         self.wizard.progressBar.setMaximum(66)
         success = True
+        language_id = self.get_language()
+        if not language_id:
+            log.exception(u'Importing books from %s   " '\
+                'failed' % self.filename)
+            return False
         books_file = None
         book_list = {}
         # Populate the Tables
@@ -148,8 +157,15 @@
                 self.wizard.incrementProgressBar(unicode(
                     translate('BibleDB.Wizard', 'Importing books... %s')) %
                     unicode(line[2], details['encoding']))
+                book_ref_id = self.parent.manager.get_book_ref_id_by_name(
+                    unicode(line[2], details['encoding']), language_id)
+                if not book_ref_id:
+                    log.exception(u'Importing books from %s " '\
+                        'failed' % self.booksfile)
+                    return False
+                book_details = BiblesResourcesDB.get_book_by_id(book_ref_id)
                 self.create_book(unicode(line[2], details['encoding']),
-                    unicode(line[3], details['encoding']), int(line[1]))
+                    book_ref_id, book_details[u'testament_id'])
                 book_list[int(line[0])] = unicode(line[2], details['encoding'])
             Receiver.send_message(u'openlp_process_events')
         except (IOError, IndexError):

=== modified file 'openlp/plugins/bibles/lib/db.py'
--- openlp/plugins/bibles/lib/db.py	2011-03-24 19:04:02 +0000
+++ openlp/plugins/bibles/lib/db.py	2011-04-02 20:44:17 +0000
@@ -26,7 +26,9 @@
 
 import logging
 import chardet
+import os
 import re
+import sqlite3
 
 from PyQt4 import QtCore
 from sqlalchemy import Column, ForeignKey, or_, Table, types
@@ -36,6 +38,7 @@
 from openlp.core.lib import Receiver, translate
 from openlp.core.lib.db import BaseModel, init_db, Manager
 from openlp.core.lib.ui import critical_error_message_box
+from openlp.core.utils import AppLocation
 
 log = logging.getLogger(__name__)
 
@@ -45,13 +48,14 @@
     """
     pass
 
-
+#TODO: Delete unused code
+'''
 class Testament(BaseModel):
     """
     Bible Testaments
     """
     pass
-
+'''
 
 class Book(BaseModel):
     """
@@ -66,6 +70,12 @@
     """
     pass
 
+class AlternativeBookNames(BaseModel):
+    """
+    Alternative Book Names model
+    """
+    pass
+
 
 def init_schema(url):
     """
@@ -80,19 +90,23 @@
         Column(u'key', types.Unicode(255), primary_key=True, index=True),
         Column(u'value', types.Unicode(255)),
     )
+    #TODO: Delete unused code
+    '''
     testament_table = Table(u'testament', metadata,
         Column(u'id', types.Integer, primary_key=True),
         Column(u'name', types.Unicode(50)),
     )
+    '''
     book_table = Table(u'book', metadata,
         Column(u'id', types.Integer, primary_key=True),
-        Column(u'testament_id', types.Integer, ForeignKey(u'testament.id')),
+        Column(u'book_reference_id', types.Integer),
+        Column(u'testament_reference_id', types.Integer),
         Column(u'name', types.Unicode(50), index=True),
-        Column(u'abbreviation', types.Unicode(5), index=True),
     )
     verse_table = Table(u'verse', metadata,
         Column(u'id', types.Integer, primary_key=True, index=True),
-        Column(u'book_id', types.Integer, ForeignKey(u'book.id'), index=True),
+        Column(u'book_id', types.Integer, ForeignKey(
+            u'book.id'), index=True),
         Column(u'chapter', types.Integer, index=True),
         Column(u'verse', types.Integer, index=True),
         Column(u'text', types.UnicodeText, index=True),
@@ -102,11 +116,13 @@
         class_mapper(BibleMeta)
     except UnmappedClassError:
         mapper(BibleMeta, meta_table)
+    #TODO: Delete unused code
+    '''
     try:
         class_mapper(Testament)
     except UnmappedClassError:
-        mapper(Testament, testament_table,
-            properties={'books': relation(Book, backref='testament')})
+        mapper(Testament, testament_table)
+    '''
     try:
         class_mapper(Book)
     except UnmappedClassError:
@@ -120,6 +136,30 @@
     metadata.create_all(checkfirst=True)
     return session
 
+def init_schema_alternative_book_names(url):
+    """
+    Setup a alternative book names database connection and initialise the 
+    database schema.
+
+    ``url``
+        The database to setup.
+    """
+    session, metadata = init_db(url)
+
+    alternative_book_names_table = Table(u'alternative_book_names', metadata,
+        Column(u'id', types.Integer, primary_key=True),
+        Column(u'book_reference_id', types.Integer),
+        Column(u'language_id', types.Integer),
+        Column(u'name', types.Unicode(50), index=True),
+    )
+
+    try:
+        class_mapper(AlternativeBookNames)
+    except UnmappedClassError:
+        mapper(AlternativeBookNames, alternative_book_names_table)
+
+    metadata.create_all(checkfirst=True)
+    return session
 
 class BibleDB(QtCore.QObject, Manager):
     """
@@ -158,7 +198,7 @@
             self.file = self.clean_filename(self.name)
         if u'file' in kwargs:
             self.file = kwargs[u'file']
-        Manager.__init__(self, u'bibles', init_schema, self.file)
+        Manager.__init__(self, u'bibles/bibles', init_schema, self.file)
         if u'file' in kwargs:
             self.get_name()
         self.wizard = None
@@ -208,9 +248,12 @@
         """
         self.wizard = wizard
         self.create_meta(u'dbversion', u'2')
-        self.setup_testaments()
+        #TODO: Delete unused code
+        #self.setup_testaments()
         return self.name
 
+    #TODO: Delete unused code
+    '''
     def setup_testaments(self):
         """
         Initialise the testaments section of a bible with suitable defaults.
@@ -218,23 +261,25 @@
         self.save_object(Testament.populate(name=u'Old Testament'))
         self.save_object(Testament.populate(name=u'New Testament'))
         self.save_object(Testament.populate(name=u'Apocrypha'))
+    '''
 
-    def create_book(self, name, abbrev, testament=1):
+    def create_book(self, name, bk_ref_id, testament=1):
         """
         Add a book to the database.
 
         ``name``
             The name of the book.
 
-        ``abbrev``
-            The abbreviation of the book.
+        ``bk_ref_id``
+            The book_reference_id from bibles_resources.sqlite of the book.
 
         ``testament``
-            *Defaults to 1.* The id of the testament this book belongs to.
+            *Defaults to 1.* The testament_reference_id from 
+            bibles_resources.sqlite of the testament this book belongs to.
         """
-        log.debug(u'create_book %s,%s', name, abbrev)
-        book = Book.populate(name=name, abbreviation=abbrev,
-            testament_id=testament)
+        log.debug(u'BibleDB.create_book("%s", "%s")', name, bk_ref_id)
+        book = Book.populate(name=name, book_reference_id=bk_ref_id,
+            testament_reference_id=testament)
         self.save_object(book)
         return book
 
@@ -252,7 +297,7 @@
             A dict of the verses to be inserted. The key is the verse number,
             and the value is the verse text.
         """
-        log.debug(u'create_chapter %s,%s', book_id, chapter)
+        log.debug(u'BibleDBcreate_chapter("%s", "%s")', book_id, chapter)
         # Text list has book and chapter as first two elements of the array.
         for verse_number, verse_text in textlist.iteritems():
             verse = Verse.populate(
@@ -302,7 +347,9 @@
         ``value``
             The value for this instance.
         """
-        log.debug(u'save_meta %s/%s', key, value)
+        if not isinstance(value, unicode):
+            value = unicode(value)
+        log.debug(u'BibleDB.save_meta("%s/%s")', key, value)
         self.save_object(BibleMeta.populate(key=key, value=value))
 
     def get_book(self, book):
@@ -312,11 +359,8 @@
         ``book``
             The name of the book to return.
         """
-        log.debug(u'BibleDb.get_book("%s")', book)
+        log.debug(u'BibleDB.get_book("%s")', book)
         db_book = self.get_object_filtered(Book, Book.name.like(book + u'%'))
-        if db_book is None:
-            db_book = self.get_object_filtered(Book,
-                Book.abbreviation.like(book + u'%'))
         return db_book
 
     def get_books(self):
@@ -326,6 +370,18 @@
         """
         return self.get_all_objects(Book, order_by_ref=Book.id)
 
+    def get_book_by_book_ref_id(self, id):
+        """
+        Return a book object from the database.
+
+        ``id``
+            The reference id of the book to return.
+        """
+        log.debug(u'BibleDB.get_book_by_book_ref_id("%s")', id)
+        db_book = self.get_object_filtered(Book, 
+            Book.book_reference_id.like(id))
+        return db_book
+
     def get_verses(self, reference_list):
         """
         This is probably the most used function. It retrieves the list of
@@ -335,24 +391,24 @@
             This is the list of references the media manager item wants. It is
             a list of tuples, with the following format::
 
-                (book, chapter, start_verse, end_verse)
+                (book_reference_id, chapter, start_verse, end_verse)
 
             Therefore, when you are looking for multiple items, simply break
             them up into references like this, bundle them into a list. This
             function then runs through the list, and returns an amalgamated
             list of ``Verse`` objects. For example::
 
-                [(u'Genesis', 1, 1, 1), (u'Genesis', 2, 2, 3)]
+                [(u'35', 1, 1, 1), (u'35', 2, 2, 3)]
         """
-        log.debug(u'BibleDB.get_verses: %s', reference_list)
+        log.debug(u'BibleDB.get_verses("%s")', reference_list)
         verse_list = []
-        for book, chapter, start_verse, end_verse in reference_list:
-            db_book = self.get_book(book)
+        for book_id, chapter, start_verse, end_verse in reference_list:
+            db_book = self.get_book_by_book_ref_id(book_id)
             if db_book:
-                book = db_book.name
-                log.debug(u'Book name corrected to "%s"', book)
+                book_id = db_book.book_reference_id
+                log.debug(u'Book name corrected to "%s"', db_book.name)
                 if end_verse == -1:
-                    end_verse = self.get_verse_count(book, chapter)
+                    end_verse = self.get_verse_count(book_id, chapter)
                 verses = self.session.query(Verse)\
                     .filter_by(book_id=db_book.id)\
                     .filter_by(chapter=chapter)\
@@ -397,23 +453,23 @@
         verses = verses.all()
         return verses
 
-    def get_chapter_count(self, book):
+    def get_chapter_count(self, book_id):
         """
         Return the number of chapters in a book.
 
         ``book``
             The book to get the chapter count for.
         """
-        log.debug(u'BibleDB.get_chapter_count("%s")', book)
+        log.debug(u'BibleDB.get_chapter_count("%s")', book_id)
         count = self.session.query(Verse.chapter).join(Book)\
-            .filter(Book.name==book)\
+            .filter(Book.book_reference_id==book_id)\
             .distinct().count()
         if not count:
             return 0
         else:
             return count
 
-    def get_verse_count(self, book, chapter):
+    def get_verse_count(self, book_id, chapter):
         """
         Return the number of verses in a chapter.
 
@@ -423,9 +479,9 @@
         ``chapter``
             The chapter to get the verse count for.
         """
-        log.debug(u'BibleDB.get_verse_count("%s", %s)', book, chapter)
+        log.debug(u'BibleDB.get_verse_count("%s", "%s")', book_id, chapter)
         count = self.session.query(Verse).join(Book)\
-            .filter(Book.name==book)\
+            .filter(Book.book_reference_id==book_id)\
             .filter(Verse.chapter==chapter)\
             .count()
         if not count:
@@ -433,6 +489,22 @@
         else:
             return count
 
+    def get_language(self):
+        """
+        Return the language of a bible.
+
+        ``book``
+            The language the bible is.
+        """
+        log.debug(u'BibleDB.get_language()')
+        language = self.bible_plugin.manager.import_wizard.languageDialog()
+        if not language:
+            return False
+        language = BiblesResourcesDB.get_language(language)
+        language_id = language[u'id']
+        self.create_meta(u'language_id', language_id)
+        return language_id
+
     def dump_bible(self):
         """
         Utility debugging method to dump the contents of a bible.
@@ -444,3 +516,424 @@
         log.debug(u'...............................Verses ')
         verses = self.session.query(Verse).all()
         log.debug(verses)
+
+
+class BiblesResourcesDB(QtCore.QObject, Manager):
+    """
+    This class represents the database-bound Bible Resources. It provide
+    some resources which are used in the Bibles plugin.
+    A wrapper class around a small SQLite database which contains the download
+    resources, a biblelist from the different download resources, the books,
+    chapter counts and verse counts for the web download Bibles, a language 
+    reference, the testament reference and some alternative book names. This 
+    class contains a singleton "cursor" so that only one connection to the 
+    SQLite database is ever used.
+    """
+    cursor = None
+
+    @staticmethod
+    def get_cursor():
+        """
+        Return the cursor object. Instantiate one if it doesn't exist yet.
+        """
+        if BiblesResourcesDB.cursor is None:
+            filepath = os.path.join(
+                AppLocation.get_directory(AppLocation.PluginsDir), u'bibles',
+                u'resources', u'bibles_resources.sqlite')
+            conn = sqlite3.connect(filepath)
+            BiblesResourcesDB.cursor = conn.cursor()
+        return BiblesResourcesDB.cursor
+
+    @staticmethod
+    def run_sql(query, parameters=()):
+        """
+        Run an SQL query on the database, returning the results.
+
+        ``query``
+            The actual SQL query to run.
+
+        ``parameters``
+            Any variable parameters to add to the query.
+        """
+        cursor = BiblesResourcesDB.get_cursor()
+        cursor.execute(query, parameters)
+        return cursor.fetchall()
+
+    @staticmethod
+    def get_books():
+        """
+        Return a list of all the books of the Bible.
+        """
+        log.debug(u'BiblesResourcesDB.get_books()')
+        books = BiblesResourcesDB.run_sql(u'SELECT id, testament_id, name, '
+                u'abbreviation, chapters FROM book_reference ORDER BY id')
+        book_list = []
+        for book in books:
+            book_list.append({
+                u'id': book[0],
+                u'testament_id': book[1],
+                u'name': unicode(book[2]),
+                u'abbreviation': unicode(book[3]),
+                u'chapters': book[4]
+            })
+        return book_list
+
+    @staticmethod
+    def get_book(name):
+        """
+        Return a book by name or abbreviation.
+
+        ``name``
+            The name or abbreviation of the book.
+        """
+        log.debug(u'BiblesResourcesDB.get_book("%s")', name)
+        if not isinstance(name, unicode):
+            name = unicode(name)
+        books = BiblesResourcesDB.run_sql(u'SELECT id, testament_id, name, '
+                u'abbreviation, chapters FROM book_reference WHERE name = ? OR '
+                u'abbreviation = ?', (name, name))
+        if books:
+            return {
+                u'id': books[0][0],
+                u'testament_id': books[0][1],
+                u'name': unicode(books[0][2]),
+                u'abbreviation': unicode(books[0][3]),
+                u'chapters': books[0][4]
+            }
+        else:
+            return None
+
+    @staticmethod
+    def get_book_by_id(id):
+        """
+        Return a book by id.
+
+        ``id``
+            The id of the book.
+        """
+        log.debug(u'BiblesResourcesDB.get_book_by_id("%s")', id)
+        if not isinstance(id, int):
+            id = int(id)
+        books = BiblesResourcesDB.run_sql(u'SELECT id, testament_id, name, '
+                u'abbreviation, chapters FROM book_reference WHERE id = ?', 
+                (id, ))
+        if books:
+            return {
+                u'id': books[0][0],
+                u'testament_id': books[0][1],
+                u'name': unicode(books[0][2]),
+                u'abbreviation': unicode(books[0][3]),
+                u'chapters': books[0][4]
+            }
+        else:
+            return None
+
+    @staticmethod
+    def get_chapter(book_id, chapter):
+        """
+        Return the chapter details for a specific chapter of a book.
+
+        ``book_id``
+            The id of a book.
+
+        ``chapter``
+            The chapter number.
+        """
+        log.debug(u'BiblesResourcesDB.get_chapter("%s", "%s")', book_id,  chapter)
+        if not isinstance(chapter, int):
+            chapter = int(chapter)
+        chapters = BiblesResourcesDB.run_sql(u'SELECT id, book_reference_id, '
+            u'chapter, verse_count FROM chapters WHERE book_reference_id = ?', 
+            (book_id,))
+        if chapters:
+            return {
+                u'id': chapters[chapter-1][0],
+                u'book_reference_id': chapters[chapter-1][1],
+                u'chapter': chapters[chapter-1][2],
+                u'verse_count': chapters[chapter-1][3]
+            }
+        else:
+            return None
+
+    @staticmethod
+    def get_chapter_count(book_id):
+        """
+        Return the number of chapters in a book.
+
+        ``book_id``
+            The id of the book.
+        """
+        log.debug(u'BiblesResourcesDB.get_chapter_count("%s")', book_id)
+        details = BiblesResourcesDB.get_book_by_id(book_id)
+        if details:
+            return details[u'chapters']
+        return 0
+
+    @staticmethod
+    def get_verse_count(book_id, chapter):
+        """
+        Return the number of verses in a chapter.
+
+        ``book``
+            The id of the book.
+
+        ``chapter``
+            The number of the chapter.
+        """
+        log.debug(u'BiblesResourcesDB.get_verse_count("%s", "%s")', book_id,  
+            chapter)
+        details = BiblesResourcesDB.get_chapter(book_id, chapter)
+        if details:
+            return details[u'verse_count']
+        return 0
+
+    @staticmethod
+    def get_download_source(source):
+        """
+        Return a download_source_id by source.
+
+        ``name``
+            The name or abbreviation of the book.
+        """
+        log.debug(u'BiblesResourcesDB.get_download_source("%s")', source)
+        if not isinstance(source, unicode):
+            source = unicode(source)
+        source = source.title()
+        dl_source = BiblesResourcesDB.run_sql(u'SELECT id, source FROM '
+                u'download_source WHERE source = ?', (source.lower(),))
+        if dl_source:
+            return {
+                u'id': dl_source[0][0],
+                u'source': dl_source[0][1]
+            }
+        else:
+            return None
+    
+    @staticmethod
+    def get_webbibles(source):
+        """
+        Return the bibles a webbible provide for download.
+
+        ``source``
+            The source of the webbible.
+        """
+        log.debug(u'BiblesResourcesDB.get_webbibles("%s")', source)
+        if not isinstance(source,  unicode):
+            source = unicode(source)
+        source = BiblesResourcesDB.get_download_source(source)
+        bibles = BiblesResourcesDB.run_sql(u'SELECT id, name, abbreviation, '
+            u'language_id, download_source_id FROM webbibles WHERE '
+            u'download_source_id = ?', (source[u'id'],))
+        if bibles:
+            bibles_temp = []
+            for bible in bibles:
+                bibles_temp.append({
+                    u'id': bible[0],
+                    u'name': bible[1],
+                    u'abbreviation': bible[2],
+                    u'language_id': bible[3], 
+                    u'download_source_id': bible[4]
+                    })
+            return bibles_temp
+        else:
+            return None
+
+    @staticmethod
+    def get_webbible(abbreviation, source):
+        """
+        Return the bibles a webbible provide for download.
+
+        ``abbreviation``
+            The abbreviation of the webbible.
+            
+        ``source``
+            The source of the webbible.
+        """
+        log.debug(u'BiblesResourcesDB.get_webbibles("%s", "%s")', abbreviation, 
+            source)
+        if not isinstance(abbreviation, unicode):
+            abbreviation = unicode(abbreviation)
+        if not isinstance(source, unicode):
+            source = unicode(source)
+        source = BiblesResourcesDB.get_download_source(source)
+        bible = BiblesResourcesDB.run_sql(u'SELECT id, name, abbreviation, '
+            u'language_id, download_source_id FROM webbibles WHERE '
+            u'download_source_id = ? AND abbreviation = ?', (source[u'id'], 
+            abbreviation))
+        if bible:
+            bibles_temp = {
+                u'id': bible[0][0],
+                u'name': bible[0][1],
+                u'abbreviation': bible[0][2],
+                u'language_id': bible[0][3], 
+                u'download_source_id': bible[0][4]
+                }
+            return bibles_temp
+        else:
+            return None
+
+    @staticmethod
+    def get_alternative_book_name(name, language_id=None):
+        """
+        Return a book_reference_id if the name matches.
+        """
+        log.debug(u'BiblesResourcesDB.get_alternative_book_name("%s", "%s")', 
+            name, language_id)
+        if language_id:
+            id = BiblesResourcesDB.run_sql(u'SELECT book_reference_id '
+                u'FROM alternative_book_names WHERE name = ? and language_id '
+                u'= ? ORDER BY id', (name, language_id))
+        else:
+            id = BiblesResourcesDB.run_sql(u'SELECT book_reference_id '
+                u'FROM alternative_book_names WHERE name = ? ORDER BY id', (
+                name, ))
+        if id:
+            return int(id[0][0])
+        else:
+            return None
+
+    @staticmethod
+    def get_language(name):
+        """
+        Return a dict containing the language id, name and code by name or 
+        abbreviation.
+
+        ``name``
+            The name or abbreviation of the language.
+        """
+        log.debug(u'BiblesResourcesDB.get_language("%s")', name)
+        if not isinstance(name, unicode):
+            name = unicode(name)
+        name = name.title()
+        language = BiblesResourcesDB.run_sql(u'SELECT id, name, code FROM '
+                u'language WHERE name = ? OR code = ?', (name, name.lower()))
+        if language:
+            return {
+                u'id': language[0][0],
+                u'name': unicode(language[0][1]),
+                u'code': unicode(language[0][2])
+            }
+        else:
+            return None
+
+    @staticmethod
+    def get_languages():
+        """
+        Return a dict containing all languages with id, name and code.
+        """
+        log.debug(u'BiblesResourcesDB.get_languages()')
+        languages = BiblesResourcesDB.run_sql(u'SELECT id, name, code FROM '
+                u'language ORDER by name')
+        if languages:
+            languages_temp = []
+            for language in languages:
+                languages_temp.append({
+                    u'id': language[0],
+                    u'name': unicode(language[1]),
+                    u'code': unicode(language[2])
+                })
+            return languages_temp
+        else:
+            return None
+
+    @staticmethod
+    def get_testament_reference():
+        """
+        Return a list of all testaments and their id of the Bible.
+        """
+        log.debug(u'BiblesResourcesDB.get_testament_reference()')
+        testaments = BiblesResourcesDB.run_sql(u'SELECT id, name FROM '
+                u'testament_reference ORDER BY id')
+        testament_list = []
+        for testament in testaments:
+            testament_list.append({
+                u'id': testament[0],
+                u'name': unicode(testament[1])
+            })
+        return testament_list
+
+class AlternativeBookNamesDB(QtCore.QObject, Manager):
+    """
+    This class represents a database-bound alternative book names system. 
+    """
+
+    def __init__(self, parent, **kwargs):
+        """
+        The constructor loads up the database and creates and initialises the
+        tables if the database doesn't exist.
+
+        **Required keyword arguments:**
+
+        ``path``
+            The path to the bible database file.
+
+        ``name``
+            The name of the database. This is also used as the file name for
+            SQLite databases.
+        """
+        log.info(u'AlternativeBookNamesDB loaded')
+        QtCore.QObject.__init__(self)
+        self.bible_plugin = parent
+        if u'path' not in kwargs:
+            raise KeyError(u'Missing keyword argument "path".')
+        self.stop_import_flag = False
+        self.name = u'alternative_book_names.sqlite'
+        if not isinstance(self.name, unicode):
+            self.name = unicode(self.name, u'utf-8')
+        self.file = self.name
+        Manager.__init__(self, u'bibles/resources', 
+            init_schema_alternative_book_names, self.file)
+        self.wizard = None
+        QtCore.QObject.connect(Receiver.get_receiver(),
+            QtCore.SIGNAL(u'openlp_stop_wizard'), self.stop_import)
+
+    def stop_import(self):
+        """
+        Stops the import of the Bible.
+        """
+        log.debug(u'Stopping import')
+        self.stop_import_flag = True
+
+    def get_book_reference_id(self, name,  language=None):
+        """
+        Return the book_reference_id of a book by name.
+
+        ``name``
+            The name to search the id.
+            
+        ``language``
+            The language for which should be searched
+        """
+        log.debug(u'AlternativeBookNamesDB.get_book_reference_id("%s")', name)
+        if language:
+            id = self.session.query(AlternativeBookNames.book_reference_id)\
+                .filter(AlternativeBookNames.name.like(name))\
+                .filter(AlternativeBookNames.language_id.like(language)).first()
+        else:
+            id = self.get_object_filtered(AlternativeBookNames.book_reference_id,
+                AlternativeBookNames.name.like(name))
+        if not id:
+            return None
+        else:
+            return id[0]
+
+    def create_alternative_book_name(self, name, book_reference_id, 
+        language_id):
+        """
+        Add an alternative book name to the database.
+
+        ``name``
+            The name of the alternative book name.
+
+        ``book_reference_id``
+            The book_reference_id of the book.
+
+        ``language_id``
+            The language to which the alternative book name belong.
+        """
+        log.debug(u'AlternativeBookNamesDB.create_alternative_book_name("%s", '
+            '"%s", "%s"', name, book_reference_id, language_id)
+        alternative_book_name = AlternativeBookNames.populate(name=name, 
+            book_reference_id=book_reference_id, language_id=language_id)
+        self.save_object(alternative_book_name)
+        return alternative_book_name

=== modified file 'openlp/plugins/bibles/lib/http.py'
--- openlp/plugins/bibles/lib/http.py	2011-03-24 19:04:02 +0000
+++ openlp/plugins/bibles/lib/http.py	2011-04-02 20:44:17 +0000
@@ -41,152 +41,17 @@
 from openlp.core.lib.ui import critical_error_message_box
 from openlp.core.utils import AppLocation, get_web_page
 from openlp.plugins.bibles.lib import SearchResults
-from openlp.plugins.bibles.lib.db import BibleDB, Book
+from openlp.plugins.bibles.lib.db import BibleDB, BiblesResourcesDB, \
+    Book, BibleMeta
 
 log = logging.getLogger(__name__)
 
-class HTTPBooks(object):
-    """
-    A wrapper class around a small SQLite database which contains the books,
-    chapter counts and verse counts for the web download Bibles. This class
-    contains a singleton "cursor" so that only one connection to the SQLite
-    database is ever used.
-    """
-    cursor = None
-
-    @staticmethod
-    def get_cursor():
-        """
-        Return the cursor object. Instantiate one if it doesn't exist yet.
-        """
-        if HTTPBooks.cursor is None:
-            filepath = os.path.join(
-                AppLocation.get_directory(AppLocation.PluginsDir), u'bibles',
-                u'resources', u'httpbooks.sqlite')
-            conn = sqlite3.connect(filepath)
-            HTTPBooks.cursor = conn.cursor()
-        return HTTPBooks.cursor
-
-    @staticmethod
-    def run_sql(query, parameters=()):
-        """
-        Run an SQL query on the database, returning the results.
-
-        ``query``
-            The actual SQL query to run.
-
-        ``parameters``
-            Any variable parameters to add to the query.
-        """
-        cursor = HTTPBooks.get_cursor()
-        cursor.execute(query, parameters)
-        return cursor.fetchall()
-
-    @staticmethod
-    def get_books():
-        """
-        Return a list of all the books of the Bible.
-        """
-        books = HTTPBooks.run_sql(u'SELECT id, testament_id, name, '
-                u'abbreviation, chapters FROM books ORDER BY id')
-        book_list = []
-        for book in books:
-            book_list.append({
-                u'id': book[0],
-                u'testament_id': book[1],
-                u'name': unicode(book[2]),
-                u'abbreviation': unicode(book[3]),
-                u'chapters': book[4]
-            })
-        return book_list
-
-    @staticmethod
-    def get_book(name):
-        """
-        Return a book by name or abbreviation.
-
-        ``name``
-            The name or abbreviation of the book.
-        """
-        if not isinstance(name, unicode):
-            name = unicode(name)
-        name = name.title()
-        books = HTTPBooks.run_sql(u'SELECT id, testament_id, name, '
-                u'abbreviation, chapters FROM books WHERE name = ? OR '
-                u'abbreviation = ?', (name, name))
-        if books:
-            return {
-                u'id': books[0][0],
-                u'testament_id': books[0][1],
-                u'name': unicode(books[0][2]),
-                u'abbreviation': unicode(books[0][3]),
-                u'chapters': books[0][4]
-            }
-        else:
-            return None
-
-    @staticmethod
-    def get_chapter(name, chapter):
-        """
-        Return the chapter details for a specific chapter of a book.
-
-        ``name``
-            The name or abbreviation of a book.
-
-        ``chapter``
-            The chapter number.
-        """
-        if not isinstance(name, int):
-            chapter = int(chapter)
-        book = HTTPBooks.get_book(name)
-        chapters = HTTPBooks.run_sql(u'SELECT id, book_id, chapter, '
-            u'verses FROM chapters WHERE book_id = ?', (book[u'id'],))
-        if chapters:
-            return {
-                u'id': chapters[chapter-1][0],
-                u'book_id': chapters[chapter-1][1],
-                u'chapter': chapters[chapter-1][2],
-                u'verses': chapters[chapter-1][3]
-            }
-        else:
-            return None
-
-    @staticmethod
-    def get_chapter_count(book):
-        """
-        Return the number of chapters in a book.
-
-        ``book``
-            The name or abbreviation of the book.
-        """
-        details = HTTPBooks.get_book(book)
-        if details:
-            return details[u'chapters']
-        return 0
-
-    @staticmethod
-    def get_verse_count(book, chapter):
-        """
-        Return the number of verses in a chapter.
-
-        ``book``
-            The name or abbreviation of the book.
-
-        ``chapter``
-            The number of the chapter.
-        """
-        details = HTTPBooks.get_chapter(book, chapter)
-        if details:
-            return details[u'verses']
-        return 0
-
-
 class BGExtract(object):
     """
     Extract verses from BibleGateway
     """
     def __init__(self, proxyurl=None):
-        log.debug(u'init %s', proxyurl)
+        log.debug(u'BGExtract.init("%s")', proxyurl)
         self.proxyurl = proxyurl
         socket.setdefaulttimeout(30)
 
@@ -203,9 +68,11 @@
         ``chapter``
             Chapter number.
         """
-        log.debug(u'get_bible_chapter %s, %s, %s', version, bookname, chapter)
+        log.debug(u'BGExtract.get_bible_chapter("%s", "%s", "%s")', version, 
+            bookname, chapter)
+        urlbookname = urllib.quote(bookname.encode("utf-8"))
         url_params = urllib.urlencode(
-            {u'search': u'%s %s' % (bookname, chapter),
+            {u'search': u'%s %s' % (urlbookname, chapter),
             u'version': u'%s' % version})
         cleaner = [(re.compile('&nbsp;|<br />|\'\+\''), lambda match: '')]
         soup = get_soup_for_bible_ref(
@@ -263,13 +130,57 @@
             return None
         return SearchResults(bookname, chapter, verse_list)
 
+    def get_books_from_http(self, version):
+        """
+        Load a list of all books a bible contaions from BibleGateway website.
+
+        ``version``
+            The version of the bible like NIV for New International Version
+        """
+        log.debug(u'BGExtract.get_books_from_http("%s")', version)
+        url_params = urllib.urlencode(
+            {u'search': 'Bible-List', u'version': u'%s' % version})
+        reference_url = u'http://www.biblegateway.com/passage/?%s' % url_params
+        page = get_web_page(reference_url)
+        if not page:
+            send_error_message(u'download')
+            return None
+        page_source = page.read()
+        page_source = unicode(page_source, 'utf8')
+        page_source_temp = re.search(u'<table id="booklist".*?>.*?</table>',  \
+            page_source,  re.DOTALL)
+        if page_source_temp:
+            soup = page_source_temp.group(0)
+        else:
+            soup = None
+        try:
+            soup = BeautifulSoup(soup)
+        except HTMLParseError:
+            log.exception(u'BeautifulSoup could not parse the bible page.')
+        if not soup:
+            send_error_message(u'parse')
+            return None
+        Receiver.send_message(u'openlp_process_events')
+        content = soup.find(u'table', {u'id': u'booklist'})
+        content = content.findAll(u'tr')
+        if not content:
+            log.exception(u'No books found in the Biblegateway response.')
+            send_error_message(u'parse')
+            return None
+        books = []
+        for book in content:
+            book = book.find(u'td')
+            if book:
+                books.append(book.contents[0])
+        return books
+
 
 class BSExtract(object):
     """
     Extract verses from Bibleserver.com
     """
     def __init__(self, proxyurl=None):
-        log.debug(u'init %s', proxyurl)
+        log.debug(u'BSExtract.init("%s")', proxyurl)
         self.proxyurl = proxyurl
         socket.setdefaulttimeout(30)
 
@@ -286,9 +197,11 @@
         ``chapter``
             Chapter number
         """
-        log.debug(u'get_bible_chapter %s,%s,%s', version, bookname, chapter)
+        log.debug(u'BSExtract.get_bible_chapter("%s", "%s", "%s")', version, 
+            bookname, chapter)
+        urlbookname = urllib.quote(bookname.encode("utf-8"))
         chapter_url = u'http://m.bibleserver.com/text/%s/%s%s' % \
-            (version, bookname, chapter)
+            (version, urlbookname, chapter)
         header = (u'Accept-Language', u'en')
         soup = get_soup_for_bible_ref(chapter_url, header)
         if not soup:
@@ -308,13 +221,38 @@
             verses[versenumber] = verse.contents[1].rstrip(u'\n')
         return SearchResults(bookname, chapter, verses)
 
+    def get_books_from_http(self, version):
+        """
+        Load a list of all books a bible contains from Bibleserver mobile 
+        website.
+
+        ``version``
+            The version of the bible like NIV for New International Version
+        """
+        log.debug(u'BSExtract.get_books_from_http("%s")', version)
+        chapter_url = u'http://m.bibleserver.com/overlay/selectBook?'\
+            'translation=%s' % (version)
+        soup = get_soup_for_bible_ref(chapter_url)
+        if not soup:
+            return None
+        content = soup.find(u'ul')
+        if not content:
+            log.exception(u'No books found in the Bibleserver response.')
+            send_error_message(u'parse')
+            return None
+        content = content.findAll(u'li')
+        books = []
+        for book in content:
+            books.append(book.contents[0].contents[0])
+        return books
+
 
 class CWExtract(object):
     """
     Extract verses from CrossWalk/BibleStudyTools
     """
     def __init__(self, proxyurl=None):
-        log.debug(u'init %s', proxyurl)
+        log.debug(u'CWExtract.init("%s")', proxyurl)
         self.proxyurl = proxyurl
         socket.setdefaulttimeout(30)
 
@@ -331,10 +269,13 @@
         ``chapter``
             Chapter number
         """
-        log.debug(u'get_bible_chapter %s,%s,%s', version, bookname, chapter)
+        log.debug(u'CWExtract.get_bible_chapter("%s", "%s", "%s")', version, 
+            bookname, chapter)
         urlbookname = bookname.replace(u' ', u'-')
+        urlbookname = urlbookname.lower()
+        urlbookname = urllib.quote(urlbookname.encode("utf-8"))
         chapter_url = u'http://www.biblestudytools.com/%s/%s/%s.html' % \
-            (version, urlbookname.lower(), chapter)
+            (version, urlbookname, chapter)
         soup = get_soup_for_bible_ref(chapter_url)
         if not soup:
             return None
@@ -377,6 +318,32 @@
             verses[versenumber] = versetext
         return SearchResults(bookname, chapter, verses)
 
+    def get_books_from_http(self, version):
+        """
+        Load a list of all books  a bible contain from the Crosswalk website.
+
+        ``version``
+            The version of the bible like NIV for New International Version
+        """
+        log.debug(u'CWExtract.get_books_from_http("%s")', version)
+        chapter_url = u'http://www.biblestudytools.com/%s/'\
+             % (version)
+        soup = get_soup_for_bible_ref(chapter_url)
+        if not soup:
+            return None
+        content = soup.find(u'div', {u'class': u'Body'})
+        content = content.find(u'ul', {u'class': u'parent'})
+        if not content:
+            log.exception(u'No books found in the Crosswalk response.')
+            send_error_message(u'parse')
+            return None
+        content = content.findAll(u'li')
+        books = []
+        for book in content:
+            book = book.find(u'a')
+            books.append(book.contents[0])
+        return books
+
 
 class HTTPBible(BibleDB):
     log.info(u'%s HTTPBible loaded' , __name__)
@@ -392,6 +359,7 @@
         Init confirms the bible exists and stores the database path.
         """
         BibleDB.__init__(self, parent, **kwargs)
+        self.parent = parent
         self.download_source = kwargs[u'download_source']
         self.download_name = kwargs[u'download_name']
         # TODO: Clean up proxy stuff. We probably want one global proxy per
@@ -399,6 +367,8 @@
         self.proxy_server = None
         self.proxy_username = None
         self.proxy_password = None
+        if u'path' in kwargs:
+            self.path = kwargs[u'path']
         if u'proxy_server' in kwargs:
             self.proxy_server = kwargs[u'proxy_server']
         if u'proxy_username' in kwargs:
@@ -411,8 +381,10 @@
         Run the import. This method overrides the parent class method. Returns
         ``True`` on success, ``False`` on failure.
         """
-        self.wizard.progressBar.setMaximum(2)
-        self.wizard.incrementProgressBar('Registering bible...')
+        self.wizard.progressBar.setMaximum(68)
+        self.wizard.incrementProgressBar(unicode(translate(
+            'BiblesPlugin.HTTPBible', 
+            'Registering bible and loading books...')))
         self.create_meta(u'download source', self.download_source)
         self.create_meta(u'download name', self.download_name)
         if self.proxy_server:
@@ -423,6 +395,45 @@
         if self.proxy_password:
             # Store the proxy password.
             self.create_meta(u'proxy password', self.proxy_password)
+        if self.download_source.lower() == u'crosswalk':
+            handler = CWExtract(self.proxy_server)
+        elif self.download_source.lower() == u'biblegateway':
+            handler = BGExtract(self.proxy_server)
+        elif self.download_source.lower() == u'bibleserver':
+            handler = BSExtract(self.proxy_server)
+        books = handler.get_books_from_http(self.download_name)
+        if not books:
+            log.exception(u'Importing books from %s - download name: "%s" '\
+                'failed' % (self.download_source,  self.download_name))
+            return False
+        self.wizard.progressBar.setMaximum(len(books)+2)
+        self.wizard.incrementProgressBar(unicode(translate(
+            'BiblesPlugin.HTTPBible', 'Registering Language...')))
+        bible = BiblesResourcesDB.get_webbible(self.download_name, 
+                self.download_source.lower())
+        if bible[u'language_id']:
+            language_id = bible[u'language_id']
+            self.create_meta(u'language_id', language_id)
+        else:
+            language_id = self.get_language()
+        if not language_id:
+            log.exception(u'Importing books from %s   " '\
+                'failed' % self.filename)
+            return False
+        for book in books:
+            self.wizard.incrementProgressBar(unicode(translate(
+                            'BiblesPlugin.HTTPBible', 'Importing %s...',
+                            'Importing <book name>...')) % book)
+            book_ref_id = self.parent.manager.get_book_ref_id_by_name(book, 
+                language_id)
+            if not book_ref_id:
+                log.exception(u'Importing books from %s - download name: "%s" '\
+                    'failed' % (self.download_source,  self.download_name))
+                return False
+            book_details = BiblesResourcesDB.get_book_by_id(book_ref_id)
+            log.debug(u'Book details: Name:%s; id:%s; testament_id:%s', 
+                book, book_ref_id, book_details[u'testament_id'])
+            self.create_book(book, book_ref_id, book_details[u'testament_id'])
         return True
 
     def get_verses(self, reference_list):
@@ -437,33 +448,28 @@
             This is the list of references the media manager item wants. It is
             a list of tuples, with the following format::
 
-                (book, chapter, start_verse, end_verse)
+                (book_reference_id, chapter, start_verse, end_verse)
 
             Therefore, when you are looking for multiple items, simply break
             them up into references like this, bundle them into a list. This
             function then runs through the list, and returns an amalgamated
             list of ``Verse`` objects. For example::
 
-                [(u'Genesis', 1, 1, 1), (u'Genesis', 2, 2, 3)]
+                [(u'35', 1, 1, 1), (u'35', 2, 2, 3)]
         """
+        log.debug(u'HTTPBible.get_verses("%s")', reference_list)
         for reference in reference_list:
-            log.debug(u'Reference: %s', reference)
-            book = reference[0]
-            db_book = self.get_book(book)
+            book_id = reference[0]
+            db_book = self.get_book_by_book_ref_id(book_id)
             if not db_book:
-                book_details = HTTPBooks.get_book(book)
-                if not book_details:
-                    critical_error_message_box(
-                        translate('BiblesPlugin', 'No Book Found'),
-                        translate('BiblesPlugin', 'No matching '
-                        'book could be found in this Bible. Check that you '
-                        'have spelled the name of the book correctly.'))
-                    return []
-                db_book = self.create_book(book_details[u'name'],
-                    book_details[u'abbreviation'],
-                    book_details[u'testament_id'])
+                critical_error_message_box(
+                    translate('BiblesPlugin', 'No Book Found'),
+                    translate('BiblesPlugin', 'No matching '
+                    'book could be found in this Bible. Check that you '
+                    'have spelled the name of the book correctly.'))
+                return []
             book = db_book.name
-            if BibleDB.get_verse_count(self, book, reference[1]) == 0:
+            if BibleDB.get_verse_count(self, book_id, reference[1]) == 0:
                 Receiver.send_message(u'cursor_busy')
                 search_results = self.get_chapter(book, reference[1])
                 if search_results and search_results.has_verselist():
@@ -486,7 +492,7 @@
         """
         Receive the request and call the relevant handler methods.
         """
-        log.debug(u'get_chapter %s, %s', book, chapter)
+        log.debug(u'HTTPBible.get_chapter("%s", "%s")', book, chapter)
         log.debug(u'source = %s', self.download_source)
         if self.download_source.lower() == u'crosswalk':
             handler = CWExtract(self.proxy_server)
@@ -500,16 +506,17 @@
         """
         Return the list of books.
         """
-        return [Book.populate(name=book['name'])
-            for book in HTTPBooks.get_books()]
+        log.debug(u'HTTPBible.get_books("%s")', Book.name)
+        return self.get_all_objects(Book, order_by_ref=Book.id)
 
-    def get_chapter_count(self, book):
+    def get_chapter_count(self, book_id):
         """
         Return the number of chapters in a particular book.
         """
-        return HTTPBooks.get_chapter_count(book)
+        log.debug(u'HTTPBible.get_chapter_count("%s")', book_id)
+        return BiblesResourcesDB.get_chapter_count(book_id)
 
-    def get_verse_count(self, book, chapter):
+    def get_verse_count(self, book_id, chapter):
         """
         Return the number of verses for the specified chapter and book.
 
@@ -519,7 +526,8 @@
         ``chapter``
             The chapter whose verses are being counted.
         """
-        return HTTPBooks.get_verse_count(book, chapter)
+        log.debug(u'HTTPBible.get_verse_count("%s", %s)', book_id, chapter)
+        return BiblesResourcesDB.get_verse_count(book_id, chapter)
 
 def get_soup_for_bible_ref(reference_url, header=None, pre_parse_regex=None,
     pre_parse_substitute=None, cleaner=None):

=== modified file 'openlp/plugins/bibles/lib/manager.py'
--- openlp/plugins/bibles/lib/manager.py	2011-03-24 19:04:02 +0000
+++ openlp/plugins/bibles/lib/manager.py	2011-04-02 20:44:17 +0000
@@ -30,9 +30,11 @@
 from PyQt4 import QtCore
 
 from openlp.core.lib import Receiver, SettingsManager, translate
+from openlp.core.lib.ui import critical_error_message_box
 from openlp.core.utils import AppLocation, delete_file
 from openlp.plugins.bibles.lib import parse_reference
-from openlp.plugins.bibles.lib.db import BibleDB, BibleMeta
+from openlp.plugins.bibles.lib.db import BibleDB, BibleMeta, \
+    AlternativeBookNamesDB, BiblesResourcesDB
 from csvbible import CSVBible
 from http import HTTPBible
 from opensong import OpenSongBible
@@ -119,7 +121,7 @@
         """
         log.debug(u'Bible Initialising')
         self.parent = parent
-        self.settingsSection = u'bibles'
+        self.settingsSection = u'bibles/bibles'
         self.web = u'Web'
         self.db_cache = None
         self.path = AppLocation.get_section_data_path(self.settingsSection)
@@ -129,6 +131,8 @@
         self.suffix = u'.sqlite'
         self.import_wizard = None
         self.reload_bibles()
+        #TODO: Delete unused code
+        #self.reload_alternative_book_names()
         self.media = None
 
     def reload_bibles(self):
@@ -166,6 +170,19 @@
                 self.db_cache[name] = web_bible
         log.debug(u'Bibles reloaded')
 
+    #TODO: Delete unused code
+    '''
+    def reload_alternative_book_names(self):
+        """
+        Reloads the alternative book names from the local alternative book names
+        database on disk.
+        """
+        log.debug(u'Reload AlternativeBookNames')
+        self.alternative_book_names_cache = AlternativeBookNamesDB(self.parent, 
+            path=self.path)
+        log.debug(u'AlternativeBookNames reloaded')
+    '''
+
     def set_process_dialog(self, wizard):
         """
         Sets the reference to the dialog with the progress bar on it.
@@ -207,19 +224,22 @@
             Unicode. The Bible to get the list of books from.
         """
         log.debug(u'BibleManager.get_books("%s")', bible)
-        return [
+        language_id = self.get_meta_data(bible, u'language_id')
+        books = []
+        for book in self.db_cache[bible].get_books():
+            books.append(
             {
                 u'name': book.name,
-                u'chapters': self.db_cache[bible].get_chapter_count(book.name)
-            }
-            for book in self.db_cache[bible].get_books()
-        ]
+                u'chapters': self.db_cache[bible].get_chapter_count(book.book_reference_id)
+            })
+        return books
 
     def get_chapter_count(self, bible, book):
         """
         Returns the number of Chapters for a given book.
         """
-        log.debug(u'get_book_chapter_count %s', book)
+        log.debug(u'BibleManager.get_book_chapter_count ("%s", "%s")', bible, 
+            book)
         return self.db_cache[bible].get_chapter_count(book)
 
     def get_verse_count(self, bible, book, chapter):
@@ -229,9 +249,11 @@
         """
         log.debug(u'BibleManager.get_verse_count("%s", "%s", %s)',
             bible, book, chapter)
-        return self.db_cache[bible].get_verse_count(book, chapter)
+        db_book = self.db_cache[bible].get_book(book)
+        book_ref_id = db_book.book_reference_id
+        return self.db_cache[bible].get_verse_count(book_ref_id, chapter)
 
-    def get_verses(self, bible, versetext):
+    def get_verses(self, bible, versetext, firstbible=False):
         """
         Parses a scripture reference, fetches the verses from the Bible
         specified, and returns a list of ``Verse`` objects.
@@ -262,6 +284,28 @@
             return None
         reflist = parse_reference(versetext)
         if reflist:
+            new_reflist = []
+            for item in reflist:
+                if item:
+                    if firstbible:
+                        db_book = self.db_cache[firstbible].get_book(item[0])
+                        db_book = self.db_cache[bible].get_book_by_book_ref_id(
+                            db_book.book_reference_id)
+                    else:
+                        db_book = self.db_cache[bible].get_book(item[0])
+                    if db_book:
+                        book_id = db_book.book_reference_id
+                        log.debug(u'Book name corrected to "%s"', db_book.name)
+                        new_reflist.append((book_id, item[1], item[2], 
+                            item[3]))
+                    else:
+                        log.debug(u'OpenLP failed to find book %s', item[0])
+                        critical_error_message_box(
+                            translate('BiblesPlugin', 'No Book Found'),
+                            translate('BiblesPlugin', 'No matching book '
+                            'could be found in this Bible. Check that you have '
+                            'spelled the name of the book correctly.'))
+            reflist = new_reflist
             return self.db_cache[bible].get_verses(reflist)
         else:
             Receiver.send_message(u'openlp_information_message', {
@@ -280,6 +324,44 @@
                 })
             return None
 
+    def get_book_ref(self, book,  language_id=None):
+        log.debug(u'BibleManager.get_book_ref("%s", "%s")', book, language_id)
+        book_id = self.get_book_ref_id_by_name(book, language_id)
+        book_temp = BiblesResourcesDB.get_book_by_id(book_id)
+        log.debug(u'BibleManager.get_book_ref("Return: %s")', 
+            book_temp[u'name'])
+        return book_temp[u'name']
+
+    def get_book_ref_id_by_name(self, book, language_id=None):
+        log.debug(u'BibleManager.get_book_ref_id_by_name:("%s", "%s")', book, 
+            language_id)
+        self.alternative_book_names_cache = AlternativeBookNamesDB(self.parent, 
+            path=self.path)
+        if BiblesResourcesDB.get_book(book):
+            book_temp = BiblesResourcesDB.get_book(book)
+            book_id = book_temp[u'id']
+        elif BiblesResourcesDB.get_alternative_book_name(book, language_id):
+            book_id = BiblesResourcesDB.get_alternative_book_name(book, 
+                language_id)
+        elif self.alternative_book_names_cache.get_book_reference_id(book, 
+            language_id):
+            book_id = self.alternative_book_names_cache.get_book_reference_id(
+                book, language_id)
+        else:   
+            book_ref = self.import_wizard.bookNameDialog(book)
+            book_temp = BiblesResourcesDB.get_book(book_ref)
+            if book_temp:
+                book_id = book_temp[u'id']
+            else:
+                return None
+            if book_id:
+                self.alternative_book_names_cache.create_alternative_book_name(
+                    book, book_id, language_id)
+        if book_id:
+            return book_id
+        else:
+            return None
+
     def verse_search(self, bible, second_bible, text):
         """
         Does a verse search for the given bible and text.

=== modified file 'openlp/plugins/bibles/lib/mediaitem.py'
--- openlp/plugins/bibles/lib/mediaitem.py	2011-03-26 16:29:21 +0000
+++ openlp/plugins/bibles/lib/mediaitem.py	2011-04-02 20:44:17 +0000
@@ -476,7 +476,7 @@
         self.search_results = self.parent.manager.get_verses(bible, versetext)
         if second_bible:
             self.second_search_results = self.parent.manager.get_verses(
-                second_bible, versetext)
+                second_bible, versetext, bible)
         if self.advancedClearComboBox.currentIndex() == 0:
             self.listView.clear()
         if self.listView.count() != 0:
@@ -503,7 +503,7 @@
             self.search_results = self.parent.manager.get_verses(bible, text)
             if second_bible and self.search_results:
                 self.second_search_results = self.parent.manager.get_verses(
-                    second_bible, text)
+                    second_bible, text, bible)
         else:
             # We are doing a 'Text Search'.
             Receiver.send_message(u'cursor_busy')

=== modified file 'openlp/plugins/bibles/lib/openlp1.py'
--- openlp/plugins/bibles/lib/openlp1.py	2011-03-24 19:04:02 +0000
+++ openlp/plugins/bibles/lib/openlp1.py	2011-04-02 20:44:17 +0000
@@ -29,7 +29,7 @@
 
 from openlp.core.lib import Receiver
 from openlp.core.ui.wizard import WizardStrings
-from openlp.plugins.bibles.lib.db import BibleDB
+from openlp.plugins.bibles.lib.db import BibleDB, BiblesResourcesDB
 
 log = logging.getLogger(__name__)
 
@@ -43,6 +43,7 @@
         """
         log.debug(self.__class__.__name__)
         BibleDB.__init__(self, parent, **kwargs)
+        self.parent = parent
         self.filename = kwargs[u'filename']
 
     def do_import(self):
@@ -56,6 +57,12 @@
             cursor = connection.cursor()
         except:
             return False
+        #Create the bible language
+        language_id = self.get_language()
+        if not language_id:
+            log.exception(u'Importing books from %s   " '\
+                'failed' % self.filename)
+            return False
         # Create all books.
         cursor.execute(u'SELECT id, testament_id, name, abbreviation FROM book')
         books = cursor.fetchall()
@@ -68,7 +75,15 @@
             testament_id = int(book[1])
             name = unicode(book[2], u'cp1252')
             abbreviation = unicode(book[3], u'cp1252')
-            self.create_book(name, abbreviation, testament_id)
+            book_ref_id = self.parent.manager.get_book_ref_id_by_name(name, 
+                language_id)
+            if not book_ref_id:
+                log.exception(u'Importing books from %s " '\
+                    'failed' % self.filename)
+                return False
+            book_details = BiblesResourcesDB.get_book_by_id(book_ref_id)
+            db_book = self.create_book(name, book_ref_id, 
+                book_details[u'testament_id'])
             # Update the progess bar.
             self.wizard.incrementProgressBar(WizardStrings.ImportingType % name)
             # Import the verses for this book.
@@ -82,7 +97,7 @@
                 chapter = int(verse[0])
                 verse_number = int(verse[1])
                 text = unicode(verse[2], u'cp1252')
-                self.create_verse(book_id, chapter, verse_number, text)
+                self.create_verse(db_book.id, chapter, verse_number, text)
                 Receiver.send_message(u'openlp_process_events')
             self.session.commit()
         connection.close()

=== modified file 'openlp/plugins/bibles/lib/opensong.py'
--- openlp/plugins/bibles/lib/opensong.py	2011-03-24 19:04:02 +0000
+++ openlp/plugins/bibles/lib/opensong.py	2011-04-02 20:44:17 +0000
@@ -28,7 +28,7 @@
 from lxml import objectify
 
 from openlp.core.lib import Receiver, translate
-from openlp.plugins.bibles.lib.db import BibleDB
+from openlp.plugins.bibles.lib.db import BibleDB, BiblesResourcesDB
 
 log = logging.getLogger(__name__)
 
@@ -43,6 +43,7 @@
         """
         log.debug(self.__class__.__name__)
         BibleDB.__init__(self, parent, **kwargs)
+        self.parent = parent
         self.filename = kwargs['filename']
 
     def do_import(self):
@@ -61,11 +62,23 @@
             file = open(self.filename, u'r')
             opensong = objectify.parse(file)
             bible = opensong.getroot()
+            language_id = self.get_language()
+            if not language_id:
+                log.exception(u'Importing books from %s   " '\
+                    'failed' % self.filename)
+                return False
             for book in bible.b:
                 if self.stop_import_flag:
                     break
-                db_book = self.create_book(unicode(book.attrib[u'n']),
-                    unicode(book.attrib[u'n'][:4]))
+                book_ref_id = self.parent.manager.get_book_ref_id_by_name(
+                    unicode(book.attrib[u'n']), language_id)
+                if not book_ref_id:
+                    log.exception(u'Importing books from %s " '\
+                        'failed' % self.filename)
+                    return False
+                book_details = BiblesResourcesDB.get_book_by_id(book_ref_id)
+                db_book = self.create_book(unicode(book.attrib[u'n']), 
+                    book_ref_id, book_details[u'testament_id'])
                 for chapter in book.c:
                     if self.stop_import_flag:
                         break

=== modified file 'openlp/plugins/bibles/lib/osis.py'
--- openlp/plugins/bibles/lib/osis.py	2011-03-24 19:04:02 +0000
+++ openlp/plugins/bibles/lib/osis.py	2011-04-02 20:44:17 +0000
@@ -33,7 +33,7 @@
 
 from openlp.core.lib import Receiver, translate
 from openlp.core.utils import AppLocation
-from openlp.plugins.bibles.lib.db import BibleDB
+from openlp.plugins.bibles.lib.db import BibleDB, BiblesResourcesDB
 
 log = logging.getLogger(__name__)
 
@@ -46,6 +46,7 @@
     def __init__(self, parent, **kwargs):
         log.debug(self.__class__.__name__)
         BibleDB.__init__(self, parent, **kwargs)
+        self.parent = parent
         self.filename = kwargs[u'filename']
         fbibles = None
         self.books = {}
@@ -91,7 +92,8 @@
         osis = None
         success = True
         last_chapter = 0
-        testament = 1
+        #TODO: Delete unused code
+        #testament = 1
         match_count = 0
         self.wizard.incrementProgressBar(translate('BiblesPlugin.OsisImport',
             'Detecting encoding (this may take a few minutes)...'))
@@ -104,6 +106,12 @@
         finally:
             if detect_file:
                 detect_file.close()
+        # Set meta language_id
+        language_id = self.get_language()
+        if not language_id:
+            log.exception(u'Importing books from %s   " '\
+                'failed' % self.filename)
+            return False
         try:
             osis = codecs.open(self.filename, u'r', details['encoding'])
             for file_record in osis:
@@ -117,13 +125,23 @@
                     verse = int(match.group(3))
                     verse_text = match.group(4)
                     if not db_book or db_book.name != self.books[book][0]:
-                        log.debug(u'New book: "%s"', self.books[book][0])
-                        if book == u'Matt' or book == u'Jdt':
-                            testament += 1
+                        log.debug(u'New book: "%s"' % self.books[book][0])
+                        #TODO: Delete unused code
+                        #if book == u'Matt' or book == u'Jdt':
+                        #    testament += 1
+                        book_ref_id = self.parent.manager.\
+                            get_book_ref_id_by_name(
+                            unicode(self.books[book][0]), language_id)
+                        if not book_ref_id:
+                            log.exception(u'Importing books from %s " '\
+                                'failed' % self.filename)
+                            return False
+                        book_details = BiblesResourcesDB.get_book_by_id(
+                            book_ref_id)
                         db_book = self.create_book(
                             unicode(self.books[book][0]),
-                            unicode(self.books[book][1]),
-                            testament)
+                            book_ref_id,
+                            book_details[u'testament_id'])
                     if last_chapter == 0:
                         if book == u'Gen':
                             self.wizard.progressBar.setMaximum(1188)

=== removed file 'openlp/plugins/bibles/resources/biblegateway.csv'
--- openlp/plugins/bibles/resources/biblegateway.csv	2010-12-17 22:10:29 +0000
+++ openlp/plugins/bibles/resources/biblegateway.csv	1970-01-01 00:00:00 +0000
@@ -1,81 +0,0 @@
-João Ferreira de Almeida Atualizada,AA
-التفسير التطبيقى للكتاب المقدس,ALAB
-Shqip,ALB
-Amplified Bible,AMP
-Amuzgo de Guerrero,AMU
-American Standard Version,ASV
-La Bible du Semeur,BDS
-Български 1940,BG1940
-Български,BULG
-Chinanteco de Comaltepec,CCO
-Contemporary English Version,CEV
-Cakchiquel Occidental,CKW
-Hrvatski,CRO
-Castilian,CST
-聖經和合本 (简体中文),CUVS
-聖經和合本 (繁体中文),CUV
-Darby Translation,DARBY
-Dette er Biblen på dansk,DN1933
-Det Norsk Bibelselskap 1930,DNB1930
-English Standard Version,ESV
-GOD’S WORD Translation,GW
-Holman Christian Standard Bible,HCSB
-Kreyòl ayisyen bib,HCV
-Hiligaynon Bible,HLGN
-Hoffnung für Alle,HOF
-Het Boek,HTB
-Icelandic Bible,ICELAND
-Jacalteco – Oriental,JAC
-Károlyi-biblia,KAR
-Kekchi,KEK
-21st Century King James Version,KJ21
-King James Version,KJV
-La Biblia de las Américas,LBLA
-Levande Bibeln,LB
-La Parola è Vita,LM
-La Nuova Diodati,LND
-Louis Segond,LSG
-Luther Bibel 1545,LUTH1545
-Māori Bible,MAORI
-Македонски Новиот Завет,MNT
-The Message,MSG
-Mam de Comitancillo Central,MVC
-Mam de Todos Santos Cuchumatán,MVJ
-New American Standard Bible,NASB
-New Century Version,NCV
-Náhuatl de Guerrero,NGU
-New International Reader's Version,NIRV
-New International Version 1984,NIV1984
-New International Version 2010,NIV
-New International Version - UK,NIVUK
-New King James Version,NKJV
-New Living Translation,NLT
-Nádej pre kazdého,NPK
-Nueva Versión Internacional,NVI
-O Livro,OL
-Quiché – Centro Occidental,QUT
-Reimer 2001,REIMER
-Română Cornilescu,RMNN
-Новый перевод на русский язык,RUSV
-Reina-Valera Antigua,RVA
-Reina-Valera 1960,RVR1960
-Reina-Valera 1995,RVR1995
-Slovo na cestu,SNC
-Ang Salita ng Diyos,SND
-Swahili New Testament,SNT
-Svenska 1917,SV1917
-Levande Bibeln,SVL
-Создать страницу,SZ
-Traducción en lenguaje actual,TLA
-New Romanian Translation,TLCR
-Today’s New International Version 2005,TNIV
-Textus Receptus Stephanus 1550,TR1550
-Textus Receptus Scrivener 1894,TR1894
-Українська Біблія. Переклад Івана Огієнка,UKR
-Uspanteco,USP
-Kinh Thánh tiếng Việt 1934,VIET
-Worldwide English (New Testament),WE
-Codex Vaticanus Westcott-Hort 1881,WHNU
-Westminster Leningrad Codex,WLC
-Wycliffe New Testament,WYC
-Young's Literal Translation,YLT

=== added file 'openlp/plugins/bibles/resources/bibles_resources.sqlite'
Binary files openlp/plugins/bibles/resources/bibles_resources.sqlite	1970-01-01 00:00:00 +0000 and openlp/plugins/bibles/resources/bibles_resources.sqlite	2011-04-02 20:44:17 +0000 differ
=== removed file 'openlp/plugins/bibles/resources/bibleserver.csv'
--- openlp/plugins/bibles/resources/bibleserver.csv	2011-01-25 01:19:57 +0000
+++ openlp/plugins/bibles/resources/bibleserver.csv	1970-01-01 00:00:00 +0000
@@ -1,39 +0,0 @@
-عربي, ARA
-Bible – překlad 21. století, B21
-Bible du Semeur, BDS
-Българската Библия, BLG
-Český ekumenický překlad, CEP
-Hrvatski, CRO
-Священное Писание, CRS
-Version La Biblia al Dia, CST
-中文和合本(简体), CUVS
-Bibelen på hverdagsdansk, DK
-Revidierte Elberfelder, ELB
-Einheitsübersetzung, EU
-Gute Nachricht Bibel, GNB
-Hoffnung für alle, HFA
-Hungarian, HUN
-Het Boek, HTB
-La Parola è Vita, ITA
-IBS-fordítás (Új Károli), KAR
-King James Version, KJV
-Luther 1984, LUT
-Septuaginta, LXX
-Neue Genfer Ãœbersetzung, NGU
-New International Readers Version, NIRV
-New International Version, NIV
-Neues Leben, NL
-En Levende Bok (NOR), NOR
-Nádej pre kazdého, NPK
-Noua traducere în limba românã, NTR
-Nueva Versión Internacional, NVI
-הברית הישנה, OT
-Słowo Życia, POL
-O Livro, PRT
-Новый перевод на русский язык, RUS
-Slovo na cestu, SNC
-Schlachter 2000, SLT
-En Levande Bok (SWE), SVL
-Today's New International Version, TNIV
-Türkçe, TR
-Biblia Vulgata, VUL

=== removed file 'openlp/plugins/bibles/resources/crosswalkbooks.csv'
--- openlp/plugins/bibles/resources/crosswalkbooks.csv	2010-12-17 22:10:29 +0000
+++ openlp/plugins/bibles/resources/crosswalkbooks.csv	1970-01-01 00:00:00 +0000
@@ -1,27 +0,0 @@
-New American Standard,nas
-American Standard Version,asv
-English Standard Version,esv
-New King James Version,nkj
-King James Version,kjv
-Holman Christian Standard Bible,csb
-Third Millennium Bible,tmb
-New International Version,niv
-New Living Translation,nlt
-New Revised Standard,nrs
-Revised Standard Version,rsv
-Good News Translation,gnt
-Douay-Rheims Bible,rhe
-The Message,msg
-The Complete Jewish Bible,cjb
-New Century Version,ncv
-GOD'S WORD Translation,gwd
-Hebrew Names Version,hnv
-World English Bible,web
-The Bible in Basic English,bbe
-Young's Literal Translation,ylt
-Today's New International Version,tnv
-New International Reader's Version,nrv
-The Darby Translation,dby
-The Webster Bible,wbt
-The Latin Vulgate,vul
-Weymouth New Testament,wnt

=== removed file 'openlp/plugins/bibles/resources/httpbooks.sqlite'
Binary files openlp/plugins/bibles/resources/httpbooks.sqlite	2011-01-22 17:35:02 +0000 and openlp/plugins/bibles/resources/httpbooks.sqlite	1970-01-01 00:00:00 +0000 differ
=== added file 'resources/forms/bibleimportrequestdialog.ui'
--- resources/forms/bibleimportrequestdialog.ui	1970-01-01 00:00:00 +0000
+++ resources/forms/bibleimportrequestdialog.ui	2011-04-02 20:44:17 +0000
@@ -0,0 +1,137 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>BibleImportRequest</class>
+ <widget class="QDialog" name="BibleImportRequest">
+  <property name="geometry">
+   <rect>
+    <x>0</x>
+    <y>0</y>
+    <width>400</width>
+    <height>175</height>
+   </rect>
+  </property>
+  <property name="sizePolicy">
+   <sizepolicy hsizetype="Preferred" vsizetype="MinimumExpanding">
+    <horstretch>0</horstretch>
+    <verstretch>0</verstretch>
+   </sizepolicy>
+  </property>
+  <property name="windowTitle">
+   <string>Dialog</string>
+  </property>
+  <widget class="QWidget" name="">
+   <property name="geometry">
+    <rect>
+     <x>10</x>
+     <y>15</y>
+     <width>381</width>
+     <height>151</height>
+    </rect>
+   </property>
+   <layout class="QVBoxLayout" name="verticalLayout">
+    <item>
+     <widget class="QLabel" name="HeadlineLabel">
+      <property name="font">
+       <font>
+        <family>Arial</family>
+        <pointsize>12</pointsize>
+        <weight>75</weight>
+        <bold>true</bold>
+       </font>
+      </property>
+      <property name="text">
+       <string>Choose Book:</string>
+      </property>
+     </widget>
+    </item>
+    <item>
+     <widget class="QLabel" name="InfoLabel">
+      <property name="text">
+       <string>The following books cannot be clearly attributed. 
+Please choose the book it is.</string>
+      </property>
+     </widget>
+    </item>
+    <item>
+     <layout class="QFormLayout" name="formLayout">
+      <item row="0" column="0">
+       <widget class="QLabel" name="RequestLabel">
+        <property name="text">
+         <string>Book:</string>
+        </property>
+       </widget>
+      </item>
+      <item row="0" column="1">
+       <widget class="QComboBox" name="RequestComboBox">
+        <property name="sizePolicy">
+         <sizepolicy hsizetype="Preferred" vsizetype="Fixed">
+          <horstretch>0</horstretch>
+          <verstretch>0</verstretch>
+         </sizepolicy>
+        </property>
+       </widget>
+      </item>
+     </layout>
+    </item>
+    <item>
+     <spacer name="verticalSpacer">
+      <property name="orientation">
+       <enum>Qt::Vertical</enum>
+      </property>
+      <property name="sizeHint" stdset="0">
+       <size>
+        <width>20</width>
+        <height>40</height>
+       </size>
+      </property>
+     </spacer>
+    </item>
+    <item>
+     <widget class="QDialogButtonBox" name="BibleImportRequestButtonBox">
+      <property name="orientation">
+       <enum>Qt::Horizontal</enum>
+      </property>
+      <property name="standardButtons">
+       <set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
+      </property>
+     </widget>
+    </item>
+   </layout>
+  </widget>
+ </widget>
+ <resources/>
+ <connections>
+  <connection>
+   <sender>BibleImportRequestButtonBox</sender>
+   <signal>accepted()</signal>
+   <receiver>BibleImportRequest</receiver>
+   <slot>accept()</slot>
+   <hints>
+    <hint type="sourcelabel">
+     <x>248</x>
+     <y>254</y>
+    </hint>
+    <hint type="destinationlabel">
+     <x>157</x>
+     <y>274</y>
+    </hint>
+   </hints>
+  </connection>
+  <connection>
+   <sender>BibleImportRequestButtonBox</sender>
+   <signal>rejected()</signal>
+   <receiver>BibleImportRequest</receiver>
+   <slot>reject()</slot>
+   <hints>
+    <hint type="sourcelabel">
+     <x>316</x>
+     <y>260</y>
+    </hint>
+    <hint type="destinationlabel">
+     <x>286</x>
+     <y>274</y>
+    </hint>
+   </hints>
+  </connection>
+ </connections>
+</ui>


Follow ups