1 | /* This file is part of the Kate project. |
2 | * |
3 | * Copyright (C) 2010 Christoph Cullmann <cullmann@kde.org> |
4 | * |
5 | * This library is free software; you can redistribute it and/or |
6 | * modify it under the terms of the GNU Library General Public |
7 | * License as published by the Free Software Foundation; either |
8 | * version 2 of the License, or (at your option) any later version. |
9 | * |
10 | * This library is distributed in the hope that it will be useful, |
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
13 | * Library General Public License for more details. |
14 | * |
15 | * You should have received a copy of the GNU Library General Public License |
16 | * along with this library; see the file COPYING.LIB. If not, write to |
17 | * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
18 | * Boston, MA 02110-1301, USA. |
19 | */ |
20 | |
21 | #ifndef KATE_PROJECT_ITEM_H |
22 | #define KATE_PROJECT_ITEM_H |
23 | |
24 | #include <QStandardItem> |
25 | #include <KTextEditor/ModificationInterface> |
26 | |
27 | namespace KTextEditor { |
28 | class Document; |
29 | |
30 | } |
31 | |
32 | /** |
33 | * Class representing a item inside a project. |
34 | * Items can be: projects, directories, files |
35 | */ |
36 | class KateProjectItem : public QStandardItem |
37 | { |
38 | |
39 | public: |
40 | /** |
41 | * Possible Types |
42 | */ |
43 | enum Type { |
44 | Project |
45 | , Directory |
46 | , File |
47 | }; |
48 | |
49 | /** |
50 | * construct new item with given text |
51 | * @param type type for this item |
52 | * @param text text for this item |
53 | */ |
54 | KateProjectItem (Type type, const QString &text); |
55 | |
56 | /** |
57 | * deconstruct project |
58 | */ |
59 | ~KateProjectItem (); |
60 | |
61 | /** |
62 | * Overwritten data methode for on-demand icon creation and co. |
63 | * @param role role to get data for |
64 | * @return data for role |
65 | */ |
66 | QVariant data (int role = Qt::UserRole + 1) const; |
67 | |
68 | private: |
69 | /** |
70 | * type |
71 | */ |
72 | const Type m_type; |
73 | |
74 | /** |
75 | * cached icon |
76 | */ |
77 | mutable QIcon *m_icon; |
78 | |
79 | /** |
80 | * for document icons |
81 | */ |
82 | QString *m_emblem; |
83 | |
84 | public: |
85 | void slotModifiedChanged(KTextEditor::Document*); |
86 | void slotModifiedOnDisk (KTextEditor::Document *document, |
87 | bool isModified, KTextEditor::ModificationInterface::ModifiedOnDiskReason reason); |
88 | |
89 | |
90 | }; |
91 | |
92 | #endif |
93 | |
94 | // kate: space-indent on; indent-width 2; replace-tabs on; |
95 | |