Libksieve

sievehelpbutton.cpp
1/*
2 SPDX-FileCopyrightText: 2013-2024 Laurent Montel <montel@kde.org>
3
4 SPDX-License-Identifier: LGPL-2.0-or-later
5*/
6#include "sievehelpbutton.h"
7
8#include <KIO/JobUiDelegateFactory>
9#include <KIO/OpenUrlJob>
10#include <KLocalizedString>
11#include <QIcon>
12#include <QWhatsThis>
13#include <QWhatsThisClickedEvent>
14
15using namespace KSieveUi;
16SieveHelpButton::SieveHelpButton(QWidget *parent)
17 : QToolButton(parent)
18{
19 setToolTip(i18nc("@info:tooltip", "Help"));
20 setIcon(QIcon::fromTheme(QStringLiteral("help-hint")));
21}
22
23SieveHelpButton::~SieveHelpButton() = default;
24
25bool SieveHelpButton::event(QEvent *event)
26{
27 if (event->type() == QEvent::WhatsThisClicked) {
28 auto clicked = static_cast<QWhatsThisClickedEvent *>(event);
29 auto job = new KIO::OpenUrlJob(QUrl(clicked->href()));
31 job->start();
32 return true;
33 }
34 return QToolButton::event(event);
35}
36
37#include "moc_sievehelpbutton.cpp"
QString i18nc(const char *context, const char *text, const TYPE &arg...)
AKONADI_CALENDAR_EXPORT KCalendarCore::Event::Ptr event(const Akonadi::Item &item)
KIOCORE_EXPORT KJobUiDelegate * createDefaultJobUiDelegate()
void clicked(bool checked)
WhatsThisClicked
QIcon fromTheme(const QString &name)
virtual bool event(QEvent *event) override
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Sat Dec 21 2024 16:57:10 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.