• Skip to content
  • Skip to link menu
Trinity API Reference
  • Trinity API Reference
  • kate
 

kate

  • kate
  • app
kateexternaltools.h
1 /*
2  This file is part of the Kate text editor of the KDE project.
3  It describes a "external tools" action for kate and provides a dialog
4  page to configure that.
5 
6  This library is free software; you can redistribute it and/or
7  modify it under the terms of the GNU Library General Public
8  License version 2 as published by the Free Software Foundation.
9 
10  This library is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13  Library General Public License for more details.
14 
15  You should have received a copy of the GNU Library General Public License
16  along with this library; see the file COPYING.LIB. If not, write to
17  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18  Boston, MA 02110-1301, USA.
19 
20  ---
21  Copyright (C) 2004, Anders Lund <anders@alweb.dk>
22 */
23 
24 #ifndef _KATE_EXTERNAL_TOOLS_H_
25 #define _KATE_EXTERNAL_TOOLS_H_
26 
27 #include <tdeaction.h>
28 #include <kdialogbase.h>
29 #include <kate/document.h>
30 #include <kmacroexpander.h>
31 #include <tqpixmap.h>
32 
54 class KateExternalToolsMenuAction : public TDEActionMenu
55 {
56  friend class KateExternalToolAction;
57 
58  TQ_OBJECT
59  public:
60  KateExternalToolsMenuAction( const TQString &text=TQString::null, TQObject *parent=0, const char* name=0, class KateMainWindow *mw=0 );
61  ~KateExternalToolsMenuAction() {};
62 
66  void reload();
67 
68  class TDEActionCollection *actionCollection() { return m_actionCollection; }
69 
70  private slots:
71  void slotDocumentChanged();
72 
73  private:
74  class TDEActionCollection *m_actionCollection;
75  class KateMainWindow *mainwindow; // for the actions to access view/doc managers
76 };
77 
81 class KateExternalToolAction : public TDEAction, public KWordMacroExpander
82 {
83  TQ_OBJECT
84  public:
85  KateExternalToolAction( TQObject *parent, const char *name, class KateExternalTool *t );
86  ~KateExternalToolAction();
87  protected:
88  virtual bool expandMacro( const TQString &str, TQStringList &ret );
89 
90  private slots:
91  void slotRun();
92 
93  public:
94  class KateExternalTool *tool;
95 };
96 
100 class KateExternalTool
101 {
102  public:
103  KateExternalTool( const TQString &name=TQString::null,
104  const TQString &command=TQString::null,
105  const TQString &icon=TQString::null,
106  const TQString &tryexec=TQString::null,
107  const TQStringList &mimetypes=TQStringList(),
108  const TQString &acname=TQString::null,
109  const TQString &cmdname=TQString::null,
110  int save=0 );
111  ~KateExternalTool() {};
112 
113  TQString name;
114  TQString command;
115  TQString icon;
116  TQString tryexec;
117  TQStringList mimetypes;
118  bool hasexec;
119  TQString acname;
120  TQString cmdname;
121  int save;
122 
126  bool valid( const TQString &mimetype ) const;
132  bool checkExec();
133 
134  private:
135  TQString m_exec;
136 };
137 
143 class KateExternalToolsConfigWidget : public Kate::ConfigPage
144 {
145  TQ_OBJECT
146  public:
147  KateExternalToolsConfigWidget( TQWidget *parent, const char* name);
148  virtual ~KateExternalToolsConfigWidget();
149 
150  virtual void apply();
151  virtual void reload();
152  virtual void reset() { reload(); } // sigh
153  virtual void defaults() { reload(); } // double sigh
154 
155  private slots:
156  void slotNew();
157  void slotEdit();
158  void slotRemove();
159  void slotInsertSeparator();
160 
161  void slotMoveUp();
162  void slotMoveDown();
163 
164  void slotSelectionChanged();
165 
166  private:
167  TQPixmap blankIcon();
168 
169  TQStringList m_removed;
170 
171  class TDEListBox *lbTools;
172  class TQPushButton *btnNew, *btnRemove, *btnEdit, *btnMoveUp, *btnMoveDwn;
173 
174  class TDEConfig *config;
175 
176  bool m_changed;
177 };
178 
182  class KateExternalToolsCommand : public Kate::Command {
183  public:
184  KateExternalToolsCommand ();
185  virtual ~KateExternalToolsCommand () {};
186  static KateExternalToolsCommand *self();
187  void reload();
188  public:
189  virtual TQStringList cmds ();
190  virtual bool exec (Kate::View *view, const TQString &cmd, TQString &msg);
191  virtual bool help (Kate::View *view, const TQString &cmd, TQString &msg);
192  private:
193  static KateExternalToolsCommand *s_self;
194  TQStringList m_list;
195  TQMap<TQString,TQString> m_map;
196  bool m_inited;
197  };
198 
202 class KateExternalToolServiceEditor : public KDialogBase
203 {
204  TQ_OBJECT
205 
206  public:
207 
208  KateExternalToolServiceEditor( KateExternalTool *tool=0,
209  TQWidget *parent=0, const char *name=0 );
210 
211  class TQLineEdit *leName, *leExecutable, *leMimetypes,*leCmdLine;
212  class TQTextEdit *teCommand;
213  class TDEIconButton *btnIcon;
214  class TQComboBox *cmbSave;
215 
216  private slots:
220  void slotOk();
224  void showMTDlg();
225 
226  private:
227  KateExternalTool *tool;
228 };
229 #endif //_KATE_EXTERNAL_TOOLS_H_
KateExternalTool::save
int save
We can save documents prior to activating the tool command: 0 = nothing, 1 = current document...
Definition: kateexternaltools.h:121
KateExternalTool::icon
TQString icon
the icon to use in the menu.
Definition: kateexternaltools.h:115
KateExternalToolsConfigWidget
The config widget.
Definition: kateexternaltools.h:143
KateExternalToolsMenuAction
The external tools action This action creates a menu, in which each item will launch a process with t...
Definition: kateexternaltools.h:54
KateExternalTool
This class defines a single external tool.
Definition: kateexternaltools.h:100
KateExternalToolServiceEditor
A Dialog to edit a single KateExternalTool object.
Definition: kateexternaltools.h:202
KateExternalToolAction
This Action contains a KateExternalTool.
Definition: kateexternaltools.h:81
KateExternalTool::mimetypes
TQStringList mimetypes
Optional list of mimetypes for which this action is valid.
Definition: kateexternaltools.h:117
KateExternalTool::acname
TQString acname
The name for the action. This is generated first time the action is is created.
Definition: kateexternaltools.h:119
KateExternalTool::name
TQString name
The name used in the menu.
Definition: kateexternaltools.h:111
KateExternalTool::hasexec
bool hasexec
This is set by the constructor by calling checkExec(), if a value is present.
Definition: kateexternaltools.h:118
KateExternalTool::command
TQString command
The command to execute.
Definition: kateexternaltools.h:114
KateExternalTool::tryexec
TQString tryexec
The name or path of the executable.
Definition: kateexternaltools.h:116
KateExternalToolsMenuAction::reload
void reload()
This will load all the confiured services.
Definition: kateexternaltools.cpp:308
KateExternalToolsCommand
A Singleton class for invoking external tools with the view command line.
Definition: kateexternaltools.h:182
KateExternalTool::cmdname
TQString cmdname
The name for the commandline.
Definition: kateexternaltools.h:120

kate

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

kate

Skip menu "kate"
  • kate
  • libkonq
  • twin
  •   lib
Generated for kate by doxygen 1.8.13
This website is maintained by Timothy Pearson.