mirror of
https://invent.kde.org/graphics/okular
synced 2024-10-28 19:28:38 +00:00
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
This commit is contained in:
parent
d1b4c8ae17
commit
4a71603ab6
2 changed files with 13 additions and 20 deletions
|
@ -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;
|
||||
|
|
Loading…
Reference in a new issue