Commit c998bb40 authored by Nicolas Fella's avatar Nicolas Fella
Browse files

Port away from KMimeTypeTrader

It is about to be deprecated

See https://phabricator.kde.org/T12177
parent 6b1c5c1c
......@@ -30,7 +30,7 @@
#include <KIO/ApplicationLauncherJob>
#include <KLocalizedString>
#include <KMimeTypeTrader>
#include <KApplicationTrader>
#include <KNotificationJobUiDelegate>
#include <KPropertiesDialog>
#include <KProtocolInfo>
......@@ -91,7 +91,7 @@ QVariantList createActionListForFileItem(const KFileItem &fileItem)
{
QVariantList list;
KService::List services = KMimeTypeTrader::self()->query(fileItem.mimetype(), QStringLiteral("Application"));
KService::List services = KApplicationTrader::queryByMimeType(fileItem.mimetype());
if (!services.isEmpty()) {
list << createTitleActionItem(i18n("Open with:"));
......@@ -370,7 +370,7 @@ QVariantList appstreamActions(const KService::Ptr &service)
QVariantList ret;
#ifdef HAVE_APPSTREAMQT
const KService::Ptr appStreamHandler = KMimeTypeTrader::self()->preferredService(QStringLiteral("x-scheme-handler/appstream"));
const KService::Ptr appStreamHandler = KApplicationTrader::preferredService(QStringLiteral("x-scheme-handler/appstream"));
// Don't show action if we can't find any app to handle appstream:// URLs.
if (!appStreamHandler) {
......
......@@ -38,7 +38,7 @@
#include <KJob>
#include <KIO/ApplicationLauncherJob>
#include <KLocalizedString>
#include <KMimeTypeTrader>
#include <KApplicationTrader>
#include <KNotificationJobUiDelegate>
#include <KRun>
#include <KSycoca>
......@@ -273,7 +273,7 @@ KService::Ptr AppEntry::defaultAppByName(const QString& name)
QString browser = config.readPathEntry("BrowserApplication", QString());
if (browser.isEmpty()) {
return KMimeTypeTrader::self()->preferredService(QLatin1String("text/html"));
return KApplicationTrader::preferredService(QLatin1String("text/html"));
} else if (browser.startsWith(QLatin1Char('!'))) {
browser.remove(0, 1);
}
......
......@@ -39,7 +39,6 @@
#include <KFileItem>
#include <KIO/ApplicationLauncherJob>
#include <KLocalizedString>
#include <KMimeTypeTrader>
#include <KNotificationJobUiDelegate>
#include <KRun>
#include <KService>
......
......@@ -35,7 +35,7 @@
#include <KNotificationJobUiDelegate>
#include <KService>
#include <KStringHandler>
#include <KMimeTypeTrader>
#include <KApplicationTrader>
#include <KWindowSystem>
#include "klippersettings.h"
......@@ -146,7 +146,7 @@ void URLGrabber::matchingMimeActions(const QString& clipData)
}
if ( !mimetype.isDefault() ) {
KService::List lst = KMimeTypeTrader::self()->query( mimetype.name(), QStringLiteral("Application") );
KService::List lst = KApplicationTrader::queryByMimeType(mimetype.name());
if ( !lst.isEmpty() ) {
ClipAction* action = new ClipAction( QString(), mimetype.comment() );
foreach( const KService::Ptr &service, lst ) {
......
......@@ -26,7 +26,7 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
#include <KDesktopFile>
#include <kemailsettings.h>
#include <KFileItem>
#include <KMimeTypeTrader>
#include <KApplicationTrader>
#include <KNotificationJobUiDelegate>
#include <KRun>
#include <KServiceTypeTrader>
......@@ -648,7 +648,7 @@ QString defaultApplication(const QUrl &url)
QString browserApp = config.readPathEntry("BrowserApplication", QString());
if (browserApp.isEmpty()) {
const KService::Ptr htmlApp = KMimeTypeTrader::self()->preferredService(QStringLiteral("text/html"));
const KService::Ptr htmlApp = KApplicationTrader::preferredService(QStringLiteral("text/html"));
if (htmlApp) {
browserApp = htmlApp->storageId();
......@@ -663,12 +663,12 @@ QString defaultApplication(const QUrl &url)
return confGroup.readPathEntry("TerminalApplication", QStringLiteral("konsole"));
} else if (application.compare(QLatin1String("filemanager"), Qt::CaseInsensitive) == 0) {
KService::Ptr service = KMimeTypeTrader::self()->preferredService(QStringLiteral("inode/directory"));
KService::Ptr service = KApplicationTrader::preferredService(QStringLiteral("inode/directory"));
if (service) {
return service->storageId();
}
} else if (KService::Ptr service = KMimeTypeTrader::self()->preferredService(application)) {
} else if (KService::Ptr service = KApplicationTrader::preferredService(application)) {
return service->storageId();
} else {
// Try the files in share/apps/kcm_componentchooser/*.desktop.
......
......@@ -29,7 +29,7 @@
#include <QDesktopServices>
#include <KLocalizedString>
#include <KMimeTypeTrader>
#include <KApplicationTrader>
#include <KSharedConfig>
#include "bookmarkmatch.h"
......@@ -88,7 +88,7 @@ QString BookmarksRunner::findBrowserName()
QString exec = config.readPathEntry(QStringLiteral("BrowserApplication"), QString());
//qDebug() << "Found exec string: " << exec;
if (exec.isEmpty()) {
KService::Ptr service = KMimeTypeTrader::self()->preferredService(QStringLiteral("text/html"));
KService::Ptr service = KApplicationTrader::preferredService(QStringLiteral("text/html"));
if (service) {
exec = service->exec();
}
......
......@@ -23,7 +23,7 @@
#include <KLocalizedString>
#include <KUriFilter>
#include <KSharedConfig>
#include <KMimeTypeTrader>
#include <KApplicationTrader>
#include <KIO/CommandLauncherJob>
#include <KSycoca>
#include <KShell>
......@@ -82,7 +82,7 @@ void WebshortcutRunner::configurePrivateBrowsingActions()
service = KService::serviceByStorageId(browserFile);
}
if (!service) {
service = KMimeTypeTrader::self()->preferredService(QStringLiteral("text/html"));
service = KApplicationTrader::preferredService(QStringLiteral("text/html"));
}
if (!service) {
return;
......
......@@ -29,7 +29,7 @@
#include <QDebug>
#include <klocalizedstring.h>
#include <kmimetypetrader.h>
#include <KApplicationTrader>
#include <kservicetypetrader.h>
#include <kshell.h>
......@@ -643,7 +643,7 @@ QJSValue ScriptEngine::V1::defaultApplication(const QString &application, bool s
= config.readPathEntry("BrowserApplication", QString());
if (browserApp.isEmpty()) {
const KService::Ptr htmlApp
= KMimeTypeTrader::self()->preferredService(QStringLiteral("text/html"));
= KApplicationTrader::preferredService(QStringLiteral("text/html"));
if (htmlApp) {
browserApp = storageId ? htmlApp->storageId() : htmlApp->exec();
}
......@@ -659,7 +659,7 @@ QJSValue ScriptEngine::V1::defaultApplication(const QString &application, bool s
QStringLiteral("konsole")));
} else if (matches(application, QLatin1String("filemanager"))) {
KService::Ptr service = KMimeTypeTrader::self()->preferredService(
KService::Ptr service = KApplicationTrader::preferredService(
QStringLiteral("inode/directory"));
if (service) {
return storageId ? service->storageId() : onlyExec(service->exec());
......@@ -671,7 +671,7 @@ QJSValue ScriptEngine::V1::defaultApplication(const QString &application, bool s
return onlyExec(
confGroup.readEntry("windowManager", QStringLiteral("kwin")));
} else if (KService::Ptr service = KMimeTypeTrader::self()->preferredService(application)) {
} else if (KService::Ptr service = KApplicationTrader::preferredService(application)) {
return storageId ? service->storageId() : onlyExec(service->exec());
} else {
......
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