Kaydet (Commit) 439db93b authored tarafından Rafael Dominguez's avatar Rafael Dominguez Kaydeden (comit) Bosdonnat Cedric

Fix deleting templates through Template Manager.

Change-Id: Ic59d3d666ae5f3808ef7dd7324589a731a841186
Reviewed-on: https://gerrit.libreoffice.org/3076Reviewed-by: 's avatarBosdonnat Cedric <cedric.bosdonnat@free.fr>
Tested-by: 's avatarBosdonnat Cedric <cedric.bosdonnat@free.fr>
üst 036c783b
...@@ -1088,30 +1088,19 @@ void SfxTemplateManagerDlg::OnTemplateDelete () ...@@ -1088,30 +1088,19 @@ void SfxTemplateManagerDlg::OnTemplateDelete ()
else else
{ {
sal_uInt16 nRegionItemId = maView->getCurRegionItemId(); sal_uInt16 nRegionItemId = maView->getCurRegionItemId();
std::set<const ThumbnailViewItem*,selection_cmp_fn> aSelTemplates = maSelTemplates; //Avoid invalid iterators
std::set<const ThumbnailViewItem*,selection_cmp_fn>::const_iterator pIter; std::set<const ThumbnailViewItem*,selection_cmp_fn>::const_iterator pIter;
for (pIter = maSelTemplates.begin(); pIter != maSelTemplates.end();) for (pIter = aSelTemplates.begin(); pIter != aSelTemplates.end(); ++pIter)
{ {
if (maView->removeTemplate((*pIter)->mnId,nRegionItemId)) if (!maView->removeTemplate((*pIter)->mnId,nRegionItemId))
maSelTemplates.erase(pIter++);
else
{ {
if (aTemplateList.isEmpty()) if (aTemplateList.isEmpty())
aTemplateList = (*pIter)->maTitle; aTemplateList = (*pIter)->maTitle;
else else
aTemplateList = aTemplateList + "\n" + (*pIter)->maTitle; aTemplateList = aTemplateList + "\n" + (*pIter)->maTitle;
++pIter;
} }
} }
if (maSelTemplates.empty())
{
mpTemplateBar->SetItemDown(TBI_TEMPLATE_DELETE,false);
mpTemplateBar->Show(false);
mpViewBar->Show();
mpActionBar->Show();
}
} }
if (!aTemplateList.isEmpty()) if (!aTemplateList.isEmpty())
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment