glom r1873 - in trunk: . glom glom/mode_data glom/utility_widgets/db_adddel
- From: murrayc svn gnome org
- To: svn-commits-list gnome org
- Subject: glom r1873 - in trunk: . glom glom/mode_data glom/utility_widgets/db_adddel
- Date: Mon, 2 Feb 2009 22:50:50 +0000 (UTC)
Author: murrayc
Date: Mon Feb 2 22:50:50 2009
New Revision: 1873
URL: http://svn.gnome.org/viewvc/glom?rev=1873&view=rev
Log:
2009-02-02 Murray Cumming <murrayc murrayc com>
* glom/base_db_table_data.[h|cc]: Added get_row_selected() virtual function,
used in record_new() instead of an always-null TreeModel::iterator.
This lets lookups, default values, and calculated values be seen when
adding new list records or related records.
* glom/mode_data/box_data_list.[h|cc]:
* glom/utility_widgets/db_adddel/db_adddel.[h|cc]:
Added get_row_selected() overrides.
This should fix bug #569722 (Johannes Schmid)
Modified:
trunk/ChangeLog
trunk/glom/base_db_table_data.cc
trunk/glom/base_db_table_data.h
trunk/glom/mode_data/box_data_list.cc
trunk/glom/mode_data/box_data_list.h
trunk/glom/utility_widgets/db_adddel/db_adddel.cc
trunk/glom/utility_widgets/db_adddel/db_adddel.h
Modified: trunk/glom/base_db_table_data.cc
==============================================================================
--- trunk/glom/base_db_table_data.cc (original)
+++ trunk/glom/base_db_table_data.cc Mon Feb 2 22:50:50 2009
@@ -59,6 +59,13 @@
return Gnome::Gda::Value(); //null
}
+Gtk::TreeModel::iterator Base_DB_Table_Data::get_row_selected()
+{
+ //This in meaningless for Details,
+ //but is overridden for list views.
+ return Gtk::TreeModel::iterator();
+}
+
bool Base_DB_Table_Data::record_new(bool use_entered_data, const Gnome::Gda::Value& primary_key_value)
{
@@ -213,7 +220,7 @@
std::cerr << "Box_Data::record_new(): INSERT failed." << std::endl;
else
{
- Gtk::TreeModel::iterator row; // TODO: remove this parameter.
+ Gtk::TreeModel::iterator row = get_row_selected(); //Null and ignored for details views.
set_primary_key_value(row, primary_key_value); //Needed by Box_Data_List::on_adddel_user_changed().
//Update any lookups, related fields, or calculations:
Modified: trunk/glom/base_db_table_data.h
==============================================================================
--- trunk/glom/base_db_table_data.h (original)
+++ trunk/glom/base_db_table_data.h Mon Feb 2 22:50:50 2009
@@ -77,6 +77,9 @@
virtual void on_record_added(const Gnome::Gda::Value& primary_key_value, const Gtk::TreeModel::iterator& row); //Overridden by derived classes.
virtual void on_record_deleted(const Gnome::Gda::Value& primary_key_value); //Overridden by derived classes.
+
+ //Gets the row being edited, for derived classes that have rows.
+ virtual Gtk::TreeModel::iterator get_row_selected();
FoundSet m_found_set;
Modified: trunk/glom/mode_data/box_data_list.cc
==============================================================================
--- trunk/glom/mode_data/box_data_list.cc (original)
+++ trunk/glom/mode_data/box_data_list.cc Mon Feb 2 22:50:50 2009
@@ -607,6 +607,11 @@
document->set_criteria_current(m_table_name, m_found_set);
}
+Gtk::TreeModel::iterator Box_Data_List::get_row_selected()
+{
+ return m_AddDel.get_item_selected();
+}
+
#ifndef GLOM_ENABLE_CLIENT_ONLY
//overridden, so we can change the column widths, so they are all visible:
void Box_Data_List::on_dialog_layout_hide()
Modified: trunk/glom/mode_data/box_data_list.h
==============================================================================
--- trunk/glom/mode_data/box_data_list.h (original)
+++ trunk/glom/mode_data/box_data_list.h Mon Feb 2 22:50:50 2009
@@ -47,6 +47,8 @@
virtual void set_entered_field_data(const sharedptr<const LayoutItem_Field>& field, const Gnome::Gda::Value& value);
virtual void set_entered_field_data(const Gtk::TreeModel::iterator& row, const sharedptr<const LayoutItem_Field>& field, const Gnome::Gda::Value& value);
+ virtual Gtk::TreeModel::iterator get_row_selected();
+
bool get_showing_multiple_records() const;
void set_read_only(bool read_only = true);
Modified: trunk/glom/utility_widgets/db_adddel/db_adddel.cc
==============================================================================
--- trunk/glom/utility_widgets/db_adddel/db_adddel.cc (original)
+++ trunk/glom/utility_widgets/db_adddel/db_adddel.cc Mon Feb 2 22:50:50 2009
@@ -2471,6 +2471,11 @@
return get_value_key(row);
}
+Gtk::TreeModel::iterator DbAddDel::get_row_selected()
+{
+ return get_item_selected();
+}
+
} //namespace Glom
Modified: trunk/glom/utility_widgets/db_adddel/db_adddel.h
==============================================================================
--- trunk/glom/utility_widgets/db_adddel/db_adddel.h (original)
+++ trunk/glom/utility_widgets/db_adddel/db_adddel.h Mon Feb 2 22:50:50 2009
@@ -266,7 +266,8 @@
virtual void set_entered_field_data(const sharedptr<const LayoutItem_Field>& field, const Gnome::Gda::Value& value);
virtual void set_entered_field_data(const Gtk::TreeModel::iterator& row, const sharedptr<const LayoutItem_Field>& field, const Gnome::Gda::Value& value);
virtual Gnome::Gda::Value get_entered_field_data(const sharedptr<const LayoutItem_Field>& field) const;
-
+ virtual Gtk::TreeModel::iterator get_row_selected();
+
//Implementations of pure virtual methods from Base_DB_Table_Data:
virtual sharedptr<Field> get_field_primary_key() const;
virtual Gnome::Gda::Value get_primary_key_value_selected() const;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]