mirror of
https://bitbucket.org/smil3y/kde-workspace.git
synced 2025-02-24 02:42:50 +00:00
plasma: blind-start services via KRun from kickoff menu
KRun will show message box if exec fails (it uses KToolInvocation itself and checks the return value) and the menu will not be blocked while the application is starting Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
parent
f3e5025c2f
commit
ce614f2297
1 changed files with 9 additions and 12 deletions
|
@ -27,7 +27,7 @@
|
||||||
#include <KDebug>
|
#include <KDebug>
|
||||||
#include <KJob>
|
#include <KJob>
|
||||||
#include <KService>
|
#include <KService>
|
||||||
#include <KToolInvocation>
|
#include <KRun>
|
||||||
#include <KUrl>
|
#include <KUrl>
|
||||||
#include <Solid/PowerManagement>
|
#include <Solid/PowerManagement>
|
||||||
|
|
||||||
|
@ -48,20 +48,17 @@ using namespace Kickoff;
|
||||||
|
|
||||||
bool ServiceItemHandler::openUrl(const KUrl& url)
|
bool ServiceItemHandler::openUrl(const KUrl& url)
|
||||||
{
|
{
|
||||||
int result = KToolInvocation::startServiceByDesktopPath(url.pathOrUrl(), QStringList(), 0, 0, 0, "", true);
|
KService::Ptr service = KService::serviceByDesktopPath(url.pathOrUrl());
|
||||||
|
|
||||||
if (result == 0) {
|
if (!service.isNull()) {
|
||||||
KService::Ptr service = KService::serviceByDesktopPath(url.pathOrUrl());
|
RecentApplications::self()->add(service);
|
||||||
|
} else {
|
||||||
if (!service.isNull()) {
|
qWarning() << "Failed to find service for" << url;
|
||||||
RecentApplications::self()->add(service);
|
return false;
|
||||||
} else {
|
|
||||||
qWarning() << "Failed to find service for" << url;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return result == 0;
|
new KRun(url, 0);
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool LeaveItemHandler::openUrl(const KUrl& url)
|
bool LeaveItemHandler::openUrl(const KUrl& url)
|
||||||
|
|
Loading…
Add table
Reference in a new issue