00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
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