cui/source/customize/SvxNotebookbarConfigPage.cxx | 24 ++++++---------------- cui/source/customize/cfg.cxx | 3 ++ cui/source/inc/cfg.hxx | 4 +++ 3 files changed, 14 insertions(+), 17 deletions(-)
New commits: commit e4de3a1823f93090e12a192ebe60f786af2fa901 Author: Caolán McNamara <caol...@redhat.com> AuthorDate: Mon Nov 25 10:33:42 2019 +0000 Commit: Caolán McNamara <caol...@redhat.com> CommitDate: Tue Nov 26 09:55:23 2019 +0100 tdf#126043 cache the appname and filename Change-Id: I10987f8a447785eb0d9887f94ee0ffb0da99649a Reviewed-on: https://gerrit.libreoffice.org/83716 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caol...@redhat.com> Tested-by: Caolán McNamara <caol...@redhat.com> diff --git a/cui/source/customize/SvxNotebookbarConfigPage.cxx b/cui/source/customize/SvxNotebookbarConfigPage.cxx index cd654fa717c8..77ea904249f4 100644 --- a/cui/source/customize/SvxNotebookbarConfigPage.cxx +++ b/cui/source/customize/SvxNotebookbarConfigPage.cxx @@ -170,12 +170,10 @@ void SvxNotebookbarConfigPage::Init() m_xContentsListBox->clear(); m_xSaveInListBox->clear(); CustomNotebookbarGenerator::createCustomizedUIFile(); - OUString sAppName, sFileName; - CustomNotebookbarGenerator::getFileNameAndAppName(sAppName, sFileName); - OUString sNotebookbarInterface = getFileName(sFileName); + OUString sNotebookbarInterface = getFileName(m_sFileName); OUString sScopeName - = utl::ConfigManager::getProductName() + " " + sAppName + " - " + sNotebookbarInterface; + = utl::ConfigManager::getProductName() + " " + m_sAppName + " - " + sNotebookbarInterface; OUString sSaveInListBoxID = notebookbarTabScope; m_xSaveInListBox->append(sSaveInListBoxID, sScopeName); @@ -213,12 +211,10 @@ short SvxNotebookbarConfigPage::QueryReset() OUString sOriginalUIPath = CustomNotebookbarGenerator::getOriginalUIPath(); OUString sCustomizedUIPath = CustomNotebookbarGenerator::getCustomizedUIPath(); osl::File::copy(sOriginalUIPath, sCustomizedUIPath); - OUString sAppName, sFileName; - CustomNotebookbarGenerator::getFileNameAndAppName(sAppName, sFileName); - OUString sNotebookbarInterface = getFileName(sFileName); + OUString sNotebookbarInterface = getFileName(m_sFileName); Sequence<OUString> sSequenceEntries; CustomNotebookbarGenerator::setCustomizedUIItem(sSequenceEntries, sNotebookbarInterface); - OUString sUIPath = "modules/s" + sAppName.toAsciiLowerCase() + "/ui/"; + OUString sUIPath = "modules/s" + m_sAppName.toAsciiLowerCase() + "/ui/"; sfx2::SfxNotebookBar::ReloadNotebookBar(sUIPath); } return nValue; @@ -229,9 +225,6 @@ void SvxConfigPage::InsertEntryIntoNotebookbarTabUI(const OUString& sClassId, const OUString& sUIItemCommand, int nPos, int nStartCol) { - OUString sAppName, sFileName; - CustomNotebookbarGenerator::getFileNameAndAppName(sAppName, sFileName); - css::uno::Reference<css::container::XNameAccess> m_xCommandToLabelMap, m_xGlobalCommandToLabelMap; uno::Reference<uno::XComponentContext> xContext = ::comphelper::getProcessComponentContext(); @@ -241,7 +234,7 @@ void SvxConfigPage::InsertEntryIntoNotebookbarTabUI(const OUString& sClassId, uno::Sequence<beans::PropertyValue> aPropSeq, aGlobalPropSeq; xNameAccess->getByName("com.sun.star.text.GlobalDocument") >>= m_xGlobalCommandToLabelMap; - xNameAccess->getByName(getModuleId(sAppName)) >>= m_xCommandToLabelMap; + xNameAccess->getByName(getModuleId(m_sAppName)) >>= m_xCommandToLabelMap; try { @@ -557,10 +550,7 @@ static void EditRegistryFile(const OUString& sUIItemId, const OUString& sSetEntr void SvxNotebookbarEntriesListBox::ChangedVisibility(int nRow) { OUString sUIItemId = m_xControl->get_selected_id(); - OUString sAppName; - OUString sFileName; - CustomNotebookbarGenerator::getFileNameAndAppName(sAppName, sFileName); - OUString sNotebookbarInterface = getFileName(sFileName); + OUString sNotebookbarInterface = getFileName(m_pPage->GetFileName()); OUString sVisible; if (m_xControl->get_toggle(nRow, 0) == TRISTATE_TRUE) @@ -572,7 +562,7 @@ void SvxNotebookbarEntriesListBox::ChangedVisibility(int nRow) sSeqOfEntries[0] = sSetEntries; EditRegistryFile(sUIItemId, sSetEntries, sNotebookbarInterface); CustomNotebookbarGenerator::modifyCustomizedUIFile(sSeqOfEntries); - OUString sUIPath = "modules/s" + sAppName.toAsciiLowerCase() + "/ui/"; + OUString sUIPath = "modules/s" + m_pPage->GetAppName().toAsciiLowerCase() + "/ui/"; sfx2::SfxNotebookBar::ReloadNotebookBar(sUIPath); } diff --git a/cui/source/customize/cfg.cxx b/cui/source/customize/cfg.cxx index 0f0f6dc7b1f9..0d6f668610f6 100644 --- a/cui/source/customize/cfg.cxx +++ b/cui/source/customize/cfg.cxx @@ -48,6 +48,7 @@ #include <acccfg.hxx> #include <cfg.hxx> +#include <CustomNotebookbarGenerator.hxx> #include <SvxMenuConfigPage.hxx> #include <SvxToolbarConfigPage.hxx> #include <SvxNotebookbarConfigPage.hxx> @@ -992,6 +993,8 @@ SvxConfigPage::SvxConfigPage(weld::Container* pPage, weld::DialogController* pCo , m_xAddCommandButton(m_xBuilder->weld_button("add")) , m_xRemoveCommandButton(m_xBuilder->weld_button("remove")) { + CustomNotebookbarGenerator::getFileNameAndAppName(m_sAppName, m_sFileName); + m_xTopLevelListBox->connect_changed(LINK(this, SvxConfigPage, SelectElementHdl)); weld::TreeView& rTreeView = m_xFunctions->get_widget(); diff --git a/cui/source/inc/cfg.hxx b/cui/source/inc/cfg.hxx index 93f4346aa15f..0cd522354124 100644 --- a/cui/source/inc/cfg.hxx +++ b/cui/source/inc/cfg.hxx @@ -418,6 +418,8 @@ protected: std::unique_ptr<weld::Button> m_xAddCommandButton; std::unique_ptr<weld::Button> m_xRemoveCommandButton; + OUString m_sAppName; + OUString m_sFileName; SvxConfigPage(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet&); @@ -464,6 +466,8 @@ public: static bool CanConfig( const OUString& rModuleId ); SaveInData* GetSaveInData() { return pCurrentSaveInData; } + const OUString& GetAppName() const { return m_sAppName; } + const OUString& GetFileName() const { return m_sFileName; } int AddFunction(int nTarget, bool bAllowDuplicates); _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits