The old code directly accessed a member variable of GtkEntry. This
direct access is no longer possible, but there is no public function
to get/set this variable. There is a private one used by
GtkComboBox internally) but it's not exported so it can't be used either.
As an interim solution I peeked at how hesiod handled it in his earlier
(unmerged) gtk3 branch. He replaced this private access with setting
gtk_widget_set_visible, something I wouldn't have considered in this
situation. The issue is in the register2 code, so for now it's not
too important. We can investigate this more when the register rewrite
is picked up again.
The keyfile that stores the settings won't accept '[' and ']' as settingss names,
so this commit will prevent the user from entering these characters. They are
automatically replaced with the valid '(' and ')' characters.
In addition any attempt to save settings with an invalid name via a code path
bypassing the gui will be refused.
In this form not all data needs reparsing when a single column
changes. The drawback is it makes the code slightly more complicated
because accounts can only be verified after the account match page
has completed, while most columns are set on the preview page.
With the preview page blocking as long as there are (unskipped) errors
there is no need any more for the assistant to go back from the documentation
page to the preview page in case of errors - the documentation page
can only be reached if all required data is valid.
This required some additional tweaks to other functions that were
written to be called twice in TxImport and no longer will be.
- Not all possible issues were reported to the user.
- Report column conflicts above the table, and line issues in the first column of the line having the issue
- m_ prefix all member variables
- delay variable declarations until actually needed
- use auto where possible for variable declarations
- use standard c(++) types and constants where possible
- rename variables and functions to be more consistent
- set gui callbacks as much as possible in the glade file
- drop unused parameters
- Store importer settings in a separate object inside the CsvTxImport
- make CsvTxImport responsible for maintaining a consistent settings state
- reduce the assistant's responsability to passing settings changes to CsvTxImport and
visual display. It no longer does validation
- Refine the gui some more
- make the CsvTxImport class responsible for the check
- guide the user with suggestions rather than have the user click through to the next page to find out things weren't set up properly
- move all gtk related stuff to the assistant code
- move all checks to the settings object, the assistant should query that
- handle sensitivity of the save and delete button more intelligently
The context being either multi-split or two-split. There's no use
in selecting a Transaction ID column in two-split mode for example.
Similarly none of the 'Transfer xzy' types will be used in
multi-split mode.
In its current state it will only work for a very restricted context.
However there's no code to validate this context so the importer will
happily produce wrong results in all other contexts.
A query on the mailing list didn't return any interest in this feature
so instead of fixing it I'd rather drop it to keep the code clean.
A detail worth noting: contrary to most other date fields
an empty value for a reconcile date is allowed if the reconcile
field is not set to 'y' (reconciled).
At the same time drop the exception handling for the num for action setting.
The importer can't possibly get this right automatically in all cases. It's
now up to the user to assign the right columns to the correct properties
based on how he/she wants gnucash to store it internally.
Additionally use g_key_file_[gs]_<type>_list to store and retrieve coltypes and colwidths
instead of storing/retrieving a raw string to parse afterwards
The returned values in case of an error from the g_key_file_get* are
the correct defaults in most cases already.
In addition:
- Reduce number of temporary variables
- Fix a memory leak while testing the saved data
This was still pulled in via the now removed gnc-csv-model.
In order to remove this, the fixed format csv importer
has been tweaked to get the required features from
the c++ csv importer code instead.
Dereferencing an iterator and then assigning it to another variable
apparently copies the object the iterator points at, instead
of making a reference to it. C++ beginner mistakes...
Also do the multi-split parent dance before handling errors. Otherwise
child lines would be mistakenly added to the first working parent split
instead of also being skipped until the parent is fixed.
- The preview part should be less chaotic now. It already has an option for future multi-split
import functionality, but that's not used yet
- rename a few variables
- change semantics on start/end lines; this is now communicated in number of lines to skip
- avoid a couple of double value storing (once in the assistant object and onece in the import object)
- improve comments
- improve variable and function names (to be more concise and to the point
- use 'Transfer Account' instead of 'Other Account' as that's the term used in the rest of gnucash
The overly complex templated class hierarchy is replaced
with two simple classes. One to keep the discovered transaction
properties and one for the discovered split properties. Make
both classes responsible for verifying it's state and creating
the necessary objects.
- Use CamelCase for type definitions and _ for function names
- m_ for member variables
- avoid typedef (not needed for structs, replace by using for aliases)
- use std::string for composing strings
- fix condition part in for loop (can't use , need &&)
- markup comment for doxygen inclusion
The class was still called after the original struct in c and the file
had an almost ok name from when I started the conversion.
Add some usage information to the class as well.
- Use a more logical grouping for setting up liststores and columns
- Use one common store for all the header line's combo box entries
- Store column number in each combo box entry for later retrieval
- prefer c++ data types (auto, bool, int, std::string)
- iterate over vectors instead of accessing via the [] operator
- use boost::{u32}regex instead of directly manipulating a c-string
This required moving around a few other parameters
- currency_format and date_format will now be passed directly to the function that needs it
- Account is converted into a trans_prop just like all the other columns the user had selected
As per recommendation 10 in Meyer's Effective Modern C++
This also means the string array with column type names
can no longer be shared between c and c++ code, so
set up a separate one in c++
- use iterators to loop and std::find
This allows us to use 'continue' on the loop in case
of errors instead of using an ever more indenting if/else
- Use auto where possible
- Use constant iterators where possible