Review Request 128511: Major rewrite of CSV Importer part 1

Łukasz Wojniłowicz lukasz.wojnilowicz at gmail.com
Sat Aug 6 11:18:01 UTC 2016


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://git.reviewboard.kde.org/r/128511/
-----------------------------------------------------------

(Updated Aug. 6, 2016, 1:18 p.m.)


Status
------

This change has been marked as submitted.


Review request for KMymoney.


Changes
-------

Submitted with commit 52d62baea894ffe9bae10dd4f416cf6bd0278356 by ?ukasz Wojni?owicz to branch master.


Repository: kmymoney


Description
-------

First diff:

Purpose of displayLine in tableWidget shouldn't differ whether it's
investment or banking statement, so take of responsibilities of parsing
data into columns and creating memo field from displayLine and put them
into separate functions.

In csvdialog.cpp and investprocessing.cpp, I introduced createMemoField (it simplifies memo concatenating and allows to remove some redundant boolean variables), which in both places looks the same. I think it will be easy to move it into csvwizard.cpp after trying to move e.g. readFile there, so that will be next target.

Second diff:

csvdialog.cpp and investprocessing.cpp have methods duplicated, 
complicated and not structured for easy maintenance and development.
Due to this methods and variables were simplified, unified, 
deduplicated and put in main file i.e. csvwizard.cpp
New/rewritten methods:
    "readfile" - loads file into buffer and gets its boundaries
    "displayLines" - for displaying lines from buffer in table
    "getMaxColumnCount" - for detecting field delimiter
    "validateDateFormat" - for validating date
    "createMemoField" - for creating memo out of copied columns
    "startLineChanged" - moved to csvwizard.cpp
    "endLineChanged" - moved to csvwizard.cpp
    "dateFormatSelected" - moved to csvwizard.cpp
    "readSettings" - for reading settings and setting variables only
    
Sorry for this patch for being so big, but changing something in CSV importer code was kind of domino effect. The code is so unstructured that it makes no sense making it step by step, so I was editing obviously wrong code on the spot. I decided to publish it now because all began to work on new codepath. 
I think the next step could be rewriting parsers for investment and banking lines which look very obfuscated to me.


Diffs
-----

  kmymoney/plugins/csvimport/completionwizardpage.ui ddc064b 
  kmymoney/plugins/csvimport/csvdialog.h 69cca6e 
  kmymoney/plugins/csvimport/csvdialog.cpp fa70b04 
  kmymoney/plugins/csvimport/csvutil.h e27199b 
  kmymoney/plugins/csvimport/csvutil.cpp 9c0929d 
  kmymoney/plugins/csvimport/csvwizard.h 28eea62 
  kmymoney/plugins/csvimport/csvwizard.cpp 7aee196 
  kmymoney/plugins/csvimport/investmentdlg.cpp b68da8e 
  kmymoney/plugins/csvimport/investprocessing.h 38f622c 
  kmymoney/plugins/csvimport/investprocessing.cpp 328a79b 
  kmymoney/plugins/csvimport/lines-datewizardpage.ui d844da5 

Diff: https://git.reviewboard.kde.org/r/128511/diff/


Testing
-------

Banking and investment statement CSV imports; with and without setup.


Thanks,

Łukasz Wojniłowicz

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kmymoney-devel/attachments/20160806/d6b6acfb/attachment.html>


More information about the KMyMoney-devel mailing list