本文整理汇总了C++中QMimeDatabase::mimeTypeForNameAndData方法的典型用法代码示例。如果您正苦于以下问题:C++ QMimeDatabase::mimeTypeForNameAndData方法的具体用法?C++ QMimeDatabase::mimeTypeForNameAndData怎么用?C++ QMimeDatabase::mimeTypeForNameAndData使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QMimeDatabase
的用法示例。
在下文中一共展示了QMimeDatabase::mimeTypeForNameAndData方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: get
void ProtocolMSITS::get( const QUrl& url )
{
QString htmdata, fileName;
chmUnitInfo ui;
QByteArray buf;
qCDebug(KIO_MITS_LOG) << "kio_msits::get() " << url.path();
if ( !parseLoadAndLookup ( url, fileName ) )
return; // error() has been called by parseLoadAndLookup
qCDebug(KIO_MITS_LOG) << "kio_msits::get: parseLoadAndLookup returned " << fileName;
if ( LCHMUrlFactory::handleFileType( url.path(), htmdata ) )
{
buf = htmdata.toUtf8();
qCDebug(KIO_MITS_LOG) << "Using special handling for image pages: " << htmdata;
}
else
{
if ( isDirectory (fileName) )
{
error( KIO::ERR_IS_DIRECTORY, url.toString() );
return;
}
if ( !ResolveObject ( fileName, &ui) )
{
qCDebug(KIO_MITS_LOG) << "kio_msits::get: could not resolve filename " << fileName;
error( KIO::ERR_DOES_NOT_EXIST, url.toString() );
return;
}
buf.resize( ui.length );
if ( RetrieveObject (&ui, (unsigned char*) buf.data(), 0, ui.length) == 0 )
{
qCDebug(KIO_MITS_LOG) << "kio_msits::get: could not retrieve filename " << fileName;
error( KIO::ERR_NO_CONTENT, url.toString() );
return;
}
}
totalSize( buf.size() );
#if 0 //PORT QT5
QMimeDatabase db;
QMimeType result = db.mimeTypeForNameAndData( fileName, buf );
qCDebug(KIO_MITS_LOG) << "Emitting mimetype " << result.name();
mimeType( result.name() );
#endif
data( buf );
processedSize( buf.size() );
finished();
}