Refactor: migration warn dlg without modifying API
Use Migration warn dialog directly in library dba instead of popping up window in dbu and passing down the information through XDataSource. Change-Id: I6b8d2b55408a741662052d4af316b0c662d799f0 Reviewed-on: https://gerrit.libreoffice.org/53363 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Tamás Bunth <btomi96@gmail.com>
This commit is contained in:
@@ -117,6 +117,7 @@ $(eval $(call gb_Library_add_exception_objects,dba,\
|
||||
dbaccess/source/core/misc/DatabaseDataProvider \
|
||||
dbaccess/source/core/misc/dsntypes \
|
||||
dbaccess/source/core/misc/objectnameapproval \
|
||||
dbaccess/source/core/misc/migrwarndlg \
|
||||
dbaccess/source/core/misc/PropertyForward \
|
||||
dbaccess/source/core/misc/sdbcoretools \
|
||||
dbaccess/source/core/misc/services \
|
||||
|
||||
@@ -151,7 +151,6 @@ $(eval $(call gb_Library_add_exception_objects,dbu,\
|
||||
dbaccess/source/ui/dlg/textconnectionsettings \
|
||||
dbaccess/source/ui/dlg/UserAdmin \
|
||||
dbaccess/source/ui/dlg/UserAdminDlg \
|
||||
dbaccess/source/ui/dlg/migrwarndlg \
|
||||
dbaccess/source/ui/misc/asyncmodaldialog \
|
||||
dbaccess/source/ui/misc/charsets \
|
||||
dbaccess/source/ui/misc/controllerframe \
|
||||
|
||||
@@ -29,6 +29,7 @@
|
||||
#include <OAuthenticationContinuation.hxx>
|
||||
|
||||
#include <hsqlimport.hxx>
|
||||
#include <migrwarndlg.hxx>
|
||||
|
||||
#include <com/sun/star/beans/NamedValue.hpp>
|
||||
#include <com/sun/star/beans/PropertyAttribute.hpp>
|
||||
@@ -574,11 +575,6 @@ void ODatabaseSource::disposing()
|
||||
m_pImpl.clear();
|
||||
}
|
||||
|
||||
OUString SAL_CALL ODatabaseSource::getConnectionUrl()
|
||||
{
|
||||
return m_pImpl->m_sConnectURL;
|
||||
}
|
||||
|
||||
Reference< XConnection > ODatabaseSource::buildLowLevelConnection(const OUString& _rUid, const OUString& _rPwd)
|
||||
{
|
||||
Reference< XConnection > xReturn;
|
||||
@@ -588,8 +584,20 @@ Reference< XConnection > ODatabaseSource::buildLowLevelConnection(const OUString
|
||||
OUString sMigrEnvVal;
|
||||
osl_getEnvironment(OUString("DBACCESS_HSQL_MIGRATION").pData,
|
||||
&sMigrEnvVal.pData);
|
||||
bool bNeedMigration = m_pImpl->m_sConnectURL == "sdbc:embedded:hsqldb" &&
|
||||
(m_bMigationNeeded || !sMigrEnvVal.isEmpty());
|
||||
bool bNeedMigration = false;
|
||||
if(m_pImpl->m_sConnectURL == "sdbc:embedded:hsqldb")
|
||||
{
|
||||
OUString sSalUseVclplugin;
|
||||
osl_getEnvironment(OUString("SAL_USE_VCLPLUGIN").pData,
|
||||
&sSalUseVclplugin.pData);
|
||||
if(!sMigrEnvVal.isEmpty() || sSalUseVclplugin == "svp")
|
||||
bNeedMigration = true;
|
||||
else
|
||||
{
|
||||
MigrationWarnDialog aWarnDlg{nullptr};
|
||||
bNeedMigration = aWarnDlg.run() == RET_OK;
|
||||
}
|
||||
}
|
||||
if(bNeedMigration)
|
||||
m_pImpl->m_sConnectURL = "sdbc:embedded:firebird";
|
||||
|
||||
|
||||
@@ -83,7 +83,6 @@ private:
|
||||
using ODatabaseSource_Base::rBHelper;
|
||||
// note: this thing uses the ref-count of "this", see OBookmarkContainer::acquire!
|
||||
OBookmarkContainer m_Bookmarks;
|
||||
bool m_bMigationNeeded = false;
|
||||
::comphelper::OInterfaceContainerHelper2 m_aFlushListeners;
|
||||
|
||||
private:
|
||||
@@ -162,9 +161,6 @@ public:
|
||||
virtual css::uno::Reference< css::sdbc::XConnection > SAL_CALL getConnection( const OUString& user, const OUString& password ) override;
|
||||
virtual void SAL_CALL setLoginTimeout( sal_Int32 seconds ) override;
|
||||
virtual sal_Int32 SAL_CALL getLoginTimeout( ) override;
|
||||
virtual void SAL_CALL setMigrationNeeded( sal_Bool bNeeded ) override { m_bMigationNeeded = bNeeded; }
|
||||
virtual sal_Bool SAL_CALL getMigrationNeeded() override { return m_bMigationNeeded; }
|
||||
virtual OUString SAL_CALL getConnectionUrl() override;
|
||||
|
||||
//::css::sdb::XBookmarksSupplier
|
||||
virtual css::uno::Reference< css::container::XNameAccess > SAL_CALL getBookmarks( ) override;
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
|
||||
#include <vcl/weld.hxx>
|
||||
|
||||
namespace dbaui
|
||||
namespace dbaccess
|
||||
{
|
||||
class MigrationWarnDialog : public weld::MessageDialogController
|
||||
{
|
||||
@@ -9,7 +9,7 @@
|
||||
|
||||
#include <migrwarndlg.hxx>
|
||||
|
||||
namespace dbaui
|
||||
namespace dbaccess
|
||||
{
|
||||
MigrationWarnDialog::MigrationWarnDialog(weld::Window* pParent)
|
||||
: MessageDialogController(pParent, "dbaccess/ui/migrwarndlg.ui", "MigrationWarnDialog")
|
||||
@@ -40,7 +40,6 @@
|
||||
#include <cppuhelper/exc_hlp.hxx>
|
||||
#include <strings.hrc>
|
||||
#include <strings.hxx>
|
||||
#include <migrwarndlg.hxx>
|
||||
|
||||
namespace dbaui
|
||||
{
|
||||
@@ -114,12 +113,6 @@ namespace dbaui
|
||||
DBG_UNHANDLED_EXCEPTION("dbaccess");
|
||||
}
|
||||
|
||||
if(_xDataSource->getConnectionUrl().startsWithIgnoreAsciiCase("sdbc:embedded:hsqldb"))
|
||||
{
|
||||
MigrationWarnDialog aWarnDlg{m_pErrorMessageParent->GetFrameWeld()};
|
||||
_xDataSource->setMigrationNeeded(aWarnDlg.run() == RET_OK);
|
||||
}
|
||||
|
||||
// try to connect
|
||||
SQLExceptionInfo aInfo;
|
||||
try
|
||||
|
||||
@@ -34,11 +34,6 @@
|
||||
*/
|
||||
published interface XDataSource: com::sun::star::uno::XInterface
|
||||
{
|
||||
/** indicates whether database migration is needed or not.
|
||||
*/
|
||||
[attribute] boolean MigrationNeeded;
|
||||
|
||||
string getConnectionUrl();
|
||||
|
||||
/** attempts to establish a database connection.
|
||||
@param user
|
||||
|
||||
@@ -10212,8 +10212,6 @@ module com {
|
||||
};
|
||||
module sdbc {
|
||||
published interface XDataSource {
|
||||
[attribute] boolean MigrationNeeded;
|
||||
string getConnectionUrl();
|
||||
interface ::com::sun::star::uno::XInterface;
|
||||
::com::sun::star::sdbc::XConnection getConnection([in] string user, [in] string password) raises (::com::sun::star::sdbc::SQLException);
|
||||
void setLoginTimeout([in] long seconds) raises (::com::sun::star::sdbc::SQLException);
|
||||
|
||||
Reference in New Issue
Block a user