[Kmymoney-devel] A Little Puzzle
Thomas Baumgart
thb at net-bembel.de
Tue Nov 22 04:57:22 UTC 2011
Hi,
on Monday 21 November 2011 23:17:38 Allan wrote:
> 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?
A call to slotUpdateActions() is needed whenever a state of the application
changes that has impact on the menu. So it certainly makes sense to add a call
there. It can't harm either.
--
Regards
Thomas Baumgart
GPG-FP: E55E D592 F45F 116B 8429 4F99 9C59 DB40 B75D D3BA
-------------------------------------------------------------
The Unix Guru's View of Sex:
============================
# unzip; strip; touch; finger; mount; fsck; more; yes; umount; sleep
-------------------------------------------------------------
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 225 bytes
Desc: This is a digitally signed message part.
URL: <http://mail.kde.org/pipermail/kmymoney-devel/attachments/20111122/dcc2f55b/attachment.sig>
More information about the KMyMoney-devel
mailing list