1
2/*
3 * infocenter.h
4 *
5 * Copyright (C) 2010 David Hubner <hubnerd@ntlworld.com>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
20 *
21 */
22
23#ifndef INFOCENTER
24#define INFOCENTER
25
26//KDE
27#include <KXmlGuiWindow>
28#include <KLineEdit>
29#include <KAction>
30#include <KCModule>
31#include <KActionMenu>
32
33//QT
34#include <QWidget>
35#include <QObject>
36#include <QEvent>
37#include <QSplitter>
38#include <QPushButton>
39
40//Local
41#include "sidepanel.h"
42#include "kcmcontainer.h"
43#include "infokcmmodel.h"
44#include "kcmtreeitem.h"
45#include "tooltipmanager.h"
46
47class KcmContainer;
48class SizePanel;
49class ToolTipManager;
50class KcmTreeItem;
51
52class KInfoCenter : public KXmlGuiWindow
53{
54 Q_OBJECT
55
56 public:
57
58 /**
59 * Create KInfoCenter main window
60 */
61 KInfoCenter();
62
63 /**
64 * Destory KInfoCenter object
65 */
66 ~KInfoCenter();
67
68 /**
69 * Event filter to move KCMContainer to be level with
70 * the side menu.
71 *
72 * @param watched object being watched
73 * @param event event object containing event information
74 */
75 bool eventFilter(QObject *watched, QEvent *event);
76
77 public Q_SLOTS:
78
79 /**
80 * Triggered when mouse is clicked on a treeview item
81 *
82 * @param item item selected via mouse
83 */
84 void itemClickedSlot(const KcmTreeItem *item);
85
86 /**
87 * Triggered when help toolbar action is used.
88 */
89 void helpClickedSlot();
90
91 /**
92 * Triggered when export toolbar action is used.
93 */
94 void exportClickedSlot();
95
96 /**
97 * Triggered when the about KCM action is used
98 * in the help menu.
99 */
100 void aboutKcmSlot();
101
102 /**
103 * Show a error message box
104 *
105 * @param parent parent object
106 * @param errorMessage error message text
107 */
108 static void showError(QWidget *parent, const QString& errorMessage);
109
110 private:
111
112 /**
113 * Create main window and splitter
114 */
115 void createMainFrame();
116
117 /**
118 * Create top toolbar on main window and setup toolbar
119 * actions.
120 */
121 void createToolBar();
122
123 /**
124 * Create side menu frame including search bar
125 */
126 void createMenuFrame();
127
128 /**
129 * Detect if export and help buttons should be enabled
130 *
131 * @param buttons buttons to check
132 */
133 void setButtons(const KCModule::Buttons buttons);
134
135 /**
136 * Load KCM into KCMContainer
137 *
138 * @param kcmItem KCM to be loaded
139 */
140 void setKcm(const KcmTreeItem *kcmItem);
141
142 /**
143 * Set enable state on KCM About menu action,
144 * export toolbar action and help toolbar action.
145 */
146 void resetCondition();
147
148 KcmContainer *m_contain;
149 QSplitter *m_splitter;
150
151 KAction *m_aboutKcm;
152 KAction *m_searchAction;
153 KAction *m_exportAction;
154 KAction *m_moduleHelpAction;
155 KActionMenu *m_helpAction;
156
157 QWidget *m_cWidget;
158 KLineEdit *m_searchText;
159
160 SidePanel *m_sideMenu;
161 ToolTipManager *m_toolTips;
162};
163
164#endif //INFOCENTER
165