Kate
autobookmarker.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023 #ifndef AUTOBOOKMARKER_H
00024 #define AUTOBOOKMARKER_H
00025
00026 #include <ktexteditor/plugin.h>
00027 #include <ktexteditor/configinterfaceextension.h>
00028
00029 #include <kdialog.h>
00030
00031 #include <Qt3Support/Q3PtrList>
00032
00033 class AutoBookmarkEnt
00034 {
00035 public:
00036 enum REFlags { CaseSensitive=1, MinimalMatching=2 };
00037 explicit AutoBookmarkEnt(const QString &p=QString(),
00038 const QStringList &f=QStringList(),
00039 const QStringList &m=QStringList(),
00040 int flags=1 );
00041 ~AutoBookmarkEnt(){}
00042 QString pattern;
00043 QStringList filemask;
00044 QStringList mimemask;
00045 int flags;
00046 };
00047
00048 class AutoBookmarker
00049 : public KTextEditor::Plugin, public KTextEditor::PluginViewInterface,
00050 public KTextEditor::ConfigInterfaceExtension
00051 {
00052 Q_OBJECT
00053 public:
00054 explicit AutoBookmarker( QObject *parent = 0,
00055 const char* name = 0,
00056 const QVariantList &args = QVariantList() );
00057 virtual ~AutoBookmarker() {}
00058
00059 void addView (KTextEditor::View *view);
00060 void removeView (KTextEditor::View *view);
00061
00062
00063 uint configPages() const { return 1; };
00064 KTextEditor::ConfigPage * configPage( uint number, QWidget *parent, const char *name );
00065 QString configPageName( uint ) const;
00066 QString configPageFullName( uint ) const;
00067 QPixmap configPagePixmap( uint, int ) const;
00068 bool abDone;
00069
00070 private Q_SLOTS:
00071 void slotCompleted();
00072 void applyEntity( AutoBookmarkEnt *e );
00073 };
00074
00075 typedef Q3PtrList<AutoBookmarkEnt> ABEntityList;
00076 typedef Q3PtrListIterator<AutoBookmarkEnt> ABEntityListIterator;
00077
00078
00079 class ABGlobal
00080 {
00081 public:
00082 ABGlobal();
00083 ~ABGlobal();
00084
00085 static ABGlobal* self();
00086
00087 ABEntityList* entities() { return m_ents; };
00088 void readConfig();
00089 void writeConfig();
00090
00091 private:
00092 ABEntityList *m_ents;
00093 };
00094
00095 class AutoBookmarkerConfigPage : public KTextEditor::ConfigPage
00096 {
00097 Q_OBJECT
00098 public:
00099 AutoBookmarkerConfigPage( QWidget *parent, const char *name );
00100 virtual ~AutoBookmarkerConfigPage() {}
00101
00102 virtual void apply();
00103 virtual void reset();
00104 virtual void defaults();
00105
00106 private Q_SLOTS:
00107 void slotNew();
00108 void slotDel();
00109 void slotEdit();
00110
00111 private:
00112 class K3ListView *lvPatterns;
00113 class QPushButton *btnNew, *btnDel, *btnEdit;
00114 ABEntityList *m_ents;
00115 };
00116
00117 class AutoBookmarkerEntEditor : public KDialog
00118 {
00119 Q_OBJECT
00120 public:
00121 AutoBookmarkerEntEditor( QWidget *parent, AutoBookmarkEnt *e );
00122 ~AutoBookmarkerEntEditor(){}
00123
00124 void apply();
00125
00126 private Q_SLOTS:
00127 void showMTDlg();
00128 void slotPatternChanged( const QString& );
00129 private:
00130 class KLineEdit *lePattern, *leMimeTypes, *leFileMask;
00131 class QCheckBox *cbCS, *cbMM;
00132 AutoBookmarkEnt *e;
00133 };
00134
00135 #endif //_AUTOBOOKMARKER_H_