[glom/modification: 30/33] Probably unwise partial compilation fix.



commit 22630130db0c6f44fa694f1d1f505c3f66b7b85e
Author: Murray Cumming <murrayc murrayc com>
Date:   Thu Jun 4 19:08:42 2009 +0200

    Probably unwise partial compilation fix.
---
 glom/base_db.cc            |    4 ++++
 glom/base_db.h             |    4 ++++
 glom/base_db_table_data.cc |    9 ++++++---
 3 files changed, 14 insertions(+), 3 deletions(-)

diff --git a/glom/base_db.cc b/glom/base_db.cc
index 41c92a9..e6abf5b 100644
--- a/glom/base_db.cc
+++ b/glom/base_db.cc
@@ -3769,5 +3769,9 @@ bool Base_DB::disable_user(const Glib::ustring& user)
   return true;
 }
 
+Gtk::TreeModel::iterator Base_DB::get_row_selected()
+{
+  return Gtk::TreeModel::iterator();
+}
 
 } //namespace Glom
diff --git a/glom/base_db.h b/glom/base_db.h
index 7461473..5248ee6 100644
--- a/glom/base_db.h
+++ b/glom/base_db.h
@@ -423,6 +423,10 @@ private:
   /// Fill m_extra_field_values with the extra field definitions. 
   void init_extra_modification_fields();
 
+  //TODO: This probably shouldn't be here, but is needed because 
+  //record_new() calls methods that need to data that is entered in the UI. 
+  virtual Gtk::TreeModel::iterator get_row_selected();
+
 protected:
 
   type_field_calcs m_FieldsCalculationInProgress; //Prevent circular calculations and recalculations.
diff --git a/glom/base_db_table_data.cc b/glom/base_db_table_data.cc
index f4a24b8..eec0e1e 100644
--- a/glom/base_db_table_data.cc
+++ b/glom/base_db_table_data.cc
@@ -75,7 +75,7 @@ bool Base_DB_Table_Data::record_new_with_entered_data(const Gnome::Gda::Value& p
   //Add values for all fields that default to something, not just the shown ones:
   //For instance, we must always add the primary key, and fields with default/calculated/lookup values:
   const type_vecLayoutFields fieldsOnLayout = m_FieldsShown;
-  for(type_vecLayoutFields::const_iterator iter = fieldsOnLayout.begin(); iter != fieldsOnLayout.end(); ++iter)
+  for(type_vecLayoutFields::iterator iter = fieldsOnLayout.begin(); iter != fieldsOnLayout.end(); ++iter)
   {
     //Check that we don't have a value for this field already:
     //(This gives priority to specified fields values rather than entered field values.)
@@ -83,7 +83,10 @@ bool Base_DB_Table_Data::record_new_with_entered_data(const Gnome::Gda::Value& p
     type_field_values::const_iterator iterFind = std::find_if(field_values_plus_entered.begin(), field_values_plus_entered.end(), predicate_FieldHasName<LayoutItem_Field>((*iter)->get_name()));
     if(iterFind == field_values_plus_entered.end())
     {
-      field_values_plus_entered.push_back(*iter);
+      sharedptr<const LayoutItem_Field> layoutitem = *iter;
+      sharedptr<const Field> field = layoutitem->get_full_field_details();
+      type_field_and_value field_and_value(field, Gnome::Gda::Value());
+      field_values_plus_entered.push_back(field_and_value);
     }
   }
 
@@ -193,7 +196,7 @@ bool Base_DB_Table_Data::add_related_record_for_field(const sharedptr<const Layo
         //Generate the new key value.
       }
 
-      const bool added = record_new(relationship->get_to_table(), false /* use_entered_field_data */, primary_key_value);
+      const bool added = record_new(relationship->get_to_table(), primary_key_value, type_field_values());
       if(!added)
       {
         std::cerr << "Base_DB_Table_Data::add_related_record_for_field(): record_new() failed." << std::endl;



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