GNOME Bugzilla – Bug 509089
QIF Import: Duplicates windows shown after Scheme error
Last modified: 2018-06-29 21:59:11 UTC
Please describe the problem: If a Scheme error occurs when the druid calls the qif-to-gnc procedure, the user is taken to an empty duplicate checking window. Steps to reproduce: 1. Cause a scheme error to occur during the qif-to-gnc procedure. For example, edit qif-to-gnc.scm and insert a bad expression such as (qwerty) in the code. 2. Attempt to import a QIF file that wouldn't normally cause an error. Actual results: The user is shown an error message ("An error occurred while importing...") but then taken to an empty (nonsensical) duplicate checking window. Expected results: The druid should quit and return the user to the GnuCash main window. Does this happen every time? Yes. Other information:
Created attachment 104160 [details] [review] Proposed patch Avoiding the duplicates window was trivial. Actually handling the error comprehensively required a lot more work. The existing functionality was that if an error occurred during conversion to GnuCash data structures, a pop-up warning would be shown, but no other action would be taken, and the user was free to go back/forward throughout the druid and retry with possibly corrupted data. This patch includes the following changes: In qif.glade: 1. Added an error page to the druid (see attached screenshot). 2. Added missing keyboard accelerators to three druid buttons ("Load another file", "Unload selected file", and "Select...") druid-qif-import.c: 1. Reorganized and simplified the functions performing conversion and duplicate checking. 2. Centralized the code for choosing the next page after conversion (which had been duplicated in four separate places). 3. Replaced the pop-up error message with the druid's own error page that notifies the user and requires the import to be canceled. 4. Adjusted for consistent formatting within some functions. 5. Added or improved comments for some functions. 6. Fixed an inconsistent return value in get_prev_druid_page.
Created attachment 104161 [details] Screenshot of druid's new error page
Since little mistakes in C can have big consequences (like crashing), I have tested this patch 'til I'm blue in the face. I can't break it. Anyone who'd like to test this further would have my sincere appreciation.
Created attachment 104437 [details] [review] Proposed patch v2 (commenting changes only) This is the same as the first patch except for revisions to commenting style.
Now that 2.2.4 is out of the way, does anyone have any comments for this patch before I commit it?
Committed as r17031 with some additional commenting changes. Awaiting backport for 2.2.
Applied to branches/2.2 as r17098 for GnuCash 2.2.5. Thanks a lot!
GnuCash bug tracking has moved to a new Bugzilla host. This bug has been copied to https://bugs.gnucash.org/show_bug.cgi?id=509089. Please update any external references or bookmarks.