[glom] Box_Data_Portal: Only one init_db_details*() needs to be virtual.



commit 177d1fe8ea24007b4959b89e6f3f9bef38087fb6
Author: Murray Cumming <murrayc murrayc com>
Date:   Mon Mar 21 13:26:35 2016 +0100

    Box_Data_Portal: Only one init_db_details*() needs to be virtual.

 glom/mode_data/box_data_calendar_related.cc |    8 +-------
 glom/mode_data/box_data_calendar_related.h  |    7 +------
 glom/mode_data/box_data_list_related.cc     |    8 +-------
 glom/mode_data/box_data_list_related.h      |    7 +------
 glom/mode_data/box_data_portal.cc           |    2 +-
 glom/mode_data/box_data_portal.h            |    4 ++--
 glom/mode_data/flowtablewithfields.cc       |    4 ++--
 7 files changed, 9 insertions(+), 31 deletions(-)
---
diff --git a/glom/mode_data/box_data_calendar_related.cc b/glom/mode_data/box_data_calendar_related.cc
index 7766faa..48a4c05 100644
--- a/glom/mode_data/box_data_calendar_related.cc
+++ b/glom/mode_data/box_data_calendar_related.cc
@@ -72,13 +72,7 @@ void Box_Data_Calendar_Related::enable_buttons()
   //m_calendar.set_allow_view_details(view_details_possible); //Don't allow the user to go to a record in a 
hidden table.
 }
 
-bool Box_Data_Calendar_Related::init_db_details(const std::shared_ptr<const LayoutItem_Portal>& portal, bool 
show_title)
-{
-  //This calls the other method overload:
-  return Box_Data_Portal::init_db_details(portal, show_title);
-}
-
-bool Box_Data_Calendar_Related::init_db_details(const Glib::ustring& parent_table)
+bool Box_Data_Calendar_Related::init_db_details_without_portal(const Glib::ustring &parent_table)
 {
   //std::cout << "debug: " << G_STRFUNC << ": " << parent_table << std::endl;
 
diff --git a/glom/mode_data/box_data_calendar_related.h b/glom/mode_data/box_data_calendar_related.h
index 75eb555..b010281 100644
--- a/glom/mode_data/box_data_calendar_related.h
+++ b/glom/mode_data/box_data_calendar_related.h
@@ -40,14 +40,9 @@ public:
   Box_Data_Calendar_Related();
   virtual ~Box_Data_Calendar_Related();
 
-  /**
-   * @param portal: The full portal details
-   */
-  bool init_db_details(const std::shared_ptr<const LayoutItem_Portal>& portal, bool show_title = true) 
override;
-
   /** Use this if no portal is yet defined, so the user can use the context menu to define a portal.
    */
-  bool init_db_details(const Glib::ustring& parent_table) override;
+  bool init_db_details_without_portal(const Glib::ustring &parent_table) override;
 
 private:
   bool fill_from_database() override;
diff --git a/glom/mode_data/box_data_list_related.cc b/glom/mode_data/box_data_list_related.cc
index 7e14deb..2d74e01 100644
--- a/glom/mode_data/box_data_list_related.cc
+++ b/glom/mode_data/box_data_list_related.cc
@@ -71,13 +71,7 @@ void Box_Data_List_Related::enable_buttons()
   m_AddDel.set_allow_view_details(view_details_possible);
 }
 
-bool Box_Data_List_Related::init_db_details(const std::shared_ptr<const LayoutItem_Portal>& portal, bool 
show_title)
-{
-  //This calls the other method overload:
-  return Box_Data_Portal::init_db_details(portal, show_title);
-}
-
-bool Box_Data_List_Related::init_db_details(const Glib::ustring& parent_table)
+bool Box_Data_List_Related::init_db_details_without_portal(const Glib::ustring &parent_table)
 {
   set_parent_table(parent_table);
 
diff --git a/glom/mode_data/box_data_list_related.h b/glom/mode_data/box_data_list_related.h
index 212ac46..ee4fcc9 100644
--- a/glom/mode_data/box_data_list_related.h
+++ b/glom/mode_data/box_data_list_related.h
@@ -33,14 +33,9 @@ class Box_Data_List_Related : public Box_Data_Portal
 public:
   Box_Data_List_Related();
 
-  /**
-   * @param portal: The full portal details
-   */
-  bool init_db_details(const std::shared_ptr<const LayoutItem_Portal>& portal, bool show_title = true) 
override;
-
   /** Use this if no portal is yet defined, so the user can use the context menu to define a portal.
    */
-  bool init_db_details(const Glib::ustring& parent_table) override;
+  bool init_db_details_without_portal(const Glib::ustring &parent_table) override;
 
   void set_find_mode(bool val = true) override;
 
diff --git a/glom/mode_data/box_data_portal.cc b/glom/mode_data/box_data_portal.cc
index d59244a..e1b06f1 100644
--- a/glom/mode_data/box_data_portal.cc
+++ b/glom/mode_data/box_data_portal.cc
@@ -107,7 +107,7 @@ bool Box_Data_Portal::init_db_details(const std::shared_ptr<const LayoutItem_Por
   }
   show_title_in_ui(title);
 
-  return init_db_details(parent_table);
+  return init_db_details_without_portal(parent_table);
 }
 
 Glib::ustring Box_Data_Portal::get_title(const Glib::ustring& locale) const
diff --git a/glom/mode_data/box_data_portal.h b/glom/mode_data/box_data_portal.h
index ee03c07..17295fb 100644
--- a/glom/mode_data/box_data_portal.h
+++ b/glom/mode_data/box_data_portal.h
@@ -46,11 +46,11 @@ public:
   /**
    * @param portal: The full portal details
    */
-  virtual bool init_db_details(const std::shared_ptr<const LayoutItem_Portal>& portal, bool show_title = 
true);
+  bool init_db_details(const std::shared_ptr<const LayoutItem_Portal>& portal, bool show_title = true);
 
   /** Use this if no portal is yet defined, so the user can use the context menu to define a portal.
    */
-  virtual bool init_db_details(const Glib::ustring& parent_table) = 0;
+  virtual bool init_db_details_without_portal(const Glib::ustring& parent_table) = 0;
 
   /** Update a portal if a relevant value in its parent table has changed.
    *
diff --git a/glom/mode_data/flowtablewithfields.cc b/glom/mode_data/flowtablewithfields.cc
index 8b27a63..656baf6 100644
--- a/glom/mode_data/flowtablewithfields.cc
+++ b/glom/mode_data/flowtablewithfields.cc
@@ -268,7 +268,7 @@ Box_Data_List_Related* FlowTableWithFields::create_related(const std::shared_ptr
     if(portal && portal->get_has_relationship_name())
       portal_box->init_db_details(portal, show_title);
     else
-      portal_box->init_db_details(m_table_name);
+      portal_box->init_db_details_without_portal(m_table_name);
 
     Glib::ustring to_table;
     auto relationship = document->get_relationship(m_table_name, portal->get_relationship_name());
@@ -308,7 +308,7 @@ Box_Data_Calendar_Related* FlowTableWithFields::create_related_calendar(const st
     if(portal && portal->get_has_relationship_name())
       portal_box->init_db_details(portal, show_title);
     else
-      portal_box->init_db_details(m_table_name);
+      portal_box->init_db_details_without_portal(m_table_name);
 
     Glib::ustring to_table;
     auto relationship = document->get_relationship(m_table_name, portal->get_relationship_name());


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