Ejemplo n.º 1
0
bool KServiceType::inherits(const QString &servTypeName) const
{
    if(name() == servTypeName)
        return true;
    QString st = parentServiceType();
    while(!st.isEmpty())
    {
        KServiceType::Ptr ptr = KServiceType::serviceType(st);
        if(!ptr)
            return false; // error
        if(ptr->name() == servTypeName)
            return true;
        st = ptr->parentServiceType();
    }
    return false;
}
Ejemplo n.º 2
0
void
KBuildServiceTypeFactory::addEntry(const KSycocaEntry::Ptr& newEntry)
{
    KSycocaFactory::addEntry(newEntry);

    KServiceType::Ptr serviceType = KServiceType::Ptr::staticCast( newEntry );

    const QMap<QString,QVariant::Type>& pd = serviceType->propertyDefs();
    QMap<QString,QVariant::Type>::ConstIterator pit = pd.begin();
    for( ; pit != pd.end(); ++pit ) {
        const QString property = pit.key();
        QMap<QString, int>::iterator dictit = m_propertyTypeDict.find(property);
        if (dictit == m_propertyTypeDict.end())
            m_propertyTypeDict.insert(property, pit.value());
        else if (*dictit != static_cast<int>(pit.value()))
            kWarning(7021) << "Property '"<< property << "' is defined multiple times ("<< serviceType->name() <<")";
    }
}