Beispiel #1
0
bool Dialog::isPluginForKCMEnabled(KCModuleInfo *moduleinfo) const
{
    // if the user of this class requested to hide disabled modules
    // we check whether it should be enabled or not
    bool enabled = true;
    kdDebug(700) << "check whether the " << moduleinfo->moduleName() << " KCM should be shown" << endl;
    // for all parent components
    QStringList parentComponents = moduleinfo->service()->property("X-KDE-ParentComponents").toStringList();
    for(QStringList::ConstIterator pcit = parentComponents.begin(); pcit != parentComponents.end(); ++pcit)
    {
        // if the parentComponent is not registered ignore it
        if(d->registeredComponents.find(*pcit) == d->registeredComponents.end())
            continue;

        // we check if the parent component is a plugin
        if(!d->plugininfomap.contains(*pcit))
        {
            // if not the KCModule must be enabled
            enabled = true;
            // we're done for this KCModuleInfo
            break;
        }
        // if it is a plugin we check whether the plugin is enabled
        KPluginInfo *pinfo = d->plugininfomap[*pcit];
        pinfo->load();
        enabled = pinfo->isPluginEnabled();
        kdDebug(700) << "parent " << *pcit << " is " << (enabled ? "enabled" : "disabled") << endl;
        // if it is enabled we're done for this KCModuleInfo
        if(enabled)
            break;
    }
    return enabled;
}
Beispiel #2
0
void KPluginSelectionWidget::load()
{
    // kdDebug( 702 ) << k_funcinfo << endl;

    for(QMap< QCheckListItem *, KPluginInfo * >::Iterator it = d->pluginInfoMap.begin(); it != d->pluginInfoMap.end(); ++it)
    {
        KPluginInfo *info = it.data();
        info->load(d->config);
        it.key()->setOn(info->isPluginEnabled());
        if(d->visible && info == d->currentplugininfo)
            d->currentchecked = info->isPluginEnabled();
    }

    for(QValueList< KCModuleProxy * >::Iterator it = d->modulelist.begin(); it != d->modulelist.end(); ++it)
        if((*it)->changed())
            (*it)->load();

    updateConfigPage();
    // TODO: update changed state
}