Changeset View
Changeset View
Standalone View
Standalone View
src/qmlcontrols/kioplugin/krunproxy.cpp
Show All 35 Lines | 32 | { | |||
---|---|---|---|---|---|
36 | 36 | | |||
37 | if (fileMymeType == QStringLiteral("application/x-executable") || !mime.isValid()) { | 37 | if (fileMymeType == QStringLiteral("application/x-executable") || !mime.isValid()) { | ||
38 | //for security reasons we should not be able to execute applications. | 38 | //for security reasons we should not be able to execute applications. | ||
39 | //We should use its desktop file to access it. | 39 | //We should use its desktop file to access it. | ||
40 | return false; | 40 | return false; | ||
41 | } | 41 | } | ||
42 | 42 | | |||
43 | if (fileMymeType == QStringLiteral("application/x-desktop")) { | 43 | if (fileMymeType == QStringLiteral("application/x-desktop")) { | ||
44 | // If our mimetype is a desktop file, then we don't won't to open | 44 | // If our mimetype is a desktop file, then we don't want to open | ||
45 | // the desktop file itself but the application in which it is associated | 45 | // the desktop file itself but the application in which it is associated | ||
46 | // with. | 46 | // with. | ||
47 | KService::Ptr service = KService::serviceByDesktopPath(filePath); | 47 | KService::Ptr service = KService::serviceByDesktopPath(filePath); | ||
48 | return KRun::runService(*service, QList<QUrl>(), nullptr) != 0; | 48 | return KRun::runService(*service, QList<QUrl>(), nullptr) != 0; | ||
maxrd2: While I'm at it should i also change to runApplication() here? | |||||
49 | } else { | 49 | } else { | ||
50 | return KRun::runUrl(QUrl(filePath), fileMymeType, nullptr); | 50 | return KRun::runUrl(QUrl(filePath), fileMymeType, nullptr); | ||
51 | } | 51 | } | ||
52 | } | 52 | } | ||
53 | | ||||
54 | bool KRunProxy::openService(const QString &serviceName) | ||||
55 | { | ||||
56 | KService::Ptr service = KService::serviceByDesktopName(serviceName); | ||||
57 | if(service) | ||||
Am not sure if service->isApplication() check here is needed... can someone confirm please? maxrd2: Am not sure if service->isApplication() check here is needed... can someone confirm please? | |||||
58 | return KRun::runApplication(*service, QList<QUrl>(), nullptr) != 0; | ||||
59 | return false; | ||||
60 | } |
While I'm at it should i also change to runApplication() here?