From: <ste...@us...> - 2011-09-07 13:14:18
|
Revision: 1445 http://moneymanagerex.svn.sourceforge.net/moneymanagerex/?rev=1445&view=rev Author: stef145g Date: 2011-09-07 13:14:09 +0000 (Wed, 07 Sep 2011) Log Message: ----------- Correct QIF Line counting when importing. Modified Paths: -------------- trunk/mmex/src/qifimport.cpp Modified: trunk/mmex/src/qifimport.cpp =================================================================== --- trunk/mmex/src/qifimport.cpp 2011-09-05 13:25:26 UTC (rev 1444) +++ trunk/mmex/src/qifimport.cpp 2011-09-07 13:14:09 UTC (rev 1445) @@ -361,6 +361,15 @@ return dataString; } +wxString getFileLine(wxTextInputStream& textFile, int& lineNumber) +{ + wxString textLine = textFile.ReadLine(); + lineNumber ++; + textLine.Trim(); // remove any trailing spaces + + return textLine; +} + int mmImportQIF(mmCoreDB* core, wxString destinationAccountName ) { wxSQLite3Database* db_ = core->db_.get(); @@ -459,10 +468,7 @@ break; // abort processing } - readLine = text.ReadLine(); - readLine.Trim(); // remove any trailing spaces - - numLines++; + readLine = getFileLine(text, numLines); if (readLine.Length() == 0) continue; @@ -488,7 +494,7 @@ { // account information // Need to read till we get to end of account information - while((readLine = text.ReadLine()) != wxT("^")) + while( (readLine = getFileLine(text, numLines) ) != wxT("^")) { payee = wxT(""); type = wxT(""); @@ -544,9 +550,9 @@ // ignore these type of lines if ( accountType == wxT("Option:AutoSwitch") ) { - while((readLine = text.ReadLine()) != wxT("^")) + while((readLine = getFileLine(text, numLines)) != wxT("^")) { - numLines++; + // ignore all lines } continue; } @@ -561,9 +567,7 @@ bool reading = true; while( reading ) { - readLine = text.ReadLine(); - readLine.Trim(); - numLines++; + readLine = getFileLine(text, numLines); if (readLine == wxT("!Type:Bank")) reading = false; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |