kate
katefilelist.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 #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 class KSelectAction;
00040
00041 class KateFileListItem : public QListViewItem
00042 {
00043 public:
00044 KateFileListItem( QListView *lv,
00045 Kate::Document *doc );
00046 ~KateFileListItem();
00047
00048 inline uint documentNumber () { return m_docNumber; }
00049 inline Kate::Document * document() { return doc; }
00050
00051 int rtti() const { return RTTI_KateFileListItem; }
00052
00056 void setViewHistPos( int p ) { m_viewhistpos = p; }
00060 void setEditHistPos( int p ) { m_edithistpos = p; }
00061
00062 protected:
00063 virtual const QPixmap *pixmap ( int column ) const;
00064 void paintCell( QPainter *painter, const QColorGroup & cg, int column, int width, int align );
00068 int compare ( QListViewItem * i, int col, bool ascending ) const;
00069
00070 private:
00071 Kate::Document *doc;
00072 int m_viewhistpos;
00073 int m_edithistpos;
00074 uint m_docNumber;
00075 };
00076
00077 class KateFileList : public KListView
00078 {
00079 Q_OBJECT
00080
00081 friend class KFLConfigPage;
00082
00083 public:
00084 KateFileList (KateMainWindow *main, KateViewManager *_viewManager, QWidget * parent = 0, const char * name = 0 );
00085 ~KateFileList ();
00086
00087 int sortType () const { return m_sort; };
00088 void updateSort ();
00089
00090 enum sorting {
00091 sortByID = 0,
00092 sortByName = 1,
00093 sortByURL = 2
00094 };
00095
00096 QString tooltip( QListViewItem *item, int );
00097
00098 uint histCount() const { return m_viewHistory.count(); }
00099 uint editHistCount() const { return m_editHistory.count(); }
00100 QColor editShade() const { return m_editShade; }
00101 QColor viewShade() const { return m_viewShade; }
00102 bool shadingEnabled() { return m_enableBgShading; }
00103
00104 void readConfig( class KConfig *config, const QString &group );
00105 void writeConfig( class KConfig *config, const QString &group );
00106
00110 void takeItem( QListViewItem * );
00111
00112 public slots:
00113 void setSortType (int s);
00114 void slotNextDocument();
00115 void slotPrevDocument();
00116
00117 private slots:
00118 void slotDocumentCreated (Kate::Document *doc);
00119 void slotDocumentDeleted (uint documentNumber);
00120 void slotActivateView( QListViewItem *item );
00121 void slotModChanged (Kate::Document *doc);
00122 void slotModifiedOnDisc (Kate::Document *doc, bool b, unsigned char reason);
00123 void slotNameChanged (Kate::Document *doc);
00124 void slotViewChanged ();
00125 void slotMenu ( QListViewItem *item, const QPoint &p, int col );
00126
00127 protected:
00128 virtual void keyPressEvent( QKeyEvent *e );
00133 virtual void contentsMousePressEvent( QMouseEvent *e );
00138 virtual void resizeEvent( QResizeEvent *e );
00139
00140 private:
00141 void setupActions ();
00142 void updateActions ();
00143
00144 private:
00145 KateMainWindow *m_main;
00146 KateViewManager *viewManager;
00147
00148 int m_sort;
00149 bool notify;
00150
00151 KAction* windowNext;
00152 KAction* windowPrev;
00153 KSelectAction* sortAction;
00154
00155 QPtrList<KateFileListItem> m_viewHistory;
00156 QPtrList<KateFileListItem> m_editHistory;
00157
00158 QColor m_viewShade, m_editShade;
00159 bool m_enableBgShading;
00160
00161 class ToolTip *m_tooltip;
00162 };
00163
00164 class KFLConfigPage : public Kate::ConfigPage {
00165 Q_OBJECT
00166 public:
00167 KFLConfigPage( QWidget* parent=0, const char *name=0, KateFileList *fl=0 );
00168 virtual ~KFLConfigPage() {};
00169
00170 virtual void apply();
00171 virtual void reload();
00172
00173 public slots:
00174 void slotEnableChanged();
00175
00176 private slots:
00177 void slotMyChanged();
00178
00179 private:
00180 class QCheckBox *cbEnableShading;
00181 class KColorButton *kcbViewShade, *kcbEditShade;
00182 class QLabel *lEditShade, *lViewShade, *lSort;
00183 class QComboBox *cmbSort;
00184 KateFileList *m_filelist;
00185
00186 bool m_changed;
00187 };
00188
00189
00190 #endif
00191