From e3cf16e6fbf8d39cad8762f002b6db1d4f61ed36 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sat, 4 May 2024 07:03:24 +0200 Subject: Merging upstream version 4:24.2.3. Signed-off-by: Daniel Baumann --- dbaccess/source/ui/dlg/DBSetupConnectionPages.cxx | 6 ++++- dbaccess/source/ui/dlg/dbwizsetup.cxx | 3 +++ dbaccess/source/ui/dlg/generalpage.cxx | 32 +++++++++++------------ 3 files changed, 23 insertions(+), 18 deletions(-) (limited to 'dbaccess/source/ui/dlg') diff --git a/dbaccess/source/ui/dlg/DBSetupConnectionPages.cxx b/dbaccess/source/ui/dlg/DBSetupConnectionPages.cxx index 22cdefdd6c..ad81680ba4 100644 --- a/dbaccess/source/ui/dlg/DBSetupConnectionPages.cxx +++ b/dbaccess/source/ui/dlg/DBSetupConnectionPages.cxx @@ -239,9 +239,13 @@ using namespace ::com::sun::star; if ( bHasMySQLNative ) m_xNATIVEDatabase->show(); - // if any of the options is checked, then there's nothing to do + // tdf#103068: if any of the options is checked, then just update the selected kind: + // it could happen that the selection and the wizard path are not in sync if ( m_xODBCDatabase->get_active() || m_xJDBCDatabase->get_active() || m_xNATIVEDatabase->get_active() ) + { + maClickHdl.Call(this); return; + } // prefer "native" or "JDBC" if ( bHasMySQLNative ) diff --git a/dbaccess/source/ui/dlg/dbwizsetup.cxx b/dbaccess/source/ui/dlg/dbwizsetup.cxx index 720892e2a0..2fb260e18e 100644 --- a/dbaccess/source/ui/dlg/dbwizsetup.cxx +++ b/dbaccess/source/ui/dlg/dbwizsetup.cxx @@ -312,6 +312,9 @@ void ODbTypeWizDialogSetup::activateDatabasePath() { OUString sOld = m_sURL; m_sURL = m_pGeneralPage->GetSelectedType(); + if (m_sURL.startsWith("sdbc:mysql:") && sOld.startsWith("sdbc:mysql:")) + m_sURL = sOld; // The type of MySQL connection was already set elsewhere; just use it, + // instead of the hardcoded one from the selector DataSourceInfoConverter::convert(getORB(), m_pCollection,sOld,m_sURL,m_pImpl->getCurrentDataSource()); ::dbaccess::DATASOURCE_TYPE eType = VerifyDataSourceType(m_pCollection->determineType(m_sURL)); if (eType == ::dbaccess::DST_UNKNOWN) diff --git a/dbaccess/source/ui/dlg/generalpage.cxx b/dbaccess/source/ui/dlg/generalpage.cxx index a2a48158c5..bb30884552 100644 --- a/dbaccess/source/ui/dlg/generalpage.cxx +++ b/dbaccess/source/ui/dlg/generalpage.cxx @@ -226,31 +226,29 @@ namespace dbaui OUString OGeneralPageWizard::getEmbeddedDBName( const SfxItemSet& _rSet ) { + if (!m_pCollection) + return {}; // first check whether or not the selection is invalid or readonly (invalid implies readonly, but not vice versa) bool bValid, bReadonly; getFlags( _rSet, bValid, bReadonly ); - - // if the selection is invalid, disable everything - - implSetCurrentType( OUString() ); + if (!bValid) + return {}; // compare the DSN prefix with the registered ones - OUString sDisplayName; - - if (m_pCollection && bValid) - { - implSetCurrentType( dbaccess::ODsnTypeCollection::getEmbeddedDatabase() ); - sDisplayName = m_pCollection->getTypeDisplayName( m_eCurrentSelection ); - onTypeSelected(m_eCurrentSelection); - } - - // select the correct datasource type - if ( dbaccess::ODsnTypeCollection::isEmbeddedDatabase( m_eCurrentSelection ) - && m_xEmbeddedDBType->find_text(sDisplayName) == -1 ) + OUString sDBURL; + if (const SfxStringItem* pUrlItem = _rSet.GetItem(DSID_CONNECTURL)) + if (dbaccess::ODsnTypeCollection::isEmbeddedDatabase(pUrlItem->GetValue())) + sDBURL = pUrlItem->GetValue(); + if (sDBURL.isEmpty()) + sDBURL = dbaccess::ODsnTypeCollection::getEmbeddedDatabase(); + OUString sDisplayName = m_pCollection->getTypeDisplayName(sDBURL); + + // ensure presence of the correct datasource type + if (!sDisplayName.isEmpty() && m_xEmbeddedDBType->find_text(sDisplayName) == -1) { // this indicates it's really a type which is known in general, but not supported on the current platform // show a message saying so // eSpecialMessage = smUnsupportedType; - insertEmbeddedDBTypeEntryData( m_eCurrentSelection, sDisplayName ); + insertEmbeddedDBTypeEntryData(sDBURL, sDisplayName); } return sDisplayName; -- cgit v1.2.3