| 1 | // SPDX-FileCopyrightText: 2023 Alexander Lohnau <alexander.lohnau@gmx.de> |
|---|---|
| 2 | // SPDX-License-Identifier: LGPL-2.0-or-later |
| 3 | #include "action.h" |
| 4 | |
| 5 | #include <QIcon> |
| 6 | |
| 7 | namespace KRunner |
| 8 | { |
| 9 | class ActionPrivate |
| 10 | { |
| 11 | public: |
| 12 | explicit ActionPrivate(const QString &id, const QString &text, const QString &iconName) |
| 13 | : m_id(id) |
| 14 | , m_text(text) |
| 15 | , m_iconSource(iconName) |
| 16 | { |
| 17 | } |
| 18 | explicit ActionPrivate() = default; |
| 19 | explicit ActionPrivate(const ActionPrivate &action) = default; |
| 20 | const QString m_id; |
| 21 | const QString m_text; |
| 22 | const QString m_iconSource; |
| 23 | }; |
| 24 | |
| 25 | Action::Action(const QString &id, const QString &iconName, const QString &text) |
| 26 | : d(new ActionPrivate(id, text, iconName)) |
| 27 | { |
| 28 | } |
| 29 | Action::Action(const Action &action) |
| 30 | : d(new ActionPrivate(*action.d)) |
| 31 | { |
| 32 | } |
| 33 | Action::Action() |
| 34 | : d(new ActionPrivate()) |
| 35 | { |
| 36 | } |
| 37 | |
| 38 | Action::~Action() = default; |
| 39 | Action &Action::operator=(const Action &other) |
| 40 | { |
| 41 | d.reset(p: new ActionPrivate(*other.d)); |
| 42 | return *this; |
| 43 | } |
| 44 | |
| 45 | QString Action::id() const |
| 46 | { |
| 47 | return d->m_id; |
| 48 | } |
| 49 | QString Action::text() const |
| 50 | { |
| 51 | return d->m_text; |
| 52 | } |
| 53 | QString Action::iconSource() const |
| 54 | { |
| 55 | return d->m_iconSource; |
| 56 | } |
| 57 | } |
| 58 | |
| 59 | #include "moc_action.cpp" |
| 60 |
