[Kde-pim] AgentBase::Observer behaviour

Volker Krause vkrause at kde.org
Mon May 12 16:00:20 BST 2008


On Thursday 08 May 2008 23:38:57 Dmitry Ivanov wrote:
> Hi,
>
> I was playing with krss and AgentBase::Observer::collectionAdded(),
> collectionChanged(), collectionRemoved() and ran into a problem.
>
> The problem is twofold:
>
> 1. By default the resource is online. When I add a new collection
> via akonadiconsole the resource (krss) gets notification, but in
> collectionAdded(Collection col, Collection parent) I see 'col' and
> 'parent' have only 'id' set, 'name' and 'remoteId' (for 'parent' only)
> are empty.
>
> If I explicitly call setOnline(true) from inside the resource the
> properties of 'col' and 'parent' I receive in collectionAdded()
> are set correctly.
>
> So I had a look at what setOnline() does:
>
> void AgentBase::setOnline( bool state )
> {
>   Q_D( AgentBase );
>   d->mOnline = state;
>   d->mSettings->setValue( QLatin1String( "Agent/Online" ), state );
>   d->mMonitor->fetchCollection( state );

^^ that's wrong and should be removed, changing the online state should not 
change the change recorder configuration.

>   // TODO: d->monitor->fetchItemData( state );
> }
>
> It turned out that by default 'mOnline' is set to 'true' but
> 'fetchCollection' is set to 'false' in 'mMonitor'. That's why the
> resource gets notifications but the collections are empty. Only
> calling setOnline(true) explicitly helps

The amount of data fetched by the monitor should be configured by the 
resource, eg:
changeRecorder()->fetchCollection( true );

> 2. If I put the resource offline I _still_ receive notifications
> and 'col' and 'parent' are empty (only 'id' is set). Isn't
> ChangeRecorder supposed to intercept the notification messages and
> save them when the resource is offline? Maybe AgentBase::setOnline()
> misses a call to mMonitor->setChangeRecordingEnabled() ?

Right, that call is apparently missing there.

regards
Volker
-------------- 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/20080512/d0d7a86b/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