mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
Bug 799047 - AutoComplete Only Considers Visible Transactions
In the past, all transactions were used on the first load of the register and this is when the autocomplete would be populated, on subsequent loads it would be a filtered list. With the change to delay loading, the first load is empty and the autocomplete is now being populated by the filtered list. To fix this, make a copy of the original query and compare this query to the query used for refresh. When different, pass a second list of splits to the register to populate the autocomplete lists.
This commit is contained in:
@@ -1509,7 +1509,7 @@ schedXact_editor_populate (GncSxEditorDialog *sxed)
|
|||||||
if (splitList)
|
if (splitList)
|
||||||
{
|
{
|
||||||
splitReg = gnc_ledger_display_get_split_register (sxed->ledger);
|
splitReg = gnc_ledger_display_get_split_register (sxed->ledger);
|
||||||
gnc_split_register_load (splitReg, splitList, NULL);
|
gnc_split_register_load (splitReg, splitList, NULL, NULL);
|
||||||
} /* otherwise, use the existing stuff. */
|
} /* otherwise, use the existing stuff. */
|
||||||
g_list_free (splitList);
|
g_list_free (splitList);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -59,6 +59,7 @@ struct gnc_ledger_display
|
|||||||
GncGUID leader;
|
GncGUID leader;
|
||||||
|
|
||||||
Query* query;
|
Query* query;
|
||||||
|
Query* pre_filter_query;
|
||||||
|
|
||||||
GNCLedgerDisplayType ld_type;
|
GNCLedgerDisplayType ld_type;
|
||||||
|
|
||||||
@@ -655,6 +656,9 @@ close_handler (gpointer user_data)
|
|||||||
qof_query_destroy (ld->query);
|
qof_query_destroy (ld->query);
|
||||||
ld->query = NULL;
|
ld->query = NULL;
|
||||||
|
|
||||||
|
qof_query_destroy (ld->pre_filter_query);
|
||||||
|
ld->pre_filter_query = NULL;
|
||||||
|
|
||||||
g_free (ld);
|
g_free (ld);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -834,6 +838,8 @@ gnc_ledger_display_internal (Account* lead_account, Query* q,
|
|||||||
else
|
else
|
||||||
gnc_ledger_display_make_query (ld, limit, reg_type);
|
gnc_ledger_display_make_query (ld, limit, reg_type);
|
||||||
|
|
||||||
|
ld->pre_filter_query = qof_query_copy (ld->query);
|
||||||
|
|
||||||
ld->component_id = gnc_register_gui_component (klass,
|
ld->component_id = gnc_register_gui_component (klass,
|
||||||
refresh_handler,
|
refresh_handler,
|
||||||
close_handler, ld);
|
close_handler, ld);
|
||||||
@@ -854,7 +860,7 @@ gnc_ledger_display_internal (Account* lead_account, Query* q,
|
|||||||
* the query when we're not in focus yet.
|
* the query when we're not in focus yet.
|
||||||
*/
|
*/
|
||||||
ld->loading = TRUE;
|
ld->loading = TRUE;
|
||||||
gnc_split_register_load (ld->reg, NULL, gnc_ledger_display_leader (ld));
|
gnc_split_register_load (ld->reg, NULL, NULL, gnc_ledger_display_leader (ld));
|
||||||
ld->loading = FALSE;
|
ld->loading = FALSE;
|
||||||
return ld;
|
return ld;
|
||||||
}
|
}
|
||||||
@@ -888,6 +894,7 @@ static void
|
|||||||
gnc_ledger_display_refresh_internal (GNCLedgerDisplay* ld)
|
gnc_ledger_display_refresh_internal (GNCLedgerDisplay* ld)
|
||||||
{
|
{
|
||||||
GList* splits;
|
GList* splits;
|
||||||
|
GList* pre_filter_splits = NULL;
|
||||||
|
|
||||||
if (ld->loading)
|
if (ld->loading)
|
||||||
return;
|
return;
|
||||||
@@ -899,6 +906,9 @@ gnc_ledger_display_refresh_internal (GNCLedgerDisplay* ld)
|
|||||||
*/
|
*/
|
||||||
splits = qof_query_run (ld->query);
|
splits = qof_query_run (ld->query);
|
||||||
|
|
||||||
|
if (!qof_query_equal (ld->query, ld->pre_filter_query))
|
||||||
|
pre_filter_splits = qof_query_run (ld->pre_filter_query);
|
||||||
|
|
||||||
gnc_ledger_display_set_watches (ld, splits);
|
gnc_ledger_display_set_watches (ld, splits);
|
||||||
|
|
||||||
if (!gnc_split_register_full_refresh_ok (ld->reg))
|
if (!gnc_split_register_full_refresh_ok (ld->reg))
|
||||||
@@ -906,7 +916,7 @@ gnc_ledger_display_refresh_internal (GNCLedgerDisplay* ld)
|
|||||||
|
|
||||||
ld->loading = TRUE;
|
ld->loading = TRUE;
|
||||||
|
|
||||||
gnc_split_register_load (ld->reg, splits,
|
gnc_split_register_load (ld->reg, splits, pre_filter_splits,
|
||||||
gnc_ledger_display_leader (ld));
|
gnc_ledger_display_leader (ld));
|
||||||
|
|
||||||
ld->needs_refresh = FALSE;
|
ld->needs_refresh = FALSE;
|
||||||
|
|||||||
@@ -256,8 +256,9 @@ _find_split_with_parent_txn (gconstpointer a, gconstpointer b)
|
|||||||
return xaccSplitGetParent (split) == txn ? 0 : 1;
|
return xaccSplitGetParent (split) == txn ? 0 : 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void add_quickfill_completions (TableLayout* layout, Transaction* trans,
|
static void
|
||||||
Split* split, gboolean has_last_num)
|
add_quickfill_completions (TableLayout* layout, Transaction* trans,
|
||||||
|
Split* split, gboolean has_last_num)
|
||||||
{
|
{
|
||||||
gnc_quickfill_cell_add_completion (
|
gnc_quickfill_cell_add_completion (
|
||||||
(QuickFillCell*) gnc_table_layout_get_cell (layout, NOTES_CELL),
|
(QuickFillCell*) gnc_table_layout_get_cell (layout, NOTES_CELL),
|
||||||
@@ -365,9 +366,30 @@ update_info (SRInfo* info, SplitRegister* reg)
|
|||||||
info->reg_loaded = TRUE;
|
info->reg_loaded = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
add_completions_from_pre_filter_slist (TableLayout* layout, GList *pre_filter_slist,
|
||||||
|
gboolean first_pass, gboolean quickfill_setup,
|
||||||
|
gboolean has_last_num)
|
||||||
|
{
|
||||||
|
GList *node;
|
||||||
|
|
||||||
|
for (node = pre_filter_slist; node; node = node->next)
|
||||||
|
{
|
||||||
|
Split *split = node->data;
|
||||||
|
Transaction *trans = xaccSplitGetParent (split);
|
||||||
|
|
||||||
|
gnc_completion_cell_add_menu_item (
|
||||||
|
(CompletionCell*) gnc_table_layout_get_cell (layout, DESC_CELL),
|
||||||
|
xaccTransGetDescription (trans));
|
||||||
|
|
||||||
|
if (!first_pass && !quickfill_setup)
|
||||||
|
add_quickfill_completions (layout, trans, split, has_last_num);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
gnc_split_register_load (SplitRegister* reg, GList* slist,
|
gnc_split_register_load (SplitRegister* reg, GList* slist,
|
||||||
Account* default_account)
|
GList* pre_filter_slist, Account* default_account)
|
||||||
{
|
{
|
||||||
SRInfo* info;
|
SRInfo* info;
|
||||||
Transaction* pending_trans;
|
Transaction* pending_trans;
|
||||||
@@ -635,6 +657,13 @@ gnc_split_register_load (SplitRegister* reg, GList* slist,
|
|||||||
(CompletionCell*) gnc_table_layout_get_cell (reg->table->layout, DESC_CELL),
|
(CompletionCell*) gnc_table_layout_get_cell (reg->table->layout, DESC_CELL),
|
||||||
table->model->reverse_sort);
|
table->model->reverse_sort);
|
||||||
|
|
||||||
|
if (!info->first_pass && pre_filter_slist)
|
||||||
|
{
|
||||||
|
add_completions_from_pre_filter_slist (reg->table->layout, pre_filter_slist,
|
||||||
|
info->first_pass, info->quickfill_setup,
|
||||||
|
has_last_num);
|
||||||
|
}
|
||||||
|
|
||||||
/* populate the table */
|
/* populate the table */
|
||||||
for (node = slist; node; node = node->next)
|
for (node = slist; node; node = node->next)
|
||||||
{
|
{
|
||||||
@@ -752,12 +781,15 @@ gnc_split_register_load (SplitRegister* reg, GList* slist,
|
|||||||
|
|
||||||
/* On first load the split list is empty so fill up the quickfill cells
|
/* On first load the split list is empty so fill up the quickfill cells
|
||||||
* only on the next load. */
|
* only on the next load. */
|
||||||
if (!info->first_pass && !info->quickfill_setup)
|
if (!info->first_pass && !pre_filter_slist && !info->quickfill_setup)
|
||||||
add_quickfill_completions (reg->table->layout, trans, split, has_last_num);
|
add_quickfill_completions (reg->table->layout, trans, split, has_last_num);
|
||||||
|
|
||||||
gnc_completion_cell_add_menu_item (
|
if (!info->first_pass && !pre_filter_slist)
|
||||||
(CompletionCell*) gnc_table_layout_get_cell (reg->table->layout, DESC_CELL),
|
{
|
||||||
xaccTransGetDescription (trans));
|
gnc_completion_cell_add_menu_item (
|
||||||
|
(CompletionCell*) gnc_table_layout_get_cell (reg->table->layout, DESC_CELL),
|
||||||
|
xaccTransGetDescription (trans));
|
||||||
|
}
|
||||||
|
|
||||||
if (trans == find_trans)
|
if (trans == find_trans)
|
||||||
new_trans_row = vcell_loc.virt_row;
|
new_trans_row = vcell_loc.virt_row;
|
||||||
|
|||||||
@@ -530,10 +530,12 @@ void gnc_split_register_cancel_cursor_trans_changes (SplitRegister* reg);
|
|||||||
*
|
*
|
||||||
* @param slist a list of splits
|
* @param slist a list of splits
|
||||||
*
|
*
|
||||||
|
* @param pre_filter_slist the list of splits before applying filter
|
||||||
|
*
|
||||||
* @param default_account an account to provide defaults for the blank split
|
* @param default_account an account to provide defaults for the blank split
|
||||||
*/
|
*/
|
||||||
void gnc_split_register_load (SplitRegister* reg, GList* slist,
|
void gnc_split_register_load (SplitRegister* reg, GList* slist,
|
||||||
Account* default_account);
|
GList* pre_filter_slist, Account* default_account);
|
||||||
|
|
||||||
/** Copy the contents of the current cursor to a split. The split and
|
/** Copy the contents of the current cursor to a split. The split and
|
||||||
* transaction that are updated are the ones associated with the
|
* transaction that are updated are the ones associated with the
|
||||||
|
|||||||
Reference in New Issue
Block a user