kate Library API Documentation

katefiletype.h

00001 /* This file is part of the KDE libraries
00002    Copyright (C) 2001-2003 Christoph Cullmann <cullmann@kde.org>
00003 
00004    This library is free software; you can redistribute it and/or
00005    modify it under the terms of the GNU Library General Public
00006    License version 2 as published by the Free Software Foundation.
00007 
00008    This library is distributed in the hope that it will be useful,
00009    but WITHOUT ANY WARRANTY; without even the implied warranty of
00010    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00011    Library General Public License for more details.
00012 
00013    You should have received a copy of the GNU Library General Public License
00014    along with this library; see the file COPYING.LIB.  If not, write to
00015    the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
00016    Boston, MA 02111-1307, USA.
00017 */
00018 
00019 #ifndef __kate_filetype_h__
00020 #define __kate_filetype_h__
00021 
00022 #include <qstringlist.h>
00023 #include <qptrlist.h>
00024 #include <qguardedptr.h>
00025 
00026 #include "katedialogs.h"
00027 
00028 class KateDocument;
00029 
00030 class QPopupMenu;
00031 
00032 class KateFileType
00033 {
00034   public:
00035     int number;
00036     QString name;
00037     QString section;
00038     QStringList wildcards;
00039     QStringList mimetypes;
00040     int priority;
00041     QString varLine;
00042 };
00043 
00044 class KateFileTypeManager
00045 {
00046   public:
00047     KateFileTypeManager ();
00048     ~KateFileTypeManager ();
00049 
00053     void update ();
00054 
00055     void save (QPtrList<KateFileType> *v);
00056 
00061     int fileType (KateDocument *doc);
00062 
00066     const KateFileType *fileType (uint number);
00067 
00071     QPtrList<KateFileType> *list () { return &m_types; }
00072 
00073   private:
00074     int wildcardsFind (const QString &fileName);
00075 
00076   private:
00077     QPtrList<KateFileType> m_types;
00078 };
00079 
00080 class KateFileTypeConfigTab : public KateConfigPage
00081 {
00082   Q_OBJECT
00083 
00084   public:
00085     KateFileTypeConfigTab( QWidget *parent );
00086 
00087   public slots:
00088     void apply();
00089     void reload();
00090     void reset();
00091     void defaults();
00092 
00093   private slots:
00094     void update ();
00095     void deleteType ();
00096     void newType ();
00097     void typeChanged (int type);
00098     void showMTDlg();
00099     void save ();
00100 
00101   private:
00102     class QGroupBox *gbProps;
00103     class QPushButton *btndel;
00104     class QComboBox *typeCombo;
00105     class QLineEdit *wildcards;
00106     class QLineEdit *mimetypes;
00107     class KIntNumInput *priority;
00108     class QLineEdit *name;
00109     class QLineEdit *section;
00110     class QLineEdit *varLine;
00111 
00112     QPtrList<KateFileType> m_types;
00113     KateFileType *m_lastType;
00114 };
00115 
00116 class KateViewFileTypeAction : public Kate::ActionMenu
00117 {
00118   Q_OBJECT
00119 
00120   public:
00121     KateViewFileTypeAction(const QString& text, QObject* parent = 0, const char* name = 0)
00122        : Kate::ActionMenu(text, parent, name) { init(); };
00123 
00124     ~KateViewFileTypeAction(){;};
00125 
00126     void updateMenu (Kate::Document *doc);
00127 
00128   private:
00129     void init();
00130 
00131     QGuardedPtr<KateDocument> m_doc;
00132     QStringList subMenusName;
00133     QStringList names;
00134     QPtrList<QPopupMenu> subMenus;
00135 
00136   public  slots:
00137     void slotAboutToShow();
00138 
00139   private slots:
00140     void setType (int mode);
00141 };
00142 
00143 #endif
KDE Logo
This file is part of the documentation for kate Library Version 3.2.2.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Fri Jan 21 09:59:08 2005 by doxygen 1.3.6 written by Dimitri van Heesch, © 1997-2003