not quite so much needs to be delayed to the init() function
[personal-kdebase.git] / workspace / kcontrol / kxkb / kxkbcore.h
blob7c680e0346f963d7c24df8081479dbf0b5141e5b
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;
42 class KShortcut;
44 //typedef KxkbWidget* (*KxkbWidgetCreateFn(KxkbWidget*));
46 /* This is the main Kxkb class responsible for reading options
47 and switching layouts
50 class KxkbCore : public QObject
52 Q_OBJECT
54 public:
55 enum { KXKB_MAIN=1, KXKB_COMPONENT=2 };
57 KxkbCore(int mode=KXKB_MAIN);
58 ~KxkbCore();
60 virtual int newInstance();
61 bool setLayout(int layout);
62 int getStatus() { return m_status; }
63 bool x11EventFilter ( XEvent * event );
64 void setWidget(KxkbWidget* kxkbWidet);
65 void cleanup();
66 const KShortcut* getKDEShortcut();
68 // DBUS:
69 public slots:
70 bool setLayout(const QString& layoutPair);
71 QString getCurrentLayout() { return m_kxkbConfig.m_layouts[m_currentLayout].toPair(); }
72 QStringList getLayoutsList() { return m_kxkbConfig.getLayoutStringList(); }
73 void toggled();
75 protected slots:
76 void iconMenuTriggered(QAction*);
77 void windowChanged(WId winId);
78 void desktopChanged(int desktop);
80 void settingsChanged(int category);
82 protected:
83 bool settingsRead();
84 void layoutApply();
86 private:
87 int m_mode;
88 int m_currentLayout;
89 int m_status;
90 bool m_eventsHandled;
91 bool m_error;
93 KxkbConfig m_kxkbConfig;
94 LayoutMap* m_layoutOwnerMap;
96 XKBExtension *m_extension;
97 XkbRules *m_rules;
99 KxkbWidget *m_kxkbWidget;
100 KActionCollection *actionCollection;
102 QWidget* m_dummyWidget;
104 void updateIndicator(int layout, int res);
105 void initTray();
106 void initKDEShortcut();
107 void stopKDEShortcut();
108 void initReactions();
109 void initLayoutGroups();
110 void initSwitchingPolicy();
111 int updateGroupsFromServer();
114 #endif