File indexing completed on 2024-04-28 11:37:13
0001 /* 0002 SPDX-FileCopyrightText: 2008 Michael Jansen <kde@michael-jansen.biz> 0003 SPDX-FileCopyrightText: 2016 Marco Martin <mart@kde.org> 0004 0005 SPDX-License-Identifier: LGPL-2.0-or-later 0006 */ 0007 0008 #ifndef KSERVICEACTIONCOMPONENT_H 0009 #define KSERVICEACTIONCOMPONENT_H 0010 0011 #include "component.h" 0012 0013 #include <KDesktopFile> 0014 0015 #include <memory> 0016 0017 /** 0018 * @author Michael Jansen <kde@michael-jansen.biz> 0019 */ 0020 class KServiceActionComponent : public Component 0021 { 0022 Q_OBJECT 0023 0024 public: 0025 ~KServiceActionComponent() override; 0026 0027 void loadFromService(); 0028 void emitGlobalShortcutPressed(const GlobalShortcut &shortcut) override; 0029 0030 bool cleanUp() override; 0031 0032 private: 0033 friend class ::GlobalShortcutsRegistry; 0034 //! Constructs a KServiceActionComponent. This is a private constuctor, to create 0035 //! a KServiceActionComponent, use GlobalShortcutsRegistry::self()->createServiceActionComponent(). 0036 KServiceActionComponent(const QString &serviceStorageId, const QString &friendlyName); 0037 0038 void runProcess(const KConfigGroup &group, const QString &token); 0039 0040 QString m_serviceStorageId; 0041 std::unique_ptr<KDesktopFile> m_desktopFile; 0042 bool m_isInApplicationsDir = false; 0043 }; 0044 0045 #endif /* #ifndef KSERVICEACTIONCOMPONENT_H */