kate Library API Documentation

kateexternaltools.h

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., 59 Temple Place - Suite 330,
00018    Boston, MA 02111-1307, 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 
00087   protected:
00088     virtual bool expandMacro( const QString &str, QStringList &ret );
00089 
00090   private slots:
00091     void slotRun();
00092 
00093   private:
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     ~KateExternalTool() {};
00110 
00111     QString name; 
00112     QString command; 
00113     QString icon; 
00114     QString tryexec; 
00115     QStringList mimetypes; 
00116     bool hasexec; 
00117     QString acname; 
00118 
00122     bool valid( QString mimetype ) const;
00128     bool checkExec();
00129 
00130   private:
00131     QString m_exec; 
00132 };
00133 
00139 class KateExternalToolsConfigWidget : public Kate::ConfigPage
00140 {
00141   Q_OBJECT
00142   public:
00143     KateExternalToolsConfigWidget( QWidget *parent, const char* name);
00144     virtual ~KateExternalToolsConfigWidget() {};
00145 
00146     virtual void apply();
00147     virtual void reload();
00148     virtual void reset() { reload(); } // sigh
00149     virtual void defaults() { reload(); } // double sigh
00150 
00151   private slots:
00152     void slotNew();
00153     void slotEdit();
00154     void slotRemove();
00155     void slotInsertSeparator();
00156 
00157     void slotMoveUp();
00158     void slotMoveDown();
00159 
00160     void slotSelectionChanged();
00161 
00162   private:
00163     QPixmap blankIcon();
00164 
00165     class KListBox *lbTools;
00166     class QPushButton *btnNew, *btnRemove, *btnEdit, *btnMoveUp, *btnMoveDwn;
00167 };
00168 
00172 class KateExternalToolServiceEditor : public KDialogBase
00173 {
00174   Q_OBJECT
00175 
00176   public:
00177 
00178     KateExternalToolServiceEditor( KateExternalTool *tool=0,
00179                        QWidget *parent=0, const char *name=0 );
00180 
00181     class QLineEdit *leName, *leCommand, *leExecutable, *leMimetypes;
00182     class KIconButton *btnIcon;
00183 
00184   private slots:
00188     void slotOk();
00189 
00190   private:
00191     KateExternalTool *tool;
00192 };
00193 #endif //_KATE_EXTERNAL_TOOLS_H_
KDE Logo
This file is part of the documentation for kate Library Version 3.3.90.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Tue Apr 5 03:59:28 2005 by doxygen 1.3.9.1 written by Dimitri van Heesch, © 1997-2003