• Skip to content
  • Skip to link menu
KDE 4.1 API Reference
  • KDE API Reference
  • kdelibs
  • Sitemap
  • Contact Us
 

KTextEditor

KTextEditor::Plugin

KTextEditor::Plugin Class Reference

#include <plugin.h>

Inheritance diagram for KTextEditor::Plugin:

Inheritance graph
[legend]

List of all members.


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
Todo:
write docu about save/load settings

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 (KConfig *config);
   virtual void writeSessionConfig (KConfig *config);
 };

Plugin Architecture

After the plugin is loaded the editor implementation should first call readConfig() with a given KConfig object. After this it will 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 <cullmann@kde.org>

Definition at line 106 of file plugin.h.


Public Member Functions

virtual void addDocument (Document *document)
virtual void addView (View *view)
 Plugin (QObject *parent)
virtual void removeDocument (Document *document)
virtual void removeView (View *view)
virtual ~Plugin ()

Constructor & Destructor Documentation

Plugin::Plugin ( QObject *  parent  ) 

Constructor.

Create a new plugin.

Parameters:
parent parent object

Definition at line 265 of file ktexteditor.cpp.

Plugin::~Plugin (  )  [virtual]

Virtual destructor.

Definition at line 270 of file ktexteditor.cpp.


Member Function Documentation

virtual void KTextEditor::Plugin::addDocument ( Document *  document  )  [inline, virtual]

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:
document new document to handle
See also:
removeDocument(), addView()

Definition at line 140 of file plugin.h.

virtual void KTextEditor::Plugin::addView ( View *  view  )  [inline, virtual]

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 the GUI by iterating over all Document::views() yourself neither use the signal Document::viewCreated().
Parameters:
view view to hang the gui in
See also:
removeView(), addDocument()

Definition at line 174 of file plugin.h.

virtual void KTextEditor::Plugin::removeDocument ( Document *  document  )  [inline, virtual]

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:
document document to hang the gui out from
See also:
addDocument(), removeView()

Definition at line 153 of file plugin.h.

virtual void KTextEditor::Plugin::removeView ( View *  view  )  [inline, virtual]

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:
view view to hang the gui out from
See also:
addView(), removeDocument()

Definition at line 186 of file plugin.h.


The documentation for this class was generated from the following files:
  • plugin.h
  • ktexteditor.cpp

KTextEditor

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

kdelibs

Skip menu "kdelibs"
  • DNSSD
  • Interfaces
  •   KHexEdit
  •   KMediaPlayer
  •   KSpeech
  •   KTextEditor
  • Kate
  • kconf_update
  • KDE3Support
  •   KUnitTest
  • KDECore
  • KDED
  • KDEsu
  • KDEUI
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • KIO
  • KIOSlave
  • KJS
  •   KJS-API
  •   WTF
  • kjsembed
  • KNewStuff
  • KParts
  • Kross
  • KUtils
  • Nepomuk
  • Solid
  • Sonnet
  • ThreadWeaver
Generated for kdelibs by doxygen 1.5.4
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal