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 <tdelistview.h>
00029
00030 #include <tqtooltip.h>
00031 #include <tqcolor.h>
00032 #include <tqptrlist.h>
00033
00034 #define RTTI_KateFileListItem 1001
00035
00036 class KateMainWindow;
00037
00038 class TDEAction;
00039 class TDESelectAction;
00040
00041 class KateFileListItem : public TQListViewItem
00042 {
00043 public:
00044 KateFileListItem( TQListView *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 TQPixmap *pixmap ( int column ) const;
00064 void paintCell( TQPainter *painter, const TQColorGroup & cg, int column, int width, int align );
00068 int compare ( TQListViewItem * 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 TDEListView
00078 {
00079 Q_OBJECT
00080
00081 friend class KFLConfigPage;
00082
00083 public:
00084 KateFileList (KateMainWindow *main, KateViewManager *_viewManager, TQWidget * 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 sortManual = 3
00095 };
00096
00097 TQString tooltip( TQListViewItem *item, int );
00098
00099 uint histCount() const { return m_viewHistory.count(); }
00100 uint editHistCount() const { return m_editHistory.count(); }
00101 TQColor editShade() const { return m_editShade; }
00102 TQColor viewShade() const { return m_viewShade; }
00103 bool shadingEnabled() { return m_enableBgShading; }
00104
00105 void readConfig( class TDEConfig *config, const TQString &group );
00106 void writeConfig( class TDEConfig *config, const TQString &group );
00107
00111 void takeItem( TQListViewItem * );
00112
00113 public slots:
00114 void setSortType (int s);
00115 void moveFileUp();
00116 void moveFileDown();
00117 void slotNextDocument();
00118 void slotPrevDocument();
00119
00120 private slots:
00121 void slotDocumentCreated (Kate::Document *doc);
00122 void slotDocumentDeleted (uint documentNumber);
00123 void slotActivateView( TQListViewItem *item );
00124 void slotModChanged (Kate::Document *doc);
00125 void slotModifiedOnDisc (Kate::Document *doc, bool b, unsigned char reason);
00126 void slotNameChanged (Kate::Document *doc);
00127 void slotViewChanged ();
00128 void slotMenu ( TQListViewItem *item, const TQPoint &p, int col );
00129 void updateFileListLocations();
00130
00131 protected:
00132 virtual void keyPressEvent( TQKeyEvent *e );
00137 virtual void contentsMousePressEvent( TQMouseEvent *e );
00142 virtual void resizeEvent( TQResizeEvent *e );
00143
00144 private:
00145 void setupActions ();
00146 void updateActions ();
00147
00148 private:
00149 KateMainWindow *m_main;
00150 KateViewManager *viewManager;
00151
00152 int m_sort;
00153 bool notify;
00154
00155 TDEAction* windowNext;
00156 TDEAction* windowPrev;
00157 TDESelectAction* sortAction;
00158 TDEAction* listMoveFileUp;
00159 TDEAction* listMoveFileDown;
00160
00161 TQPtrList<KateFileListItem> m_viewHistory;
00162 TQPtrList<KateFileListItem> m_editHistory;
00163
00164 TQColor m_viewShade, m_editShade;
00165 bool m_enableBgShading;
00166
00167 TQListViewItem *m_clickedMenuItem;
00168
00169 TQPoint m_lastMouseDownPos;
00170
00171 class ToolTip *m_tooltip;
00172 };
00173
00174 class KFLConfigPage : public Kate::ConfigPage {
00175 Q_OBJECT
00176 public:
00177 KFLConfigPage( TQWidget* parent=0, const char *name=0, KateFileList *fl=0 );
00178 virtual ~KFLConfigPage() {};
00179
00180 virtual void apply();
00181 virtual void reload();
00182
00183 public slots:
00184 void slotEnableChanged();
00185
00186 private slots:
00187 void slotMyChanged();
00188
00189 private:
00190 class TQCheckBox *cbEnableShading;
00191 class KColorButton *kcbViewShade, *kcbEditShade;
00192 class TQLabel *lEditShade, *lViewShade, *lSort;
00193 class TQComboBox *cmbSort;
00194 KateFileList *m_filelist;
00195
00196 bool m_changed;
00197 };
00198
00199
00200 #endif
00201