Fix crash if key bindings specified in profile cannot be found. Improve
[personal-kdebase.git] / apps / kinfocenter / moduletreeview.h
blob50de345d6080e0138c18596806226914b418244b
1 /*
2 Copyright (c) 2000 Matthias Elter <elter@kde.org>
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.
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.
14 You should have received a copy of the GNU General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
20 #ifndef __moduletreeview_h__
21 #define __moduletreeview_h__
23 #include <QListWidget>
24 #include <QPixmap>
26 #include <klistwidgetsearchline.h>
28 class ConfigModule;
29 class ConfigModuleList;
31 class ModuleTreeItem : public QListWidgetItem {
33 public:
34 explicit ModuleTreeItem(QListWidget* parent, ConfigModule* module = NULL);
36 ConfigModule* module() const;
38 private:
39 ConfigModule *_module;
43 class ModuleTreeView : public QListWidget {
44 Q_OBJECT
46 public:
47 explicit ModuleTreeView(ConfigModuleList* configModules, QWidget* parent = NULL);
49 void fill();
51 bool isGeneralItem(const QListWidgetItem* item) const;
53 QListWidgetItem* generalItem() const;
55 ModuleTreeItem* findMatchingItem(ConfigModule* configModule) const;
57 signals:
58 void moduleSelected(ConfigModule* configModule);
59 void generalSelected();
61 private slots:
62 void selectItem();
64 private:
65 QListWidgetItem* _generalItem;
67 ConfigModuleList* _modules;
70 class ModuleWidgetSearchLine : public KListWidgetSearchLine {
71 public:
72 ModuleWidgetSearchLine(QWidget* parent, ModuleTreeView* listWidget);
74 protected:
76 virtual bool itemMatches(const QListWidgetItem* item, const QString& search) const;
79 #endif