[glom/glom-1-28] Box_Data_Details/FlowTableWithFields: Allow notebooks at the top-level.



commit 76deb35b1316c50fea92a9455d3c9586c29ff8ff
Author: Murray Cumming <murrayc murrayc com>
Date:   Thu Jan 28 22:36:47 2016 +0100

    Box_Data_Details/FlowTableWithFields: Allow notebooks at the top-level.
    
    And portals too. By not just assuming that the top-level groups
    are normal groups. They can be derived groups, such as notebooks.
    
    Bug #759511

 glom/mode_data/flowtablewithfields.cc |   30 ++++++++++++++++++++++++++----
 glom/mode_data/flowtablewithfields.h  |   17 +++++++++++++++--
 2 files changed, 41 insertions(+), 6 deletions(-)
---
diff --git a/glom/mode_data/flowtablewithfields.cc b/glom/mode_data/flowtablewithfields.cc
index bf65381..80c239d 100644
--- a/glom/mode_data/flowtablewithfields.cc
+++ b/glom/mode_data/flowtablewithfields.cc
@@ -113,10 +113,10 @@ void FlowTableWithFields::add_layout_item(const sharedptr<LayoutItem>& item)
   }
   else
   {
-    sharedptr<LayoutItem_Portal> portal = sharedptr<LayoutItem_Portal>::cast_dynamic(item);
-    if(portal)
+    sharedptr<LayoutGroup> group = sharedptr<LayoutGroup>::cast_dynamic(item);
+    if(group)
     {
-      add_layout_portal(portal);
+      add_layout_group_or_derived(group);
     }
     else
     {
@@ -153,7 +153,29 @@ void FlowTableWithFields::add_layout_item(const sharedptr<LayoutItem>& item)
   }
 }
 
-void FlowTableWithFields::add_layout_group(const sharedptr<LayoutGroup>& group, bool with_indent)
+void FlowTableWithFields::add_layout_group_or_derived(const sharedptr<LayoutGroup>& group, bool with_indent)
+{
+  auto portal = std::dynamic_pointer_cast<LayoutItem_Portal>(group);
+  if(portal)
+  {
+    add_layout_portal(portal);
+  }
+  else
+  {
+    auto notebook = std::dynamic_pointer_cast<LayoutItem_Notebook>(group);
+    if(notebook)
+    {
+      add_layout_notebook(notebook);
+    }
+    else
+    {
+      add_layout_group(group, with_indent);
+    }
+  }
+}
+          
+void FlowTableWithFields::add_layout_group(const std::shared_ptr<LayoutGroup>& group, bool with_indent)
+>>>>>>> 59a1b05... Box_Data_Details/FlowTableWithFields: Allow notebooks at the top-level.
 {
   if(!group)
     return;
diff --git a/glom/mode_data/flowtablewithfields.h b/glom/mode_data/flowtablewithfields.h
index 0ffd5e9..9a5e793 100644
--- a/glom/mode_data/flowtablewithfields.h
+++ b/glom/mode_data/flowtablewithfields.h
@@ -89,10 +89,10 @@ public:
 
   void add_layout_item(const sharedptr<LayoutItem>& item);
 
-  /**
+    /**
    * @param with_indent Pass true for top-level groups, to avoid wasting extra space with an unnecessary 
indent.
    */
-  void add_layout_group(const sharedptr<LayoutGroup>& group, bool with_indent = true);
+  void add_layout_group_or_derived(const std::shared_ptr<LayoutGroup>& group, bool with_indent = true);
 
   void set_field_editable(const sharedptr<const LayoutItem_Field>& field, bool editable = true);
 
@@ -252,8 +252,21 @@ private:
   void add_imageobject(const sharedptr<LayoutItem_Image>& layoutitem_image, const Glib::ustring& table_name);
 
   void add_layoutwidgetbase(LayoutWidgetBase* layout_widget);
+<<<<<<< HEAD
   void add_layout_notebook(const sharedptr<LayoutItem_Notebook>& notebook);
   void add_layout_portal(const sharedptr<LayoutItem_Portal>& portal);
+=======
+
+  /** Add a normal group, not a notebook or portal.
+   * See also add_layout_group_or_derived().
+   *
+   * @param with_indent Pass true for top-level groups, to avoid wasting extra space with an unnecessary 
indent.
+   */
+  void add_layout_group(const std::shared_ptr<LayoutGroup>& group, bool with_indent = true);
+
+  void add_layout_notebook(const std::shared_ptr<LayoutItem_Notebook>& notebook);
+  void add_layout_portal(const std::shared_ptr<LayoutItem_Portal>& portal);
+>>>>>>> 59a1b05... Box_Data_Details/FlowTableWithFields: Allow notebooks at the top-level.
 
 #ifndef GLOM_ENABLE_CLIENT_ONLY
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]