1/*
2 SPDX-FileCopyrightText: 2003 Jason Keirstead <jason@keirstead.org>
3 SPDX-FileCopyrightText: 2003-2006 Michel Hermier <michel.hermier@gmail.com>
4 SPDX-FileCopyrightText: 2007 Nick Shaforostoff <shafff@ukr.net>
5
6 SPDX-License-Identifier: LGPL-2.0-or-later
7*/
8#ifndef KCODECACTION_H
9#define KCODECACTION_H
10
11#include <kconfigwidgets_export.h>
12
13#include <KSelectAction>
14#include <memory>
15
16/*!
17 * \class KCodecAction
18 * \inmodule KConfigWidgets
19 *
20 * \brief Action for selecting one of several text codecs.
21 *
22 * This action shows up a submenu with a list of the available codecs on the system.
23 */
24class KCONFIGWIDGETS_EXPORT KCodecAction : public KSelectAction
25{
26 Q_OBJECT
27
28 /*!
29 * \property KCodecAction::codecName
30 */
31 Q_PROPERTY(QString codecName READ currentCodecName WRITE setCurrentCodec)
32
33public:
34 /*!
35 *
36 */
37 explicit KCodecAction(QObject *parent, bool showAutoOptions = false);
38
39 /*!
40 *
41 */
42 KCodecAction(const QString &text, QObject *parent, bool showAutoOptions = false);
43
44 /*!
45 *
46 */
47 KCodecAction(const QIcon &icon, const QString &text, QObject *parent, bool showAutoOptions = false);
48
49 ~KCodecAction() override;
50
51public:
52 /*!
53 *
54 */
55 QString currentCodecName() const;
56
57 /*!
58 *
59 */
60 bool setCurrentCodec(const QString &codecName);
61
62Q_SIGNALS:
63 /*!
64 * Emitted when a codec was selected
65 *
66 * \a name the name of the selected encoding.
67 *
68 * Note that textTriggered(const QString &) is emitted too (as defined in KSelectAction).
69 *
70 * \since 5.103
71 */
72 void codecNameTriggered(const QByteArray &name);
73
74 /*!
75 * Emitted when the 'Default' codec action is triggered.
76 */
77 void defaultItemTriggered();
78
79protected Q_SLOTS:
80 /*!
81 *
82 */
83 void slotActionTriggered(QAction *) override;
84
85protected:
86 using KSelectAction::actionTriggered;
87
88private:
89 friend class KCodecActionPrivate;
90 std::unique_ptr<class KCodecActionPrivate> const d;
91};
92
93#endif
94

source code of kconfigwidgets/src/kcodecaction.h