Exemplo n.º 1
0
// Scans for plugins and stores the information for them in "pluginInfo"
static void scanPlugins() {
    KST::PluginInfoList tmpList;

    KstDebug::self()->log(i18n("Scanning for data-source plugins."));

    KService::List sl = KServiceType::offers("Kst Data Source");
    for (KService::List::ConstIterator it = sl.begin(); it != sl.end(); ++it) {
        for (KST::PluginInfoList::ConstIterator i2 = pluginInfo.begin(); i2 != pluginInfo.end(); ++i2) {
            if ((*i2)->service == *it) {
                tmpList.append(*i2);
                continue;
            }
        }

        KstSharedPtr<KST::Plugin> p = new KST::Plugin(*it);
        tmpList.append(p);
    }

    // This cleans up plugins that have been uninstalled and adds in new ones.
    // Since it is a shared pointer it can't dangle anywhere.
    pluginInfo = tmpList;
}