[Kmymoney-devel] Some experimentd trying to move loading methods out of the GUI

Cristian Oneţ onet.cristian at gmail.com
Mon Oct 19 20:14:05 CEST 2009


În data de Luni 19 Octombrie 2009 20:38:16 Michaël Lhomme a scris:
> Hello,
> 
> as I already discussed a bit with Thomas and Alvaro, I'm working on an
> Akonadi resource to display schedules as todos. The most difficult part was
> to use existing loading methods (in kmymoneyview) without loading the KMM
> GUI.
> 
> The solution I chose is to create a small class dedicated on data loading.
>  I extracted the main method KMyMoneyView::readFile and related methods
>  (checkAccountName, loadDefaultCurrency, loadDefaultCurrencies,
> loadAncientCurrency, loadAncientCurrencies and ungetString). Then I
>  replaced every "messagebox" and "return false" statements by exceptions.
>  This made the trick for the compilation.
> 
> The next problem was linkage : KGncReader depends on various dialogs,
> depending themselves on other part of the application, and so on. Finally I
> ended up including every KMM libs, and declaring a main pointer to the
> application in my resource (KMyMoney2App* kmymoney2). It's working but it's
> really ugly ;)
> 
> And voila, I hope my experience could help.
> 
> Regards,
> 
> Michaël Lhomme
> 
Altough I haven't tried doing it, at a quick look, I think that a kmymoney file 
can be loaded by using only the objects in libkmm_mymoney which is only linked 
against kde and qt libs. You don't need to add the UI as a dependency as long 
as you use only the objects in libkmm_mymoney. The icalendar plugin which does 
the same thing as the akonadi resource you are talking about uses only those 
objects and it has a dependecy only on libkmm_mymoney. It's true that it has 
access to an already loaded kmymoney file but I think thet loading and saving 
can be done without introducing the UI as a dependecy. Please point me to the 
part that pulls the UI with it because in the functions pointed by you I can't 
find such code (only the readFile function but that part can be dropped in the 
case of the Akonadi resource).

Altough I would agree that an engine object that takes care of loading/saving 
the kmymoney file would be welcomed in libkmm_mymoney.

-- 
Regards,

Cristian Oneţ
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: This is a digitally signed message part.
Url : http://mail.kde.org/pipermail/kmymoney-devel/attachments/20091019/4badc564/attachment.sig 


More information about the KMyMoney-devel mailing list