Commit e1a54b03 authored by Murray Cumming's avatar Murray Cumming
Browse files

Allow printing of print layouts from the list view.

* glom/appwindow.cc: fill_menu_print_layouts(): Show the print layouts
even if the list view is visible.
* glom/mode_data/notebook_data.[h|cc]:
get_found_set_details(): Replace with get_found_set_selected()
which checks the selected record in the list view, if the list
view is visible, instead of just the details view.
* glom/frame_glom.[h|cc]: Remove get_viewing_details().
do_print_layout(): Use get_found_set_selected() so we can print the
print layout for the selected record.

This avoids some confusion caused by the print layouts not being available
when viewing the list instead of the details.
Bug #670462 (alien)
parent 42d01fe9
2012-02-22 Murray Cumming <murrayc@murrayc.com>
Allow printing of print layouts from the list view.
* glom/appwindow.cc: fill_menu_print_layouts(): Show the print layouts
even if the list view is visible.
* glom/mode_data/notebook_data.[h|cc]:
get_found_set_details(): Replace with get_found_set_selected()
which checks the selected record in the list view, if the list
view is visible, instead of just the details view.
* glom/frame_glom.[h|cc]: Remove get_viewing_details().
do_print_layout(): Use get_found_set_selected() so we can print the
print layout for the selected record.
This avoids some confusion caused by the print layouts not being available
when viewing the list instead of the details.
Bug #670462 (alien)
2012-02-13 Murray Cumming <murrayc@murrayc.com>
Users: Warn if we cannot get the list of users.
......
......@@ -2120,11 +2120,6 @@ void AppWindow::fill_menu_print_layouts(const Glib::ustring& table_name)
if(m_menu_print_layouts_ui_merge_id)
m_refUIManager->remove_ui(m_menu_print_layouts_ui_merge_id);
//Only fill menu if we are in details mode,
//because this feature is not (yet) available for lists:
if(!m_pFrame || !m_pFrame->get_viewing_details())
return;
if(m_refNavPrintLayoutsActionGroup)
{
m_refUIManager->remove_action_group(m_refNavPrintLayoutsActionGroup);
......
......@@ -2332,7 +2332,7 @@ void Frame_Glom::do_print_layout(const Glib::ustring& print_layout_name, bool pr
//TODO: When expanding items, avoid the page gaps that the print layout's design
//has added.
const FoundSet found_set = m_Notebook_Data.get_found_set_details();
const FoundSet found_set = m_Notebook_Data.get_found_set_selected();
//Note that found_set.m_where_clause could be empty if there are no records yet,
//and that is acceptable if this is for a print preview while designing the print layout.
......@@ -2473,11 +2473,6 @@ void Frame_Glom::on_button_find_all()
show_table(m_table_name);
}
bool Frame_Glom::get_viewing_details() const
{
return (m_Notebook_Data.get_current_view() == Notebook_Data::DATA_VIEW_Details);
}
Glib::ustring Frame_Glom::get_shown_table_name() const
{
return m_table_name;
......
......@@ -170,9 +170,6 @@ public:
*/
void show_table_refresh();
///Whether we are viewing the details or list.
bool get_viewing_details() const;
Glib::ustring get_shown_table_name() const;
/** Show the table, possibly selecting a particular record, possibly showing that in the details tab.
......
......@@ -258,9 +258,41 @@ void Notebook_Data::on_details_user_requested_related_details(const Glib::ustrin
*/
}
FoundSet Notebook_Data::get_found_set_details() const
FoundSet Notebook_Data::get_found_set_selected() const
{
return m_Box_Details.get_found_set();
if(get_current_view() == DATA_VIEW_Details)
{
return m_Box_Details.get_found_set();
}
else
{
//Start with something sensible:
FoundSet found_set = m_Box_List.get_found_set();
const Gnome::Gda::Value primary_key_value_selected =
m_Box_List.get_primary_key_value_selected();
if(Conversions::value_is_empty(primary_key_value_selected))
{
//Indicate to the caller that no record is selected:
found_set.m_where_clause = Gnome::Gda::SqlExpr();
return found_set;
}
const Document* document = get_document();
if(!document)
{
std::cerr << G_STRFUNC << ": document is null" << std::endl;
found_set.m_where_clause = Gnome::Gda::SqlExpr();
return found_set;
}
sharedptr<Field> primary_key_field =
document->get_field_primary_key(m_table_name);
found_set.m_where_clause = Utils::build_simple_where_expression(
m_table_name, primary_key_field,
primary_key_value_selected);
return found_set;
}
}
......
......@@ -44,8 +44,10 @@ public:
///Get the existing where clause, previously supplied to init_db_details().
FoundSet get_found_set() const;
///Get the found set for the currently-visible record in the details tab:
FoundSet get_found_set_details() const;
/** Get the found set for the currently-selected record in the list view,
* if the list view is visible, or the currently-visible details tab.
*/
FoundSet get_found_set_selected() const;
///Show the details for a particular record, without affecting the list view.
void show_details(const Gnome::Gda::Value& primary_key_value);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment