1/*
2 SPDX-FileCopyrightText: 2023 Alexander Lohnau <alexander.lohnau@gmx.de>
3 SPDX-License-Identifier: LGPL-2.0-or-later
4*/
5
6#ifndef KDESKTOPFILEACTION_H
7#define KDESKTOPFILEACTION_H
8#include <kconfigcore_export.h>
9
10#include <QSharedDataPointer>
11#include <QString>
12
13class KDesktopFileActionPrivate;
14
15/**
16 * Class for representing an Action of a desktop file
17 *
18 * @since 6.0
19 */
20class KCONFIGCORE_EXPORT KDesktopFileAction
21{
22public:
23 /**
24 * Construct an empty KDesktopFileAction. Needed so the Action can be stored in containers that require type T to be
25 * default constructible (e.g. QVariant).
26 */
27 explicit KDesktopFileAction();
28 /**
29 * Construct a KDesktopFileAction with all required properties
30 */
31 explicit KDesktopFileAction(const QString &name, const QString &text, const QString &icon, const QString &exec, const QString &desktopFilePath);
32
33 KDesktopFileAction(const KDesktopFileAction &other);
34 KDesktopFileAction &operator=(const KDesktopFileAction &other);
35 KDesktopFileAction(KDesktopFileAction &&other);
36 KDesktopFileAction &operator=(KDesktopFileAction &&other);
37 ~KDesktopFileAction();
38
39 /**
40 * @return the action's internal name
41 * For instance Actions=Setup;... and the group [Desktop Action Setup]
42 * define an action with the name "Setup".
43 */
44 QString actionsKey() const;
45
46 /**
47 * @return Path of the desktop file this action was loaded from
48 */
49 QString desktopFilePath() const;
50
51 /**
52 * @return the action's Name, as defined by the Name key in the desktop action group
53 */
54 QString name() const;
55
56 /**
57 * @return the action's icon, as defined by the Icon key in the desktop action group
58 */
59 QString icon() const;
60
61 /**
62 * @return the action's exec command, as defined by the Exec key in the desktop action group
63 */
64 QString exec() const;
65
66 /**
67 * Returns whether the action is a separator.
68 * This is true when the Actions key contains "_SEPARATOR_".
69 */
70 bool isSeparator() const;
71
72private:
73 QSharedDataPointer<KDesktopFileActionPrivate> d;
74};
75#endif
76

source code of kconfig/src/core/kdesktopfileaction.h