Exemplo n.º 1
0
KServiceType * KServiceTypeFactory::findServiceTypeByName(const TQString &_name)
{
   if (!m_sycocaDict) return 0L; // Error!
   assert (!KSycoca::self()->isBuilding());
   int offset = m_sycocaDict->find_string( _name );
   if (!offset) return 0; // Not found
   KServiceType * newServiceType = createEntry(offset);

   // Check whether the dictionary was right.
   if (newServiceType && (newServiceType->name() != _name))
   {
     // No it wasn't...
     delete newServiceType;
     newServiceType = 0; // Not found
   }
   return newServiceType;
}
Exemplo n.º 2
0
void
KBuildServiceTypeFactory::addEntry(KSycocaEntry *newEntry, const char *resource)
{
   KServiceType * serviceType = (KServiceType *) newEntry;
   if ( (*m_entryDict)[ newEntry->name() ] )
   {
     // Already exists
     if (serviceType->desktopEntryPath().endsWith("kdelnk"))
        return; // Skip

     // Replace
     KSycocaFactory::removeEntry(newEntry);
   }
   KSycocaFactory::addEntry(newEntry, resource);


   const TQMap<TQString,TQVariant::Type>& pd = serviceType->propertyDefs();
   TQMap<TQString,TQVariant::Type>::ConstIterator pit = pd.begin();
   for( ; pit != pd.end(); ++pit )
   {
     if (!m_propertyTypeDict.contains(pit.key()))
       m_propertyTypeDict.insert(pit.key(), pit.data());
     else if (m_propertyTypeDict[pit.key()] != pit.data())
       kdWarning(7021) << "Property '"<< pit.key() << "' is defined multiple times ("<< serviceType->name() <<")" <<endl;
   }
}