[Kmymoney-devel] KMyMoney - Mutable?

Allan agander93 at gmail.com
Thu Jan 3 23:07:49 UTC 2013


I'm in the process of modifying the CSV plugin to behave in a similar 
way to QIF import, in that if it has the account ID, it will avoid the 
need for the user to select an account for the import each time. As it 
has profiles, the account name/ID can be retained.

I've written a very basic account selector for first-run use, and the 
account name/ID are saved.  Next time, the account ID is available and 
mymoneystatementreader.cpp does not need to show its account selector. 
Should the user wish to select a different account, he may do so. 
However, what if the user wishes to create a new account?  As my new 
selector is very basic, it has no creation capability, but relies 
instead on mymoneystatementreader.cpp to do the necessary.  So far, so good.

This leaves outstanding the issue of saving the newly created account 
details.  I had assumed that I could get the details from the statement 
after the import returns.  Unfortunately, I cannot add the necessary 
detail to the statement in mymoneystatementreader.cpp, because the 
statement is a const.

Whilst I can extract the necessary by comparing accounts before and 
after, to find the new account, this seems a bit clumsy.

What I've tried instead is adding the 'mutable' keyword to
QString m_strAccountName in mymoneystatement.h, and this works as 
expected, at least so far as my current testing and requirement is 
concerned.  However, for one thing, I've never used 'mutable' before and 
would appreciate guidance on whether or not this is acceptable or 
deplorable, or absolutely a NO NO!

Thanks

Allan




More information about the KMyMoney-devel mailing list