summaryrefslogtreecommitdiff
path: root/dbaccess
diff options
context:
space:
mode:
authorTamas Bunth <tamas.bunth@collabora.co.uk>2018-04-23 22:05:55 +0200
committerTamás Bunth <btomi96@gmail.com>2018-05-05 11:10:07 +0200
commit1c5c9b84df270e41c68e68bb69fbf183fc20eed2 (patch)
tree10a9dd4f2888224dd776a8ed4703e5fd91f201e4 /dbaccess
parent60413c9800c27f53c1108015b50754b065bc98c6 (diff)
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>
Diffstat (limited to 'dbaccess')
-rw-r--r--dbaccess/Library_dba.mk1
-rw-r--r--dbaccess/Library_dbu.mk1
-rw-r--r--dbaccess/source/core/dataaccess/datasource.cxx22
-rw-r--r--dbaccess/source/core/dataaccess/datasource.hxx4
-rw-r--r--dbaccess/source/core/inc/migrwarndlg.hxx (renamed from dbaccess/source/ui/inc/migrwarndlg.hxx)2
-rw-r--r--dbaccess/source/core/misc/migrwarndlg.cxx (renamed from dbaccess/source/ui/dlg/migrwarndlg.cxx)2
-rw-r--r--dbaccess/source/ui/misc/datasourceconnector.cxx7
7 files changed, 18 insertions, 21 deletions
diff --git a/dbaccess/Library_dba.mk b/dbaccess/Library_dba.mk
index 52eae77d8d78..fe80f157887b 100644
--- a/dbaccess/Library_dba.mk
+++ b/dbaccess/Library_dba.mk
@@ -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 \
diff --git a/dbaccess/Library_dbu.mk b/dbaccess/Library_dbu.mk
index b8ff06ecbf7f..908c1cf9471f 100644
--- a/dbaccess/Library_dbu.mk
+++ b/dbaccess/Library_dbu.mk
@@ -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 \
diff --git a/dbaccess/source/core/dataaccess/datasource.cxx b/dbaccess/source/core/dataaccess/datasource.cxx
index 135d5964df25..19a91e6143c6 100644
--- a/dbaccess/source/core/dataaccess/datasource.cxx
+++ b/dbaccess/source/core/dataaccess/datasource.cxx
@@ -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";
diff --git a/dbaccess/source/core/dataaccess/datasource.hxx b/dbaccess/source/core/dataaccess/datasource.hxx
index faa7b9901221..815b662506fe 100644
--- a/dbaccess/source/core/dataaccess/datasource.hxx
+++ b/dbaccess/source/core/dataaccess/datasource.hxx
@@ -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;
diff --git a/dbaccess/source/ui/inc/migrwarndlg.hxx b/dbaccess/source/core/inc/migrwarndlg.hxx
index 25e31046ce57..3e0935bd732c 100644
--- a/dbaccess/source/ui/inc/migrwarndlg.hxx
+++ b/dbaccess/source/core/inc/migrwarndlg.hxx
@@ -11,7 +11,7 @@
#include <vcl/weld.hxx>
-namespace dbaui
+namespace dbaccess
{
class MigrationWarnDialog : public weld::MessageDialogController
{
diff --git a/dbaccess/source/ui/dlg/migrwarndlg.cxx b/dbaccess/source/core/misc/migrwarndlg.cxx
index ef3fa007303c..cbbe6e3ca90c 100644
--- a/dbaccess/source/ui/dlg/migrwarndlg.cxx
+++ b/dbaccess/source/core/misc/migrwarndlg.cxx
@@ -9,7 +9,7 @@
#include <migrwarndlg.hxx>
-namespace dbaui
+namespace dbaccess
{
MigrationWarnDialog::MigrationWarnDialog(weld::Window* pParent)
: MessageDialogController(pParent, "dbaccess/ui/migrwarndlg.ui", "MigrationWarnDialog")
diff --git a/dbaccess/source/ui/misc/datasourceconnector.cxx b/dbaccess/source/ui/misc/datasourceconnector.cxx
index 406575239f68..664e7bf20601 100644
--- a/dbaccess/source/ui/misc/datasourceconnector.cxx
+++ b/dbaccess/source/ui/misc/datasourceconnector.cxx
@@ -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