diff options
Diffstat (limited to 'svtools/source/dialogs/addresstemplate.cxx')
-rw-r--r-- | svtools/source/dialogs/addresstemplate.cxx | 25 |
1 files changed, 18 insertions, 7 deletions
diff --git a/svtools/source/dialogs/addresstemplate.cxx b/svtools/source/dialogs/addresstemplate.cxx index ddb34d5d4fd2..14ede88482a6 100644 --- a/svtools/source/dialogs/addresstemplate.cxx +++ b/svtools/source/dialogs/addresstemplate.cxx @@ -97,6 +97,22 @@ namespace svt DECLARE_STL_VECTOR( String, StringArray ); DECLARE_STL_STDKEY_SET( ::rtl::OUString, StringBag ); DECLARE_STL_USTRINGACCESS_MAP( ::rtl::OUString, MapString2String ); + + namespace + { + String lcl_getSelectedDataSource( const ComboBox& _dataSourceCombo ) + { + String selectedDataSource = _dataSourceCombo.GetText(); + if ( _dataSourceCombo.GetEntryPos( selectedDataSource ) == LISTBOX_ENTRY_NOTFOUND ) + { + // none of the pre-selected entries -> assume a path to a database document + OFileNotation aFileNotation( selectedDataSource, OFileNotation::N_SYSTEM ); + selectedDataSource = aFileNotation.get( OFileNotation::N_URL ); + } + return selectedDataSource; + } + } + // =================================================================== // = IAssigmentData // =================================================================== @@ -857,9 +873,7 @@ public: Reference< XCompletedConnection > xDS; if ( m_pImpl->bWorkingPersistent ) { - String sSelectedDS = m_aDatasource.GetText(); - OFileNotation aFileNotation( sSelectedDS ,OFileNotation::N_SYSTEM); - sSelectedDS = aFileNotation.get(OFileNotation::N_URL); + String sSelectedDS = lcl_getSelectedDataSource( m_aDatasource ); // get the data source the user has chosen and let it build a connection INetURLObject aURL( sSelectedDS ); @@ -1179,9 +1193,7 @@ public: // ------------------------------------------------------------------- IMPL_LINK(AddressBookSourceDialog, OnOkClicked, Button*, EMPTYARG) { - String sSelectedDS = m_aDatasource.GetText(); - OFileNotation aFileNotation( sSelectedDS ,OFileNotation::N_SYSTEM); - sSelectedDS = aFileNotation.get(OFileNotation::N_URL); + String sSelectedDS = lcl_getSelectedDataSource( m_aDatasource ); if ( m_pImpl->bWorkingPersistent ) { m_pImpl->pConfigData->setDatasourceName(sSelectedDS); @@ -1231,7 +1243,6 @@ public: Reference<XPropertySet> xProp(xAdminDialog,UNO_QUERY); if ( xProp.is() ) { - String sOldDS = m_aDatasource.GetText(); ::rtl::OUString sName; xProp->getPropertyValue(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("DataSourceName"))) >>= sName; |