File: infocenter.h

package info (click to toggle)
kde-workspace 4%3A4.8.4-6
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 89,920 kB
  • sloc: cpp: 373,584; ansic: 35,020; xml: 7,435; perl: 1,550; sh: 1,329; ruby: 1,135; python: 646; asm: 566; makefile: 38
file content (164 lines) | stat: -rw-r--r-- 3,648 bytes parent folder | download
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

/*
 *  infocenter.h
 *
 *  Copyright (C) 2010 David Hubner <hubnerd@ntlworld.com>
 *
 *  This program is free software; you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation; either version 2 of the License, or
 *  (at your option) any later version.
 *
 *  This program 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 General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with this program; if not, write to the Free Software
 *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
 *
 */

#ifndef INFOCENTER
#define INFOCENTER

//KDE
#include <KXmlGuiWindow>
#include <KLineEdit>
#include <KAction>
#include <KCModule>
#include <KActionMenu>

//QT
#include <QWidget>
#include <QObject>
#include <QEvent>
#include <QSplitter>
#include <QPushButton>

//Local
#include "sidepanel.h"
#include "kcmcontainer.h"
#include "infokcmmodel.h"
#include "kcmtreeitem.h"
#include "tooltipmanager.h"

class KcmContainer;
class SizePanel;
class ToolTipManager;
class KcmTreeItem;

class KInfoCenter : public KXmlGuiWindow
{
  Q_OBJECT
  
  public:
    
    /**
    * Create KInfoCenter main window
    */
    KInfoCenter();
    
    /**
    * Destory KInfoCenter object
    */
    ~KInfoCenter();

    /** 
    * Event filter to move KCMContainer to be level with 
    * the side menu.
    *
    * @param watched object being watched
    * @param event event object containing event information
    */
    bool eventFilter(QObject *watched, QEvent *event);

  public Q_SLOTS:
    
    /**
    * Triggered when mouse is clicked on a treeview item
    *
    * @param item item selected via mouse
    */
    void itemClickedSlot(const KcmTreeItem *item);
    
    /** 
    * Triggered when help toolbar action is used.
    */
    void helpClickedSlot();
    
    /** 
    * Triggered when export toolbar action is used.
    */
    void exportClickedSlot();
    
    /**
    * Triggered when the about KCM action is used
    * in the help menu.
    */
    void aboutKcmSlot();
    
    /**
    * Show a error message box
    * 
    * @param parent parent object
    * @param errorMessage error message text
    */
    static void showError(QWidget *parent, const QString& errorMessage);
    
  private:
    
    /** 
    * Create main window and splitter
    */
    void createMainFrame();
    
    /** 
    * Create top toolbar on main window and setup toolbar
    * actions.
    */
    void createToolBar();
    
    /** 
    * Create side menu frame including search bar
    */
    void createMenuFrame();
    
    /**
    * Detect if export and help buttons should be enabled
    *
    * @param buttons buttons to check
    */
    void setButtons(const KCModule::Buttons buttons);
    
    /** 
    * Load KCM into KCMContainer
    *
    * @param kcmItem KCM to be loaded
    */
    void setKcm(const KcmTreeItem *kcmItem);
    
    /**
    * Set enable state on KCM About menu action, 
    * export toolbar action and help toolbar action.
    */
    void resetCondition();

    KcmContainer *m_contain;
    QSplitter *m_splitter;
    
    KAction *m_aboutKcm;
    KAction *m_searchAction;
    KAction *m_exportAction;
    KAction *m_moduleHelpAction;
    KActionMenu *m_helpAction;
    
    QWidget *m_cWidget;
    KLineEdit *m_searchText;
    
    SidePanel *m_sideMenu;
    ToolTipManager *m_toolTips;
};

#endif //INFOCENTER