[Libreoffice-commits] core.git: sfx2/source

Akshay Deep akshaydeepiitr at gmail.com
Thu Jun 9 12:13:53 UTC 2016


 sfx2/source/doc/templatedlg.cxx |   61 ++++++++++++++++++++--------------------
 1 file changed, 31 insertions(+), 30 deletions(-)

New commits:
commit 0801e73583fb0b7015d857a481894565c29076a1
Author: Akshay Deep <akshaydeepiitr at gmail.com>
Date:   Wed Jun 8 06:35:35 2016 +0530

    Template Manager: Improve "Rename Category" functionality
    
    Change-Id: I0b32179133eca5cf01df6d581a25843da40a8a7e
    Reviewed-on: https://gerrit.libreoffice.org/26043
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Samuel Mehrbrodt <Samuel.Mehrbrodt at cib.de>

diff --git a/sfx2/source/doc/templatedlg.cxx b/sfx2/source/doc/templatedlg.cxx
index 9a6335a..77e78f0 100644
--- a/sfx2/source/doc/templatedlg.cxx
+++ b/sfx2/source/doc/templatedlg.cxx
@@ -377,6 +377,7 @@ void SfxTemplateManagerDlg::fillFolderComboBox()
             mpCBFolder->InsertEntry(aFolderNames[i], i+1);
     }
     mpCBFolder->SelectEntryPos(0);
+    mpActionMenu->HideItem(MNI_ACTION_RENAME_FOLDER);
     mpLocalView->ShowTooltips(true);
 }
 
@@ -386,6 +387,7 @@ void SfxTemplateManagerDlg::getApplicationSpecificSettings()
     {
         mpCBApp->SelectEntryPos(0);
         mpCBFolder->SelectEntryPos(0);
+        mpActionMenu->HideItem(MNI_ACTION_RENAME_FOLDER);
         mpCurView->filterItems(ViewFilter_Application(getCurrentApplicationFilter()));
         mpLocalView->showAllTemplates();
         return;
@@ -416,6 +418,7 @@ void SfxTemplateManagerDlg::getApplicationSpecificSettings()
 
     mpCurView->filterItems(ViewFilter_Application(getCurrentApplicationFilter()));
     mpCBFolder->SelectEntryPos(0);
+    mpActionMenu->HideItem(MNI_ACTION_RENAME_FOLDER);
     mpLocalView->showAllTemplates();
 }
 
@@ -460,6 +463,7 @@ void SfxTemplateManagerDlg::readSettings ()
     {
         //show all categories
         mpCBFolder->SelectEntryPos(0);
+        mpActionMenu->HideItem(MNI_ACTION_RENAME_FOLDER);
         mpLocalView->ShowTooltips(true);
         mpLocalView->showAllTemplates();
     }
@@ -467,6 +471,7 @@ void SfxTemplateManagerDlg::readSettings ()
     {
         mpCBFolder->SelectEntry(aLastFolder);
         mpLocalView->showRegion(aLastFolder);
+        mpActionMenu->ShowItem(MNI_ACTION_RENAME_FOLDER);
     }
 }
 
@@ -496,6 +501,7 @@ IMPL_LINK_NOARG_TYPED(SfxTemplateManagerDlg, SelectApplicationHdl, ListBox&, voi
         mpCurView->filterItems(ViewFilter_Application(getCurrentApplicationFilter()));
         mpCurView->showAllTemplates();
         mpCBFolder->SelectEntryPos(0);
+        mpActionMenu->HideItem(MNI_ACTION_RENAME_FOLDER);
         mpCurView->ShowTooltips(true);
     }
 
@@ -512,11 +518,13 @@ IMPL_LINK_NOARG_TYPED(SfxTemplateManagerDlg, SelectRegionHdl, ListBox&, void)
         {
             mpLocalView->showAllTemplates();
             mpLocalView->ShowTooltips(true);
+            mpActionMenu->HideItem(MNI_ACTION_RENAME_FOLDER);
         }
         else
         {
             mpLocalView->showRegion(sSelectedRegion);
             mpLocalView->ShowTooltips(false);
+            mpActionMenu->ShowItem(MNI_ACTION_RENAME_FOLDER);
         }
     }
 
@@ -732,6 +740,7 @@ IMPL_LINK_NOARG_TYPED(SfxTemplateManagerDlg, ImportClickHdl, Button*, void)
     mpLocalView->ShowTooltips(true);
     mpCBApp->SelectEntryPos(0);
     mpCBFolder->SelectEntryPos(0);
+    mpActionMenu->HideItem(MNI_ACTION_RENAME_FOLDER);
 }
 
 IMPL_STATIC_LINK_NOARG_TYPED(SfxTemplateManagerDlg, LinkClickHdl, Button*, void)
@@ -928,6 +937,7 @@ IMPL_LINK_NOARG_TYPED(SfxTemplateManagerDlg, SearchUpdateHdl, Edit&, void)
         {
             OUString sLastFolder = mpCBFolder->GetSelectEntry();
             mpLocalView->showRegion(sLastFolder);
+            mpActionMenu->ShowItem(MNI_ACTION_RENAME_FOLDER);
         }
     }
 }
@@ -1225,41 +1235,31 @@ void SfxTemplateManagerDlg::OnCategoryNew()
 
 void SfxTemplateManagerDlg::OnCategoryRename()
 {
-    ScopedVclPtrInstance< SfxTemplateCategoryDialog > aDlg;
-    aDlg->SetCategoryLBEntries(mpLocalView->getFolderNames());
-    aDlg->HideNewCategoryOption();
-    aDlg->SetText(SfxResId(STR_CATEGORY_RENAME).toString());
-    aDlg->SetSelectLabelText(SfxResId(STR_CATEGORY_SELECT).toString());
+    OUString sCategory = mpCBFolder->GetSelectEntry();
+    ScopedVclPtrInstance< InputDialog > dlg(SfxResId(STR_INPUT_NEW).toString(),this);
 
-    if(aDlg->Execute() == RET_OK)
-    {
-        OUString sCategory = aDlg->GetSelectedCategory();
-        ScopedVclPtrInstance< InputDialog > dlg(SfxResId(STR_INPUT_NEW).toString(),this);
+    dlg->SetEntryText(sCategory);
+    int ret = dlg->Execute();
 
-        dlg->SetEntryText(sCategory);
-        int ret = dlg->Execute();
+    if (ret)
+    {
+        OUString aName = dlg->GetEntryText();
 
-        if (ret)
+        if(mpLocalView->renameRegion(sCategory, aName))
         {
-            OUString aName = dlg->GetEntryText();
-
-            if(mpLocalView->renameRegion(sCategory, aName))
-            {
-                sal_Int32 nPos = mpCBFolder->GetEntryPos(sCategory);
-                mpCBFolder->RemoveEntry(nPos);
-                mpCBFolder->InsertEntry(aName, nPos);
+            sal_Int32 nPos = mpCBFolder->GetEntryPos(sCategory);
+            mpCBFolder->RemoveEntry(nPos);
+            mpCBFolder->InsertEntry(aName, nPos);
+            mpCBFolder->SelectEntryPos(nPos);
 
-                mpLocalView->reload();
-                mpLocalView->showAllTemplates();
-                mpLocalView->ShowTooltips(true);
-                mpCBApp->SelectEntryPos(0);
-                mpCBFolder->SelectEntryPos(0);
-            }
-            else
-            {
-                OUString aMsg( SfxResId(STR_CREATE_ERROR).toString() );
-                ScopedVclPtrInstance<MessageDialog>::Create(this, aMsg.replaceFirst("$1", aName))->Execute();
-            }
+            mpLocalView->reload();
+            mpLocalView->showRegion(aName);
+            mpLocalView->ShowTooltips(true);
+        }
+        else
+        {
+            OUString aMsg( SfxResId(STR_CREATE_ERROR).toString() );
+            ScopedVclPtrInstance<MessageDialog>::Create(this, aMsg.replaceFirst("$1", aName))->Execute();
         }
     }
 }
@@ -1300,6 +1300,7 @@ void SfxTemplateManagerDlg::OnCategoryDelete()
     mpLocalView->ShowTooltips(true);
     mpCBApp->SelectEntryPos(0);
     mpCBFolder->SelectEntryPos(0);
+    mpActionMenu->HideItem(MNI_ACTION_RENAME_FOLDER);
 }
 
 void SfxTemplateManagerDlg::createRepositoryMenu()


More information about the Libreoffice-commits mailing list