[Kmymoney-devel] A Little Puzzle

Allan agander93 at gmail.com
Mon Nov 21 22:17:38 UTC 2011


On 21/11/11 20:53, Thomas Baumgart wrote:
> Hi,
>
> on Friday 18 November 2011 00:49:21 Allan wrote:
>
>> I've noticed when using the csvplugin - either the stable or the git
>> version - that when a file has been imported, the File/Import and the
>> File/Export items are all disabled.
>>
>> Selecting main menu entries works but doesn't correct the problem.  What
>> does re-enable them is selecting a ledger entry or one of the icons in
>> the left pane.
>>
>> The File/Import/Csvplugin menu item is disabled by design and does get
>> re-enabled, as it should, when the plugin is closed.  Whether or not it
>> has been closed, has no effect on the issue.  I can't try ofx or gnucash
>> import.
>>
>> Please, can anyone shed any light on this?
>
> Take a look at KMyMoneyApp::slotUpdateActions(void) which contains
>
>    bool importRunning = (d->m_qifReader != 0) || (d->m_smtReader != 0);
>    action("file_export_qif")->setEnabled(fileOpen&&  !importRunning);
>    action("file_import_qif")->setEnabled(fileOpen&&  !importRunning);
>    action("file_import_gnc")->setEnabled(!importRunning);
>    action("file_import_template")->setEnabled(fileOpen&&  !importRunning);
>    action("file_export_template")->setEnabled(fileOpen&&  !importRunning);
>
> so there must be a leftover qifReader or smtReader when your plugin finishes.
> Does slotUpdateActions gets called when the plugin finishes at all? That could
> also be a cause.
>
> Hope this gives you a start.

Hi Thomas

Yes, thanks for that.  The plugin stays open

The file menu items are enabled up to the actual start of the import.
The last time KMyMoneyApp::slotUpdateActions() is called, d->m_smtReader 
is non-zero.  It doesn't get reset in slotStatementImport() until after 
that :-

Processing transactions done (testG)
5880 KMM d->m_smtReader MyMoneyStatementReader(0xa59e780)
5881 KMM fileOpen true
Importing statement for 'testG' done
2312 slotStatementImport true
2319 slotStatementImportd->m_smtReader  QObject(0x0)

It looked like another call to slotUpdateActions() was needed, so I 
added one at the end of KMyMoneyApp::slotStatementImport, and that seems 
to do the trick.

What do you think?

Allan


More information about the KMyMoney-devel mailing list