Warning, file /frameworks/ktexteditor/src/include/ktexteditor/sessionconfiginterface.h was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).
0001 /* 0002 SPDX-FileCopyrightText: 2001-2014 Christoph Cullmann <cullmann@kde.org> 0003 SPDX-FileCopyrightText: 2005-2014 Dominik Haumann <dhaumann@kde.org> 0004 SPDX-FileCopyrightText: 2009 Michel Ludwig <michel.ludwig@kdemail.net> 0005 0006 SPDX-License-Identifier: LGPL-2.0-or-later 0007 */ 0008 0009 #ifndef KTEXTEDITOR_SESSIONCONFIGINTERFACE_H 0010 #define KTEXTEDITOR_SESSIONCONFIGINTERFACE_H 0011 0012 #include <ktexteditor_export.h> 0013 0014 class KConfigGroup; 0015 0016 #include <QObject> 0017 0018 namespace KTextEditor 0019 { 0020 /** 0021 * \class SessionConfigInterface sessionconfiginterface.h <KTextEditor/SessionConfigInterface> 0022 * 0023 * \brief Session config interface extension for the Plugin and Plugin views. 0024 * 0025 * \ingroup kte_group_plugin_extensions 0026 * 0027 * \section sessionconfig_intro Introduction 0028 * 0029 * The SessionConfigInterface is an extension for Plugin%s and Plugin views 0030 * to add support for session-specific configuration settings. 0031 * readSessionConfig() is called whenever session-specific settings are to be 0032 * read from the given KConfigGroup and writeSessionConfig() whenever they are to 0033 * be written, for example when a session changed or was closed. 0034 * 0035 * \note A \e session does not have anything to do with an X-session under Unix. 0036 * What is meant is rather a context, think of sessions in Kate or 0037 * projects in KDevelop for example. 0038 * 0039 * \section sessionconfig_support Adding Session Support 0040 * 0041 * To add support for sessions, your Plugin has to inherit the SessionConfigInterface 0042 * and reimplement readSessionConfig() and writeSessionConfig(). 0043 * 0044 * \section sessionconfig_access Accessing the SessionConfigInterface 0045 * 0046 * This section is for application developers such as Kate, KDevelop, etc that 0047 * what to support session configuration for plugins. 0048 * 0049 * The SessionConfigInterface is an extension interface for a Plugin or a 0050 * Plugin view, i.e. Plugin/Plugin view inherits the interface 0051 * \e provided that it implements the interface. Use qobject_cast to 0052 * access the interface: 0053 * \code 0054 * // object is of type Plugin* or, in case of a plugin view, QObject* 0055 * KTextEditor::SessionConfigInterface *iface = 0056 * qobject_cast<KTextEditor::SessionConfigInterface*>( object ); 0057 * 0058 * if( iface ) { 0059 * // interface is supported 0060 * // do stuff 0061 * } 0062 * \endcode 0063 * 0064 * \see KTextEditor::Plugin 0065 * \author Christoph Cullmann \<cullmann@kde.org\> 0066 */ 0067 class KTEXTEDITOR_EXPORT SessionConfigInterface 0068 { 0069 public: 0070 SessionConfigInterface(); 0071 0072 /** 0073 * Virtual destructor. 0074 */ 0075 virtual ~SessionConfigInterface(); 0076 0077 public: 0078 /** 0079 * Read session settings from the given \p config. 0080 * 0081 * That means for example 0082 * - a Document should reload the file, restore all marks etc... 0083 * - a View should scroll to the last position and restore the cursor 0084 * position etc... 0085 * - a Plugin should restore session specific settings 0086 * - If no file is being loaded, because an empty new document is going to be displayed, 0087 * this function should emit ReadOnlyPart::completed 0088 * 0089 * \param config read the session settings from this KConfigGroup 0090 * \see writeSessionConfig() 0091 */ 0092 virtual void readSessionConfig(const KConfigGroup &config) = 0; 0093 0094 /** 0095 * Write session settings to the \p config. 0096 * See readSessionConfig() for more details. 0097 * 0098 * \param config write the session settings to this KConfigGroup 0099 * \see readSessionConfig() 0100 */ 0101 virtual void writeSessionConfig(KConfigGroup &config) = 0; 0102 0103 private: 0104 class SessionConfigInterfacePrivate *const d = nullptr; 0105 }; 0106 0107 } 0108 0109 Q_DECLARE_INTERFACE(KTextEditor::SessionConfigInterface, "org.kde.KTextEditor.SessionConfigInterface") 0110 0111 #endif