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

kapptemplate

  • sources
  • kde-4.12
  • kdesdk
  • kapptemplate
  • templates
  • C++
  • ktexteditor
ktexteditor/%{APPNAMELC}plugin.cpp
Go to the documentation of this file.
1 #include "%{APPNAMELC}plugin.h"
2 #include "%{APPNAMELC}view.h"
3 
4 #include <KTextEditor/Document>
5 #include <KTextEditor/View>
6 
7 #include <KPluginFactory>
8 #include <KPluginLoader>
9 #include <KLocale>
10 #include <KAction>
11 #include <KActionCollection>
12 
13 K_PLUGIN_FACTORY(%{APPNAME}PluginFactory, registerPlugin<%{APPNAME}Plugin>("ktexteditor_%{APPNAMELC}");)
14 K_EXPORT_PLUGIN(%{APPNAME}PluginFactory("ktexteditor_%{APPNAMELC}", "ktexteditor_plugins"))
15 
16 %{APPNAME}Plugin::%{APPNAME}Plugin(QObject *parent, const QVariantList &args)
17 : KTextEditor::Plugin(parent)
18 {
19  Q_UNUSED(args);
20 }
21 
22 %{APPNAME}Plugin::~%{APPNAME}Plugin()
23 {
24 }
25 
26 void %{APPNAME}Plugin::addView(KTextEditor::View *view)
27 {
28  %{APPNAME}View *nview = new %{APPNAME}View(view);
29  m_views.append(nview);
30 }
31 
32 void %{APPNAME}Plugin::removeView(KTextEditor::View *view)
33 {
34  for(int z = 0; z < m_views.size(); z++)
35  {
36  if(m_views.at(z)->parentClient() == view)
37  {
38  %{APPNAME}View *nview = m_views.at(z);
39  m_views.removeAll(nview);
40  delete nview;
41  }
42  }
43 }
44 
45 void %{APPNAME}Plugin::readConfig()
46 {
47 }
48 
49 void %{APPNAME}Plugin::writeConfig()
50 {
51 }
52 
53 %{APPNAME}View::%{APPNAME}View(KTextEditor::View *view)
54 : QObject(view)
55 , KXMLGUIClient(view)
56 , m_view(view)
57 {
58  setComponentData(%{APPNAME}PluginFactory::componentData());
59 
60  KAction *action = new KAction(i18n("KTextEditor - %{APPNAME}"), this);
61  actionCollection()->addAction("tools_%{APPNAMELC}", action);
62  //action->setShortcut(Qt::CTRL + Qt::Key_XYZ);
63  connect(action, SIGNAL(triggered()), this, SLOT(insert%{APPNAME}()));
64 
65  setXMLFile("%{APPNAMELC}ui.rc");
66 }
67 
68 %{APPNAME}View::~%{APPNAME}View()
69 {
70 }
71 
72 void %{APPNAME}View::insert%{APPNAME}()
73 {
74  m_view->document()->insertText(m_view->cursorPosition(), i18n("Hello, World!"));
75 }
76 
77 #include "%{APPNAMELC}view.moc"
removeView
void removeView(KTextEditor::View *view)
addView
virtual void addView(KTextEditor::View *view)
m_view
m_view(view)
Definition: ktexteditor/%{APPNAMELC}plugin.cpp:56
writeConfig
void writeConfig()
View
class SettingsHelper View
Plugin
class @0 Plugin(QObject *parent, const QVariantList &args)
%{APPNAMELC}view.h
m_views
QList< class%{APPNAME}View * > m_views
Definition: ktexteditor/%{APPNAMELC}plugin.h:32
view
virtual QDeclarativeView * view
Destructor.
Definition: kapp4-qml/src/%{APPNAMELC}view.h:51
APPNAME
main APPNAME
readConfig
void readConfig()
%{APPNAMELC}plugin.h
KXMLGUIClient
KXMLGUIClient(view)
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 23:03:22 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

kapptemplate

Skip menu "kapptemplate"
  • Main Page
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members

kdesdk API Reference

Skip menu "kdesdk API Reference"
  • kapptemplate
  • kcachegrind
  • kompare
  • lokalize
  • okteta
  • umbrello
  •   umbrello

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