dbaccess/source/ui/browser/unodatbr.cxx | 16 ++++++++-------- dbaccess/source/ui/control/opendoccontrols.cxx | 21 +++++---------------- dbaccess/source/ui/dlg/generalpage.cxx | 2 +- dbaccess/source/ui/inc/opendoccontrols.hxx | 5 +---- 4 files changed, 15 insertions(+), 29 deletions(-)
New commits: commit b4f2dbe6001109a61f009fc0df74f14071ac8645 Author: Noel Grandin <[email protected]> AuthorDate: Tue May 7 14:39:41 2024 +0200 Commit: Noel Grandin <[email protected]> CommitDate: Sat May 11 18:16:46 2024 +0200 replace createFromAscii with OUString literals in OpenDocumentButton Change-Id: I989f5f82fe65e0f877d86b7eb98ba8ad57147988 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167509 Tested-by: Jenkins Reviewed-by: Noel Grandin <[email protected]> diff --git a/dbaccess/source/ui/control/opendoccontrols.cxx b/dbaccess/source/ui/control/opendoccontrols.cxx index f8b9d6721ab6..bb2558afd435 100644 --- a/dbaccess/source/ui/control/opendoccontrols.cxx +++ b/dbaccess/source/ui/control/opendoccontrols.cxx @@ -52,12 +52,8 @@ namespace dbaui using ::com::sun::star::ui::XImageManager; using ::com::sun::star::graphic::XGraphic; - Reference< XGraphic> GetCommandIcon( const char* _pCommandURL, const OUString& _rModuleName ) + Reference< XGraphic> GetCommandIcon( const OUString& sCommandURL, const OUString& _rModuleName ) { - if ( !_pCommandURL || !*_pCommandURL ) - return nullptr; - - OUString sCommandURL = OUString::createFromAscii( _pCommandURL ); try { do @@ -94,24 +90,17 @@ namespace dbaui // OpenButton - OpenDocumentButton::OpenDocumentButton(std::unique_ptr<weld::Button> xControl, const char* _pAsciiModuleName) - : m_xControl(std::move(xControl)) + OpenDocumentButton::OpenDocumentButton(std::unique_ptr<weld::Button> xControl, const OUString& _rAsciiModuleName) + : m_sModule( _rAsciiModuleName ) + , m_xControl(std::move(xControl)) { - impl_init( _pAsciiModuleName ); - } - - void OpenDocumentButton::impl_init( const char* _pAsciiModuleName ) - { - OSL_ENSURE( _pAsciiModuleName, "OpenDocumentButton::impl_init: invalid module name!" ); - m_sModule = OUString::createFromAscii( _pAsciiModuleName ); - // our label should equal the UI text of the "Open" command auto aProperties = vcl::CommandInfoProvider::GetCommandProperties(u".uno:Open"_ustr, m_sModule); OUString sLabel(vcl::CommandInfoProvider::GetLabelForCommand(aProperties)); m_xControl->set_label(" " + sLabel.replaceAll("~", "")); // Place icon left of text and both centered in the button. - m_xControl->set_image(GetCommandIcon(".uno:Open", m_sModule)); + m_xControl->set_image(GetCommandIcon(u".uno:Open"_ustr, m_sModule)); } // OpenDocumentListBox diff --git a/dbaccess/source/ui/dlg/generalpage.cxx b/dbaccess/source/ui/dlg/generalpage.cxx index 03887054becb..bd87bb8a0f1b 100644 --- a/dbaccess/source/ui/dlg/generalpage.cxx +++ b/dbaccess/source/ui/dlg/generalpage.cxx @@ -453,7 +453,7 @@ namespace dbaui , m_xEmbeddedDBType(m_xBuilder->weld_combo_box(u"embeddeddbList"_ustr)) , m_xFT_DocListLabel(m_xBuilder->weld_label(u"docListLabel"_ustr)) , m_xLB_DocumentList(new OpenDocumentListBox(m_xBuilder->weld_combo_box(u"documentList"_ustr), "com.sun.star.sdb.OfficeDatabaseDocument")) - , m_xPB_OpenDatabase(new OpenDocumentButton(m_xBuilder->weld_button(u"openDatabase"_ustr), "com.sun.star.sdb.OfficeDatabaseDocument")) + , m_xPB_OpenDatabase(new OpenDocumentButton(m_xBuilder->weld_button(u"openDatabase"_ustr), u"com.sun.star.sdb.OfficeDatabaseDocument"_ustr)) , m_xFT_NoEmbeddedDBLabel(m_xBuilder->weld_label(u"noembeddeddbLabel"_ustr)) , m_eOriginalCreationMode(eCreateNew) , m_bInitEmbeddedDBList(true) diff --git a/dbaccess/source/ui/inc/opendoccontrols.hxx b/dbaccess/source/ui/inc/opendoccontrols.hxx index 8448a047dc7b..d0bfe63e8214 100644 --- a/dbaccess/source/ui/inc/opendoccontrols.hxx +++ b/dbaccess/source/ui/inc/opendoccontrols.hxx @@ -38,13 +38,10 @@ namespace dbaui std::unique_ptr<weld::Button> m_xControl; public: - OpenDocumentButton(std::unique_ptr<weld::Button> xControl, const char* _pAsciiModuleName); + OpenDocumentButton(std::unique_ptr<weld::Button> xControl, const OUString& _rAsciiModuleName); void set_sensitive(bool bSensitive) { m_xControl->set_sensitive(bSensitive); } void connect_clicked(const Link<weld::Button&, void>& rLink) { m_xControl->connect_clicked(rLink); } - - private: - void impl_init( const char* _pAsciiModuleName ); }; // OpenDocumentListBox commit 1ea8e12e50579c60ccc244fc8e3414026ad82c61 Author: Noel Grandin <[email protected]> AuthorDate: Tue May 7 14:36:09 2024 +0200 Commit: Noel Grandin <[email protected]> CommitDate: Sat May 11 18:16:32 2024 +0200 replace createFromAscii with OUString literals in SbaTableQueryBrowser Change-Id: Ic822faea02d1d598e7b5deb846a88ae59994535d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167508 Reviewed-by: Noel Grandin <[email protected]> Tested-by: Jenkins diff --git a/dbaccess/source/ui/browser/unodatbr.cxx b/dbaccess/source/ui/browser/unodatbr.cxx index 201033332880..cbebe4fff75c 100644 --- a/dbaccess/source/ui/browser/unodatbr.cxx +++ b/dbaccess/source/ui/browser/unodatbr.cxx @@ -1226,23 +1226,23 @@ void SbaTableQueryBrowser::connectExternalDispatches() if ( m_aExternalFeatures.empty() ) { - const char* pURLs[] = { - ".uno:DataSourceBrowser/DocumentDataSource", - ".uno:DataSourceBrowser/FormLetter", - ".uno:DataSourceBrowser/InsertColumns", - ".uno:DataSourceBrowser/InsertContent", + constexpr OUString aURLs[] { + u".uno:DataSourceBrowser/DocumentDataSource"_ustr, + u".uno:DataSourceBrowser/FormLetter"_ustr, + u".uno:DataSourceBrowser/InsertColumns"_ustr, + u".uno:DataSourceBrowser/InsertContent"_ustr, }; - const sal_uInt16 nIds[] = { + constexpr sal_uInt16 nIds[] = { ID_BROWSER_DOCUMENT_DATASOURCE, ID_BROWSER_FORMLETTER, ID_BROWSER_INSERTCOLUMNS, ID_BROWSER_INSERTCONTENT }; - for ( size_t i=0; i < std::size( pURLs ); ++i ) + for ( size_t i=0; i < std::size( aURLs ); ++i ) { URL aURL; - aURL.Complete = OUString::createFromAscii( pURLs[i] ); + aURL.Complete = aURLs[i]; if ( m_xUrlTransformer.is() ) m_xUrlTransformer->parseStrict( aURL ); m_aExternalFeatures[ nIds[ i ] ] = ExternalFeature( std::move(aURL) );
