File indexing completed on 2024-05-19 05:37:49

0001 /*
0002     SPDX-FileCopyrightText: 2009 Chani Armitage <chani@kde.org>
0003 
0004     SPDX-License-Identifier: LGPL-2.0-only
0005 */
0006 
0007 #include "appjob.h"
0008 
0009 #include <KIO/ApplicationLauncherJob>
0010 
0011 AppJob::AppJob(AppSource *source, const QString &operation, QMap<QString, QVariant> &parameters, QObject *parent)
0012     : ServiceJob(source->objectName(), operation, parameters, parent)
0013     , m_source(source)
0014 {
0015 }
0016 
0017 AppJob::~AppJob()
0018 {
0019 }
0020 
0021 void AppJob::start()
0022 {
0023     const QString operation = operationName();
0024     if (operation == QLatin1String("launch")) {
0025         auto job = new KIO::ApplicationLauncherJob(m_source->getApp());
0026         job->start();
0027         setResult(true);
0028         return;
0029     }
0030     setResult(false);
0031 }