Commit 4a71603a authored by Pino Toscano's avatar Pino Toscano

take the list of the supported mimetypes from the kpart .desktop, as they...

take the list of the supported mimetypes from the kpart .desktop, as they contain more mimetypes (including the compressed versions)
[the compressed versions are not in the "generator" .desktop files because okular can deal natively with any gzip- or bzip2- compressed version of the supported document types]

svn path=/trunk/KDE/kdegraphics/okular/; revision=755661
parent d1b4c8ae
......@@ -2544,15 +2544,16 @@ QStringList Document::supportedMimeTypes() const
if ( !d->m_supportedMimeTypes.isEmpty() )
return d->m_supportedMimeTypes;
QString constraint( "([X-KDE-Priority] > 0) and (exist Library)" );
KService::List offers = KServiceTypeTrader::self()->query( "okular/Generator", constraint );
QString constraint( "(Library == 'okularpart')" );
QLatin1String basePartService( "KParts/ReadOnlyPart" );
KService::List offers = KServiceTypeTrader::self()->query( basePartService, constraint );
KService::List::ConstIterator it = offers.begin(), itEnd = offers.end();
for ( ; it != itEnd; ++it )
{
KService::Ptr service = *it;
QStringList mimeTypes = service->serviceTypes();
foreach ( const QString& mimeType, mimeTypes )
if ( !mimeType.contains( "okular" ) )
if ( mimeType != basePartService )
d->m_supportedMimeTypes.append( mimeType );
}
......
......@@ -197,27 +197,19 @@ void Shell::readProperties(const KConfigGroup &group)
QStringList Shell::fileFormats() const
{
QString constraint("([X-KDE-Priority] > 0) and (exist Library) ") ;
KService::List offers = KServiceTypeTrader::self()->query("okular/Generator",constraint);
QStringList supportedPatterns;
if (offers.isEmpty())
QString constraint( "(Library == 'okularpart')" );
QLatin1String basePartService( "KParts/ReadOnlyPart" );
KService::List offers = KServiceTypeTrader::self()->query( basePartService, constraint );
KService::List::ConstIterator it = offers.begin(), itEnd = offers.end();
for ( ; it != itEnd; ++it )
{
return supportedPatterns;
}
KService::List::ConstIterator iterator = offers.begin();
KService::List::ConstIterator end = offers.end();
for (; iterator != end; ++iterator)
{
QStringList mimeTypes = (*iterator)->serviceTypes();
foreach (const QString& mimeType, mimeTypes )
{
if ( !mimeType.contains( "okular" ) )
{
KService::Ptr service = *it;
QStringList mimeTypes = service->serviceTypes();
foreach ( const QString& mimeType, mimeTypes )
if ( mimeType != basePartService )
supportedPatterns.append( mimeType );
}
}
}
return supportedPatterns;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment