Libkleo

docaction.h
1/*
2 kleo/docaction.h
3
4 This file is part of libkleopatra, the KDE keymanagement library
5 SPDX-FileCopyrightText: 2022 g10 Code GmbH
6 SPDX-FileContributor: Andre Heinecke <aheinecke@g10code.com>
7
8 SPDX-License-Identifier: GPL-2.0-or-later
9*/
10
11#pragma once
12
13#include "kleo_export.h"
14
15#include <QAction>
16#include <QUrl>
17
18#include <memory>
19
20class QIcon;
21class QString;
22
23namespace Kleo
24{
25/**
26 An action for custom documentation which is opened
27 by file. This can be used for PDF documents like the
28 GnuPG manual.
29
30 The action is disabled and invisible if the corresponding
31 file cannout be found at creation. Otherwise triggered
32 calls QDesktopServicesOpenURL on the file.
33*/
34class KLEO_EXPORT DocAction : public QAction
35{
37
38public:
39 /* Create a DocAction with icon, text and file name of the document
40 *
41 * @a filename The name of the documentation file.
42 * @a url Url to a website that will be shown if the given file is not available.
43 * @a pathHint A path relative to QCoreApplication::applicationDirPath() to look for the file.
44 *
45 * */
46 DocAction(const QIcon &icon,
47 const QString &text,
48 const QString &filename,
49 const QString &pathHint = QString(),
50 const QUrl &url = {},
51 QObject *parent = nullptr);
52
53 ~DocAction() override;
54
55 DocAction(const QString &, QObject *parent) = delete;
56 DocAction(QObject *parent) = delete;
57
58private:
59 class Private;
60 std::unique_ptr<Private> d;
61};
62
63} // namespace Kleo
QAction(QObject *parent)
QObject(QObject *parent)
Q_OBJECTQ_OBJECT
QObject * parent() const const
This file is part of the KDE documentation.
Documentation copyright © 1996-2025 The KDE developers.
Generated on Fri Jan 24 2025 11:50:11 by doxygen 1.13.2 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.