本文整理汇总了C++中kmimetype::Ptr::property方法的典型用法代码示例。如果您正苦于以下问题:C++ Ptr::property方法的具体用法?C++ Ptr::property怎么用?C++ Ptr::property使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类kmimetype::Ptr
的用法示例。
在下文中一共展示了Ptr::property方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: createAudioPreview
KPreviewWidgetBase * KFileMetaPreview::previewProviderFor( const TQString& mimeType )
{
// tqDebug("### looking for: %s", mimeType.latin1());
// often the first highlighted item, where we can be sure, there is no plugin
// (this "folders reflect icons" is a konq-specific thing, right?)
if ( mimeType == "inode/directory" )
return 0L;
KPreviewWidgetBase *provider = m_previewProviders.find( mimeType );
if ( provider )
return provider;
//tqDebug("#### didn't find anything for: %s", mimeType.latin1());
if ( s_tryAudioPreview &&
!mimeType.startsWith("text/") && !mimeType.startsWith("image/") )
{
if ( !haveAudioPreview )
{
KPreviewWidgetBase *audioPreview = createAudioPreview( m_stack );
if ( audioPreview )
{
haveAudioPreview = true;
(void) m_stack->addWidget( audioPreview );
TQStringList mimeTypes = audioPreview->supportedMimeTypes();
TQStringList::ConstIterator it = mimeTypes.begin();
for ( ; it != mimeTypes.end(); ++it )
m_previewProviders.insert( *it, audioPreview );
}
}
}
// with the new mimetypes from the audio-preview, try again
provider = m_previewProviders.find( mimeType );
if ( provider )
return provider;
// ### mimetype may be image/* for example, try that
int index = mimeType.find( '/' );
if ( index > 0 )
{
provider = m_previewProviders.find( mimeType.left( index + 1 ) + "*" );
if ( provider )
return provider;
}
KMimeType::Ptr mimeInfo = KMimeType::mimeType( mimeType );
if ( mimeInfo )
{
// check mime type inheritance
TQString parentMimeType = mimeInfo->parentMimeType();
while ( !parentMimeType.isEmpty() )
{
provider = m_previewProviders.find( parentMimeType );
if ( provider )
return provider;
KMimeType::Ptr parentMimeInfo = KMimeType::mimeType( parentMimeType );
if ( !parentMimeInfo ) break;
parentMimeType = parentMimeInfo->parentMimeType();
}
// check X-TDE-Text property
TQVariant textProperty = mimeInfo->property( "X-TDE-text" );
if ( textProperty.isValid() && textProperty.type() == TQVariant::Bool )
{
if ( textProperty.toBool() )
{
provider = m_previewProviders.find( "text/plain" );
if ( provider )
return provider;
provider = m_previewProviders.find( "text/*" );
if ( provider )
return provider;
}
}
}
return 0L;
}
示例2: startPreview
void PreviewJob::startPreview()
{
// Load the list of plugins to determine which mimetypes are supported
TDETrader::OfferList plugins = TDETrader::self()->query("ThumbCreator");
TQMap<TQString, KService::Ptr> mimeMap;
for (TDETrader::OfferList::ConstIterator it = plugins.begin(); it != plugins.end(); ++it)
if (!d->enabledPlugins || d->enabledPlugins->contains((*it)->desktopEntryName()))
{
TQStringList mimeTypes = (*it)->property("MimeTypes").toStringList();
for (TQStringList::ConstIterator mt = mimeTypes.begin(); mt != mimeTypes.end(); ++mt)
mimeMap.insert(*mt, *it);
}
// Look for images and store the items in our todo list :)
bool bNeedCache = false;
for (KFileItemListIterator it(d->initialItems); it.current(); ++it )
{
PreviewItem item;
item.item = it.current();
TQMap<TQString, KService::Ptr>::ConstIterator plugin = mimeMap.find(it.current()->mimetype());
if (plugin == mimeMap.end()
&& (it.current()->mimetype() != "application/x-desktop")
&& (it.current()->mimetype() != "media/builtin-mydocuments")
&& (it.current()->mimetype() != "media/builtin-mycomputer")
&& (it.current()->mimetype() != "media/builtin-mynetworkplaces")
&& (it.current()->mimetype() != "media/builtin-printers")
&& (it.current()->mimetype() != "media/builtin-trash")
&& (it.current()->mimetype() != "media/builtin-webbrowser"))
{
TQString mimeType = it.current()->mimetype();
plugin = mimeMap.find(mimeType.replace(TQRegExp("/.*"), "/*"));
if (plugin == mimeMap.end())
{
// check mime type inheritance
KMimeType::Ptr mimeInfo = KMimeType::mimeType(it.current()->mimetype());
TQString parentMimeType = mimeInfo->parentMimeType();
while (!parentMimeType.isEmpty())
{
plugin = mimeMap.find(parentMimeType);
if (plugin != mimeMap.end()) break;
KMimeType::Ptr parentMimeInfo = KMimeType::mimeType(parentMimeType);
if (!parentMimeInfo) break;
parentMimeType = parentMimeInfo->parentMimeType();
}
}
if (plugin == mimeMap.end())
{
// check X-TDE-Text property
KMimeType::Ptr mimeInfo = KMimeType::mimeType(it.current()->mimetype());
TQVariant textProperty = mimeInfo->property("X-TDE-text");
if (textProperty.isValid() && textProperty.type() == TQVariant::Bool)
{
if (textProperty.toBool())
{
plugin = mimeMap.find("text/plain");
if (plugin == mimeMap.end())
{
plugin = mimeMap.find( "text/*" );
}
}
}
}
}
if (plugin != mimeMap.end())
{
item.plugin = *plugin;
d->items.append(item);
if (!bNeedCache && d->bSave &&
(it.current()->url().protocol() != "file" ||
!it.current()->url().directory( false ).startsWith(d->thumbRoot)) &&
(*plugin)->property("CacheThumbnail").toBool())
bNeedCache = true;
}
else
{
emitFailed(it.current());
if (d->deleteItems)
delete it.current();
}
}
// Read configuration value for the maximum allowed size
TDEConfig * config = TDEGlobal::config();
TDEConfigGroupSaver cgs( config, "PreviewSettings" );
d->maximumSize = config->readNumEntry( "MaximumSize", 1024*1024 /* 1MB */ );
if (bNeedCache)
{
if (d->width <= 128 && d->height <= 128) d->cacheWidth = d->cacheHeight = 128;
else d->cacheWidth = d->cacheHeight = 256;
d->thumbPath = d->thumbRoot + (d->cacheWidth == 128 ? "normal/" : "large/");
TDEStandardDirs::makeDir(d->thumbPath, 0700);
}
else
//.........这里部分代码省略.........