autobookmarker.h00001
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 <kdialogbase.h>
00030
00031 #include <qptrlist.h>
00032 #include <qvbox.h>
00033
00034 class AutoBookmarkEnt
00035 {
00036 public:
00037 enum REFlags { CaseSensitive=1, MinimalMatching=2 };
00038 AutoBookmarkEnt(const QString &p=QString::null,
00039 const QStringList &f=QStringList(),
00040 const QStringList &m=QStringList(),
00041 int flags=1 );
00042 ~AutoBookmarkEnt(){};
00043 QString pattern;
00044 QStringList filemask;
00045 QStringList mimemask;
00046 int flags;
00047 };
00048
00049 class AutoBookmarker
00050 : public KTextEditor::Plugin, public KTextEditor::PluginViewInterface,
00051 public KTextEditor::ConfigInterfaceExtension
00052 {
00053 Q_OBJECT
00054 public:
00055 AutoBookmarker( QObject *parent = 0,
00056 const char* name = 0,
00057 const QStringList &args = QStringList() );
00058 virtual ~AutoBookmarker() {};
00059
00060 void addView (KTextEditor::View *view);
00061 void removeView (KTextEditor::View *view);
00062
00063
00064 uint configPages() const { return 1; };
00065 KTextEditor::ConfigPage * configPage( uint number, QWidget *parent, const char *name );
00066 QString configPageName( uint ) const;
00067 QString configPageFullName( uint ) const;
00068 QPixmap configPagePixmap( uint, int ) const;
00069 bool abDone;
00070
00071 private slots:
00072 void slotCompleted();
00073 void applyEntity( AutoBookmarkEnt *e );
00074 };
00075
00076 typedef QPtrList<AutoBookmarkEnt> ABEntityList;
00077 typedef QPtrListIterator<AutoBookmarkEnt> ABEntityListIterator;
00078
00079
00080 class ABGlobal
00081 {
00082 public:
00083 ABGlobal();
00084 ~ABGlobal();
00085
00086 static ABGlobal* self();
00087
00088 ABEntityList* entities() { return m_ents; };
00089 void readConfig();
00090 void writeConfig();
00091
00092 private:
00093 ABEntityList *m_ents;
00094 static ABGlobal *s_self;
00095 };
00096
00097 class AutoBookmarkerConfigPage : public KTextEditor::ConfigPage
00098 {
00099 Q_OBJECT
00100 public:
00101 AutoBookmarkerConfigPage( QWidget *parent, const char *name );
00102 virtual ~AutoBookmarkerConfigPage() {};
00103
00104 virtual void apply();
00105 virtual void reset();
00106 virtual void defaults();
00107
00108 private slots:
00109 void slotNew();
00110 void slotDel();
00111 void slotEdit();
00112
00113 private:
00114 class KListView *lvPatterns;
00115 class QPushButton *btnNew, *btnDel, *btnEdit;
00116 ABEntityList *m_ents;
00117 };
00118
00119 class AutoBookmarkerEntEditor : public KDialogBase
00120 {
00121 Q_OBJECT
00122 public:
00123 AutoBookmarkerEntEditor( QWidget *parent, AutoBookmarkEnt *e );
00124 ~AutoBookmarkerEntEditor(){};
00125
00126 void apply();
00127
00128 private slots:
00129 void showMTDlg();
00130 void slotPatternChanged( const QString& );
00131 private:
00132 class QLineEdit *lePattern, *leMimeTypes, *leFileMask;
00133 class QCheckBox *cbCS, *cbMM;
00134 AutoBookmarkEnt *e;
00135 };
00136
00137 #endif //_AUTOBOOKMARKER_H_
|