1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
|
/* This file is part of the KDE project
Copyright (C) 2001 Christoph Cullmann <[email protected]>
Copyright (C) 2001 Joseph Wenninger <[email protected]>
Copyright (C) 2001 Anders Lund <[email protected]>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License version 2 as published by the Free Software Foundation.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#ifndef __KATE_FILELIST_H__
#define __KATE_FILELIST_H__
#include "katemain.h"
#include <kate/document.h>
#include <klistview.h>
#include <qtooltip.h>
#include <qcolor.h>
#include <qptrlist.h>
#define RTTI_KateFileListItem 1001
class KateMainWindow;
class KAction;
class KSelectAction;
class KateFileListItem : public QListViewItem
{
public:
KateFileListItem( QListView *lv,
Kate::Document *doc );
~KateFileListItem();
inline uint documentNumber () { return m_docNumber; }
inline Kate::Document * document() { return doc; }
int rtti() const { return RTTI_KateFileListItem; }
/**
* Sets the view history position.
*/
void setViewHistPos( int p ) { m_viewhistpos = p; }
/**
* Sets the edit history position.
*/
void setEditHistPos( int p ) { m_edithistpos = p; }
protected:
virtual const QPixmap *pixmap ( int column ) const;
void paintCell( QPainter *painter, const QColorGroup & cg, int column, int width, int align );
/**
* Reimplemented so we can sort by a number of different document properties.
*/
int compare ( QListViewItem * i, int col, bool ascending ) const;
private:
Kate::Document *doc;
int m_viewhistpos; ///< this gets set by the list as needed
int m_edithistpos; ///< this gets set by the list as needed
uint m_docNumber;
};
class KateFileList : public KListView
{
Q_OBJECT
friend class KFLConfigPage;
public:
KateFileList (KateMainWindow *main, KateViewManager *_viewManager, QWidget * parent = 0, const char * name = 0 );
~KateFileList ();
int sortType () const { return m_sort; };
void updateSort ();
enum sorting {
sortByID = 0,
sortByName = 1,
sortByURL = 2
};
QString tooltip( QListViewItem *item, int );
uint histCount() const { return m_viewHistory.count(); }
uint editHistCount() const { return m_editHistory.count(); }
QColor editShade() const { return m_editShade; }
QColor viewShade() const { return m_viewShade; }
bool shadingEnabled() { return m_enableBgShading; }
void readConfig( class KConfig *config, const QString &group );
void writeConfig( class KConfig *config, const QString &group );
/**
* reimplemented to remove the item from the history stacks
*/
void takeItem( QListViewItem * );
public slots:
void setSortType (int s);
void slotNextDocument();
void slotPrevDocument();
private slots:
void slotDocumentCreated (Kate::Document *doc);
void slotDocumentDeleted (uint documentNumber);
void slotActivateView( QListViewItem *item );
void slotModChanged (Kate::Document *doc);
void slotModifiedOnDisc (Kate::Document *doc, bool b, unsigned char reason);
void slotNameChanged (Kate::Document *doc);
void slotViewChanged ();
void slotMenu ( QListViewItem *item, const QPoint &p, int col );
protected:
virtual void keyPressEvent( QKeyEvent *e );
/**
* Reimplemented to force Single mode for real:
* don't let a mouse click outside items deselect.
*/
virtual void contentsMousePressEvent( QMouseEvent *e );
/**
* Reimplemented to make sure the first (and only) column is at least
* the width of the viewport
*/
virtual void resizeEvent( QResizeEvent *e );
private:
void setupActions ();
void updateActions ();
private:
KateMainWindow *m_main;
KateViewManager *viewManager;
int m_sort;
bool notify;
KAction* windowNext;
KAction* windowPrev;
KSelectAction* sortAction;
QPtrList<KateFileListItem> m_viewHistory;
QPtrList<KateFileListItem> m_editHistory;
QColor m_viewShade, m_editShade;
bool m_enableBgShading;
class ToolTip *m_tooltip;
};
class KFLConfigPage : public Kate::ConfigPage {
Q_OBJECT
public:
KFLConfigPage( QWidget* parent=0, const char *name=0, KateFileList *fl=0 );
virtual ~KFLConfigPage() {};
virtual void apply();
virtual void reload();
public slots:
void slotEnableChanged();
private slots:
void slotMyChanged();
private:
class QCheckBox *cbEnableShading;
class KColorButton *kcbViewShade, *kcbEditShade;
class QLabel *lEditShade, *lViewShade, *lSort;
class QComboBox *cmbSort;
KateFileList *m_filelist;
bool m_changed;
};
#endif
// kate: space-indent on; indent-width 2; replace-tabs on;
|