本文整理汇总了C++中kmimetype::Ptr::offset方法的典型用法代码示例。如果您正苦于以下问题:C++ Ptr::offset方法的具体用法?C++ Ptr::offset怎么用?C++ Ptr::offset使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类kmimetype::Ptr
的用法示例。
在下文中一共展示了Ptr::offset方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: offers
KService::List KServiceType::offers(const QString &_servicetype)
{
QDict< KService > dict(53);
KService::List lst;
// Services associated directly with this servicetype (the normal case)
KServiceType::Ptr serv = KServiceTypeFactory::self()->findServiceTypeByName(_servicetype);
if(serv)
addUnique(lst, dict, KServiceFactory::self()->offers(serv->offset()), false);
else
kdWarning(7009) << "KServiceType::offers : servicetype " << _servicetype << " not found" << endl;
// Find services associated with any mimetype parents. e.g. text/x-java -> text/plain
KMimeType::Ptr mime = dynamic_cast< KMimeType * >(static_cast< KServiceType * >(serv));
bool isAMimeType = (mime != 0);
if(mime)
{
while(true)
{
QString parent = mime->parentMimeType();
if(parent.isEmpty())
break;
mime = dynamic_cast< KMimeType * >(KServiceTypeFactory::self()->findServiceTypeByName(parent));
if(!mime)
break;
addUnique(lst, dict, KServiceFactory::self()->offers(mime->offset()), false);
}
}
serv = mime = 0;
// QValueListIterator<KService::Ptr> it = lst.begin();
// for( ; it != lst.end(); ++it )
// kdDebug() << (*it).data() << " " << (*it)->name() << endl;
// Support for all/* is deactivated by KServiceTypeProfile::configurationMode()
// (and makes no sense when querying for an "all" servicetype itself
// nor for non-mimetypes service types)
if(!KServiceTypeProfile::configurationMode() && isAMimeType && _servicetype.left(4) != "all/")
{
// Support for services associated with "all"
KServiceType *servAll = KServiceTypeFactory::self()->findServiceTypeByName("all/all");
if(servAll)
{
addUnique(lst, dict, KServiceFactory::self()->offers(servAll->offset()), true);
}
else
kdWarning(7009) << "KServiceType::offers : servicetype all/all not found" << endl;
delete servAll;
// Support for services associated with "allfiles"
if(_servicetype != "inode/directory" && _servicetype != "inode/directory-locked")
{
KServiceType *servAllFiles = KServiceTypeFactory::self()->findServiceTypeByName("all/allfiles");
if(servAllFiles)
{
addUnique(lst, dict, KServiceFactory::self()->offers(servAllFiles->offset()), true);
}
else
kdWarning(7009) << "KServiceType::offers : servicetype all/allfiles not found" << endl;
delete servAllFiles;
}
}
return lst;
}