Kate
autobookmarker.h
Go to the documentation of this file.
00001 /* 00002 This library is free software you can redistribute it and/or 00003 modify it under the terms of the GNU Library General Public 00004 License. 00005 00006 This library is distributed in the hope that it will be useful, 00007 but WITHOUT ANY WARRANTY; without even the implied warranty of 00008 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00009 Library General Public License for more details. 00010 00011 You should have received a copy of the GNU Library General Public License 00012 along with this library; see the file COPYING.LIB. If not, write to 00013 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 00014 Boston, MA 02110-1301, USA. 00015 00016 --- 00017 file: autobookmarker.h 00018 00019 KTextEditor plugin to add bookmarks to documents. 00020 Copyright Anders Lund <anders.lund@lund.tdcadsl.dk>, 2003 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 // ConfigInterfaceExtention 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 /* singleton to keep the data */ 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_
KDE 4.6 API Reference