KIO

kpropertiesdialogplugin.h
1/*
2 SPDX-FileCopyrightText: 2000 David Faure <faure@kde.org>
3 SPDX-License-Identifier: LGPL-2.0-or-later
4*/
5#include "kiowidgets_export.h"
6#include <QObject>
7
8#ifndef KPROPERTIESDIALOGPLUGIN_H
9#define KPROPERTIESDIALOGPLUGIN_H
10
11#include "kiowidgets_export.h"
12#include <QObject>
13#include <kpropertiesdialog.h>
14
15class KPropertiesDialogPluginPrivate;
16/**
17 * A Plugin in the Properties dialog
18 * This is an abstract class. You must inherit from this class
19 * to build a new kind of tabbed page for the KPropertiesDialog.
20 * A plugin in itself is just a library containing code, not a dialog's page.
21 * It's up to the plugin to insert pages into the parent dialog.
22 *
23 * To make a plugin available, ensure it has embedded json metadata using
24 * K_PLUGIN_CLASS_WITH_JSON and install the plugin in the KDE_INSTALL_PLUGINDIR/kf6/propertiesdialog
25 * folder from the KDEInstallDirs CMake module.
26 *
27 * The metadata can contain the MIME types for which the plugin should be created.
28 * For instance:
29 * @verbatim
30 {
31 "KPlugin": {
32 "MimeTypes": ["text/html", "application/x-mymimetype"]
33 },
34 "X-KDE-Protocols": ["file"]
35 }
36 @endverbatim
37 * If the MIME types are empty or not specified, the plugin will be created for all MIME types.
38 *
39 * You can also include "X-KDE-Protocols" if you want that plugin for instance
40 * to be loaded only for local files.
41 */
42class KIOWIDGETS_EXPORT KPropertiesDialogPlugin : public QObject
43{
44 Q_OBJECT
45public:
46 /**
47 * Constructor whos parent will be cast to KPropertiesDialog
48 * To insert tabs into the properties dialog, use the add methods provided by
49 * KPageDialog (the properties dialog is a KPageDialog).
50 */
52 ~KPropertiesDialogPlugin() override;
53
54 /**
55 * Applies all changes to the file.
56 * This function is called when the user presses 'Ok'. The last plugin inserted
57 * is called first.
58 */
59 virtual void applyChanges();
60
61 void setDirty(bool b = true);
62 bool isDirty() const;
63
65 /**
66 * Emit this signal when the user changed anything in the plugin's tabs.
67 * The hosting PropertiesDialog will call applyChanges only if the
68 * PropsPlugin has emitted this signal or if you have called setDirty() before.
69 */
70 void changed();
71
72protected:
73 /**
74 * Pointer to the dialog
75 */
77
78 /**
79 * Returns the font height.
80 */
81 int fontHeight() const;
82
83private:
84 const std::unique_ptr<KPropertiesDialogPluginPrivate> d;
85};
86#endif
A Plugin in the Properties dialog This is an abstract class.
KPropertiesDialog *const properties
Pointer to the dialog.
void changed()
Emit this signal when the user changed anything in the plugin's tabs.
The main properties dialog class.
Q_SIGNALSQ_SIGNALS
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Mon Nov 18 2024 12:16:28 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.