/usr/include/ktexteditor/sessionconfiginterface.h is in kdelibs5-dev 4:4.8.4-4+deb7u1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 | /* This file is part of the KDE libraries
Copyright (C) 2001 Christoph Cullmann <cullmann@kde.org>
Copyright (C) 2005 Dominik Haumann (dhdev@gmx.de) (documentation)
Copyright (C) 2009 Michel Ludwig (michel.ludwig@kdemail.net)
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#ifndef KDELIBS_KTEXTEDITOR_SESSIONCONFIGINTERFACE_H
#define KDELIBS_KTEXTEDITOR_SESSIONCONFIGINTERFACE_H
#include <ktexteditor/ktexteditor_export.h>
class KConfigGroup;
#include <QtCore/QObject>
namespace KTextEditor
{
/**
* \brief Session config interface extension for the Document, View and Plugin.
*
* \ingroup kte_group_doc_extensions
* \ingroup kte_group_view_extensions
* \ingroup kte_group_plugin_extensions
*
* \section sessionconfig_intro Introduction
*
* The SessionConfigInterface is an extension for Documents, Views and Plugins
* to add support for session-specific configuration settings.
* readSessionConfig() is called whenever session-specific settings are to be
* read from the given KConfig* and writeSessionConfig() whenever they are to
* be written, for example when a session changed or was closed.
*
* \note A \e session does not have anything to do with an X-session under Unix.
* What is meant is rather a context, think of sessions in Kate or
* projects in KDevelop for example.
*
* \section sessionconfig_support Adding Session Support
*
* To add support for sessions a KTextEditor implementation has to derive the
* Document and View class from SessionConfigInterface and reimplement
* readSessionConfig() and writeSessionConfig().
*
* The same applies to a Plugin, read the detailed description for plugins.
*
* \section sessionconfig_access Accessing the SessionConfigInterface
*
* The SessionConfigInterface is supposed to be an extension interface for a
* Document, a View or a Plugin, i.e. the Document/View/Plugin inherits the
* interface \e provided that it implements the interface. Use qobject_cast to
* access the interface:
* \code
* // object is of type KTextEditor::Document* or View* or Plugin*
* KTextEditor::SessionConfigInterface *iface =
* qobject_cast<KTextEditor::SessionConfigInterface*>( object );
*
* if( iface ) {
* // interface is supported
* // do stuff
* }
* \endcode
*
* \see KTextEditor::Document, KTextEditor::View, KTextEditor::Plugin
* \author Christoph Cullmann \<cullmann@kde.org\>
* \note KDE5: Replace this interface with ParameterizedSessionConfigInterface
*/
class KTEXTEDITOR_EXPORT SessionConfigInterface
{
public:
SessionConfigInterface();
/**
* Virtual destructor.
*/
virtual ~SessionConfigInterface();
//
// SLOTS !!!
//
public:
/**
* Read session settings from the given \p config.
*
* That means for example
* - a Document should reload the file, restore all marks etc...
* - a View should scroll to the last position and restore the cursor
* position etc...
* - a Plugin should restore session specific settings
* - If no file is being loaded, because an empty new document is going to be displayed,
* this function should emit ReadOnlyPart::completed
*
* \param config read the session settings from this KConfigGroup
* \see writeSessionConfig()
*/
virtual void readSessionConfig (const KConfigGroup& config) = 0;
/**
* Write session settings to the \p config.
* See readSessionConfig() for more details.
*
* \param config write the session settings to this KConfigGroup
* \see readSessionConfig()
*/
virtual void writeSessionConfig (KConfigGroup& config) = 0;
private:
class SessionConfigInterfacePrivate* const d;
};
/**
* \brief Parameterized session config interface extension for the Document.
*
* \ingroup kte_group_doc_extensions
*
* \section parameterizedsessionconfig_intro Introduction
*
* The ParameterizedSessionConfigInterface is an extension for Documents
* to add support for session-specific configuration settings with more fine-grained
* control over the settings that are manipulated.
* The readParameterizedSessionConfig() method is called whenever session-specific settings are to be
* read from the given KConfig* and the writeParameterizedSessionConfig() method whenever they are to
* be written, for example when a session changed or was closed.
*
* \note A \e session does not have anything to do with an X-session under Unix.
* What is meant is rather a context, think of sessions in Kate or
* projects in KDevelop for example.
*
* \note ParameterizedSessionConfigInterface is meant to be an extension of SessionConfigInterface.
* Due to limitations with qobject_cast it is not possible in KDE4 to derive this interface
* from SessionConfigInterface.
*
* \section parameterizedsessionconfig_support Adding Session Support
*
* To add support for sessions a KTextEditor implementation has to derive the
* Document class from ParameterizedSessionConfigInterface and reimplement the methods defined
* in this class.
*
* \section parameterizedsessionconfig_access Accessing the ParameterizedSessionConfigInterface
*
* The ParameterizedSessionConfigInterface is supposed to be an extension interface for a
* Document i.e. the Document inherits the
* interface \e provided that it implements the interface. Use qobject_cast to
* access the interface:
* \code
* // object is of type KTextEditor::Document*
* KTextEditor::ParameterizedSessionConfigInterface *iface =
* qobject_cast<KTextEditor::ParameterizedSessionConfigInterface*>( object );
*
* if( iface ) {
* // interface is supported
* // do stuff
* }
* \endcode
*
* \see KTextEditor::Document, KTextEditor::SessionConfigInterface
*
* \since 4.4
* \note KDE5: Rename to SessionConfigInterface, delete old SessionConfigInterface
*/
class KTEXTEDITOR_EXPORT ParameterizedSessionConfigInterface
{
public:
ParameterizedSessionConfigInterface();
/**
* Virtual destructor.
*/
virtual ~ParameterizedSessionConfigInterface();
public:
/**
* Flags for session restore.
* These flags allow to skip some parts of the configuration from restoration.
*/
enum SessionConfigParameter {
SkipNone = 0,
SkipUrl = 1 << 0,
SkipMode = 1 << 1,
SkipHighlighting = 1 << 2,
SkipEncoding = 1 << 3,
SkipFolding = 1 << 4
};
/**
* Read session settings from the given \p config excluding the settings specified in
* \p parameters.
*
* That means for example
* - a Document should reload the file, restore all marks etc...
* - a View should scroll to the last position and restore the cursor
* position etc...
* - a Plugin should restore session specific settings
* - If no file is being loaded, because an empty new document is going to be displayed or
* 'SkipUrl' is set, this function should emit ReadOnlyPart::completed
*
* \param config read the session settings from this KConfigGroup
* \param parameters settings that should not be read (i.e. a combination of flags from SessionConfigParameter)
* \see writeParameterizedSessionConfig()
*/
virtual void readParameterizedSessionConfig (const KConfigGroup& config,
unsigned long parameters) = 0;
/**
* Write session settings to the \p config excluding the settings specified in
* \p parameters.
* See readSessionConfig() for more details.
*
* \param config write the session settings to this KConfigGroup
* \param parameters settings that should not be written (i.e. a combination of flags from SessionConfigParameter)
* \see readParameterizedSessionConfig()
*/
virtual void writeParameterizedSessionConfig (KConfigGroup& config,
unsigned long parameters) = 0;
};
}
Q_DECLARE_INTERFACE(KTextEditor::SessionConfigInterface, "org.kde.KTextEditor.SessionConfigInterface")
Q_DECLARE_INTERFACE(KTextEditor::ParameterizedSessionConfigInterface, "org.kde.KTextEditor.ParameterizedSessionConfigInterface")
#endif
// kate: space-indent on; indent-width 2; replace-tabs on;
|