diff options
Diffstat (limited to 'dbaccess/source/ui/dlg/ConnectionHelper.cxx')
-rw-r--r-- | dbaccess/source/ui/dlg/ConnectionHelper.cxx | 67 |
1 files changed, 28 insertions, 39 deletions
diff --git a/dbaccess/source/ui/dlg/ConnectionHelper.cxx b/dbaccess/source/ui/dlg/ConnectionHelper.cxx index 16e4b51da212..ba0925d224ad 100644 --- a/dbaccess/source/ui/dlg/ConnectionHelper.cxx +++ b/dbaccess/source/ui/dlg/ConnectionHelper.cxx @@ -207,6 +207,7 @@ DBG_NAME(OConnectionHelper) m_pCollection = pCollectionItem->getCollection(); m_aPB_Connection.SetClickHdl(LINK(this, OConnectionHelper, OnBrowseConnections)); DBG_ASSERT(m_pCollection, "OConnectionHelper::OConnectionHelper : really need a DSN type collection !"); + m_aConnectionURL.SetTypeCollection(m_pCollection); } @@ -226,7 +227,7 @@ DBG_NAME(OConnectionHelper) m_aFT_Connection.Show(); m_aConnectionURL.Show(); - m_aConnectionURL.ShowPrefix( ::dbaccess::DST_JDBC == m_eType ); + m_aConnectionURL.ShowPrefix( ::dbaccess::DST_JDBC == m_pCollection->determineType(m_eType) ); BOOL bEnableBrowseButton = m_pCollection->supportsBrowsing( m_eType ); m_aPB_Connection.Show( bEnableBrowseButton ); @@ -253,21 +254,16 @@ DBG_NAME(OConnectionHelper) if ( !m_pAdminDialog ) return; - switch ( m_eType ) - { - case ::dbaccess::DST_CALC: + if ( m_pCollection->isFileSystemBased(m_eType) ) m_pAdminDialog->enableConfirmSettings( getURLNoPrefix().Len() > 0 ); - break; - default: - break; - } } // ----------------------------------------------------------------------- IMPL_LINK(OConnectionHelper, OnBrowseConnections, PushButton*, /*_pButton*/) { OSL_ENSURE(m_pAdminDialog,"No Admin dialog set! ->GPF"); - switch ( m_eType ) + const ::dbaccess::DATASOURCE_TYPE eType = m_pCollection->determineType(m_eType); + switch ( eType ) { case ::dbaccess::DST_DBASE: case ::dbaccess::DST_FLAT: @@ -324,15 +320,16 @@ DBG_NAME(OConnectionHelper) break; case ::dbaccess::DST_CALC: { + SvtModuleOptions aModule; ::sfx2::FileDialogHelper aFileDlg(WB_3DLOOK | WB_STDMODAL | WB_OPEN - ,SvtModuleOptions().GetFactoryEmptyDocumentURL(SvtModuleOptions::E_CALC) + ,aModule.GetFactoryEmptyDocumentURL(SvtModuleOptions::E_CALC) ,SFX_FILTER_IMPORT); askForFileName(aFileDlg); } break; case ::dbaccess::DST_MSACCESS: { - ::rtl::OUString sExt(RTL_CONSTASCII_USTRINGPARAM("*.mdb")); + const ::rtl::OUString sExt(RTL_CONSTASCII_USTRINGPARAM("*.mdb")); String sFilterName(ModuleRes (STR_MSACCESS_FILTERNAME)); ::sfx2::FileDialogHelper aFileDlg(WB_3DLOOK | WB_STDMODAL | WB_OPEN); aFileDlg.AddFilter(sFilterName,sExt); @@ -342,7 +339,7 @@ DBG_NAME(OConnectionHelper) break; case ::dbaccess::DST_MSACCESS_2007: { - ::rtl::OUString sAccdb(RTL_CONSTASCII_USTRINGPARAM("*.accdb")); + const ::rtl::OUString sAccdb(RTL_CONSTASCII_USTRINGPARAM("*.accdb")); String sFilterName2(ModuleRes (STR_MSACCESS_2007_FILTERNAME)); ::sfx2::FileDialogHelper aFileDlg(WB_3DLOOK | WB_STDMODAL | WB_OPEN); aFileDlg.AddFilter(sFilterName2,sAccdb); @@ -413,7 +410,7 @@ DBG_NAME(OConnectionHelper) aInstalledDBs = getInstalledAdabasDBs(sAdabasConfigDir,sAdabasWorkDir); } - ODatasourceSelectDialog aSelector(GetParent(), aInstalledDBs, m_eType,m_pItemSetHelper->getWriteOutputSet()); + ODatasourceSelectDialog aSelector(GetParent(), aInstalledDBs, true,m_pItemSetHelper->getWriteOutputSet()); if (RET_OK == aSelector.Execute()) { setURLNoPrefix(aSelector.GetSelected()); @@ -435,9 +432,9 @@ DBG_NAME(OConnectionHelper) case ::dbaccess::DST_ODBC: { // collect all ODBC data source names - ::rtl::OUString sCurrDatasource=getURLNoPrefix(); + ::rtl::OUString sCurrDatasource = getURLNoPrefix(); ::rtl::OUString sDataSource; - if ( getSelectedDataSource(m_eType,sDataSource,sCurrDatasource) && sDataSource.getLength() ) + if ( getSelectedDataSource(sDataSource,sCurrDatasource) && sDataSource.getLength() ) { setURLNoPrefix(sDataSource); SetRoadmapStateValue(sal_True); @@ -469,7 +466,7 @@ DBG_NAME(OConnectionHelper) case ::dbaccess::DST_THUNDERBIRD: { MozillaProductType profileType = MozillaProductType_Mozilla; - if (m_eType == ::dbaccess::DST_THUNDERBIRD) + if (eType == ::dbaccess::DST_THUNDERBIRD) profileType = MozillaProductType_Thunderbird; Reference<XMultiServiceFactory> xFactory = ::comphelper::getProcessServiceFactory(); @@ -496,7 +493,7 @@ DBG_NAME(OConnectionHelper) // excute the select dialog - ODatasourceSelectDialog aSelector(GetParent(), aProfiles, m_eType); + ODatasourceSelectDialog aSelector(GetParent(), aProfiles, eType); ::rtl::OUString sOldProfile=getURLNoPrefix(); if (sOldProfile.getLength()) @@ -539,7 +536,7 @@ DBG_NAME(OConnectionHelper) String sTypePrefix, sFileURLEncoded; if ( _bPrefix ) { - sTypePrefix = m_pCollection->getDatasourcePrefix( m_eType ); + sTypePrefix = m_pCollection->getPrefix( m_eType ); sFileURLEncoded = m_pCollection->cutPrefix( sURL ); } else @@ -585,7 +582,7 @@ DBG_NAME(OConnectionHelper) String sTypePrefix, sFileURLDecoded; if ( _bPrefix ) { - sTypePrefix = m_pCollection->getDatasourcePrefix( m_eType ); + sTypePrefix = m_pCollection->getPrefix( m_eType ); sFileURLDecoded = m_pCollection->cutPrefix( sURL ); } else @@ -770,10 +767,12 @@ DBG_NAME(OConnectionHelper) aConfigDBs = getInstalledAdabasDBDirs(sAdabasConfigDir,::ucbhelper::INCLUDE_DOCUMENTS_ONLY); aWrkDBs = getInstalledAdabasDBDirs(sAdabasWorkDir,::ucbhelper::INCLUDE_FOLDERS_ONLY); ConstStringBagIterator aOuter = aConfigDBs.begin(); - for(;aOuter != aConfigDBs.end();++aOuter) + ConstStringBagIterator aOuterEnd = aConfigDBs.end(); + for(;aOuter != aOuterEnd;++aOuter) { ConstStringBagIterator aInner = aWrkDBs.begin(); - for (;aInner != aWrkDBs.end(); ++aInner) + ConstStringBagIterator aInnerEnd = aWrkDBs.end(); + for (;aInner != aInnerEnd; ++aInner) { if (aInner->equalsIgnoreAsciiCase(*aOuter)) { @@ -811,11 +810,8 @@ DBG_NAME(OConnectionHelper) //------------------------------------------------------------------------- long OConnectionHelper::PreNotify( NotifyEvent& _rNEvt ) { - if ( ( ::dbaccess::DST_DBASE == m_eType) - || ( ::dbaccess::DST_FLAT == m_eType) - || ( ::dbaccess::DST_MSACCESS == m_eType) - || ( ::dbaccess::DST_MSACCESS_2007 == m_eType) - || ( ::dbaccess::DST_CALC == m_eType) ) + if ( m_pCollection->isFileSystemBased(m_eType) ) + { switch (_rNEvt.GetType()) { case EVENT_GETFOCUS: @@ -832,7 +828,8 @@ DBG_NAME(OConnectionHelper) return 1L; // handled } break; - } + } // switch (_rNEvt.GetType()) + } return OGenericAdministrationPage::PreNotify( _rNEvt ); } @@ -933,13 +930,7 @@ DBG_NAME(OConnectionHelper) sOldPath = m_aConnectionURL.GetSavedValueNoPrefix(); sURL = m_aConnectionURL.GetTextNoPrefix(); - switch ( m_eType ) - { - case ::dbaccess::DST_DBASE: - case ::dbaccess::DST_FLAT: - case ::dbaccess::DST_MSACCESS: - case ::dbaccess::DST_MSACCESS_2007: - case ::dbaccess::DST_CALC: + if ( m_pCollection->isFileSystemBased(m_eType) ) { if ( ( sURL != sOldPath ) && ( 0 != sURL.Len() ) ) { // the text changed since entering the control @@ -948,7 +939,9 @@ DBG_NAME(OConnectionHelper) OFileNotation aTransformer(sURL); sURL = aTransformer.get(OFileNotation::N_URL); - if ( ( ::dbaccess::DST_CALC == m_eType) || ( ::dbaccess::DST_MSACCESS == m_eType) || ( ::dbaccess::DST_MSACCESS_2007 == m_eType) ) + const ::dbaccess::DATASOURCE_TYPE eType = m_pCollection->determineType(m_eType); + + if ( ( ::dbaccess::DST_CALC == eType) || ( ::dbaccess::DST_MSACCESS == eType) || ( ::dbaccess::DST_MSACCESS_2007 == eType) ) { // #106016# -------------------------- if( pathExists(sURL, sal_True) == PATH_NOT_EXIST ) { @@ -978,10 +971,6 @@ DBG_NAME(OConnectionHelper) } } } - break; - default: - break; - } setURLNoPrefix(sURL); m_aConnectionURL.SaveValueNoPrefix(); |