katefilelist.h
00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #ifndef __KATE_FILELIST_H__
00022 #define __KATE_FILELIST_H__
00023
00024 #include "katemain.h"
00025
00026 #include <kate/document.h>
00027
00028 #include <klistview.h>
00029
00030 #include <qtooltip.h>
00031 #include <qcolor.h>
00032 #include <qptrlist.h>
00033
00034 #define RTTI_KateFileListItem 1001
00035
00036 class KateMainWindow;
00037
00038 class KAction;
00039
00040 class KateFileListItem : public QListViewItem
00041 {
00042 public:
00043 KateFileListItem( QListView *lv,
00044 Kate::Document *doc );
00045 ~KateFileListItem();
00046
00047 inline uint documentNumber () { return m_docNumber; }
00048 inline Kate::Document * document() { return doc; }
00049
00050 int rtti() const { return RTTI_KateFileListItem; }
00051
00055 void setViewHistPos( int p ) { m_viewhistpos = p; }
00059 void setEditHistPos( int p ) { m_edithistpos = p; }
00060
00061 protected:
00062 virtual const QPixmap *pixmap ( int column ) const;
00063 void paintCell( QPainter *painter, const QColorGroup & cg, int column, int width, int align );
00067 int compare ( QListViewItem * i, int col, bool ascending ) const;
00068
00069 private:
00070 Kate::Document *doc;
00071 int m_viewhistpos;
00072 int m_edithistpos;
00073 uint m_docNumber;
00074 };
00075
00076 class KateFileList : public KListView
00077 {
00078 Q_OBJECT
00079
00080 friend class KFLConfigPage;
00081
00082 public:
00083 KateFileList (KateMainWindow *main, KateViewManager *_viewManager, QWidget * parent = 0, const char * name = 0 );
00084 ~KateFileList ();
00085
00086 int sortType () const { return m_sort; };
00087 void updateSort ();
00088
00089 enum sorting {
00090 sortByID = 0,
00091 sortByName = 1,
00092 sortByURL = 2
00093 };
00094
00095 QString tooltip( QListViewItem *item, int );
00096
00097 uint histCount() const { return m_viewHistory.count(); }
00098 uint editHistCount() const { return m_editHistory.count(); }
00099 QColor editShade() const { return m_editShade; }
00100 QColor viewShade() const { return m_viewShade; }
00101 bool shadingEnabled() { return m_enableBgShading; }
00102
00103 void readConfig( class KConfig *config, const QString &group );
00104 void writeConfig( class KConfig *config, const QString &group );
00105
00109 void takeItem( QListViewItem * );
00110
00111 public slots:
00112 void setSortType (int s);
00113 void slotNextDocument();
00114 void slotPrevDocument();
00115
00116 private slots:
00117 void slotDocumentCreated (Kate::Document *doc);
00118 void slotDocumentDeleted (uint documentNumber);
00119 void slotActivateView( QListViewItem *item );
00120 void slotModChanged (Kate::Document *doc);
00121 void slotModifiedOnDisc (Kate::Document *doc, bool b, unsigned char reason);
00122 void slotNameChanged (Kate::Document *doc);
00123 void slotViewChanged ();
00124 void slotMenu ( QListViewItem *item, const QPoint &p, int col );
00125
00126 protected:
00127 virtual void keyPressEvent( QKeyEvent *e );
00132 virtual void contentsMousePressEvent( QMouseEvent *e );
00137 virtual void resizeEvent( QResizeEvent *e );
00138
00139 private:
00140 void setupActions ();
00141 void updateActions ();
00142
00143 private:
00144 KateMainWindow *m_main;
00145 KateViewManager *viewManager;
00146
00147 int m_sort;
00148 bool notify;
00149
00150 KAction* windowNext;
00151 KAction* windowPrev;
00152
00153 QPtrList<KateFileListItem> m_viewHistory;
00154 QPtrList<KateFileListItem> m_editHistory;
00155
00156 QColor m_viewShade, m_editShade;
00157 bool m_enableBgShading;
00158
00159 class ToolTip *m_tooltip;
00160 };
00161
00162 class KFLConfigPage : public Kate::ConfigPage {
00163 Q_OBJECT
00164 public:
00165 KFLConfigPage( QWidget* parent=0, const char *name=0, KateFileList *fl=0 );
00166 virtual ~KFLConfigPage() {};
00167
00168 virtual void apply();
00169 virtual void reload();
00170
00171 public slots:
00172 void slotEnableChanged();
00173
00174 private slots:
00175 void slotMyChanged();
00176
00177 private:
00178 class QCheckBox *cbEnableShading;
00179 class KColorButton *kcbViewShade, *kcbEditShade;
00180 class QLabel *lEditShade, *lViewShade;
00181 KateFileList *m_filelist;
00182
00183 bool m_changed;
00184 };
00185
00186
00187 #endif
00188
This file is part of the documentation for kate Library Version 3.4.2.