summaryrefslogtreecommitdiff
path: root/sfx2/source/control/templatelocalview.cxx
diff options
context:
space:
mode:
authorVert D <devoptmsoi@gmx.com>2021-05-24 23:01:38 -0500
committerCaolán McNamara <caolanm@redhat.com>2021-08-06 15:15:20 +0200
commit8d8450f0c14db26fb8eb44677c2887e619200904 (patch)
treee83ec7f515ac5d54ee24dc4394d7c17e3954f6f2 /sfx2/source/control/templatelocalview.cxx
parentb791974837a99ead793b4ead6760b2f4e5237de2 (diff)
tdf#139647 refresh renamed items
*Update templates names after rename (faster than reload). *Fix some warnings. Change-Id: I47387af91964afae8de8753289d49d19e6080863 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/119919 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'sfx2/source/control/templatelocalview.cxx')
-rw-r--r--sfx2/source/control/templatelocalview.cxx36
1 files changed, 35 insertions, 1 deletions
diff --git a/sfx2/source/control/templatelocalview.cxx b/sfx2/source/control/templatelocalview.cxx
index 0ba60c0d758b..4d0571eeaca1 100644
--- a/sfx2/source/control/templatelocalview.cxx
+++ b/sfx2/source/control/templatelocalview.cxx
@@ -613,7 +613,41 @@ bool TemplateLocalView::renameItem(ThumbnailViewItem* pItem, const OUString& sNe
nDocId = pDocItem->mnDocId;
}
- return mpDocTemplates->SetName( sNewTitle, nRegionId, nDocId );
+ bool bRes = mpDocTemplates->SetName( sNewTitle, nRegionId, nDocId );
+ if(bRes)
+ {
+ for (auto & pRegion : maRegions)
+ {
+ if (pRegion->mnId == nRegionId + 1 )
+ {
+ for(auto & aTemplate : pRegion->maTemplates)
+ {
+ if(aTemplate.nId == nDocId + 1)
+ {
+ aTemplate.aName = sNewTitle;
+ break;
+ }
+ }
+ break;
+ }
+ }
+ OUString sRegionName;
+ for (auto & aTemplate : maAllTemplates)
+ {
+ if (aTemplate.nRegionId == nRegionId && aTemplate.nDocId == nDocId)
+ {
+ aTemplate.aName = sNewTitle;
+ sRegionName = aTemplate.aRegionName;
+ break;
+ }
+ }
+
+ OUString sHelpText = SfxResId(STR_TEMPLATE_TOOLTIP);
+ sHelpText = (sHelpText.replaceFirst("$1", sNewTitle)).replaceFirst("$2", sRegionName);
+ pItem->setHelpText(sHelpText);
+ pItem->maTitle = sNewTitle;
+ }
+ return bRes;
}
void TemplateLocalView::insertItems(const std::vector<TemplateItemProperties> &rTemplates, bool isRegionSelected, bool bShowCategoryInTooltip)