• Skip to content
  • Skip to link menu
KDE 4.4 API Reference
  • KDE API Reference
  • kdesdk
  • Sitemap
  • Contact Us
 

kate/interfaces/kate

Kate::Plugin

Kate::Plugin Class Reference

Kate plugin interface. More...

#include <plugin.h>

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

List of all members.

Public Member Functions

 Plugin (Application *application=0, const char *name=0)
virtual ~Plugin ()
Application * application () const
virtual PluginView * createView (MainWindow *mainWindow)
virtual void readSessionConfig (KConfigBase *config, const QString &groupPrefix)
virtual void writeSessionConfig (KConfigBase *config, const QString &groupPrefix)

Detailed Description

Kate plugin interface.

Topics:

  • Introduction
  • Configuration Management
  • Plugin Views
  • Config Pages

Introduction

The Plugin class is the central part of a Kate plugin. It is possible to represent your plugin in the GUI with a subclass of PluginView. Furthermore if the plugin is configurable (and thus has config pages) you have to additionally derive your plugin from PluginConfigPageInterface.

Configuration Management

When Kate loads a session it calls readSessionConfig(), so if you have config settings use this function to load them. To save config settings for a session use writeSessionConfig(), as it will be called whenever a session is saved/closed.

If you want to save config settings which are not bound to a session but valid for all plugin instances you have to create your own KConfig like this:

 KConfig* myConfig = new KConfig("katemypluginrc");

Plugin Views

If your plugin needs to be present in the GUI (e.g. menu or toolbar entries) you have to subclass PluginView and return a new instance of your plugin view, like this:

 class MyPluginView : public Kate::PluginView
 {
     Q_OBJECT
 public:
     MyPluginView(MainWindow *mainWindow);

     // possibilities of gui:
     // - hook into the menus with KXMLGUIClient
     // - create a toolView and put a widget into it with MainWindow::createToolView()
 };

 class MyPlugin : public Kate::Plugin
 {
     Q_OBJECT

 public:
     // other methods etc...
     PluginView *createView(MainWindow *mainWindow)
     {
         return new MyPluginView(mainWindow);
     }
 };

The Kate application takes care and deletes all plugin views. Further information can be found in the class documentation of PluginView.

Config Pages

If your plugin is configurable it makes sense to have config pages which appear in Kate's settings dialog. To tell the plugin loader that your plugin supports config pages you have to additionally derive your plugin from the class PluginConfigPageInterface. Read the class documentation for PluginConfigPageInterface to see how to do this right.

See also:
PluginView, PluginConfigPageInterface
Author:
Christoph Cullmann <cullmann@kde.org>

Definition at line 114 of file plugin.h.


Constructor & Destructor Documentation

Plugin::Plugin ( Application *  application = 0,
const char *  name = 0 
) [explicit]

Constructor.

Parameters:
application the Kate application
name identifier

Definition at line 58 of file plugin.cpp.

Plugin::~Plugin (  )  [virtual]

Virtual destructor.

Definition at line 63 of file plugin.cpp.


Member Function Documentation

Application * Plugin::application (  )  const

Accessor to the Kate application.

Returns:
the application object

Definition at line 72 of file plugin.cpp.

PluginView * Plugin::createView ( MainWindow *  mainWindow  )  [virtual]

Create a new View for this plugin for the given Kate MainWindow This may be called arbitrary often by the application to create as much views as mainwindows are around, the application will take care to delete this views if mainwindows close, you don't need to handle this yourself in the plugin.

The default implementation just doesn't create any view and returns a NULL pointer

Parameters:
mainWindow the MainWindow for which a view should be created
Returns:
the new created view or NULL

Definition at line 77 of file plugin.cpp.

void Plugin::readSessionConfig ( KConfigBase *  config,
const QString &  groupPrefix 
) [virtual]

Load session specific settings here.

This function is called whenever a Kate session is loaded. You should use the given config and prefix groupPrefix to store the data. The group prefix exist so that the group does not clash with other applications that use the same config file.

Parameters:
config the KConfig object which is to be used
groupPrefix the group prefix which is to be used
See also:
writeSessionConfig()

Definition at line 82 of file plugin.cpp.

void Plugin::writeSessionConfig ( KConfigBase *  config,
const QString &  groupPrefix 
) [virtual]

Store session specific settings here.

This function is called whenever a Kate session is saved. You should use the given config and prefix groupPrefix to store the data. The group prefix exists so that the group does not clash with other applications that use the same config file.

Parameters:
config the KConfig object which is to be used
groupPrefix the group prefix which is to be used
See also:
readSessionConfig()

Definition at line 85 of file plugin.cpp.


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

kate/interfaces/kate

Skip menu "kate/interfaces/kate"
  • Main Page
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Namespace Members
  • Class Members
  • Related Pages

kdesdk

Skip menu "kdesdk"
  • kapptemplate
  • kate
  •     kate
  • kbugbuster
  • kcachegrind
  • kompare
  • lokalize
  • umbrello
  •   umbrello
Generated for kdesdk by doxygen 1.5.9-20090814
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