[glom] Dialog_Layout_Details: Handle top-level notebooks.



commit 67748b1ee385a7c6b8bb33d6051e91105ad013d0
Author: Murray Cumming <murrayc murrayc com>
Date:   Thu Jan 28 23:16:53 2016 +0100

    Dialog_Layout_Details: Handle top-level notebooks.
    
    Instead of just assuming that all top-level groups are standard
    groups. They could be derived groups, such as notebooks.
    
    Bug #759511

 glom/mode_design/layout/dialog_layout_details.cc |   23 ++++++++++++++++-----
 1 files changed, 17 insertions(+), 6 deletions(-)
---
diff --git a/glom/mode_design/layout/dialog_layout_details.cc 
b/glom/mode_design/layout/dialog_layout_details.cc
index 36f514f..46e638c 100644
--- a/glom/mode_design/layout/dialog_layout_details.cc
+++ b/glom/mode_design/layout/dialog_layout_details.cc
@@ -1049,15 +1049,26 @@ void Dialog_Layout_Details::save_to_document()
     for(const auto& row : m_model_items->children())
     {
       std::shared_ptr<LayoutItem> layout_item = row[m_model_items->m_columns.m_col_layout_item];
+
+      //There may be top-level groups, but no top-level fields, because the fields must be in a group (so 
that they are in columns)
       auto layout_group = std::dynamic_pointer_cast<LayoutGroup>(layout_item);
-      auto layout_portal = std::dynamic_pointer_cast<LayoutItem_Portal>(layout_item);
-      if(layout_group && !layout_portal) //There may be top-level groups, but no top-level fields, because 
the fields must be in a group (so that they are in columns)
-      {
-        auto group = std::make_shared<LayoutGroup>();
-        fill_group(row, group);
+      if(!layout_group)
+        continue;
 
-        list_groups.push_back(group);
+      auto layout_portal = std::dynamic_pointer_cast<LayoutItem_Portal>(layout_item);
+      auto layout_notebook = std::dynamic_pointer_cast<LayoutItem_Notebook>(layout_item);
+      std::shared_ptr<LayoutGroup> group;
+      if(layout_portal) {
+        group = std::make_shared<LayoutItem_Portal>();
+      } else if(layout_notebook) {
+        group = std::make_shared<LayoutItem_Notebook>();
+      } else {
+        group = std::make_shared<LayoutGroup>();
       }
+
+      fill_group(row, group);
+
+      list_groups.push_back(group);
     }
 
     if(document)


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