File indexing completed on 2024-05-05 03:57:19

0001 // SPDX-FileCopyrightText: 2023 Alexander Lohnau <alexander.lohnau@gmx.de>
0002 // SPDX-License-Identifier: LGPL-2.0-or-later
0003 #include "action.h"
0004 
0005 #include <QIcon>
0006 
0007 namespace KRunner
0008 {
0009 class ActionPrivate
0010 {
0011 public:
0012     explicit ActionPrivate(const QString id, const QString text, const QString iconName)
0013         : m_id(id)
0014         , m_text(text)
0015         , m_iconSource(iconName)
0016     {
0017     }
0018     explicit ActionPrivate() = default;
0019     explicit ActionPrivate(const ActionPrivate &action) = default;
0020     const QString m_id;
0021     const QString m_text;
0022     const QString m_iconSource;
0023 };
0024 
0025 Action::Action(const QString &id, const QString &iconName, const QString &text)
0026     : d(new ActionPrivate(id, text, iconName))
0027 {
0028 }
0029 Action::Action(const Action &action)
0030     : d(new ActionPrivate(*action.d))
0031 {
0032 }
0033 Action::Action()
0034     : d(new ActionPrivate())
0035 {
0036 }
0037 
0038 Action::~Action() = default;
0039 Action &Action::operator=(const Action &other)
0040 {
0041     d.reset(new ActionPrivate(*other.d));
0042     return *this;
0043 }
0044 
0045 QString Action::id() const
0046 {
0047     return d->m_id;
0048 }
0049 QString Action::text() const
0050 {
0051     return d->m_text;
0052 }
0053 QString Action::iconSource() const
0054 {
0055     return d->m_iconSource;
0056 }
0057 }
0058 
0059 #include "moc_action.cpp"