[glom] libglom::LayoutItem_Portal: Added get_suitable_table_to_view_details().



commit 2f35ec1224ef15a2109687ccfca0dc74ff73017d
Author: Murray Cumming <murrayc murrayc com>
Date:   Tue Sep 27 12:49:32 2011 +0200

    libglom::LayoutItem_Portal: Added get_suitable_table_to_view_details().
    
    	* glom/base_db.[h|cc]: Move the get_portal_navigation_relationship_automatic()
    	and get_suitable_table_to_view_details() utility functions to:
    	* glom/libglom/data_structure/layout/layoutitem_portal.[h|cc]: Also
    	move other privately-used utility functions here too, from Base_DB.
    	* glom/mode_design/layout/dialog_layout_calendar_related.cc: update_ui():
    	* glom/mode_design/layout/dialog_layout_list_related.cc: update_ui():
    	* glom/mode_data/box_data_portal.cc:
      get_has_suitable_record_to_view_details(),
      get_has_suitable_record_to_view_details(): Adapted.

 ChangeLog                                          |   14 ++
 glom/base_db.cc                                    |  116 ------------
 glom/base_db.h                                     |    8 -
 .../data_structure/layout/layoutitem_portal.cc     |  187 ++++++++++++++++++++
 .../data_structure/layout/layoutitem_portal.h      |   20 ++
 glom/mode_data/box_data_portal.cc                  |   76 ++-------
 glom/mode_data/box_data_portal.h                   |    8 -
 .../layout/dialog_layout_calendar_related.cc       |    2 +-
 .../layout/dialog_layout_list_related.cc           |    2 +-
 9 files changed, 235 insertions(+), 198 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index e1119f9..d720d7f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,17 @@
+2011-09-27  Murray Cumming  <murrayc murrayc com>>
+
+  libglom::LayoutItem_Portal: Added get_suitable_table_to_view_details().
+
+	* glom/base_db.[h|cc]: Move the get_portal_navigation_relationship_automatic()
+	and get_suitable_table_to_view_details() utility functions to: 
+	* glom/libglom/data_structure/layout/layoutitem_portal.[h|cc]: Also
+	move other privately-used utility functions here too, from Base_DB.
+	* glom/mode_design/layout/dialog_layout_calendar_related.cc: update_ui():
+	* glom/mode_design/layout/dialog_layout_list_related.cc: update_ui():
+	* glom/mode_data/box_data_portal.cc: 
+  get_has_suitable_record_to_view_details(), 
+  get_has_suitable_record_to_view_details(): Adapted.
+
 2011-09-27  Murray Cumming  <murrayc murrayc com>
 
 	libglom::layout_field_should_have_navigation(): Return Relationship not bool.
diff --git a/glom/base_db.cc b/glom/base_db.cc
index 27c2a2b..1c44828 100644
--- a/glom/base_db.cc
+++ b/glom/base_db.cc
@@ -1634,122 +1634,6 @@ bool Base_DB::get_relationship_exists(const Glib::ustring& table_name, const Gli
   return false;
 }
 
-sharedptr<const LayoutItem_Field> Base_DB::get_field_is_from_non_hidden_related_record(const sharedptr<const LayoutItem_Portal>& portal) const
-{
-  //Find the first field that is from a non-hidden related table.
-  sharedptr<LayoutItem_Field> result;
-
-  if(!portal)
-    return result;
-
-  const Document* document = get_document();
-  if(!document)
-    return result;
-
-  const Glib::ustring parent_table_name = portal->get_table_used(Glib::ustring() /* parent table - not relevant */);
-
-  LayoutItem_Portal::type_list_const_items items = portal->get_items();
-  for(LayoutItem_Portal::type_list_const_items::const_iterator iter = items.begin(); iter != items.end(); ++iter)
-  {
-    sharedptr<const LayoutItem_Field> field = sharedptr<const LayoutItem_Field>::cast_dynamic(*iter);
-    if(field)
-    {
-      if(field->get_has_relationship_name())
-      {
-        const Glib::ustring table_name = field->get_table_used(parent_table_name);
-        if(!(document->get_table_is_hidden(table_name)))
-          return field;
-      }
-
-    }
-  }
-
-  return result;
-}
-
-sharedptr<const LayoutItem_Field> Base_DB::get_field_identifies_non_hidden_related_record(const sharedptr<const LayoutItem_Portal>& portal, sharedptr<const Relationship>& used_in_relationship) const
-{
-  //Find the first field that is from a non-hidden related table.
-  sharedptr<LayoutItem_Field> result;
-
-  const Document* document = get_document();
-  if(!document)
-    return result;
-
-  const Glib::ustring parent_table_name = portal->get_table_used(Glib::ustring() /* parent table - not relevant */);
-
-  LayoutItem_Portal::type_list_const_items items = portal->get_items();
-  for(LayoutItem_Portal::type_list_const_items::const_iterator iter = items.begin(); iter != items.end(); ++iter)
-  {
-    sharedptr<const LayoutItem_Field> field = sharedptr<const LayoutItem_Field>::cast_dynamic(*iter);
-    if(field && !(field->get_has_relationship_name()))
-    {
-      sharedptr<const Relationship> relationship = document->get_field_used_in_relationship_to_one(parent_table_name, field);
-      if(relationship)
-      {
-        const Glib::ustring table_name = relationship->get_to_table();
-        if(!(table_name.empty()))
-        {
-          if(!(document->get_table_is_hidden(table_name)))
-          {
-            used_in_relationship = relationship;
-            return field;
-          }
-        }
-      }
-    }
-  }
-
-  return result;
-}
-
-sharedptr<const UsesRelationship> Base_DB::get_portal_navigation_relationship_automatic(const sharedptr<LayoutItem_Portal>& portal) const
-{
-  const Document* document = get_document();
-
-  //If the related table is not hidden then we can just navigate to that:
-  const Glib::ustring direct_related_table_name = portal->get_table_used(Glib::ustring() /* parent table - not relevant */);
-  if(!(document->get_table_is_hidden(direct_related_table_name)))
-  {
-    //Non-hidden tables can just be shown directly. Navigate to it:
-    return sharedptr<UsesRelationship>();
-  }
-  else
-  {
-    //If the related table is hidden,
-    //then find a suitable related non-hidden table by finding the first layout field that mentions one:
-    sharedptr<const LayoutItem_Field> field = get_field_is_from_non_hidden_related_record(portal);
-    if(field)
-    {
-      return field; //Returns the UsesRelationship base part. (A relationship belonging to the portal's related table.)
-      //sharedptr<UsesRelationship> result = sharedptr<UsesRelationship>::create();
-      //result->set_relationship( portal->get_relationship() );
-      //result->set_related_relationship( field->get_relationship() );
-
-      //return result;
-    }
-    else
-    {
-      //Instead, find a key field that's used in a relationship,
-      //and pretend that we are showing the to field as a related field:
-      sharedptr<const Relationship> used_in_relationship;
-      sharedptr<const LayoutItem_Field> field_identifies = get_field_identifies_non_hidden_related_record(portal, used_in_relationship);
-      if(field_identifies)
-      {
-        sharedptr<UsesRelationship> result = sharedptr<UsesRelationship>::create();
-
-        sharedptr<Relationship> rel_nonconst = sharedptr<Relationship>::cast_const(used_in_relationship);
-        result->set_relationship(rel_nonconst);
-
-        return result;
-      }
-    }
-  }
-
-  //There was no suitable related table to show:
-  return sharedptr<UsesRelationship>();
-}
-
 bool Base_DB::get_primary_key_is_in_foundset(const FoundSet& found_set, const Gnome::Gda::Value& primary_key_value)
 {
   //TODO_Performance: This is probably called too often, when we should know that the key is in the found set.
diff --git a/glom/base_db.h b/glom/base_db.h
index cf945ab..796e338 100644
--- a/glom/base_db.h
+++ b/glom/base_db.h
@@ -303,14 +303,6 @@ protected:
   type_vecConstLayoutFields get_table_fields_to_show_for_sequence(const Glib::ustring& table_name, const Document::type_list_layout_groups& mapGroupSequence) const;
   void get_table_fields_to_show_for_sequence_add_group(const Glib::ustring& table_name, const Privileges& table_privs, const type_vec_fields& all_db_fields, const sharedptr<LayoutGroup>& group, type_vecConstLayoutFields& vecFields) const;
 
-  /** Get the relationship (from the related table) into which the row button should navigate,
-   * or none if it should use the portal's directly related table itself.
-   * (If that should be chosen automatically, by looking at the fields in the portal.)
-   */
-  sharedptr<const UsesRelationship> get_portal_navigation_relationship_automatic(const sharedptr<LayoutItem_Portal>& portal) const;
-  sharedptr<const LayoutItem_Field> get_field_is_from_non_hidden_related_record(const sharedptr<const LayoutItem_Portal>& portal) const;
-  sharedptr<const LayoutItem_Field> get_field_identifies_non_hidden_related_record(const sharedptr<const LayoutItem_Portal>& portal, sharedptr<const Relationship>& used_in_relationship) const;
-
   bool get_primary_key_is_in_foundset(const FoundSet& found_set, const Gnome::Gda::Value& primary_key_value);
 
 
diff --git a/glom/libglom/data_structure/layout/layoutitem_portal.cc b/glom/libglom/data_structure/layout/layoutitem_portal.cc
index 3b17492..5ebd442 100644
--- a/glom/libglom/data_structure/layout/layoutitem_portal.cc
+++ b/glom/libglom/data_structure/layout/layoutitem_portal.cc
@@ -19,6 +19,8 @@
  */
 
 #include <libglom/data_structure/layout/layoutitem_portal.h>
+#include <libglom/document/document.h> //For the utility functions.
+#include <iostream>
 #include <glibmm/i18n.h>
 
 namespace Glom
@@ -218,4 +220,189 @@ void LayoutItem_Portal::set_print_layout_line_color(const Glib::ustring& color)
   m_print_layout_line_color = color;
 }
 
+void LayoutItem_Portal::get_suitable_table_to_view_details(Glib::ustring& table_name, sharedptr<const UsesRelationship>& relationship, const Document* document) const
+{
+  //Initialize output parameters:
+  table_name = Glib::ustring();
+
+  sharedptr<const UsesRelationship> navigation_relationship;
+
+  //Check whether a relationship was specified:
+  if(get_navigation_type() == LayoutItem_Portal::NAVIGATION_AUTOMATIC)
+  {
+    //std::cout << "debug: decide automatically." << std::endl;
+    //Decide automatically:
+    navigation_relationship = get_portal_navigation_relationship_automatic(document);
+    //if(navigation_relationship && navigation_relationship->get_relationship())
+    //  std::cout << "  navigation_relationship->get_relationship()=" <<  navigation_relationship->get_relationship()->get_name() << std::endl;
+    //if(navigation_relationship && navigation_relationship->get_related_relationship())
+    //  std::cout << "  navigation_relationship->get_related_relationship()=" <<  navigation_relationship->get_related_relationship()->get_name() << std::endl;
+  }
+  else
+  {
+    navigation_relationship = get_navigation_relationship_specific();
+    //std::cout << "debug: " << G_STRFUNC << ": Using specific nav." << std::endl;
+  }
+
+
+  //Get the navigation table name from the chosen relationship:
+  const Glib::ustring directly_related_table_name = get_table_used(Glib::ustring() /* not relevant */);
+
+  // The navigation_table_name (and therefore, the table_name output parameter,
+  // as well) stays empty if the navrel type was set to none.
+  Glib::ustring navigation_table_name;
+  if(navigation_relationship)
+  {
+    navigation_table_name = navigation_relationship->get_table_used(directly_related_table_name);
+  }
+  else if(get_navigation_type() != LayoutItem_Portal::NAVIGATION_NONE)
+  {
+    //An empty result from get_portal_navigation_relationship_automatic() or 
+    //get_navigation_relationship_specific() means we should use the directly related table:
+    navigation_table_name = directly_related_table_name;
+  }
+
+  if(navigation_table_name.empty())
+  {
+    //std::cerr << G_STRFUNC << ": navigation_table_name is empty." << std::endl;
+    return;
+  }
+  
+  if(!document)
+  {
+    std::cerr << G_STRFUNC << ": document is null" << std::endl;
+    return;
+  }
+  
+  if(document->get_table_is_hidden(navigation_table_name))
+  {
+    std::cerr << G_STRFUNC << ": navigation_table_name indicates a hidden table: " << navigation_table_name << std::endl;
+    return;
+  }
+
+  table_name = navigation_table_name;
+  relationship = navigation_relationship;
+}
+
+sharedptr<const UsesRelationship> LayoutItem_Portal::get_portal_navigation_relationship_automatic(const Document* document) const
+{
+  if(!document)
+  {
+    std::cerr << G_STRFUNC << ": document was null" << std::endl;
+    return sharedptr<const UsesRelationship>();
+  }
+
+  //If the related table is not hidden then we can just navigate to that:
+  const Glib::ustring direct_related_table_name = get_table_used(Glib::ustring() /* parent table - not relevant */);
+  if(!(document->get_table_is_hidden(direct_related_table_name)))
+  {
+    //Non-hidden tables can just be shown directly. Navigate to it:
+    return sharedptr<const UsesRelationship>();
+  }
+  else
+  {
+    //If the related table is hidden,
+    //then find a suitable related non-hidden table by finding the first layout field that mentions one:
+    sharedptr<const LayoutItem_Field> field = get_field_is_from_non_hidden_related_record(document);
+    if(field)
+    {
+      return field; //Returns the UsesRelationship base part. (A relationship belonging to the portal's related table.)
+      //sharedptr<UsesRelationship> result = sharedptr<UsesRelationship>::create();
+      //result->set_relationship( get_relationship() );
+      //result->set_related_relationship( field->get_relationship() );
+
+      //return result;
+    }
+    else
+    {
+      //Instead, find a key field that's used in a relationship,
+      //and pretend that we are showing the to field as a related field:
+      sharedptr<const Relationship> used_in_relationship;
+      sharedptr<const LayoutItem_Field> field_identifies = get_field_identifies_non_hidden_related_record(used_in_relationship, document);
+      if(field_identifies)
+      {
+        sharedptr<UsesRelationship> result = sharedptr<UsesRelationship>::create();
+
+        sharedptr<Relationship> rel_nonconst = sharedptr<Relationship>::cast_const(used_in_relationship);
+        result->set_relationship(rel_nonconst);
+
+        return result;
+      }
+    }
+  }
+
+  //There was no suitable related table to show:
+  return sharedptr<const UsesRelationship>();
+}
+
+sharedptr<const LayoutItem_Field> LayoutItem_Portal::get_field_is_from_non_hidden_related_record(const Document* document) const
+{
+  //Find the first field that is from a non-hidden related table.
+  sharedptr<LayoutItem_Field> result;
+
+  if(!document)
+  {
+    std::cerr << G_STRFUNC << ": document is null" << std::endl;
+    return result;
+  }
+  
+  const Glib::ustring parent_table_name = get_table_used(Glib::ustring() /* parent table - not relevant */);
+
+  LayoutItem_Portal::type_list_const_items items = get_items();
+  for(LayoutItem_Portal::type_list_const_items::const_iterator iter = items.begin(); iter != items.end(); ++iter)
+  {
+    sharedptr<const LayoutItem_Field> field = sharedptr<const LayoutItem_Field>::cast_dynamic(*iter);
+    if(field)
+    {
+      if(field->get_has_relationship_name())
+      {
+        const Glib::ustring table_name = field->get_table_used(parent_table_name);
+        if(!(document->get_table_is_hidden(table_name)))
+          return field;
+      }
+
+    }
+  }
+
+  return result;
+}
+
+sharedptr<const LayoutItem_Field> LayoutItem_Portal::get_field_identifies_non_hidden_related_record(sharedptr<const Relationship>& used_in_relationship, const Document* document) const
+{
+  //Find the first field that is from a non-hidden related table.
+  sharedptr<LayoutItem_Field> result;
+
+  if(!document)
+  {
+    std::cerr << G_STRFUNC << ": document is null" << std::endl;
+    return result;
+  }
+
+  const Glib::ustring parent_table_name = get_table_used(Glib::ustring() /* parent table - not relevant */);
+
+  LayoutItem_Portal::type_list_const_items items = get_items();
+  for(LayoutItem_Portal::type_list_const_items::const_iterator iter = items.begin(); iter != items.end(); ++iter)
+  {
+    sharedptr<const LayoutItem_Field> field = sharedptr<const LayoutItem_Field>::cast_dynamic(*iter);
+    if(field && !(field->get_has_relationship_name()))
+    {
+      sharedptr<const Relationship> relationship = document->get_field_used_in_relationship_to_one(parent_table_name, field);
+      if(relationship)
+      {
+        const Glib::ustring table_name = relationship->get_to_table();
+        if(!(table_name.empty()))
+        {
+          if(!(document->get_table_is_hidden(table_name)))
+          {
+            used_in_relationship = relationship;
+            return field;
+          }
+        }
+      }
+    }
+  }
+
+  return result;
+}
+
 } //namespace Glom
diff --git a/glom/libglom/data_structure/layout/layoutitem_portal.h b/glom/libglom/data_structure/layout/layoutitem_portal.h
index b5ae9a4..b8cfef4 100644
--- a/glom/libglom/data_structure/layout/layoutitem_portal.h
+++ b/glom/libglom/data_structure/layout/layoutitem_portal.h
@@ -29,6 +29,8 @@
 namespace Glom
 {
 
+class Document; //For the utility functions.
+
 class LayoutItem_Portal
 : public LayoutGroup,
   public UsesRelationship
@@ -91,7 +93,21 @@ public:
    * activates a related record row.
    */
   void set_navigation_type(navigation_type type);
+  
+  /** Discover what table to show when clicking on a related record.
+   * This table will not necessarily just be the directly related table.
+   * The caller should check, in the document, that the returned @a table_name is not hidden.
+   *
+   * @param table_name The table that should be shown.
+   * @param relationship The relationship in the directly related table that should be used to get to that table. If this is empty then we should just show the table directly.
+   */
+  void get_suitable_table_to_view_details(Glib::ustring& table_name, sharedptr<const UsesRelationship>& relationship, const Document* document) const;
 
+  /** Get the relationship (from the related table) into which the row button should navigate,
+   * or none if it should use the portal's directly related table itself.
+   * (If that should be chosen automatically, by looking at the fields in the portal.)
+   */
+  sharedptr<const UsesRelationship> get_portal_navigation_relationship_automatic(const Document* document) const;
 
   /// This is used only for the print layouts.
   double get_print_layout_row_height() const;
@@ -129,6 +145,10 @@ public:
 
 private:
 
+  sharedptr<const LayoutItem_Field> get_field_is_from_non_hidden_related_record(const Document* document) const;
+  sharedptr<const LayoutItem_Field> get_field_identifies_non_hidden_related_record(sharedptr<const Relationship>& used_in_relationship, const Document* document) const;
+
+
   sharedptr<UsesRelationship> m_navigation_relationship_specific;
 
   // This is used only for the print layouts.
diff --git a/glom/mode_data/box_data_portal.cc b/glom/mode_data/box_data_portal.cc
index fd6d1c8..4be21db 100644
--- a/glom/mode_data/box_data_portal.cc
+++ b/glom/mode_data/box_data_portal.cc
@@ -268,88 +268,36 @@ void Box_Data_Portal::on_dialog_layout_hide()
 
 bool Box_Data_Portal::get_has_suitable_record_to_view_details() const
 {
+  if(!m_portal)
+    return false;
+
+  const Document* document = get_document();
+  if(!document)
+    return false;
+    
   Glib::ustring navigation_table_name;
   sharedptr<const UsesRelationship> navigation_relationship; //Ignored.
-  get_suitable_table_to_view_details(navigation_table_name, navigation_relationship);
+  m_portal->get_suitable_table_to_view_details(navigation_table_name, navigation_relationship, document);
 
   return !(navigation_table_name.empty());
 }
 
-void Box_Data_Portal::get_suitable_table_to_view_details(Glib::ustring& table_name, sharedptr<const UsesRelationship>& relationship) const
+void Box_Data_Portal::get_suitable_record_to_view_details(const Gnome::Gda::Value& primary_key_value, Glib::ustring& table_name, Gnome::Gda::Value& table_primary_key_value) const
 {
   //Initialize output parameters:
   table_name = Glib::ustring();
+  table_primary_key_value = Gnome::Gda::Value();
 
   if(!m_portal)
     return;
 
-
-  sharedptr<const UsesRelationship> navigation_relationship;
-
-  //Check whether a relationship was specified:
-  if(m_portal->get_navigation_type() == LayoutItem_Portal::NAVIGATION_AUTOMATIC)
-  {
-    //std::cout << "debug: decide automatically." << std::endl;
-    //Decide automatically:
-    navigation_relationship = get_portal_navigation_relationship_automatic(m_portal);
-    //if(navigation_relationship && navigation_relationship->get_relationship())
-    //  std::cout << "  navigation_relationship->get_relationship()=" <<  navigation_relationship->get_relationship()->get_name() << std::endl;
-    //if(navigation_relationship && navigation_relationship->get_related_relationship())
-    //  std::cout << "  navigation_relationship->get_related_relationship()=" <<  navigation_relationship->get_related_relationship()->get_name() << std::endl;
-  }
-  else
-  {
-    navigation_relationship = m_portal->get_navigation_relationship_specific();
-    //std::cout << "debug: " << G_STRFUNC << ": Using specific nav." << std::endl;
-  }
-
   const Document* document = get_document();
   if(!document)
     return;
-
-
-  //Get the navigation table name from the chosen relationship:
-  const Glib::ustring directly_related_table_name = m_portal->get_table_used(Glib::ustring() /* not relevant */);
-
-  // The navigation_table_name (and therefore, the table_name output parameter,
-  // as well) stays empty if the navrel type was set to none.
-  Glib::ustring navigation_table_name;
-  if(navigation_relationship)
-  {
-    navigation_table_name = navigation_relationship->get_table_used(directly_related_table_name);
-  }
-  else if(m_portal->get_navigation_type() != LayoutItem_Portal::NAVIGATION_NONE)
-  {
-    //An empty result from get_portal_navigation_relationship_automatic() or 
-    //get_navigation_relationship_specific() means we should use the directly related table:
-    navigation_table_name = directly_related_table_name;
-  }
-
-  if(navigation_table_name.empty())
-  {
-    //std::cerr << G_STRFUNC << ": navigation_table_name is empty." << std::endl;
-    return;
-  }
-
-  if(document->get_table_is_hidden(navigation_table_name))
-  {
-    std::cerr << G_STRFUNC << ": navigation_table_name indicates a hidden table: " << navigation_table_name << std::endl;
-    return;
-  }
-
-  table_name = navigation_table_name;
-  relationship = navigation_relationship;
-}
-
-void Box_Data_Portal::get_suitable_record_to_view_details(const Gnome::Gda::Value& primary_key_value, Glib::ustring& table_name, Gnome::Gda::Value& table_primary_key_value) const
-{
-  //Initialize output parameters:
-  table_name = Glib::ustring();
-  table_primary_key_value = Gnome::Gda::Value();
-
+    
   Glib::ustring navigation_table_name;
   sharedptr<const UsesRelationship> navigation_relationship;
-  get_suitable_table_to_view_details(navigation_table_name, navigation_relationship);
+  m_portal->get_suitable_table_to_view_details(navigation_table_name, navigation_relationship, document);
   
   //if(navigation_relationship && navigation_relationship->get_relationship())
   //  std::cout << "debug: navigation_relationship=" << navigation_relationship->get_relationship()->get_name() << std::endl;
diff --git a/glom/mode_data/box_data_portal.h b/glom/mode_data/box_data_portal.h
index 71e1aa1..65ce310 100644
--- a/glom/mode_data/box_data_portal.h
+++ b/glom/mode_data/box_data_portal.h
@@ -72,14 +72,6 @@ public:
     
   bool get_has_suitable_record_to_view_details() const;
 
-  /** Discover what table to show when clicking on a related record.
-   * This table will not necessarily just be the directly related table.
-   *
-   * @param table_name The table that should be shown.
-   * @param relationship The relationship in the directly related table that should be used to get to that table. If this is empty then we should just show the table directly.
-   */
-  void get_suitable_table_to_view_details(Glib::ustring& table_name, sharedptr<const UsesRelationship>& relationship) const;
-
   /** Discover what record to show, in what table, when clicking on a related record.
    * This record will not necessarily just be the directly related record.
    *
diff --git a/glom/mode_design/layout/dialog_layout_calendar_related.cc b/glom/mode_design/layout/dialog_layout_calendar_related.cc
index 0f3da7d..6695cbb 100644
--- a/glom/mode_design/layout/dialog_layout_calendar_related.cc
+++ b/glom/mode_design/layout/dialog_layout_calendar_related.cc
@@ -226,7 +226,7 @@ void Dialog_Layout_Calendar_Related::update_ui(bool including_relationship_list)
 
   //Describe the automatic navigation:
   sharedptr<const UsesRelationship> relationship_navigation_automatic
-    = get_portal_navigation_relationship_automatic(m_portal);
+    = m_portal->get_portal_navigation_relationship_automatic(document);
   Glib::ustring automatic_navigation_description = 
     m_portal->get_relationship_name_used(); //TODO: Use get_relationship_display_name() instead?
   if(relationship_navigation_automatic) //This is a relationship in the related table.
diff --git a/glom/mode_design/layout/dialog_layout_list_related.cc b/glom/mode_design/layout/dialog_layout_list_related.cc
index 502d2ee..f123f91 100644
--- a/glom/mode_design/layout/dialog_layout_list_related.cc
+++ b/glom/mode_design/layout/dialog_layout_list_related.cc
@@ -269,7 +269,7 @@ void Dialog_Layout_List_Related::update_ui(bool including_relationship_list)
 
   //Describe the automatic navigation:
   sharedptr<const UsesRelationship> relationship_navigation_automatic = 
-    get_portal_navigation_relationship_automatic(m_portal);
+    m_portal->get_portal_navigation_relationship_automatic(document);
   Glib::ustring automatic_navigation_description = 
     m_portal->get_relationship_name_used(); //TODO: Use get_relationship_display_name() instead?
   if(relationship_navigation_automatic) //This is a relationship in the related table.



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