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

kate

kateexternaltools.h

Go to the documentation of this file.
00001 /*
00002    This file is part of the Kate text editor of the KDE project.
00003    It describes a "external tools" action for kate and provides a dialog
00004    page to configure that.
00005 
00006    This library is free software; you can redistribute it and/or
00007    modify it under the terms of the GNU Library General Public
00008    License version 2 as published by the Free Software Foundation.
00009 
00010    This library is distributed in the hope that it will be useful,
00011    but WITHOUT ANY WARRANTY; without even the implied warranty of
00012    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00013    Library General Public License for more details.
00014 
00015    You should have received a copy of the GNU Library General Public License
00016    along with this library; see the file COPYING.LIB.  If not, write to
00017    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00018    Boston, MA 02110-1301, USA.
00019 
00020    ---
00021    Copyright (C) 2004, Anders Lund <anders@alweb.dk>
00022 */
00023 
00024 #ifndef _KATE_EXTERNAL_TOOLS_H_
00025 #define _KATE_EXTERNAL_TOOLS_H_
00026 
00027 #include <kaction.h>
00028 #include <kdialogbase.h>
00029 #include <kate/document.h>
00030 #include <kmacroexpander.h>
00031 #include <qpixmap.h>
00032 
00054 class KateExternalToolsMenuAction : public KActionMenu
00055 {
00056   friend class KateExternalToolAction;
00057 
00058   Q_OBJECT
00059   public:
00060     KateExternalToolsMenuAction( const QString &text=QString::null, QObject *parent=0, const char* name=0, class KateMainWindow *mw=0 );
00061     ~KateExternalToolsMenuAction() {};
00062 
00066     void reload();
00067 
00068     class KActionCollection *actionCollection() { return m_actionCollection; }
00069 
00070   private slots:
00071     void slotDocumentChanged();
00072 
00073   private:
00074     class KActionCollection *m_actionCollection;
00075     class KateMainWindow *mainwindow; // for the actions to access view/doc managers
00076 };
00077 
00081 class KateExternalToolAction : public KAction, public KWordMacroExpander
00082 {
00083   Q_OBJECT
00084   public:
00085     KateExternalToolAction( QObject *parent, const char *name, class KateExternalTool *t );
00086     ~KateExternalToolAction();
00087   protected:
00088     virtual bool expandMacro( const QString &str, QStringList &ret );
00089 
00090   private slots:
00091     void slotRun();
00092 
00093   public:
00094     class KateExternalTool *tool;
00095 };
00096 
00100 class KateExternalTool
00101 {
00102   public:
00103     KateExternalTool( const QString &name=QString::null,
00104                       const QString &command=QString::null,
00105                       const QString &icon=QString::null,
00106                       const QString &tryexec=QString::null,
00107                       const QStringList &mimetypes=QStringList(),
00108                       const QString &acname=QString::null,
00109                       const QString &cmdname=QString::null,
00110                       int save=0 );
00111     ~KateExternalTool() {};
00112 
00113     QString name; 
00114     QString command; 
00115     QString icon; 
00116     QString tryexec; 
00117     QStringList mimetypes; 
00118     bool hasexec; 
00119     QString acname; 
00120     QString cmdname; 
00121     int save; 
00122 
00126     bool valid( const QString &mimetype ) const;
00132     bool checkExec();
00133 
00134   private:
00135     QString m_exec; 
00136 };
00137 
00143 class KateExternalToolsConfigWidget : public Kate::ConfigPage
00144 {
00145   Q_OBJECT
00146   public:
00147     KateExternalToolsConfigWidget( QWidget *parent, const char* name);
00148     virtual ~KateExternalToolsConfigWidget();
00149 
00150     virtual void apply();
00151     virtual void reload();
00152     virtual void reset() { reload(); } // sigh
00153     virtual void defaults() { reload(); } // double sigh
00154 
00155   private slots:
00156     void slotNew();
00157     void slotEdit();
00158     void slotRemove();
00159     void slotInsertSeparator();
00160 
00161     void slotMoveUp();
00162     void slotMoveDown();
00163 
00164     void slotSelectionChanged();
00165 
00166   private:
00167     QPixmap blankIcon();
00168 
00169     QStringList m_removed;
00170 
00171     class KListBox *lbTools;
00172     class QPushButton *btnNew, *btnRemove, *btnEdit, *btnMoveUp, *btnMoveDwn;
00173 
00174     class KConfig *config;
00175 
00176     bool m_changed;
00177 };
00178 
00182  class KateExternalToolsCommand : public Kate::Command {
00183  public:
00184     KateExternalToolsCommand ();
00185     virtual ~KateExternalToolsCommand () {};
00186     static KateExternalToolsCommand *self();
00187     void reload();
00188   public:
00189     virtual QStringList cmds ();
00190     virtual bool exec (Kate::View *view, const QString &cmd, QString &msg);
00191     virtual bool help (Kate::View *view, const QString &cmd, QString &msg);
00192   private:
00193     static KateExternalToolsCommand *s_self;
00194     QStringList m_list;
00195     QMap<QString,QString> m_map;
00196     bool m_inited;
00197  };
00198 
00202 class KateExternalToolServiceEditor : public KDialogBase
00203 {
00204   Q_OBJECT
00205 
00206   public:
00207 
00208     KateExternalToolServiceEditor( KateExternalTool *tool=0,
00209                        QWidget *parent=0, const char *name=0 );
00210 
00211     class QLineEdit *leName, *leExecutable, *leMimetypes,*leCmdLine;
00212     class QTextEdit *teCommand;
00213     class KIconButton *btnIcon;
00214     class QComboBox *cmbSave;
00215 
00216   private slots:
00220     void slotOk();
00224     void showMTDlg();
00225 
00226   private:
00227     KateExternalTool *tool;
00228 };
00229 #endif //_KATE_EXTERNAL_TOOLS_H_

kate

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

API Reference

Skip menu "API Reference"
  • kate
Generated for API Reference by doxygen 1.5.9
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