[PATCH libreoffice-4-0] Display correct region name in error messages.

Rafael Dominguez (via Code Review) gerrit at gerrit.libreoffice.org
Tue Apr 9 12:46:56 PDT 2013


Hi,

I have submitted a patch for review:

    https://gerrit.libreoffice.org/3300

To pull it, you can do:

    git pull ssh://gerrit.libreoffice.org:29418/core refs/changes/00/3300/1

Display correct region name in error messages.

Change-Id: Icf4149272f67df6681bdad711362dd7d3802d04a
---
M sfx2/inc/sfx2/templatelocalview.hxx
M sfx2/source/control/templatelocalview.cxx
M sfx2/source/doc/templatedlg.cxx
3 files changed, 16 insertions(+), 3 deletions(-)



diff --git a/sfx2/inc/sfx2/templatelocalview.hxx b/sfx2/inc/sfx2/templatelocalview.hxx
index 2e7e400..09b69ce 100644
--- a/sfx2/inc/sfx2/templatelocalview.hxx
+++ b/sfx2/inc/sfx2/templatelocalview.hxx
@@ -50,6 +50,8 @@
 
     OUString getRegionName(const sal_uInt16 nRegionId) const;
 
+    OUString getRegionItemName(const sal_uInt16 nItemId) const;
+
     std::vector<OUString> getFolderNames ();
 
     std::vector<TemplateItemProperties>
diff --git a/sfx2/source/control/templatelocalview.cxx b/sfx2/source/control/templatelocalview.cxx
index a4437c3..884897c 100644
--- a/sfx2/source/control/templatelocalview.cxx
+++ b/sfx2/source/control/templatelocalview.cxx
@@ -194,6 +194,17 @@
     return mpDocTemplates->GetRegionName(nRegionId);
 }
 
+OUString TemplateLocalView::getRegionItemName(const sal_uInt16 nItemId) const
+{
+    for (size_t i = 0; i < maRegions.size(); ++i)
+    {
+        if (maRegions[i]->mnId == nItemId)
+            return maRegions[i]->maTitle;
+    }
+
+    return OUString();
+}
+
 std::vector<OUString> TemplateLocalView::getFolderNames()
 {
     size_t n = maRegions.size();
diff --git a/sfx2/source/doc/templatedlg.cxx b/sfx2/source/doc/templatedlg.cxx
index 948de70..6f78ebe 100644
--- a/sfx2/source/doc/templatedlg.cxx
+++ b/sfx2/source/doc/templatedlg.cxx
@@ -1467,7 +1467,7 @@
                     aTemplateList = aTemplateList + "\n" + (*pIter)->maTitle;
             }
 
-            OUString aDst = maView->GetItemText(nItemId);
+            OUString aDst = maView->getRegionItemName(nItemId);
             OUString aMsg(SfxResId(STR_MSG_ERROR_LOCAL_MOVE).toString());
             aMsg = aMsg.replaceFirst("$1",aDst);
             ErrorBox(this, WB_OK,aMsg.replaceFirst( "$2",aTemplateList)).Execute();
@@ -1523,7 +1523,7 @@
         {
             OUString aMsg(SfxResId(STR_MSG_ERROR_REMOTE_MOVE).toString());
             aMsg = aMsg.replaceFirst("$1",mpOnlineView->getCurRegionName());
-            aMsg = aMsg.replaceFirst("$2",maView->GetItemText(nItemId));
+            aMsg = aMsg.replaceFirst("$2",maView->getRegionItemName(nItemId));
             ErrorBox(this,WB_OK,aMsg.replaceFirst("$1",aTemplateList)).Execute();
         }
     }
@@ -1577,7 +1577,7 @@
 
         if (!aTemplateList.isEmpty())
         {
-            OUString aDst = maView->GetItemText(nItemId);
+            OUString aDst = maView->getRegionItemName(nItemId);
             OUString aMsg(SfxResId(STR_MSG_ERROR_LOCAL_MOVE).toString());
             aMsg = aMsg.replaceFirst("$1",aDst);
             ErrorBox(this, WB_OK,aMsg.replaceFirst( "$2",aTemplateList)).Execute();

-- 
To view, visit https://gerrit.libreoffice.org/3300
To unsubscribe, visit https://gerrit.libreoffice.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Icf4149272f67df6681bdad711362dd7d3802d04a
Gerrit-PatchSet: 1
Gerrit-Project: core
Gerrit-Branch: libreoffice-4-0
Gerrit-Owner: Rafael Dominguez <venccsralph at gmail.com>



More information about the LibreOffice mailing list