summaryrefslogtreecommitdiffstats
path: root/kate/snippets/plugin_katesnippets.h
blob: 9a940e52a86b2d882f4a8c3f64f1720af610ae86 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
/*
 * Copyright (C) 2004 Stephan Möres <Erdling@gmx.net>
 */

#ifndef _PLUGIN_KATESNIPPETS_H_
#define _PLUGIN_KATESNIPPETS_H_

#include <kate/application.h>
#include <kate/documentmanager.h>
#include <kate/document.h>
#include <kate/mainwindow.h>
#include <kate/plugin.h>
#include <kate/view.h>
#include <kate/viewmanager.h>
#include <klibloader.h>
#include <klocale.h>

#include <kate/toolviewmanager.h>

#include <qlistview.h>
#include <qregexp.h>
#include <kconfig.h>
#include <qptrlist.h>
#include <qtoolbutton.h>
#include <qtextedit.h>
#include <kiconloader.h>

#include "csnippet.h"
#include "cwidgetsnippets.h"

class KatePluginSnippetsView : public CWidgetSnippets, public KXMLGUIClient {

  Q_OBJECT

  friend class KatePluginSnippets;

public:
  KatePluginSnippetsView (Kate::MainWindow *w, QWidget *dock);
  virtual ~KatePluginSnippetsView ();
  CSnippet* findSnippetByListViewItem(QListViewItem *item);

public slots:
  void slot_lvSnippetsSelectionChanged(QListViewItem  * item);
  void slot_lvSnippetsClicked (QListViewItem * item);
  void slot_lvSnippetsItemRenamed(QListViewItem *lvi,int col, const QString& text);
  void slot_btnNewClicked();
  void slot_btnSaveClicked();
  void slot_btnDeleteClicked();

protected:
  void readConfig();
  void writeConfig();

private:
  KConfig                                 *config;
  QPtrList<CSnippet>                      lSnippets;

public:
  Kate::MainWindow *win;
  QWidget *dock;
};

class KatePluginSnippets : public Kate::Plugin, Kate::PluginViewInterface {
  Q_OBJECT

public:
  KatePluginSnippets( QObject* parent = 0, const char* name = 0, const QStringList& = QStringList() );
  virtual ~KatePluginSnippets();

  void addView (Kate::MainWindow *win);
  void removeView (Kate::MainWindow *win);

private:
  QPtrList<class KatePluginSnippetsView>  m_views;

};

#endif // _PLUGIN_KATESNIPPETS_H_