1 | /*************************************************************************** |
2 | * Copyright (C) 2008 by Montel Laurent <montel@kde.org> * |
3 | * * |
4 | * This program is free software; you can redistribute it and/or modify * |
5 | * it under the terms of the GNU General Public License as published by * |
6 | * the Free Software Foundation; either version 2 of the License, or * |
7 | * (at your option) any later version. * |
8 | * * |
9 | * This program is distributed in the hope that it will be useful, * |
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * |
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * |
12 | * GNU General Public License for more details. * |
13 | * * |
14 | * You should have received a copy of the GNU General Public License * |
15 | * along with this program; if not, write to the * |
16 | * Free Software Foundation, Inc., * |
17 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA * |
18 | ***************************************************************************/ |
19 | |
20 | #ifndef _KATESESSIONAPPLET_H_ |
21 | #define _KATESESSIONAPPLET_H_ |
22 | |
23 | #include <plasma/popupapplet.h> |
24 | |
25 | #include "ui_katesessionConfig.h" |
26 | |
27 | class QTreeView; |
28 | class QGraphicsProxyWidget; |
29 | class QStandardItemModel; |
30 | class QModelIndex; |
31 | class KConfigDialog; |
32 | class QStringList; |
33 | class KateSessionConfigInterface : public QWidget { |
34 | // Wrapper widget class for the configuration interface. |
35 | Q_OBJECT |
36 | public: |
37 | KateSessionConfigInterface(const QStringList& all, const QStringList& hidden); |
38 | QStringList hideList() const; |
39 | private: |
40 | QStringList m_all; |
41 | Ui::KateSessionConfig m_config; |
42 | }; |
43 | |
44 | |
45 | class KateSessionApplet : public Plasma::PopupApplet |
46 | { |
47 | Q_OBJECT |
48 | public: |
49 | KateSessionApplet(QObject *parent, const QVariantList &args); |
50 | ~KateSessionApplet(); |
51 | |
52 | QWidget *widget(); |
53 | |
54 | enum SpecificRoles { |
55 | Index = Qt::UserRole+1 |
56 | }; |
57 | |
58 | protected slots: |
59 | void slotOnItemClicked(const QModelIndex &index); |
60 | void (); |
61 | void slotSaveConfig(); |
62 | |
63 | protected: |
64 | void initSessionFiles(); |
65 | void createConfigurationInterface(KConfigDialog *parent); |
66 | void configChanged(); |
67 | private: |
68 | QTreeView *m_listView; |
69 | QStandardItemModel *m_kateModel; |
70 | QStringList m_sessions; |
71 | QStringList m_fullList; |
72 | KateSessionConfigInterface *m_config; |
73 | }; |
74 | |
75 | K_EXPORT_PLASMA_APPLET(katesession, KateSessionApplet ) |
76 | |
77 | #endif |
78 | |