summaryrefslogtreecommitdiff
path: root/dbaccess
diff options
context:
space:
mode:
Diffstat (limited to 'dbaccess')
-rw-r--r--dbaccess/Library_dbu.mk1
-rw-r--r--dbaccess/UIConfig_dbaccess.mk1
-rw-r--r--dbaccess/source/core/dataaccess/datasource.cxx14
-rw-r--r--dbaccess/source/core/dataaccess/datasource.hxx4
-rw-r--r--dbaccess/source/core/inc/warndlg.hxx29
-rw-r--r--dbaccess/source/core/misc/warndlg.cxx22
-rw-r--r--dbaccess/source/ui/dlg/migrwarndlg.cxx22
-rw-r--r--dbaccess/source/ui/inc/migrwarndlg.hxx29
-rw-r--r--dbaccess/source/ui/misc/datasourceconnector.cxx7
-rw-r--r--dbaccess/uiconfig/ui/migrwarndlg.ui73
10 files changed, 196 insertions, 6 deletions
diff --git a/dbaccess/Library_dbu.mk b/dbaccess/Library_dbu.mk
index 0ea52842317c..d1b5a53599bb 100644
--- a/dbaccess/Library_dbu.mk
+++ b/dbaccess/Library_dbu.mk
@@ -152,6 +152,7 @@ $(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/UIConfig_dbaccess.mk b/dbaccess/UIConfig_dbaccess.mk
index 4ac2e8a09935..eacb9eb112c2 100644
--- a/dbaccess/UIConfig_dbaccess.mk
+++ b/dbaccess/UIConfig_dbaccess.mk
@@ -80,6 +80,7 @@ $(eval $(call gb_UIConfig_add_uifiles,dbaccess, \
dbaccess/uiconfig/ui/useradmindialog \
dbaccess/uiconfig/ui/useradminpage \
dbaccess/uiconfig/ui/userdetailspage \
+ dbaccess/uiconfig/ui/migrwarndlg \
))
# vim: set noet sw=4 ts=4:
diff --git a/dbaccess/source/core/dataaccess/datasource.cxx b/dbaccess/source/core/dataaccess/datasource.cxx
index 9093cd622925..d06413fc59dd 100644
--- a/dbaccess/source/core/dataaccess/datasource.cxx
+++ b/dbaccess/source/core/dataaccess/datasource.cxx
@@ -575,22 +575,24 @@ 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;
Reference< XDriverManager > xManager;
- bool bNeedMigration = false;
OUString sMigrEnvVal;
osl_getEnvironment(OUString("DBACCESS_HSQL_MIGRATION").pData,
&sMigrEnvVal.pData);
- if( m_pImpl->m_sConnectURL == "sdbc:embedded:hsqldb" &&
- !sMigrEnvVal.isEmpty())
- {
+ bool bNeedMigration = m_pImpl->m_sConnectURL == "sdbc:embedded:hsqldb" &&
+ (m_bMigationNeeded || !sMigrEnvVal.isEmpty());
+ if(bNeedMigration)
m_pImpl->m_sConnectURL = "sdbc:embedded:firebird";
- bNeedMigration = true;
- }
try {
xManager.set( ConnectionPool::create( m_pImpl->m_aContext ), UNO_QUERY_THROW );
diff --git a/dbaccess/source/core/dataaccess/datasource.hxx b/dbaccess/source/core/dataaccess/datasource.hxx
index 14328e19c34f..a330cccd9625 100644
--- a/dbaccess/source/core/dataaccess/datasource.hxx
+++ b/dbaccess/source/core/dataaccess/datasource.hxx
@@ -84,6 +84,7 @@ 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,6 +163,9 @@ 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/core/inc/warndlg.hxx b/dbaccess/source/core/inc/warndlg.hxx
new file mode 100644
index 000000000000..54cfe88cb6a4
--- /dev/null
+++ b/dbaccess/source/core/inc/warndlg.hxx
@@ -0,0 +1,29 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+#ifndef INCLUDED_DBACCESS_SOURCE_CORE_INC_WARNDLG_HXX
+#define INCLUDED_DBACCESS_SOURCE_CORE_INC_WARNDLG_HXX
+
+#include <vcl/weld.hxx>
+
+namespace dbaccess
+{
+class MigrationWarnDialog : public weld::MessageDialogController
+{
+private:
+ std::unique_ptr<weld::Button> m_xOkBtn;
+ std::unique_ptr<weld::Button> m_xLaterBtn;
+
+public:
+ MigrationWarnDialog(weld::Window* pParent);
+};
+}
+
+#endif // INCLUDED_DBACCESS_SOURCE_CORE_INC_WARNDLG_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/core/misc/warndlg.cxx b/dbaccess/source/core/misc/warndlg.cxx
new file mode 100644
index 000000000000..e8446b6e7539
--- /dev/null
+++ b/dbaccess/source/core/misc/warndlg.cxx
@@ -0,0 +1,22 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#include <warndlg.hxx>
+
+namespace dbaccess
+{
+MigrationWarnDialog::MigrationWarnDialog(weld::Window* pParent)
+ : MessageDialogController(pParent, "TODOUIfile", "MigrationWarnDialog", "ask")
+ , m_xOkBtn(m_xBuilder->weld_button("yes"))
+ , m_xLaterBtn(m_xBuilder->weld_button("later"))
+{
+}
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/dlg/migrwarndlg.cxx b/dbaccess/source/ui/dlg/migrwarndlg.cxx
new file mode 100644
index 000000000000..9281dc11a941
--- /dev/null
+++ b/dbaccess/source/ui/dlg/migrwarndlg.cxx
@@ -0,0 +1,22 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#include <migrwarndlg.hxx>
+
+namespace dbaui
+{
+MigrationWarnDialog::MigrationWarnDialog(weld::Window* pParent)
+ : MessageDialogController(pParent, "dbaccess/ui/migrwarndlg.ui", "MigrationWarnDialog")
+ , m_xOkBtn(m_xBuilder->weld_button("yes"))
+ , m_xLaterBtn(m_xBuilder->weld_button("later"))
+{
+}
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/inc/migrwarndlg.hxx b/dbaccess/source/ui/inc/migrwarndlg.hxx
new file mode 100644
index 000000000000..7f18ad02f446
--- /dev/null
+++ b/dbaccess/source/ui/inc/migrwarndlg.hxx
@@ -0,0 +1,29 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+#ifndef INCLUDED_DBACCESS_SOURCE_CORE_INC_WARNDLG_HXX
+#define INCLUDED_DBACCESS_SOURCE_CORE_INC_WARNDLG_HXX
+
+#include <vcl/weld.hxx>
+
+namespace dbaui
+{
+class MigrationWarnDialog : public weld::MessageDialogController
+{
+private:
+ std::unique_ptr<weld::Button> m_xOkBtn;
+ std::unique_ptr<weld::Button> m_xLaterBtn;
+
+public:
+ MigrationWarnDialog(weld::Window* pParent);
+};
+}
+
+#endif // INCLUDED_DBACCESS_SOURCE_CORE_INC_WARNDLG_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/misc/datasourceconnector.cxx b/dbaccess/source/ui/misc/datasourceconnector.cxx
index 0496a4edded4..434f000d907f 100644
--- a/dbaccess/source/ui/misc/datasourceconnector.cxx
+++ b/dbaccess/source/ui/misc/datasourceconnector.cxx
@@ -41,6 +41,7 @@
#include <cppuhelper/exc_hlp.hxx>
#include <strings.hrc>
#include <strings.hxx>
+#include <migrwarndlg.hxx>
namespace dbaui
{
@@ -114,6 +115,12 @@ 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
diff --git a/dbaccess/uiconfig/ui/migrwarndlg.ui b/dbaccess/uiconfig/ui/migrwarndlg.ui
new file mode 100644
index 000000000000..8fa8e4934520
--- /dev/null
+++ b/dbaccess/uiconfig/ui/migrwarndlg.ui
@@ -0,0 +1,73 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- Generated with glade 3.20.2 -->
+<interface domain="sfx">
+ <requires lib="gtk+" version="3.18"/>
+ <object class="GtkMessageDialog" id="MigrationWarnDialog">
+ <property name="can_focus">False</property>
+ <property name="type_hint">dialog</property>
+ <property name="title" translatable="yes" context="migrationwarndialog|MigrationWarnDialog">Confirm Migration</property>
+ <property name="resizable">False</property>
+ <property name="modal">True</property>
+ <child internal-child="vbox">
+ <object class="GtkBox">
+ <property name="can_focus">False</property>
+ <property name="orientation">vertical</property>
+ <property name="spacing">2</property>
+ <child internal-child="action_area">
+ <object class="GtkButtonBox">
+ <property name="can_focus">False</property>
+ <property name="layout_style">end</property>
+ <child>
+ <object class="GtkButton" id="yes">
+ <property name="label" translatable="yes" context="migrationwarndialog|yes">yes</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ </object>
+ <packing>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkButton" id="later">
+ <property name="label" translatable="yes" context="migrationwarndialog|later">later</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ </object>
+ <packing>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label" translatable="yes" context="migrationwarndialog|dialogmessage">The document contains embedded HSQL data, which is deprecated.
+Would you like to migrate to Firebird now?</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </object>
+ </child>
+ <action-widgets>
+ <action-widget response="-5">yes</action-widget>
+ <action-widget response="-6">later</action-widget>
+ </action-widgets>
+ </object>
+</interface>