not quite so much needs to be delayed to the init() function
[personal-kdebase.git] / workspace / systemsettings / mainwindow.h
blob0e8db29f8a24a6f7f2b5eaea3a512c3ab48f8e9a
1 /**
2 * This file is part of the System Settings package
3 * Copyright (C) 2005 Benjamin C Meyer (ben+systempreferences at meyerhome dot net)
4 * (C) 2007 Will Stephenson <wstephenson@kde.org>
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Library General Public License for more details.
16 * You should have received a copy of the GNU Library General Public License
17 * along with this library; see the file COPYING.LIB. If not, write to
18 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
19 * Boston, MA 02110-1301, USA.
22 #ifndef MAINWINDOW_H
23 #define MAINWINDOW_H
25 // KDE
26 #include <KService>
27 #include <KXmlGuiWindow>
29 class QAbstractItemModel;
30 class QAction;
31 class QLabel;
32 class QModelIndex;
33 class QStackedWidget;
34 class KTabWidget;
35 class KAction;
36 class KCModuleModel;
37 class KCMultiWidget;
38 class KLineEdit;
39 class MenuItem;
41 class MainWindow : public KXmlGuiWindow
43 Q_OBJECT
45 public:
46 explicit MainWindow(QWidget *parent=0);
47 ~MainWindow();
49 /**
50 * Called when the mainwindow is closed.
52 virtual bool queryClose();
54 protected:
55 virtual QSize sizeHint() const;
57 private slots:
58 void selectionChanged( const QModelIndex & selected );
59 void updateSearchHits();
60 void showOverview();
61 void widgetChange();
63 private:
64 void readMenu( MenuItem * );
66 KCModuleModel *model;
67 const KService::List categories;
68 const KService::List modules;
69 MenuItem * rootItem;
70 QStackedWidget *windowStack;
71 KTabWidget *moduleTabs;
72 KLineEdit * search;
74 KCMultiWidget *groupWidget;
76 QHash<KService::Ptr,KCMultiWidget*> moduleItemToWidgetDict;
77 QHash<const QAbstractItemModel *,int> modelToTabHash;
79 KAction *showOverviewAction;
80 KAction *searchText;
81 KAction *searchClear;
82 KAction *searchAction;
84 void buildMainWidget();
85 void buildActions();
87 QLabel *generalHitLabel;
88 QLabel *advancedHitLabel;
91 bool pageLessThan( MenuItem *page1, MenuItem *page2 );
93 #endif