Changeset View
Changeset View
Standalone View
Standalone View
src/variableeditor/katehelpbutton.cpp
Show All 16 Lines | 1 | /* SPDX-License-Identifier: LGPL-2.0-or-later | |||
---|---|---|---|---|---|
17 | the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | 17 | the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | ||
18 | Boston, MA 02110-1301, USA. | 18 | Boston, MA 02110-1301, USA. | ||
19 | */ | 19 | */ | ||
20 | 20 | | |||
21 | #include "katehelpbutton.h" | 21 | #include "katehelpbutton.h" | ||
22 | 22 | | |||
23 | #include <QIcon> | 23 | #include <QIcon> | ||
24 | 24 | | |||
25 | #include <KIconLoader> | | |||
26 | #include <KLocalizedString> | 25 | #include <KLocalizedString> | ||
27 | #include <khelpclient.h> | 26 | #include <khelpclient.h> | ||
28 | 27 | | |||
29 | KateHelpButton::KateHelpButton(QWidget *parent) | 28 | KateHelpButton::KateHelpButton(QWidget *parent) | ||
30 | : QToolButton(parent) | 29 | : QToolButton(parent) | ||
31 | { | 30 | { | ||
32 | setAutoRaise(true); | 31 | setAutoRaise(true); | ||
33 | setIconState(IconColored); | 32 | setIconState(IconColored); | ||
34 | setToolTip(i18n("Kate Handbook.")); | 33 | setToolTip(i18n("Kate Handbook.")); | ||
35 | 34 | | |||
36 | connect(this, SIGNAL(clicked()), SLOT(invokeHelp())); | 35 | connect(this, SIGNAL(clicked()), SLOT(invokeHelp())); | ||
37 | } | 36 | } | ||
38 | 37 | | |||
39 | KateHelpButton::~KateHelpButton() | 38 | KateHelpButton::~KateHelpButton() | ||
40 | { | 39 | { | ||
41 | } | 40 | } | ||
42 | 41 | | |||
43 | void KateHelpButton::setIconState(IconState state) | 42 | void KateHelpButton::setIconState(IconState state) | ||
44 | { | 43 | { | ||
45 | if (state == IconGrayscaled) { | 44 | if (state == IconHidden) { | ||
46 | setIcon(QIcon::fromTheme(QStringLiteral("help-contents")).pixmap(IconSize(KIconLoader::Small), QIcon::Disabled)); | | |||
47 | } else if (state == IconHidden) { | | |||
48 | setIcon(QIcon()); | 45 | setIcon(QIcon()); | ||
49 | } else { | 46 | } else { | ||
50 | setIcon(QIcon::fromTheme(QStringLiteral("help-contents")).pixmap(IconSize(KIconLoader::Small), QIcon::Normal)); | 47 | setIcon(QIcon::fromTheme(QStringLiteral("help-contents"))); | ||
51 | } | 48 | } | ||
52 | 49 | | |||
53 | update(); | 50 | update(); | ||
54 | } | 51 | } | ||
55 | 52 | | |||
56 | void KateHelpButton::invokeHelp() | 53 | void KateHelpButton::invokeHelp() | ||
57 | { | 54 | { | ||
58 | KHelpClient::invokeHelp(m_section, QStringLiteral("kate")); | 55 | KHelpClient::invokeHelp(m_section, QStringLiteral("kate")); | ||
59 | } | 56 | } | ||
60 | 57 | | |||
61 | void KateHelpButton::setSection(const QString §ion) | 58 | void KateHelpButton::setSection(const QString §ion) | ||
62 | { | 59 | { | ||
63 | m_section = section; | 60 | m_section = section; | ||
64 | } | 61 | } |