~ubuntu-branches/ubuntu/utopic/kde-workspace/utopic-proposed

« back to all changes in this revision

Viewing changes to kinfocenter/sidepanel.h

  • Committer: Bazaar Package Importer
  • Author(s): Michał Zając
  • Date: 2011-07-09 08:31:15 UTC
  • Revision ID: james.westby@ubuntu.com-20110709083115-ohyxn6z93mily9fc
Tags: upstream-4.6.90
Import upstream version 4.6.90

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
 
 
2
/*
 
3
 *  sidepanel.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 SIDEPANEL
 
24
#define SIDEPANEL
 
25
 
 
26
//QT
 
27
#include <QString>
 
28
#include <QModelIndex>
 
29
#include <QContextMenuEvent>
 
30
#include <QAction>
 
31
#include <QStringList>
 
32
#include <QTreeView>
 
33
 
 
34
//Local
 
35
#include "infokcmmodel.h"
 
36
#include "infokcmproxymodel.h"
 
37
 
 
38
class InfoKcmModel;
 
39
class InfoKcmProxyModel;
 
40
 
 
41
class SidePanel : public QTreeView
 
42
{
 
43
  Q_OBJECT
 
44
 
 
45
  public:
 
46
    
 
47
    /**
 
48
    * Create Side Panel Widget, including search line edit.
 
49
    *
 
50
    * @param parent objects parent
 
51
    */
 
52
    SidePanel(QWidget *parent);
 
53
 
 
54
    /** 
 
55
    * Destory SidePanel object
 
56
    */
 
57
    ~SidePanel();
 
58
 
 
59
    /**
 
60
    * Select the first valid item in TreeView
 
61
    */
 
62
    void changeToFirstValidItem();
 
63
 
 
64
    /** 
 
65
    * Map a QAbstractItemModel index to a QSortFilterProxyModel index
 
66
    */
 
67
    QModelIndex mapToProxySource(const QModelIndex&);
 
68
 
 
69
    /**
 
70
    * Get all the treeview items keywords
 
71
    */
 
72
    QStringList allChildKeywords();
 
73
 
 
74
    /**
 
75
     * Expand and collapse an Item ( if an expandable item ) 
 
76
     */
 
77
    void toggleExpand(const KcmTreeItem *);
 
78
    
 
79
  Q_SIGNALS:
 
80
  
 
81
    /**
 
82
    * Emitted when menu item is clicked
 
83
    */
 
84
    void activated(const KcmTreeItem *);
 
85
 
 
86
  private Q_SLOTS:
 
87
 
 
88
    /**
 
89
    * Triggered when treeview item is clicked
 
90
    */
 
91
    void activatedSlot(const QModelIndex &index);
 
92
 
 
93
  public Q_SLOTS:
 
94
    
 
95
    /**
 
96
    * Triggered when collapseAll is selected from tree view 
 
97
    * item menu
 
98
    */
 
99
    void collapseAllSlot();
 
100
 
 
101
    /**
 
102
    * Triggered when ExpandAll is selected from tree view
 
103
    * item menu 
 
104
    */
 
105
    void expandAllSlot();
 
106
 
 
107
    /**
 
108
    * Filter out all but menu items that fit certain keywords
 
109
    */
 
110
    void filterSideMenuSlot(const QString &);
 
111
 
 
112
    /**
 
113
    * Triggered when Reset Search is selected from tree view
 
114
    * item menu
 
115
    */
 
116
    void resetSearchSlot();
 
117
    
 
118
  private:
 
119
 
 
120
    /**
 
121
    * Created actions for the tree view item menu
 
122
    */
 
123
    void createMenuActions();
 
124
 
 
125
    /** 
 
126
    * Create treeview item menu
 
127
    */
 
128
    void contextMenuEvent(QContextMenuEvent *event);
 
129
 
 
130
    InfoKcmModel *m_model;
 
131
    InfoKcmProxyModel *m_proxyModel;
 
132
 
 
133
    QAction *colAct;
 
134
    QAction *expAct;
 
135
    QAction *resetAct;
 
136
};
 
137
 
 
138
#endif //SIDEPANEL