mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
Bug 797531 - Improve jumps to filtered registers
Currently if a jump to a filtered register is made, this could be from a report, other register, reconcile window and transaction associations and the destination split is not shown the jump will end up at the last active cell. This could be confusing so add a test for the destination split being visible and warn the user with an option to temporarily clear the filter.
This commit is contained in:
parent
f749f136ce
commit
cfc6a6e8ef
@ -607,6 +607,10 @@ row_selected_trans_cb (GtkTreeView *view, GtkTreePath *path,
|
||||
gsr = gnc_plugin_page_register_get_gsr (page);
|
||||
gnc_split_reg_raise (gsr);
|
||||
|
||||
// Test for visibility of split
|
||||
if (gnc_split_reg_clear_filter_for_split (gsr, split))
|
||||
gnc_plugin_page_register_clear_current_filter (GNC_PLUGIN_PAGE(page));
|
||||
|
||||
gnc_split_reg_jump_to_split (gsr, split);
|
||||
}
|
||||
|
||||
|
@ -3035,6 +3035,22 @@ gnc_plugin_page_register_filter_select_range_cb (GtkRadioButton* button,
|
||||
LEAVE (" ");
|
||||
}
|
||||
|
||||
void
|
||||
gnc_plugin_page_register_clear_current_filter (GncPluginPage* plugin_page)
|
||||
{
|
||||
GncPluginPageRegisterPrivate* priv;
|
||||
|
||||
g_return_if_fail (GNC_IS_PLUGIN_PAGE_REGISTER (plugin_page));
|
||||
|
||||
priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE (plugin_page);
|
||||
|
||||
priv->fd.days = 0;
|
||||
priv->fd.start_time = 0;
|
||||
priv->fd.end_time = 0;
|
||||
priv->fd.cleared_match = (gint)g_ascii_strtoll (DEFAULT_FILTER, NULL, 16);
|
||||
|
||||
gnc_ppr_update_date_query (GNC_PLUGIN_PAGE_REGISTER(plugin_page));
|
||||
}
|
||||
|
||||
/** This function is called when the "number of days" spin button is
|
||||
* changed which is then saved and updates the time limitation on
|
||||
@ -4008,6 +4024,11 @@ gnc_plugin_page_register_cmd_reverse_transaction (GtkAction* action,
|
||||
/* Now jump to new trans */
|
||||
gsr = gnc_plugin_page_register_get_gsr (GNC_PLUGIN_PAGE (page));
|
||||
split = xaccTransFindSplitByAccount(new_trans, account);
|
||||
|
||||
/* Test for visibility of split */
|
||||
if (gnc_split_reg_clear_filter_for_split (gsr, split))
|
||||
gnc_plugin_page_register_clear_current_filter (GNC_PLUGIN_PAGE(page));
|
||||
|
||||
gnc_split_reg_jump_to_split (gsr, split);
|
||||
LEAVE (" ");
|
||||
}
|
||||
@ -4781,6 +4802,11 @@ gnc_plugin_page_register_cmd_jump (GtkAction* action,
|
||||
|
||||
gnc_main_window_open_page (GNC_MAIN_WINDOW (window), new_page);
|
||||
gsr = gnc_plugin_page_register_get_gsr (new_page);
|
||||
|
||||
/* Test for visibility of split */
|
||||
if (gnc_split_reg_clear_filter_for_split (gsr, split))
|
||||
gnc_plugin_page_register_clear_current_filter (GNC_PLUGIN_PAGE(new_page));
|
||||
|
||||
gnc_split_reg_jump_to_split (gsr, split);
|
||||
LEAVE (" ");
|
||||
}
|
||||
|
@ -163,6 +163,16 @@ gnc_plugin_page_register_get_account (GncPluginPageRegister *page);
|
||||
Transaction *
|
||||
gnc_plugin_page_register_get_current_txn (GncPluginPageRegister *page);
|
||||
|
||||
/** This function clears the registers current filter.
|
||||
* It is used so jumps to splits from other places can be completed
|
||||
* otherwise the jump will be to the last active cell.
|
||||
*
|
||||
* @param plugin_page A pointer to the GncPluginPageRegister.
|
||||
*/
|
||||
void
|
||||
gnc_plugin_page_register_clear_current_filter (GncPluginPage* plugin_page);
|
||||
|
||||
|
||||
G_END_DECLS
|
||||
/** @} */
|
||||
/** @} */
|
||||
|
@ -1775,6 +1775,32 @@ gnc_split_reg_expand_trans_toolbar_cb (GtkWidget *widget, gpointer data)
|
||||
gsr_emit_simple_signal( gsr, "expand_ent" );
|
||||
}
|
||||
|
||||
gboolean
|
||||
gnc_split_reg_clear_filter_for_split (GNCSplitReg *gsr, Split *split)
|
||||
{
|
||||
VirtualCellLocation vcell_loc;
|
||||
SplitRegister *reg;
|
||||
|
||||
if (!gsr)
|
||||
return FALSE;
|
||||
|
||||
reg = gnc_ledger_display_get_split_register (gsr->ledger);
|
||||
|
||||
if (!gnc_split_register_get_split_virt_loc (reg, split, &vcell_loc))
|
||||
{
|
||||
gint response = gnc_ok_cancel_dialog (GTK_WINDOW(gsr->window),
|
||||
GTK_RESPONSE_CANCEL,
|
||||
(_("Target split is currently hidden in this register.\n\n%s\n\n"
|
||||
"Select OK to temporarily clear filter and proceed,\n"
|
||||
"otherwise the last active cell will be selected.")),
|
||||
gsr->filter_text);
|
||||
|
||||
if (response == GTK_RESPONSE_OK)
|
||||
return TRUE;
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/**
|
||||
* move the cursor to the split, if present in register
|
||||
**/
|
||||
@ -1799,7 +1825,6 @@ gnc_split_reg_jump_to_split(GNCSplitReg *gsr, Split *split)
|
||||
gnc_ledger_display_refresh( gsr->ledger );
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Move the cursor to the split in the non-blank amount column.
|
||||
**/
|
||||
|
@ -251,6 +251,17 @@ void gnc_split_reg_jump_to_blank (GNCSplitReg *gsr);
|
||||
void gnc_split_reg_jump_to_split(GNCSplitReg *gsr, Split *split);
|
||||
void gnc_split_reg_jump_to_split_amount(GNCSplitReg *gsr, Split *split);
|
||||
|
||||
/** Check if the split is visible and ask if register filter should
|
||||
* be cleared if split is not visible.
|
||||
*
|
||||
* @param gsr A pointer to GNCSplitReg
|
||||
*
|
||||
* @param split A pointer to the split to check visibility on
|
||||
*
|
||||
* @return TRUE if the register filter should be cleared
|
||||
**/
|
||||
gboolean gnc_split_reg_clear_filter_for_split (GNCSplitReg *gsr, Split *split);
|
||||
|
||||
/**
|
||||
* Set the focus of the register to the sheet
|
||||
**/
|
||||
|
@ -198,9 +198,13 @@ gnc_html_register_url_cb (const char *location, const char *label,
|
||||
if (split)
|
||||
{
|
||||
gsr = gnc_plugin_page_register_get_gsr (page);
|
||||
|
||||
/* Test for visibility of split */
|
||||
if (gnc_split_reg_clear_filter_for_split (gsr, split))
|
||||
gnc_plugin_page_register_clear_current_filter (page);
|
||||
|
||||
gnc_split_reg_jump_to_split (gsr, split);
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
@ -81,6 +81,7 @@ struct _RecnWindow
|
||||
|
||||
GtkUIManager *ui_merge;
|
||||
GtkActionGroup *action_group;
|
||||
GncPluginPage *page;
|
||||
|
||||
GtkWidget *starting; /* The starting balance */
|
||||
GtkWidget *ending; /* The ending balance */
|
||||
@ -1019,7 +1020,6 @@ static GNCSplitReg *
|
||||
gnc_reconcile_window_open_register(RecnWindow *recnData)
|
||||
{
|
||||
Account *account = recn_get_account (recnData);
|
||||
GncPluginPage *page;
|
||||
GNCSplitReg *gsr;
|
||||
gboolean include_children;
|
||||
|
||||
@ -1027,9 +1027,9 @@ gnc_reconcile_window_open_register(RecnWindow *recnData)
|
||||
return(NULL);
|
||||
|
||||
include_children = xaccAccountGetReconcileChildrenStatus (account);
|
||||
page = gnc_plugin_page_register_new (account, include_children);
|
||||
gnc_main_window_open_page (NULL, page);
|
||||
gsr = gnc_plugin_page_register_get_gsr(page);
|
||||
recnData->page = gnc_plugin_page_register_new (account, include_children);
|
||||
gnc_main_window_open_page (NULL, recnData->page);
|
||||
gsr = gnc_plugin_page_register_get_gsr (recnData->page);
|
||||
gnc_split_reg_raise (gsr);
|
||||
return gsr;
|
||||
}
|
||||
@ -1049,6 +1049,11 @@ gnc_reconcile_window_double_click_cb(GNCReconcileView *view, Split *split,
|
||||
gsr = gnc_reconcile_window_open_register(recnData);
|
||||
if (gsr == NULL)
|
||||
return;
|
||||
|
||||
/* Test for visibility of split */
|
||||
if (gnc_split_reg_clear_filter_for_split (gsr, split))
|
||||
gnc_plugin_page_register_clear_current_filter (GNC_PLUGIN_PAGE(recnData->page));
|
||||
|
||||
gnc_split_reg_jump_to_split( gsr, split );
|
||||
}
|
||||
|
||||
@ -1430,6 +1435,11 @@ gnc_ui_reconcile_window_edit_cb(GtkButton *button, gpointer data)
|
||||
gsr = gnc_reconcile_window_open_register(recnData);
|
||||
if (gsr == NULL)
|
||||
return;
|
||||
|
||||
/* Test for visibility of split */
|
||||
if (gnc_split_reg_clear_filter_for_split (gsr, split))
|
||||
gnc_plugin_page_register_clear_current_filter (GNC_PLUGIN_PAGE(recnData->page));
|
||||
|
||||
gnc_split_reg_jump_to_split_amount( gsr, split );
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user