[Kde-pim] AgentBase::Observer behaviour

Dmitry Ivanov vonami at gmail.com
Thu May 8 22:38:57 BST 2008


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 );
  // 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.


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() ?

These issues look like bugs to me. Or am I missing something?

Best,
  Dmitry

-- 
A: Because it destroys the flow of the conversation
Q: Why is top-posting bad?
_______________________________________________
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