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

Jan Holesovsky kendy at collabora.com
Fri Feb 7 04:58:32 PST 2014


 sfx2/inc/templatedlg.hxx        |    2 -
 sfx2/source/doc/objserv.cxx     |    2 -
 sfx2/source/doc/templatedlg.cxx |   47 +++++++++++++++++++---------------------
 sfx2/uiconfig/ui/templatedlg.ui |    5 ----
 4 files changed, 25 insertions(+), 31 deletions(-)

New commits:
commit 4af737df9fb1746a34d461770b5ec8b09664aea1
Author: Jan Holesovsky <kendy at collabora.com>
Date:   Fri Feb 7 13:55:32 2014 +0100

    templatemanager: Fix empty dialog when saving templates.
    
    We used to call just mpTabControl->Clear() in setSaveMode(); but that worked
    only with .src dialogs, as the tab pages could have existed even without
    TabControl containing them.  This is not possible with .ui definitions any
    more (and rightly so!), so show just one tab here for now, until we do a
    bigger Template manager rework.
    
    Change-Id: I400dbcc326e883a1c1f526e94974162c3641f8ae

diff --git a/sfx2/source/doc/templatedlg.cxx b/sfx2/source/doc/templatedlg.cxx
index 1464b14..16b023f 100644
--- a/sfx2/source/doc/templatedlg.cxx
+++ b/sfx2/source/doc/templatedlg.cxx
@@ -320,7 +320,14 @@ void SfxTemplateManagerDlg::setSaveMode()
 {
     mbIsSaveMode = true;
 
-    mpTabControl->Clear();
+    // FIXME We used to call just mpTabControl->Clear() here; but that worked
+    // only with .src dialogs, as the tab pages could have existed even
+    // without TabControl containing them.  This is not possible with .ui
+    // definitions any more (and rightly so!), so leave just one tab here for
+    // now, until we do a bigger Template manager rework.
+    while (mpTabControl->GetPageCount() > 1)
+        mpTabControl->RemovePage(mpTabControl->GetPageId(1));
+
     mpCurView->filterItems(ViewFilter_Application(FILTER_APP_NONE));
 
     mpViewBar->ShowItem(VIEWBAR_SAVE);
commit 014c5761e2132ba65138f86f0fe0b42d4b858c26
Author: Jan Holesovsky <kendy at collabora.com>
Date:   Fri Feb 7 13:36:51 2014 +0100

    templatemanager: Nobody calls setSaveMode(false).
    
    Change-Id: Ia1844523c3ed5544b4e250c7607d2148f1c4d3cd

diff --git a/sfx2/inc/templatedlg.hxx b/sfx2/inc/templatedlg.hxx
index d160053..8428590 100644
--- a/sfx2/inc/templatedlg.hxx
+++ b/sfx2/inc/templatedlg.hxx
@@ -49,7 +49,7 @@ public:
 
     ~SfxTemplateManagerDlg ();
 
-    void setSaveMode (bool bMode);
+    void setSaveMode();
 
     void setDocumentModel (const com::sun::star::uno::Reference<com::sun::star::frame::XModel> &rModel);
 
diff --git a/sfx2/source/doc/objserv.cxx b/sfx2/source/doc/objserv.cxx
index 988fc98..3aa0e93 100644
--- a/sfx2/source/doc/objserv.cxx
+++ b/sfx2/source/doc/objserv.cxx
@@ -881,7 +881,7 @@ void SfxObjectShell::ExecFile_Impl(SfxRequest &rReq)
             // save as document templates
             SfxTemplateManagerDlg aDlg;
             aDlg.setDocumentModel(GetModel());
-            aDlg.setSaveMode(true);
+            aDlg.setSaveMode();
             aDlg.Execute();
 
             break;
diff --git a/sfx2/source/doc/templatedlg.cxx b/sfx2/source/doc/templatedlg.cxx
index 3020d57..1464b14 100644
--- a/sfx2/source/doc/templatedlg.cxx
+++ b/sfx2/source/doc/templatedlg.cxx
@@ -316,33 +316,25 @@ SfxTemplateManagerDlg::~SfxTemplateManagerDlg ()
     mpSearchView->setItemStateHdl(Link());
 }
 
-void SfxTemplateManagerDlg::setSaveMode(bool bMode)
+void SfxTemplateManagerDlg::setSaveMode()
 {
-    mbIsSaveMode = bMode;
+    mbIsSaveMode = true;
+
     mpTabControl->Clear();
     mpCurView->filterItems(ViewFilter_Application(FILTER_APP_NONE));
 
-    if (bMode)
-    {
-        mpViewBar->ShowItem(VIEWBAR_SAVE);
-        mpViewBar->HideItem(VIEWBAR_IMPORT);
-        mpViewBar->HideItem(VIEWBAR_REPOSITORY);
-
-        mpTemplateBar->ShowItem(TEMPLATEBAR_SAVE);
-        mpTemplateBar->ShowItem(TEMPLATEBAR_PROPERTIES);
-        mpTemplateBar->ShowItem(TEMPLATEBAR_DEFAULT);
-        mpTemplateBar->HideItem(TEMPLATEBAR_OPEN);
-        mpTemplateBar->HideItem(TEMPLATEBAR_EDIT);
-        mpTemplateBar->HideItem(TEMPLATEBAR_MOVE);
-        mpTemplateBar->HideItem(TEMPLATEBAR_EXPORT);
-        mpTemplateBar->HideItem(TEMPLATEBAR_DELETE);
-    }
-    else
-    {
-        mpViewBar->HideItem(VIEWBAR_SAVE);
-        mpViewBar->ShowItem(VIEWBAR_IMPORT);
-        mpViewBar->ShowItem(VIEWBAR_REPOSITORY);
-    }
+    mpViewBar->ShowItem(VIEWBAR_SAVE);
+    mpViewBar->HideItem(VIEWBAR_IMPORT);
+    mpViewBar->HideItem(VIEWBAR_REPOSITORY);
+
+    mpTemplateBar->ShowItem(TEMPLATEBAR_SAVE);
+    mpTemplateBar->ShowItem(TEMPLATEBAR_PROPERTIES);
+    mpTemplateBar->ShowItem(TEMPLATEBAR_DEFAULT);
+    mpTemplateBar->HideItem(TEMPLATEBAR_OPEN);
+    mpTemplateBar->HideItem(TEMPLATEBAR_EDIT);
+    mpTemplateBar->HideItem(TEMPLATEBAR_MOVE);
+    mpTemplateBar->HideItem(TEMPLATEBAR_EXPORT);
+    mpTemplateBar->HideItem(TEMPLATEBAR_DELETE);
 }
 
 void SfxTemplateManagerDlg::setDocumentModel(const uno::Reference<frame::XModel> &rModel)
commit d05f9012572b6648f2be44e80686cc2573dd81f2
Author: Jan Holesovsky <kendy at collabora.com>
Date:   Fri Feb 7 13:36:10 2014 +0100

    templatemanager: Some items were hidden by default.
    
    Change-Id: Iec847eb2af74442d083153c5e1f307ed32497377

diff --git a/sfx2/uiconfig/ui/templatedlg.ui b/sfx2/uiconfig/ui/templatedlg.ui
index 4dd7b8c..5104b66 100644
--- a/sfx2/uiconfig/ui/templatedlg.ui
+++ b/sfx2/uiconfig/ui/templatedlg.ui
@@ -54,7 +54,6 @@
                         </child>
                         <child>
                           <object class="GtkToolButton" id="import">
-                            <property name="visible">True</property>
                             <property name="can_focus">False</property>
                             <property name="action_name">import</property>
                             <property name="label" translatable="yes">Import</property>
@@ -68,7 +67,6 @@
                         </child>
                         <child>
                           <object class="GtkToolButton" id="delete">
-                            <property name="visible">True</property>
                             <property name="can_focus">False</property>
                             <property name="action_name">delete</property>
                             <property name="label" translatable="yes">Delete</property>
@@ -82,7 +80,6 @@
                         </child>
                         <child>
                           <object class="GtkToolButton" id="save">
-                            <property name="visible">True</property>
                             <property name="can_focus">False</property>
                             <property name="action_name">save</property>
                             <property name="label" translatable="yes">Save</property>
@@ -117,12 +114,10 @@
                     </child>
                     <child>
                       <object class="GtkToolbar" id="action_templates">
-                        <property name="visible">True</property>
                         <property name="can_focus">False</property>
                         <property name="hexpand">True</property>
                         <child>
                           <object class="GtkToolButton" id="template_save">
-                            <property name="visible">True</property>
                             <property name="can_focus">False</property>
                             <property name="action_name">template_save</property>
                             <property name="label" translatable="yes">Save</property>


More information about the Libreoffice-commits mailing list