File indexing completed on 2025-02-02 05:18:15
0001 // SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL 0002 // SPDX-FileCopyrightText: 2020-2021 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::desktopFileName() const 0014 { 0015 return m_desktopFileName; 0016 } 0017 0018 void ServiceRunner::setDesktopFileName(const QString &name) 0019 { 0020 m_desktopFileName = name; 0021 m_service = KService::serviceByDesktopName(name); 0022 Q_EMIT desktopFileNameChanged(); 0023 Q_EMIT changed(); 0024 } 0025 0026 QString ServiceRunner::genericName() const 0027 { 0028 if (m_service) { 0029 return m_service->genericName(); 0030 } 0031 return {}; 0032 } 0033 0034 QString ServiceRunner::iconName() const 0035 { 0036 if (m_service) { 0037 return m_service->icon(); 0038 } 0039 return {}; 0040 } 0041 0042 bool ServiceRunner::canRun() const 0043 { 0044 return !m_desktopFileName.isEmpty() && m_service && m_service->isValid(); 0045 } 0046 0047 #include "moc_ServiceRunner.cpp"