• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • applications API Reference
  • KDE Home
  • Contact Us
 

KTextEditor

  • KTextEditor
  • Plugin
Public Member Functions | List of all members
KTextEditor::Plugin Class Reference

#include <plugin.h>

Inheritance diagram for KTextEditor::Plugin:
Inheritance graph
[legend]

Public Member Functions

 Plugin (QObject *parent)
 
virtual ~Plugin ()
 
virtual void addDocument (Document *document)
 
virtual void addView (View *view)
 
virtual void removeDocument (Document *document)
 
virtual void removeView (View *view)
 
- Public Member Functions inherited from QObject
 QObject (QObject *parent)
 
 QObject (QObject *parent, const char *name)
 
virtual  ~QObject ()
 
bool blockSignals (bool block)
 
QObject * child (const char *objName, const char *inheritsClass, bool recursiveSearch) const
 
const QObjectList & children () const
 
const char * className () const
 
bool connect (const QObject *sender, const char *signal, const char *method, Qt::ConnectionType type) const
 
void deleteLater ()
 
void destroyed (QObject *obj)
 
bool disconnect (const QObject *receiver, const char *method)
 
bool disconnect (const char *signal, const QObject *receiver, const char *method)
 
void dumpObjectInfo ()
 
void dumpObjectTree ()
 
QList< QByteArray > dynamicPropertyNames () const
 
virtual bool event (QEvent *e)
 
virtual bool eventFilter (QObject *watched, QEvent *event)
 
T findChild (const QString &name) const
 
QList< T > findChildren (const QRegExp &regExp) const
 
QList< T > findChildren (const QString &name) const
 
bool inherits (const char *className) const
 
void insertChild (QObject *object)
 
void installEventFilter (QObject *filterObj)
 
bool isA (const char *className) const
 
bool isWidgetType () const
 
void killTimer (int id)
 
virtual const QMetaObject * metaObject () const
 
void moveToThread (QThread *targetThread)
 
const char * name () const
 
const char * name (const char *defaultName) const
 
QString objectName () const
 
QObject * parent () const
 
QVariant property (const char *name) const
 
void removeChild (QObject *object)
 
void removeEventFilter (QObject *obj)
 
void setName (const char *name)
 
void setObjectName (const QString &name)
 
void setParent (QObject *parent)
 
bool setProperty (const char *name, const QVariant &value)
 
bool signalsBlocked () const
 
int startTimer (int interval)
 
QThread * thread () const
 

Additional Inherited Members

- Static Public Member Functions inherited from QObject
bool connect (const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type)
 
bool connect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method, Qt::ConnectionType type)
 
bool disconnect (const QObject *sender, const char *signal, const QObject *receiver, const char *method)
 
bool disconnect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method)
 
QString tr (const char *sourceText, const char *disambiguation, int n)
 
QString trUtf8 (const char *sourceText, const char *disambiguation, int n)
 
- Protected Member Functions inherited from QObject
bool checkConnectArgs (const char *signal, const QObject *object, const char *method)
 
virtual void childEvent (QChildEvent *event)
 
virtual void connectNotify (const char *signal)
 
virtual void customEvent (QEvent *event)
 
virtual void disconnectNotify (const char *signal)
 
int receivers (const char *signal) const
 
QObject * sender () const
 
int senderSignalIndex () const
 
virtual void timerEvent (QTimerEvent *event)
 
- Static Protected Member Functions inherited from QObject
QByteArray normalizeSignalSlot (const char *signalSlot)
 
- Properties inherited from QObject
 objectName
 

Detailed Description

KTextEditor Plugin interface.

Topics:

  • Introduction
  • Configuration Management
  • Session Management
  • Plugin Architecture

Introduction

The Plugin class provides methods to create loadable plugins for all KTextEditor implementations. A plugin can handle several documents and views. For every document the plugin should handle addDocument() is called and for every view addView().

Configuration Management

Todo:

write docu about config pages (new with kpluginmanager)

write docu about save/load settings (related to config page)

Session Management

As an extension a Plugin can implement the SessionConfigInterface. This interface provides functions to read and write session related settings. If you have session dependent data additionally derive your Plugin from this interface and implement the session related functions, for example:

class MyPlugin : public KTextEditor::Plugin,
public KTextEditor::SessionConfigInterface
{
Q_OBJECT
Q_INTERFACES(KTextEditor::SessionConfigInterface)
// ...
virtual void readSessionConfig (const KConfigGroup& config);
virtual void writeSessionConfig (KConfigGroup& config);
};

Plugin Architecture

After the plugin is loaded the editor implementation should call addDocument() and addView() for all documents and views the plugin should handle. If your plugin has a GUI it is common to add an extra class, like:

class PluginView : public QObject, public KXMLGUIClient
{
Q_OBJECT
public:
// Constructor and other methods
PluginView( KTextEditor::View* view )
: QObject( view ), KXMLGUIClient( view ), m_view( view )
{ ... }
// ...
private:
KTextEditor::View* m_view;
};

Your KTextEditor::Plugin derived class then will create a new PluginView for every View, i.e. for every call of addView().

The method removeView() will be called whenever a View is removed/closed. If you have a PluginView for every view this is the place to remove it.

See also
KTextEditor::Editor, KTextEditor::Document, KTextEditor::View, KTextEditor::SessionConfigInterface
Author
Christoph Cullmann <cullm.nosp@m.ann@.nosp@m.kde.o.nosp@m.rg>

Definition at line 107 of file plugin.h.

Constructor & Destructor Documentation

Plugin::Plugin ( QObject *  parent)

Constructor.

Create a new plugin.

Parameters
parentparent object

Definition at line 206 of file ktexteditor.cpp.

Plugin::~Plugin ( )
virtual

Virtual destructor.

Definition at line 211 of file ktexteditor.cpp.

Member Function Documentation

virtual void KTextEditor::Plugin::addDocument ( Document *  document)
inlinevirtual

Add a new document to the plugin.

This method is called whenever the plugin should handle another document.

For every call of addDocument() will finally follow a call of removeDocument(), i.e. the number of calls are identic.

Parameters
documentnew document to handle
See also
removeDocument(), addView()

Definition at line 141 of file plugin.h.

virtual void KTextEditor::Plugin::addView ( View *  view)
inlinevirtual

This method is called whenever the plugin should add its GUI to view.

The process for the Editor can be roughly described as follows:

  • add documents the plugin should handle via addDocument()
  • for every document doc call addView() for every view for doc.

For every call of addView() will finally follow a call of removeView(), i.e. the number of calls are identic.

Note
As addView() is called for every view in which the plugin's GUI should be visible you must not add the GUI by iterating over all Document::views() yourself neither use the signal Document::viewCreated().
Parameters
viewview to hang the gui in
See also
removeView(), addDocument()

Definition at line 175 of file plugin.h.

virtual void KTextEditor::Plugin::removeDocument ( Document *  document)
inlinevirtual

Remove the document from the plugin.

This method is called whenever the plugin should stop handling the document.

For every call of addDocument() will finally follow a call of removeDocument(), i.e. the number of calls are identic.

Parameters
documentdocument to hang the gui out from
See also
addDocument(), removeView()

Definition at line 154 of file plugin.h.

virtual void KTextEditor::Plugin::removeView ( View *  view)
inlinevirtual

This method is called whenever the plugin should remove its GUI from view.

For every call of addView() will finally follow a call of removeView(), i.e. the number of calls are identic.

Parameters
viewview to hang the gui out from
See also
addView(), removeDocument()

Definition at line 187 of file plugin.h.


The documentation for this class was generated from the following files:
  • plugin.h
  • ktexteditor.cpp
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Sat May 9 2020 03:56:48 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

KTextEditor

Skip menu "KTextEditor"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Modules
  • Related Pages

applications API Reference

Skip menu "applications API Reference"
  •   kate
  •       kate
  •   KTextEditor
  •   Kate
  • Konsole

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal