katefiletype.h00001
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 <qpopupmenu.h>
00025 #include <qguardedptr.h>
00026
00027 #include "katedialogs.h"
00028
00029 class KateDocument;
00030
00031 class KateFileType
00032 {
00033 public:
00034 int number;
00035 QString name;
00036 QString section;
00037 QStringList wildcards;
00038 QStringList mimetypes;
00039 int priority;
00040 QString varLine;
00041 };
00042
00043 class KateFileTypeManager
00044 {
00045 public:
00046 KateFileTypeManager ();
00047 ~KateFileTypeManager ();
00048
00052 void update ();
00053
00054 void save (QPtrList<KateFileType> *v);
00055
00060 int fileType (KateDocument *doc);
00061
00065 const KateFileType *fileType (uint number);
00066
00070 QPtrList<KateFileType> *list () { return &m_types; }
00071
00072 private:
00073 int wildcardsFind (const QString &fileName);
00074
00075 private:
00076 QPtrList<KateFileType> m_types;
00077 };
00078
00079 class KateFileTypeConfigTab : public KateConfigPage
00080 {
00081 Q_OBJECT
00082
00083 public:
00084 KateFileTypeConfigTab( QWidget *parent );
00085
00086 public slots:
00087 void apply();
00088 void reload();
00089 void reset();
00090 void defaults();
00091
00092 private slots:
00093 void update ();
00094 void deleteType ();
00095 void newType ();
00096 void typeChanged (int type);
00097 void showMTDlg();
00098 void save ();
00099
00100 private:
00101 class QGroupBox *gbProps;
00102 class QPushButton *btndel;
00103 class QComboBox *typeCombo;
00104 class QLineEdit *wildcards;
00105 class QLineEdit *mimetypes;
00106 class KIntNumInput *priority;
00107 class QLineEdit *name;
00108 class QLineEdit *section;
00109 class QLineEdit *varLine;
00110
00111 QPtrList<KateFileType> m_types;
00112 KateFileType *m_lastType;
00113 };
00114
00115 class KateViewFileTypeAction : public Kate::ActionMenu
00116 {
00117 Q_OBJECT
00118
00119 public:
00120 KateViewFileTypeAction(const QString& text, QObject* parent = 0, const char* name = 0)
00121 : Kate::ActionMenu(text, parent, name) { init(); };
00122
00123 ~KateViewFileTypeAction(){;};
00124
00125 void updateMenu (Kate::Document *doc);
00126
00127 private:
00128 void init();
00129
00130 QGuardedPtr<KateDocument> m_doc;
00131 QStringList subMenusName;
00132 QStringList names;
00133 QPtrList<QPopupMenu> subMenus;
00134
00135 public slots:
00136 void slotAboutToShow();
00137
00138 private slots:
00139 void setType (int mode);
00140 };
00141
00142 #endif
|