File indexing completed on 2024-04-28 13:28:54
0001 // SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL 0002 // SPDX-FileCopyrightText: 2020 Harald Sitter <sitter@kde.org> 0003 0004 #include "servicerunner.h" 0005 0006 #include <KIO/ApplicationLauncherJob> 0007 0008 void ServiceRunner::run() 0009 { 0010 KIO::ApplicationLauncherJob(m_service).start(); 0011 } 0012 0013 QString ServiceRunner::name() const 0014 { 0015 return m_name; 0016 } 0017 0018 void ServiceRunner::setName(const QString &name) 0019 { 0020 m_name = name; 0021 m_service = KService::serviceByDesktopName(name); 0022 Q_EMIT nameChanged(); 0023 Q_EMIT canRunChanged(); 0024 } 0025 0026 bool ServiceRunner::canRun() const 0027 { 0028 return !m_name.isEmpty() && m_service && m_service->isValid(); 0029 }