Plasma newbie questions and API fuzzyness (perhaps)
Dmitry Suzdalev
dimsuzkde at gmail.com
Thu Mar 20 19:34:30 CET 2008
Hi, guys!
A few notes as a new plasma API user :)
1. DataEngine::connectAllSources() - for some reason I thought that after in the
applet I do:
m_myEngine->connectAllSources(this)
then I'll get dataUpdated slot called for every source that is changed or *added*.
Nope. I figured out that to accomplish this I need to connect my applet to
sourceAdded slot and then do
void MyApplet::onSourceAdded(QString sourceName)
{
m_myEngine->connectSource(sourceName, this);
kDebug() << "source" << sourceName << "added";
}
Ok, perhaps this need to be mentioned in docs - that connectAllSources connects all
sources that *exist* at the moment when it called. Is it so btw? :) Didn't checked.
2. I wonder why the following code inside the data engine:
void MyDataEngine::someFunction()
{
Plasma::DataEngine::Data notificationData;
id = 1;
// fill data
setData( QString("notification %1").arg(id), notificationData );
kDebug() << "data was set";
}
produces the following output with applet set up as described in 1. (with additional
similar sourceRemoved slot):
NotifierApplet::sourceAdded: source "notification 1" added
NotifierApplet::dataUpdated: source "notification 1" changed
NotifierApplet::sourceRemoved: source "notification 1" removed
NotificationsEngine::notify: data was set
NotifierApplet::dataUpdated: source "notification 1" changed
I.e. added,changed,*removed*,changed
Why it was removed?
I didn't ask to remove it.
I guess I am doing something wrong?
Anyway if I'm doing this, I wasn't told otherwise by docs/API, so I expect it to work
the way I wrote it, so I guess something should be corrected :) Be it API docs or my
brains ;)
Cheers,
Dmitry.
More information about the Panel-devel
mailing list