1 | /* |
2 | SPDX-FileCopyrightText: 2023 Alexander Lohnau <alexander.lohnau@gmx.de> |
3 | SPDX-License-Identifier: LGPL-2.0-or-later |
4 | */ |
5 | #include "kdesktopfileaction.h" |
6 | #include <QSharedData> |
7 | |
8 | class KDesktopFileActionPrivate : public QSharedData |
9 | { |
10 | public: |
11 | QString m_internalActionKey; |
12 | QString m_name; |
13 | QString m_icon; |
14 | QString m_exec; |
15 | QString m_desktopFilePath; |
16 | |
17 | KDesktopFileActionPrivate(const QString &name, const QString &text, const QString &icon, const QString &exec, const QString &desktopFilePath) |
18 | : m_internalActionKey(name) |
19 | , m_name(text) |
20 | , m_icon(icon) |
21 | , m_exec(exec) |
22 | , m_desktopFilePath(desktopFilePath) |
23 | { |
24 | } |
25 | KDesktopFileActionPrivate() = default; |
26 | }; |
27 | |
28 | KDesktopFileAction::KDesktopFileAction(const QString &name, const QString &text, const QString &icon, const QString &exec, const QString &desktopFilePath) |
29 | : d(new KDesktopFileActionPrivate(name, text, icon, exec, desktopFilePath)) |
30 | { |
31 | } |
32 | |
33 | KDesktopFileAction::KDesktopFileAction() |
34 | : d(new KDesktopFileActionPrivate()) |
35 | { |
36 | } |
37 | |
38 | KDesktopFileAction::KDesktopFileAction(const KDesktopFileAction &other) = default; |
39 | KDesktopFileAction &KDesktopFileAction::operator=(const KDesktopFileAction &other) = default; |
40 | KDesktopFileAction::KDesktopFileAction(KDesktopFileAction &&other) = default; |
41 | KDesktopFileAction &KDesktopFileAction::operator=(KDesktopFileAction &&other) = default; |
42 | KDesktopFileAction::~KDesktopFileAction() = default; |
43 | |
44 | QString KDesktopFileAction::actionsKey() const |
45 | { |
46 | return d->m_internalActionKey; |
47 | } |
48 | |
49 | QString KDesktopFileAction::desktopFilePath() const |
50 | { |
51 | return d->m_desktopFilePath; |
52 | } |
53 | |
54 | QString KDesktopFileAction::name() const |
55 | { |
56 | return d->m_name; |
57 | } |
58 | |
59 | QString KDesktopFileAction::icon() const |
60 | { |
61 | return d->m_icon; |
62 | } |
63 | |
64 | QString KDesktopFileAction::exec() const |
65 | { |
66 | return d->m_exec; |
67 | } |
68 | |
69 | bool KDesktopFileAction::isSeparator() const |
70 | { |
71 | return d->m_internalActionKey == QLatin1String("_SEPARATOR_" ); |
72 | } |
73 | |