Make a branch to make krunner Good Enough For Aaron™.
[kdebase/uwolfer.git] / workspace / kcontrol / kxkb / kxkbcore.h
blobb122d5bf650615a5898a1bf9d946efed7f5dfd67
1 /*
2 Copyright (C) 2001, S.R.Haque <srhaque@iee.org>.
3 Copyright (C) 2006, Andriy Rysin <rysin@kde.org>. Derived from an
4 original by Matthias H�zer-Klpfel released under the QPL.
5 This file is part of the KDE project
7 This library is free software; you can redistribute it and/or
8 modify it under the terms of the GNU Library General Public
9 License as published by the Free Software Foundation; either
10 version 2 of the License, or (at your option) any later version.
12 This library 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 GNU
15 Library General Public License for more details.
17 You should have received a copy of the GNU Library General Public License
18 along with this library; see the file COPYING.LIB. If not, write to
19 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
20 Boston, MA 02110-1301, USA.
22 DESCRIPTION
24 KDE Keyboard Tool. Manages XKB keyboard mappings.
26 #ifndef __KXKBCORE_H__
27 #define __KXKBCORE_H__
30 #include <QHash>
31 #include <QQueue>
33 #include "kxkbconfig.h"
36 class XKBExtension;
37 class XkbRules;
38 class KActionCollection;
39 class LayoutMap;
40 class KxkbWidget;
41 class QAction;
43 //typedef KxkbWidget* (*KxkbWidgetCreateFn(KxkbWidget*));
45 /* This is the main Kxkb class responsible for reading options
46 and switching layouts
49 class KxkbCore : public QObject
51 Q_OBJECT
53 public:
54 enum { KXKB_MAIN=1, KXKB_COMPONENT=2 };
56 KxkbCore(int mode=KXKB_MAIN);
57 ~KxkbCore();
59 virtual int newInstance();
60 bool setLayout(int layout);
61 int getStatus() { return m_status; }
62 bool x11EventFilter ( XEvent * event );
63 void setWidget(KxkbWidget* kxkbWidet);
64 void cleanup();
66 // DBUS:
67 public slots:
68 bool setLayout(const QString& layoutPair);
69 QString getCurrentLayout() { return m_kxkbConfig.m_layouts[m_currentLayout].toPair(); }
70 QStringList getLayoutsList() { return m_kxkbConfig.getLayoutStringList(); }
72 protected slots:
73 void iconMenuTriggered(QAction*);
74 void toggled();
75 void windowChanged(WId winId);
76 void desktopChanged(int desktop);
78 void settingsChanged(int category);
80 protected:
81 bool settingsRead();
82 void layoutApply();
84 private:
85 int m_mode;
86 int m_currentLayout;
87 int m_status;
88 bool m_eventsHandled;
90 KxkbConfig m_kxkbConfig;
91 LayoutMap* m_layoutOwnerMap;
93 XKBExtension *m_extension;
94 XkbRules *m_rules;
96 KxkbWidget *m_kxkbWidget;
97 KActionCollection *actionCollection;
99 QWidget* m_dummyWidget;
101 void updateIndicator(int layout, int res);
102 void initTray();
103 void initKDEShortcut();
104 void stopKDEShortcut();
105 void initReactions();
106 void initLayoutGroups();
107 void initSwitchingPolicy();
108 int updateGroupsFromServer();
111 #endif