[glom] Find Mode: Do not show data in related records.



commit 4e412e0257666722c7d7a621747d0ec93e05f673
Author: Murray Cumming <murrayc murrayc com>
Date:   Sun Oct 2 22:34:32 2011 +0200

    Find Mode: Do not show data in related records.
    
    * glom/mode_data/box_data_portal.[h|cc]: Add a virtual set_find_mode().
    * glom/mode_data/box_data_list_related.h: Add a set_find_mode()
    override here which calls it on the DbAddDel.
    * glom/mode_data/db_adddel/db_adddel.h: Document the existing
    set_find_mode() more.
    * glom/mode_data/flowtablewithfields.[h|cc]: Add set_find_mode(), which
    calls it on all child portals and flowtables and calls it later when
    creating them.
    * glom/mode_find/box_data_details_find.cc: Call set_find_mode() on the
    FlowTable.
    This also affects the Find button next to ID fields.

 ChangeLog                               |   16 +++++++++++++++
 glom/mode_data/box_data_list_related.cc |    6 +++++
 glom/mode_data/box_data_list_related.h  |    2 +
 glom/mode_data/box_data_portal.cc       |    6 +++++
 glom/mode_data/box_data_portal.h        |   11 ++++++++++
 glom/mode_data/db_adddel/db_adddel.h    |    4 ++-
 glom/mode_data/flowtablewithfields.cc   |   33 +++++++++++++++++++++++++++++-
 glom/mode_data/flowtablewithfields.h    |   10 +++++++++
 glom/mode_find/box_data_details_find.cc |    3 ++
 9 files changed, 88 insertions(+), 3 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index e1dc2a5..862aaec 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,19 @@
+2011-10-02  Murray Cumming  <murrayc murrayc com>
+
+	Find Mode: Do not show data in related records.
+
+	* glom/mode_data/box_data_portal.[h|cc]: Add a virtual set_find_mode().
+	* glom/mode_data/box_data_list_related.h: Add a set_find_mode() 
+	override here which calls it on the DbAddDel.
+	* glom/mode_data/db_adddel/db_adddel.h: Document the existing 
+	set_find_mode() more.
+	* glom/mode_data/flowtablewithfields.[h|cc]: Add set_find_mode(), which 
+	calls it on all child portals and flowtables and calls it later when 
+	creating them.
+	* glom/mode_find/box_data_details_find.cc: Call set_find_mode() on the 
+	FlowTable.
+	This also affects the Find button next to ID fields.
+
 2011-09-30  Murray Cumming  <murrayc murrayc com>
 
 	Print Layout: Create Standard Layout: Support multiple pages.
diff --git a/glom/mode_data/box_data_list_related.cc b/glom/mode_data/box_data_list_related.cc
index 1b61f7a..22ad633 100644
--- a/glom/mode_data/box_data_list_related.cc
+++ b/glom/mode_data/box_data_list_related.cc
@@ -459,4 +459,10 @@ void Box_Data_List_Related::create_layout()
   m_FieldsShown = get_fields_to_show();
 }
 
+void Box_Data_List_Related::set_find_mode(bool val)
+{
+  Box_Data_Portal::set_find_mode(val);
+  m_AddDel.set_find_mode(val);
+}
+
 } //namespace Glom
diff --git a/glom/mode_data/box_data_list_related.h b/glom/mode_data/box_data_list_related.h
index f56e09d..ab30474 100644
--- a/glom/mode_data/box_data_list_related.h
+++ b/glom/mode_data/box_data_list_related.h
@@ -42,6 +42,8 @@ public:
    */
   virtual bool init_db_details(const Glib::ustring& parent_table, bool show_title = true);
 
+  virtual void set_find_mode(bool val = true);
+
 protected:
   virtual bool fill_from_database(); //Override.
 
diff --git a/glom/mode_data/box_data_portal.cc b/glom/mode_data/box_data_portal.cc
index 4be21db..2342ffd 100644
--- a/glom/mode_data/box_data_portal.cc
+++ b/glom/mode_data/box_data_portal.cc
@@ -33,6 +33,7 @@ namespace Glom
 {
 
 Box_Data_Portal::Box_Data_Portal()
+  : m_find_mode(false)
 {
   //m_Frame.set_label_widget(m_Label_Related);
   m_Frame.set_shadow_type(Gtk::SHADOW_NONE);
@@ -395,5 +396,10 @@ Box_Data_Portal::type_signal_portal_record_changed Box_Data_Portal::signal_porta
   return m_signal_portal_record_changed;
 }
 
+void Box_Data_Portal::set_find_mode(bool val)
+{
+  m_find_mode = val;
+}
+
 
 } //namespace Glom
diff --git a/glom/mode_data/box_data_portal.h b/glom/mode_data/box_data_portal.h
index 65ce310..a6fe47b 100644
--- a/glom/mode_data/box_data_portal.h
+++ b/glom/mode_data/box_data_portal.h
@@ -81,6 +81,15 @@ public:
    */
   void 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;
 
+  /** Prevent any attempts to change actual records,
+   * if the widget is just being used to enter find critera,
+   * and prevents any need for data retrieval from the database, because
+   * no data will be displayed.
+   *
+   * @param val True if find mode should be used.
+   */
+  virtual void set_find_mode(bool val = true);
+
 protected:
   virtual type_vecConstLayoutFields get_fields_to_show() const; //override
     
@@ -119,6 +128,8 @@ protected:
   // must match another field in the parent table.
   sharedptr<Field> m_key_field;
   Gnome::Gda::Value m_key_value;
+
+  bool m_find_mode;
     
   type_signal_portal_record_changed m_signal_portal_record_changed;
 };
diff --git a/glom/mode_data/db_adddel/db_adddel.h b/glom/mode_data/db_adddel/db_adddel.h
index 8d5eaf8..e4abb82 100644
--- a/glom/mode_data/db_adddel/db_adddel.h
+++ b/glom/mode_data/db_adddel/db_adddel.h
@@ -59,7 +59,9 @@ public:
   virtual void set_allow_delete(bool val = true);
 
   /** Prevent any attempts by this class to change actual records,
-   * if the widget is just being used to enter find critera.
+   * if the widget is just being used to enter find critera,
+   * and prevents any need for data retrieval from the database, because
+   * no data will be displayed.
    *
    * @param val True if find mode should be used.
    */
diff --git a/glom/mode_data/flowtablewithfields.cc b/glom/mode_data/flowtablewithfields.cc
index 3ffe17c..fbc0e47 100644
--- a/glom/mode_data/flowtablewithfields.cc
+++ b/glom/mode_data/flowtablewithfields.cc
@@ -54,7 +54,8 @@ FlowTableWithFields::Info::Info()
 FlowTableWithFields::FlowTableWithFields(const Glib::ustring& table_name)
 :
   m_placeholder(0),
-  m_table_name(table_name)
+  m_table_name(table_name),
+  m_find_mode(false)
 {
 }
 
@@ -190,6 +191,7 @@ void FlowTableWithFields::add_layout_group(const sharedptr<LayoutGroup>& group,
     frame->add(*alignment);
 
     FlowTableWithFields* flow_table = Gtk::manage( new FlowTableWithFields() );
+    flow_table->set_find_mode(m_find_mode);
     add_view(flow_table); //Allow these sub-flowtables to access the document too.
     flow_table->set_table(m_table_name);
 
@@ -247,6 +249,7 @@ Box_Data_List_Related* FlowTableWithFields::create_related(const sharedptr<Layou
   if(pDocument)
   {
     Box_Data_List_Related* portal_box = Gtk::manage(new Box_Data_List_Related);
+    portal_box->set_find_mode(m_find_mode);
     add_view(portal_box); //Give it access to the document, needed to get the layout and fields information.
 
     //Create the layout:
@@ -286,6 +289,7 @@ Box_Data_Calendar_Related* FlowTableWithFields::create_related_calendar(const sh
   if(pDocument)
   {
     Box_Data_Calendar_Related* portal_box = Gtk::manage(new Box_Data_Calendar_Related);
+    portal_box->set_find_mode(m_find_mode); //TODO: Implement this in the class
     add_view(portal_box); //Give it access to the document, needed to get the layout and fields information.
 
     //Create the layout:
@@ -380,6 +384,7 @@ void FlowTableWithFields::add_layout_notebook(const sharedptr<LayoutItem_Noteboo
 
         //Add a FlowTable for this group:
         FlowTableWithFields* flow_table = Gtk::manage( new FlowTableWithFields() );
+        flow_table->set_find_mode(m_find_mode);
         add_view(flow_table); //Allow these sub-flowtables to access the document too.
         flow_table->set_table(m_table_name);
 
@@ -811,7 +816,7 @@ FlowTableWithFields::type_portals FlowTableWithFields::get_portals(const sharedp
   const Glib::ustring from_key_name = from_key->get_name();
 
   //Check the single-item widgets:
-   for(type_portals::const_iterator iter = m_portals.begin(); iter != m_portals.end(); ++iter)
+  for(type_portals::const_iterator iter = m_portals.begin(); iter != m_portals.end(); ++iter)
   {
     //*iter is a FlowTableItem.
     Box_Data_Portal* pPortalUI = *iter;
@@ -1423,6 +1428,30 @@ sharedptr<LayoutItem_Portal> FlowTableWithFields::get_portal_relationship()
   return sharedptr<LayoutItem_Portal>();
 }
 
+void FlowTableWithFields::set_find_mode(bool val)
+{
+  m_find_mode = val;
+
+  //Set find mode in all portals:
+  for(type_portals::const_iterator iter = m_portals.begin(); iter != m_portals.end(); ++iter)
+  {
+    //*iter is a FlowTableItem.
+    Box_Data_Portal* portal = *iter;
+    if(portal)
+      portal->set_find_mode(m_find_mode);
+  }
+
+  //Set find mode in all the child flowtables, recursively:
+  for(type_sub_flow_tables::iterator iter = m_sub_flow_tables.begin(); iter != m_sub_flow_tables.end(); ++iter)
+  {
+    FlowTableWithFields* subtable = *iter;
+    if(subtable)
+    {
+      subtable->set_find_mode(m_find_mode);
+    }
+  }
+
+}
 
 #endif // !GLOM_ENABLE_CLIENT_ONLY
 
diff --git a/glom/mode_data/flowtablewithfields.h b/glom/mode_data/flowtablewithfields.h
index 3ad7bde..d074d2c 100644
--- a/glom/mode_data/flowtablewithfields.h
+++ b/glom/mode_data/flowtablewithfields.h
@@ -63,6 +63,15 @@ public:
   ///The table name is needed to discover details of relationships.
   virtual void set_table(const Glib::ustring& table_name);
 
+  /** Prevent any attempts to change actual records,
+   * if the widget is just being used to enter find critera,
+   * and prevents any need for data retrieval from the database, because
+   * no data will be displayed.
+   *
+   * @param val True if find mode should be used.
+   */
+  void set_find_mode(bool val = true);
+
   /** Add a field.
    * @param layoutitem_field The layout item that describes this field,
    * @param table_name The table on which this layout appears.
@@ -249,6 +258,7 @@ private:
   Gtk::Alignment* m_placeholder;
 
   Glib::ustring m_table_name;
+  bool m_find_mode;
 
   //Size groups shared by this widget's sibling FlowTables,
   //with one group for each column.
diff --git a/glom/mode_find/box_data_details_find.cc b/glom/mode_find/box_data_details_find.cc
index 1a31219..63d87f2 100644
--- a/glom/mode_find/box_data_details_find.cc
+++ b/glom/mode_find/box_data_details_find.cc
@@ -39,6 +39,8 @@ Box_Data_Details_Find::Box_Data_Details_Find()
   show_layout_toolbar(false);
 #endif
 
+  m_FlowTable.set_find_mode();
+
   show_all_children();
 }
 
@@ -74,6 +76,7 @@ bool Box_Data_Details_Find::fill_from_database()
   return result;
 }
 
+//TODO: Remove this?
 void Box_Data_Details_Find::fill_related()
 {
   //Clear existing pages:



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