[Kde-pim] KDE 3.5.final?

Ingo Klöcker kloecker at kde.org
Fri Sep 5 19:53:16 BST 2008


On Friday 05 September 2008, Jonathan Marten wrote:
> Ingo Klöcker <kloecker at kde.org> writes:
> > Frankly, the following piece of code looks pretty strange to me.
> >
> > +    KMFolder *folder = account->folder();               // init
> > folder's account list
> > +    if ( folder && !folder->hasAccounts() )
> > +      account->setFolder( folder, true );
> >
> > Why set the folder of an account to the folder it is already set
> > to? The code looks very fragile because it seems to make
> > assumptions about the internals of other classes. I'll need more
> > time to investigate whether this really is the best way to fix the
> > problem.
>
> That was my code.  It works because KMAccount::setFolder has a side
> effect, it calls KMAcctFolder::addAccount which initialises the
> folder's account list (KMFolder::mAcctList). This list is then
> checked in FolderTreeBase::hideLocalInbox (via KMFolder::hasAccounts)
> to decide whether the inbox is to be shown.
>
> Unless this is done, the folder's account list is never initialised
> with the newly created account.

So it would be much cleaner to call KMAcctFolder::addAccount() instead 
of relying on this side effect of KMAccount::setFolder(). See attached 
patch which should be equivalent to your patch without relying on 
KMAccount::setFolder()'s side effect.


Regards,
Ingo
-------------- next part --------------
A non-text attachment was scrubbed...
Name: accountmanager.diff
Type: text/x-diff
Size: 702 bytes
Desc: not available
URL: <http://mail.kde.org/pipermail/kde-pim/attachments/20080905/95c8ebdd/attachment.diff>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 194 bytes
Desc: This is a digitally signed message part.
URL: <http://mail.kde.org/pipermail/kde-pim/attachments/20080905/95c8ebdd/attachment.sig>
-------------- next part --------------
_______________________________________________
KDE PIM mailing list kde-pim at kde.org
https://mail.kde.org/mailman/listinfo/kde-pim
KDE PIM home page at http://pim.kde.org/


More information about the kde-pim mailing list