diff options
Diffstat (limited to 'dbaccess/source/ui/dlg/dbfindex.cxx')
-rw-r--r-- | dbaccess/source/ui/dlg/dbfindex.cxx | 27 |
1 files changed, 12 insertions, 15 deletions
diff --git a/dbaccess/source/ui/dlg/dbfindex.cxx b/dbaccess/source/ui/dlg/dbfindex.cxx index 84635980b983..35db6e446ee4 100644 --- a/dbaccess/source/ui/dlg/dbfindex.cxx +++ b/dbaccess/source/ui/dlg/dbfindex.cxx @@ -29,6 +29,7 @@ #include <ucbhelper/content.hxx> #include <svl/filenotation.hxx> #include <rtl/strbuf.hxx> +#include <utility> namespace dbaui { @@ -36,12 +37,12 @@ using namespace ::com::sun::star::uno; using namespace ::com::sun::star::ucb; using namespace ::svt; -const OString aGroupIdent("dBase III"); +constexpr OString aGroupIdent("dBase III"_ostr); -ODbaseIndexDialog::ODbaseIndexDialog(weld::Window * pParent, const OUString& aDataSrcName) +ODbaseIndexDialog::ODbaseIndexDialog(weld::Window * pParent, OUString aDataSrcName) : GenericDialogController(pParent, "dbaccess/ui/dbaseindexdialog.ui", "DBaseIndexDialog") - , m_aDSN(aDataSrcName) + , m_aDSN(std::move(aDataSrcName)) , m_xPB_OK(m_xBuilder->weld_button("ok")) , m_xCB_Tables(m_xBuilder->weld_combo_box("table")) , m_xIndexes(m_xBuilder->weld_widget("frame")) @@ -116,7 +117,7 @@ void ODbaseIndexDialog::implInsertIndex(const OTableIndex& _rIndex, TableIndexLi _rDisplay.select(0); } -OTableIndex ODbaseIndexDialog::RemoveTableIndex( const OUString& _rTableName, const OUString& _rIndexName ) +OTableIndex ODbaseIndexDialog::RemoveTableIndex( std::u16string_view _rTableName, const OUString& _rIndexName ) { OTableIndex aReturn; @@ -130,7 +131,7 @@ OTableIndex ODbaseIndexDialog::RemoveTableIndex( const OUString& _rTableName, co return implRemoveIndex(_rIndexName, aTablePos->aIndexList, *m_xLB_TableIndexes, true/*_bMustExist*/); } -void ODbaseIndexDialog::InsertTableIndex( const OUString& _rTableName, const OTableIndex& _rIndex) +void ODbaseIndexDialog::InsertTableIndex( std::u16string_view _rTableName, const OTableIndex& _rIndex) { TableInfoList::iterator aTablePos = std::find_if(m_aTableInfoList.begin(), m_aTableInfoList.end(), [&] (const OTableInfo& arg) { return arg.aTableName == _rTableName; }); @@ -253,9 +254,6 @@ void ODbaseIndexDialog::Init() // first assume for all indexes they're free - OUString const aIndexExt("ndx"); - OUString const aTableExt("dbf"); - std::vector< OUString > aUsedIndexes; aURL.SetSmartProtocol(INetProtocol::File); @@ -266,17 +264,17 @@ void ODbaseIndexDialog::Init() osl::FileBase::getSystemPathFromFileURL(rURL,aName); aURL.SetSmartURL(aName); OUString aExt = aURL.getExtension(); - if (aExt == aIndexExt) + if (aExt == "ndx") { m_aFreeIndexList.emplace_back(aURL.getName() ); } - else if (aExt == aTableExt) + else if (aExt == "dbf") { m_aTableInfoList.emplace_back(aURL.getName() ); OTableInfo& rTabInfo = m_aTableInfoList.back(); // open the INF file - aURL.setExtension("inf"); + aURL.setExtension(u"inf"); OFileNotation aTransformer(aURL.GetURLNoPass(), OFileNotation::N_URL); Config aInfFile( aTransformer.get(OFileNotation::N_SYSTEM) ); aInfFile.SetGroup( aGroupIdent ); @@ -363,14 +361,13 @@ void OTableInfo::WriteInfFile( const OUString& rDSN ) const } aURL.SetSmartURL(aDsn); aURL.Append(aTableName); - aURL.setExtension("inf"); + aURL.setExtension(u"inf"); OFileNotation aTransformer(aURL.GetURLNoPass(), OFileNotation::N_URL); Config aInfFile( aTransformer.get(OFileNotation::N_SYSTEM) ); aInfFile.SetGroup( aGroupIdent ); // first, delete all table indices - OString aNDX; sal_uInt16 nKeyCnt = aInfFile.GetKeyCount(); sal_uInt16 nKey = 0; @@ -378,7 +375,7 @@ void OTableInfo::WriteInfFile( const OUString& rDSN ) const { // Does the key point to an index file?... OString aKeyName = aInfFile.GetKeyName( nKey ); - aNDX = aKeyName.copy(0,3); + OString aNDX = aKeyName.copy(0,3); //...if yes, delete index file, nKey is at subsequent key if (aNDX == "NDX") @@ -414,7 +411,7 @@ void OTableInfo::WriteInfFile( const OUString& rDSN ) const try { ::ucbhelper::Content aContent(aURL.GetURLNoPass(),Reference<XCommandEnvironment>(), comphelper::getProcessComponentContext()); - aContent.executeCommand( "delete", makeAny( true ) ); + aContent.executeCommand( "delete", Any( true ) ); } catch (const Exception& ) { |