[Libreoffice-commits] core.git: include/svx svx/source svx/uiconfig

Tomaž Vajngerl tomaz.vajngerl at collabora.co.uk
Thu Nov 2 06:35:14 UTC 2017


 include/svx/ClassificationDialog.hxx       |    2 ++
 svx/source/dialog/ClassificationDialog.cxx |   18 ++++++++++++++----
 svx/uiconfig/ui/classificationdialog.ui    |    2 +-
 3 files changed, 17 insertions(+), 5 deletions(-)

New commits:
commit dc57c8ce3070b2a99ca312fbc349e6331b703ef7
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
Date:   Thu Nov 2 09:37:07 2017 +0900

    TSCP: hide markings widgets if the list of markings is empty
    
    Change-Id: I0d4a821935ef29b020409a34259a0c1fc487388f
    Reviewed-on: https://gerrit.libreoffice.org/44183
    Reviewed-by: Tomaž Vajngerl <quikee at gmail.com>
    Tested-by: Tomaž Vajngerl <quikee at gmail.com>

diff --git a/include/svx/ClassificationDialog.hxx b/include/svx/ClassificationDialog.hxx
index 36eab811d491..043272f68c03 100644
--- a/include/svx/ClassificationDialog.hxx
+++ b/include/svx/ClassificationDialog.hxx
@@ -15,6 +15,7 @@
 #include <vcl/dialog.hxx>
 #include <vcl/button.hxx>
 #include <vcl/lstbox.hxx>
+#include <vcl/fixed.hxx>
 #include <vcl/edit.hxx>
 #include <svx/svxdllapi.h>
 #include <svx/ClassificationEditView.hxx>
@@ -32,6 +33,7 @@ private:
     VclPtr<ListBox> m_pClassificationListBox;
     VclPtr<ListBox> m_pRecentlyUsedListBox;
     VclPtr<ListBox> m_pInternationalClassificationListBox;
+    VclPtr<FixedText> m_pMarkingLabel;
     VclPtr<ListBox> m_pMarkingListBox;
     VclPtr<ListBox> m_pIntellectualPropertyPartListBox;
     VclPtr<ListBox> m_pIntellectualPropertyPartNumberListBox;
diff --git a/svx/source/dialog/ClassificationDialog.cxx b/svx/source/dialog/ClassificationDialog.cxx
index 20dc952a47d1..df271dd1c5f2 100644
--- a/svx/source/dialog/ClassificationDialog.cxx
+++ b/svx/source/dialog/ClassificationDialog.cxx
@@ -131,6 +131,7 @@ ClassificationDialog::ClassificationDialog(vcl::Window* pParent, const bool bPer
     get(m_pRecentlyUsedListBox, "recentlyUsedCB");
     get(m_pClassificationListBox, "classificationCB");
     get(m_pInternationalClassificationListBox, "internationalClassificationCB");
+    get(m_pMarkingLabel, "markingLabel");
     get(m_pMarkingListBox, "markingCB");
     get(m_pIntellectualPropertyPartNumberListBox, "intellectualPropertyPartNumberCB");
     get(m_pIntellectualPropertyPartListBox, "intellectualPropertyPartLB");
@@ -153,10 +154,18 @@ ClassificationDialog::ClassificationDialog(vcl::Window* pParent, const bool bPer
         m_pInternationalClassificationListBox->InsertEntry(rName);
     m_pInternationalClassificationListBox->EnableAutoSize(true);
 
-    m_pMarkingListBox->SetSelectHdl(LINK(this, ClassificationDialog, SelectMarkingHdl));
-    for (const OUString& rName : maHelper.GetMarkings())
-        m_pMarkingListBox->InsertEntry(rName);
-    m_pMarkingListBox->EnableAutoSize(true);
+    if (!maHelper.GetMarkings().empty())
+    {
+        m_pMarkingListBox->SetSelectHdl(LINK(this, ClassificationDialog, SelectMarkingHdl));
+        for (const OUString& rName : maHelper.GetMarkings())
+            m_pMarkingListBox->InsertEntry(rName);
+        m_pMarkingListBox->EnableAutoSize(true);
+    }
+    else
+    {
+        m_pMarkingListBox->Show(false);
+        m_pMarkingLabel->Show(false);
+    }
 
     m_pIntellectualPropertyPartNumberListBox->SetSelectHdl(LINK(this, ClassificationDialog, SelectIPPartNumbersHdl));
     for (const OUString& rName : maHelper.GetIntellectualPropertyPartNumbers())
@@ -184,6 +193,7 @@ void ClassificationDialog::dispose()
     m_pRecentlyUsedListBox.clear();
     m_pClassificationListBox.clear();
     m_pInternationalClassificationListBox.clear();
+    m_pMarkingLabel.clear();
     m_pMarkingListBox.clear();
     m_pIntellectualPropertyPartListBox.clear();
     m_pIntellectualPropertyPartNumberListBox.clear();
diff --git a/svx/uiconfig/ui/classificationdialog.ui b/svx/uiconfig/ui/classificationdialog.ui
index e5a4788c3618..99d8bf88ad5a 100644
--- a/svx/uiconfig/ui/classificationdialog.ui
+++ b/svx/uiconfig/ui/classificationdialog.ui
@@ -163,7 +163,7 @@
                   </packing>
                 </child>
                 <child>
-                  <object class="GtkLabel">
+                  <object class="GtkLabel" id="markingLabel">
                     <property name="visible">True</property>
                     <property name="can_focus">False</property>
                     <property name="label" translatable="yes" context="classificationdialog|label-Marking">Marking:</property>


More information about the Libreoffice-commits mailing list