diff options
author | Tamas Bunth <tamas.bunth@collabora.co.uk> | 2018-04-14 15:00:40 +0200 |
---|---|---|
committer | Tamás Bunth <btomi96@gmail.com> | 2018-04-14 21:14:50 +0200 |
commit | 5b0ceb86c342754d8f4e83408c7ae0da0e3931d3 (patch) | |
tree | ab4be91c5c2f9753e2ffec249f0b9c0ef0bf097a /dbaccess/source/ui | |
parent | f7d155e71dec5024f2d06dcf3697d1dcf505716a (diff) |
tdf#116944 Warn user before database migration
Warn user with a pop-up dialog before migration.
To do that we have to know the database URL at UI level. In order to get
that I updated XDataSource interface with getConnectionURL().
The dialog offers two options: proceed with or without migration. If the
user choose "yes", we store that information in XDataSource. The
migration itself will be made in buildLowConnection().
Change-Id: I1f0d03da6352f7a0a8d989da79c4b2fe60a03ca1
Reviewed-on: https://gerrit.libreoffice.org/52876
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Tamás Bunth <btomi96@gmail.com>
Diffstat (limited to 'dbaccess/source/ui')
-rw-r--r-- | dbaccess/source/ui/dlg/migrwarndlg.cxx | 22 | ||||
-rw-r--r-- | dbaccess/source/ui/inc/migrwarndlg.hxx | 29 | ||||
-rw-r--r-- | dbaccess/source/ui/misc/datasourceconnector.cxx | 7 |
3 files changed, 58 insertions, 0 deletions
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 |