plasma-framework in kdereview
David Edmundson
david at davidedmundson.co.uk
Fri Apr 25 23:22:05 UTC 2014
I don't think we can tap into the parser too easily, we're not using
the ConfigLoaderHandler for actually loading a config; we're just
sharing the XML parser.
It seems there's a very simple option that works.
KConfigSkeleton keeps track of groups already.
If we replace the core of Service::setOperationsScheme with the
following it looks to work.
KSharedConfigPtr config = KSharedConfig::openConfig("/dev/null");
KConfigLoader loader(config, xml);
foreach (KConfigSkeletonItem *item, loader.items()) {
d->operationsMap[item->group()][item->key()] = item->property();
}
I ran plasmaengineexplorer and the UI for the activities service
appeared properly.
The /dev/null is a bit of a hack, I'm required to pass a string so
KSharedConfigPtr can try to share objects properly, but it doesn't get
used.
This is theoretically slower quite a bit slower but in practice a
service won't have so many entries so I don't think it will make a
real difference.
Alternatively we can fork just the ConfigLoaderHandler; we don't need
all of KConfigLoader, this part is only ~300 lines which isn't /too/
bad.
David
More information about the Plasma-devel
mailing list