3
#include "plugin_%{APPNAMELC}.h"
7
#include <kstandarddirs.h>
9
class PluginView : public KXMLGUIClient
11
friend class KatePlugin%{APPNAME};
14
Kate::MainWindow *win;
19
void* init_lib%{APPNAMELC}plugin()
21
KGlobal::locale()->insertCatalogue("kate%{APPNAMELC}");
22
return new KatePluginFactory;
26
KatePluginFactory::KatePluginFactory()
28
s_instance = new KInstance( "kate" );
31
KatePluginFactory::~KatePluginFactory()
36
QObject* KatePluginFactory::createObject( QObject* parent, const char* name, const char*, const QStringList & )
38
return new KatePlugin%{APPNAME}( parent, name );
41
KInstance* KatePluginFactory::s_instance = 0L;
43
KatePlugin%{APPNAME}::KatePlugin%{APPNAME}( QObject* parent, const char* name )
44
: Kate::Plugin ( (Kate::Application*)parent, name )
48
KatePlugin%{APPNAME}::~KatePlugin%{APPNAME}()
52
void KatePlugin%{APPNAME}::addView(Kate::MainWindow *win)
54
/// @todo doesn't this have to be deleted?
55
PluginView *view = new PluginView ();
57
(void) new KAction ( i18n("Insert Hello World"), 0, this,
58
SLOT( slotInsertHello() ), view->actionCollection(),
59
"edit_insert_%{APPNAMELC}" );
61
view->setInstance (new KInstance("kate"));
62
view->setXMLFile("plugins/%{APPNAMELC}/plugin_%{APPNAMELC}.rc");
63
win->guiFactory()->addClient (view);
66
m_views.append (view);
68
void KatePlugin%{APPNAME}::removeView(Kate::MainWindow *win)
70
for (uint z=0; z < m_views.count(); z++)
71
if (m_views.at(z)->win == win)
73
PluginView *view = m_views.at(z);
74
m_views.remove (view);
75
win->guiFactory()->removeClient (view);
80
void KatePlugin%{APPNAME}::slotInsertHello()
82
Kate::View *kv = application()->activeMainWindow()->viewManager()->activeView();
85
kv->insertText ("Hello World");
88
#include "plugin_%{APPNAMELC}.moc"