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 KDesktopFileAction
17 * \inmodule KConfigCore
18 *
19 * \brief Class for representing an Action of a desktop file.
20 *
21 * \since 6.0
22 */
23class KCONFIGCORE_EXPORT KDesktopFileAction
24{
25public:
26 /*!
27 * Construct an empty KDesktopFileAction. Needed so the Action can be stored in containers that require type T to be
28 * default constructible (e.g. QVariant).
29 */
30 explicit KDesktopFileAction();
31 /*!
32 * Construct a KDesktopFileAction with all required properties
33 */
34 explicit KDesktopFileAction(const QString &name, const QString &text, const QString &icon, const QString &exec, const QString &desktopFilePath);
35
36 KDesktopFileAction(const KDesktopFileAction &other);
37 KDesktopFileAction &operator=(const KDesktopFileAction &other);
38 KDesktopFileAction(KDesktopFileAction &&other);
39 KDesktopFileAction &operator=(KDesktopFileAction &&other);
40 ~KDesktopFileAction();
41
42 /*!
43 * Returns the action's internal name
44 * For instance Actions=Setup;... and the group [Desktop Action Setup]
45 * define an action with the name "Setup".
46 */
47 QString actionsKey() const;
48
49 /*!
50 * Returns the path of the desktop file this action was loaded from
51 */
52 QString desktopFilePath() const;
53
54 /*!
55 * Returns the action's Name, as defined by the Name key in the desktop action group
56 */
57 QString name() const;
58
59 /*!
60 * Returns the action's icon, as defined by the Icon key in the desktop action group
61 */
62 QString icon() const;
63
64 /*!
65 * Returns the action's exec command, as defined by the Exec key in the desktop action group
66 */
67 QString exec() const;
68
69 /*!
70 * Returns whether the action is a separator.
71 * This is \c true when the Actions key contains "_SEPARATOR_".
72 */
73 bool isSeparator() const;
74
75private:
76 QSharedDataPointer<KDesktopFileActionPrivate> d;
77};
78#endif
79

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