gnucash maint: Multiple changes pushed
Geert Janssens
gjanssens at code.gnucash.org
Thu Mar 28 17:40:00 EDT 2019
Updated via https://github.com/Gnucash/gnucash/commit/6cbb0adf (commit)
via https://github.com/Gnucash/gnucash/commit/2bcf6023 (commit)
from https://github.com/Gnucash/gnucash/commit/1c301ed1 (commit)
commit 6cbb0adf3d4255389e414cfe721eb045235ae7f7
Author: Geert Janssens <geert at kobaltwit.be>
Date: Thu Mar 28 22:39:49 2019 +0100
Bug 796530 - TxnCsvImport - fix loading of saved preset with update of seperator selection
Previously this would cause all but the first column
to loose its assigned types.
diff --git a/gnucash/import-export/csv-imp/assistant-csv-trans-import.cpp b/gnucash/import-export/csv-imp/assistant-csv-trans-import.cpp
index 00c1a126c..255142fad 100644
--- a/gnucash/import-export/csv-imp/assistant-csv-trans-import.cpp
+++ b/gnucash/import-export/csv-imp/assistant-csv-trans-import.cpp
@@ -1655,13 +1655,20 @@ CsvImpTransAssist::preview_refresh ()
go_charmap_sel_set_encoding (encselector, tx_imp->encoding().c_str());
// Handle separator checkboxes and custom field, only relevant if the file format is csv
+ // Note we defer the change signal until all buttons have been updated
+ // An early update may result in an incomplete tokenize run and that would
+ // cause our list of saved column types to be truncated
if (tx_imp->file_format() == GncImpFileFormat::CSV)
{
auto separators = tx_imp->separators();
const auto stock_sep_chars = std::string (" \t,:;-");
for (int i = 0; i < SEP_NUM_OF_TYPES; i++)
+ {
+ g_signal_handlers_block_by_func (sep_button[i], (gpointer) csv_tximp_preview_sep_button_cb, this);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON(sep_button[i]),
separators.find (stock_sep_chars[i]) != std::string::npos);
+ g_signal_handlers_unblock_by_func (sep_button[i], (gpointer) csv_tximp_preview_sep_button_cb, this);
+ }
// If there are any other separators in the separators string,
// add them as custom separators
@@ -1671,9 +1678,14 @@ CsvImpTransAssist::preview_refresh ()
separators.erase(pos);
pos = separators.find_first_of (stock_sep_chars);
}
+ g_signal_handlers_block_by_func (custom_cbutton, (gpointer) csv_tximp_preview_sep_button_cb, this);
+ g_signal_handlers_block_by_func (custom_entry, (gpointer) csv_tximp_preview_sep_button_cb, this);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON(custom_cbutton),
- !separators.empty());
+ !separators.empty());
gtk_entry_set_text (GTK_ENTRY(custom_entry), separators.c_str());
+ g_signal_handlers_unblock_by_func (custom_cbutton, (gpointer) csv_tximp_preview_sep_button_cb, this);
+ g_signal_handlers_unblock_by_func (custom_entry, (gpointer) csv_tximp_preview_sep_button_cb, this);
+ csv_tximp_preview_sep_button_cb (GTK_WIDGET (custom_cbutton), this);
}
// Repopulate the parsed data table
commit 2bcf60230adc0d6a4e4c0ca9cdc1f79b44e8ee7f
Author: Geert Janssens <geert at kobaltwit.be>
Date: Thu Mar 28 17:39:25 2019 +0100
CSV Tokenizer - add additional test to guard against quote parsing regressions
diff --git a/gnucash/import-export/csv-imp/test/test-tokenizer.cpp b/gnucash/import-export/csv-imp/test/test-tokenizer.cpp
index 961ac65cd..2a861ae6b 100644
--- a/gnucash/import-export/csv-imp/test/test-tokenizer.cpp
+++ b/gnucash/import-export/csv-imp/test/test-tokenizer.cpp
@@ -177,6 +177,7 @@ static tokenize_csv_test_data comma_separated [] = {
{ "Test\\ with backslash,nextfield", 2, { "Test\\ with backslash","nextfield",NULL,NULL,NULL,NULL,NULL,NULL } },
{ "Test with \\\" escaped quote,nextfield", 2, { "Test with \" escaped quote","nextfield",NULL,NULL,NULL,NULL,NULL,NULL } },
{ "Test with \"\" escaped quote,nextfield", 2, { "Test with \" escaped quote","nextfield",NULL,NULL,NULL,NULL,NULL,NULL } },
+ { "\"Unescaped quote test\",nextfield", 2, { "Unescaped quote test","nextfield",NULL,NULL,NULL,NULL,NULL,NULL } },
{ NULL, 0, { NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL } },
};
Summary of changes:
.../import-export/csv-imp/assistant-csv-trans-import.cpp | 14 +++++++++++++-
gnucash/import-export/csv-imp/test/test-tokenizer.cpp | 1 +
2 files changed, 14 insertions(+), 1 deletion(-)
More information about the gnucash-changes
mailing list