mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
Bug #343217: Register: Don't leave the account cell if the user chooses not to create a new account when prompted. This allows any typo to be quickly fixed. Previously the account cell text was blanked and focus moved to the next cell.
git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@17969 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
parent
522afc3085
commit
7014c66c6f
@ -188,20 +188,19 @@ gnc_split_register_old_split_empty_p (SplitRegister *reg, Split *split)
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* This function checks a cell for an account change, and takes
|
/* Checks a cell for an account change and takes any necessary action if
|
||||||
* any necessary action if an account change has occurred. */
|
* one has occurred. Returns TRUE if the check passes, FALSE if it fails. */
|
||||||
static void
|
static gboolean
|
||||||
gnc_split_register_check_account (SplitRegister *reg,
|
gnc_split_register_check_account (SplitRegister *reg,
|
||||||
const char *cell_name)
|
const char *cell_name)
|
||||||
{
|
{
|
||||||
SRInfo *info;
|
SRInfo *info;
|
||||||
ComboCell *cell = NULL;
|
ComboCell *cell = NULL;
|
||||||
|
PriceCell *rate_cell;
|
||||||
Account* new_acct;
|
Account* new_acct;
|
||||||
char *name;
|
char *name;
|
||||||
|
|
||||||
g_return_if_fail(reg);
|
g_return_val_if_fail(reg, TRUE);
|
||||||
|
|
||||||
ENTER("reg=%p, cell_name=%s", reg, cell_name? cell_name : "NULL");
|
|
||||||
|
|
||||||
/* See if we are leaving an account field */
|
/* See if we are leaving an account field */
|
||||||
if (gnc_cell_name_equal (cell_name, XFRM_CELL))
|
if (gnc_cell_name_equal (cell_name, XFRM_CELL))
|
||||||
@ -220,21 +219,15 @@ gnc_split_register_check_account (SplitRegister *reg,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!cell)
|
if (!cell)
|
||||||
{
|
return TRUE;
|
||||||
LEAVE(" ");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* The account has been changed. */
|
/* The account has been changed. */
|
||||||
name = cell->cell.value;
|
name = cell->cell.value;
|
||||||
DEBUG("Account now %s", name ? name : "NULL");
|
DEBUG("Changed to %s", name ? name : "NULL");
|
||||||
if (!name || *name == '\0' ||
|
if (!name || *name == '\0' ||
|
||||||
safe_strcmp (name, SPLIT_TRANS_STR) == 0 ||
|
safe_strcmp (name, SPLIT_TRANS_STR) == 0 ||
|
||||||
safe_strcmp (name, STOCK_SPLIT_STR) == 0)
|
safe_strcmp (name, STOCK_SPLIT_STR) == 0)
|
||||||
{
|
return TRUE;
|
||||||
LEAVE(" ");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Create the account if necessary. Also checks for a placeholder. */
|
/* Create the account if necessary. Also checks for a placeholder. */
|
||||||
info = gnc_split_register_get_info (reg);
|
info = gnc_split_register_get_info (reg);
|
||||||
@ -242,13 +235,15 @@ gnc_split_register_check_account (SplitRegister *reg,
|
|||||||
(BasicCell *) cell,
|
(BasicCell *) cell,
|
||||||
cell->cell.value,
|
cell->cell.value,
|
||||||
&info->full_refresh);
|
&info->full_refresh);
|
||||||
|
if (!new_acct)
|
||||||
|
{
|
||||||
|
DEBUG("account check failed");
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
/* See if we need to reset the exchange rate. */
|
/* See if we need to reset the exchange rate. */
|
||||||
if (new_acct)
|
rate_cell = (PriceCell *) gnc_table_layout_get_cell (reg->table->layout,
|
||||||
{
|
RATE_CELL);
|
||||||
PriceCell *rate_cell = (PriceCell *)
|
|
||||||
gnc_table_layout_get_cell (reg->table->layout, RATE_CELL);
|
|
||||||
|
|
||||||
if (rate_cell)
|
if (rate_cell)
|
||||||
{
|
{
|
||||||
Split *split = gnc_split_register_get_current_split(reg);
|
Split *split = gnc_split_register_get_current_split(reg);
|
||||||
@ -288,9 +283,8 @@ gnc_split_register_check_account (SplitRegister *reg,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
LEAVE(" ");
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -1061,14 +1055,19 @@ gnc_split_register_check_stock_shares (SplitRegister *reg,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* This function checks a cell for changes and takes appropriate
|
/* This function checks a cell for changes and takes appropriate action if a
|
||||||
* action if a change has occurred. It is useful, for example, to
|
* change has occurred. It is recommended to call this function just before
|
||||||
* call this function just before leaving a cell. */
|
* leaving a cell. Returns FALSE if control should remain in this cell. For
|
||||||
void
|
* example, the user may have made a mistake and needs another chance to
|
||||||
|
* edit the information before moving on. */
|
||||||
|
gboolean
|
||||||
gnc_split_register_check_cell (SplitRegister *reg, const char *cell_name)
|
gnc_split_register_check_cell (SplitRegister *reg, const char *cell_name)
|
||||||
{
|
{
|
||||||
|
ENTER("reg=%p, cell_name=%s", reg, cell_name? cell_name : "NULL");
|
||||||
|
|
||||||
/* See if we are leaving an account field. */
|
/* See if we are leaving an account field. */
|
||||||
gnc_split_register_check_account (reg, cell_name);
|
if (!gnc_split_register_check_account (reg, cell_name))
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
/* See if we are leaving an action field */
|
/* See if we are leaving an action field */
|
||||||
if ((reg->type == STOCK_REGISTER) ||
|
if ((reg->type == STOCK_REGISTER) ||
|
||||||
@ -1078,6 +1077,8 @@ gnc_split_register_check_cell (SplitRegister *reg, const char *cell_name)
|
|||||||
gnc_split_register_check_stock_action (reg, cell_name);
|
gnc_split_register_check_stock_action (reg, cell_name);
|
||||||
gnc_split_register_check_stock_shares (reg, cell_name);
|
gnc_split_register_check_stock_shares (reg, cell_name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static Account *
|
static Account *
|
||||||
@ -1510,7 +1511,11 @@ gnc_split_register_traverse (VirtualLocation *p_new_virt_loc,
|
|||||||
|
|
||||||
/* Get the current cell-name and check it for changes. */
|
/* Get the current cell-name and check it for changes. */
|
||||||
cell_name = gnc_table_get_current_cell_name (reg->table);
|
cell_name = gnc_table_get_current_cell_name (reg->table);
|
||||||
gnc_split_register_check_cell (reg, cell_name);
|
if (!gnc_split_register_check_cell (reg, cell_name))
|
||||||
|
{
|
||||||
|
LEAVE("check cell");
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
/* See if we are tabbing off the end of the very last line */
|
/* See if we are tabbing off the end of the very last line */
|
||||||
do {
|
do {
|
||||||
|
@ -161,7 +161,8 @@ Account * gnc_split_register_get_account (SplitRegister *reg,
|
|||||||
|
|
||||||
gboolean gnc_split_register_recn_cell_confirm (char old_flag, gpointer data);
|
gboolean gnc_split_register_recn_cell_confirm (char old_flag, gpointer data);
|
||||||
|
|
||||||
void gnc_split_register_check_cell (SplitRegister *reg, const char *cell_name);
|
gboolean gnc_split_register_check_cell (SplitRegister *reg,
|
||||||
|
const char *cell_name);
|
||||||
|
|
||||||
CursorClass gnc_split_register_cursor_name_to_class (const char *cursor_name);
|
CursorClass gnc_split_register_cursor_name_to_class (const char *cursor_name);
|
||||||
|
|
||||||
|
@ -1504,7 +1504,7 @@ gnc_split_register_save (SplitRegister *reg, gboolean do_commit)
|
|||||||
blank_split, blank_trans, pending_trans, trans);
|
blank_split, blank_trans, pending_trans, trans);
|
||||||
|
|
||||||
/* Act on any changes to the current cell before the save. */
|
/* Act on any changes to the current cell before the save. */
|
||||||
gnc_split_register_check_cell (reg,
|
(void) gnc_split_register_check_cell (reg,
|
||||||
gnc_table_get_current_cell_name (reg->table));
|
gnc_table_get_current_cell_name (reg->table));
|
||||||
|
|
||||||
if (!gnc_split_register_auto_calc (reg, split))
|
if (!gnc_split_register_auto_calc (reg, split))
|
||||||
|
Loading…
Reference in New Issue
Block a user