add more spacing
[personal-kdebase.git] / workspace / khotkeys / libkhotkeysprivate / settings.h
bloba69b2b9bf13640f4a5940f436ad6442f73978c8d
1 /****************************************************************************
3 KHotKeys
5 Copyright (C) 1999-2001 Lubos Lunak <l.lunak@kde.org>
7 Distributed under the terms of the GNU General Public License version 2.
9 ****************************************************************************/
11 #ifndef _SETTINGS_H_
12 #define _SETTINGS_H_
14 #include "actions/actions.h"
15 #include "action_data/action_data_group.h"
16 #include <kshortcut.h>
18 class KConfig;
20 namespace KHotKeys
23 class ActionDataGroup;
25 /**
26 * How to handle imports.
28 enum ImportType
30 ImportNone, //!< no import is done
31 ImportAsk, //!< if already imported before, ask (called from GUI)
32 ImportSilent //!< if already imported before, ignore (called from the update script)
36 /**
37 * Handles KHotKeys Settings.
39 * Settings are saved to the khotkeysrc file.
41 class KDE_EXPORT Settings
43 Q_DISABLE_COPY( Settings )
45 public:
47 Settings();
48 ~Settings();
50 /**
51 * Get the system group.
53 ActionDataGroup *get_system_group(ActionDataGroup::system_group_t group_id);
55 /**
56 * Read the settings.
58 * \param include_disabled_P Load disabled shortcuts?
60 bool read_settings( bool include_disabled_P );
62 /**
63 * Write the settings.
65 void write_settings();
67 /**
68 * Import settings from \a cfg_P.
70 bool import( KConfig& cfg_P, bool ask_P );
72 /**
73 * Get all actions
75 ActionDataGroup *actions();
77 /**
78 * Take the actions.
80 * \note Ownership is transfered to you. Subsequent calls to action() will
81 * return 0
83 ActionDataGroup *takeActions();
85 /**
86 * Set the actions.
88 * \note Ownership is taken. The current action list will be deleted.
90 void setActions( ActionDataGroup *actions );
92 /**
93 * @name KHotkeys Daemon
95 //@{
96 /**
97 * Disable the daemon.
99 void disableDaemon();
102 * Enable the daemon.
104 void enableDaemon();
107 * Is the daemon disabled?
109 bool isDaemonDisabled() const;
110 //@}
113 * @name Gestures
115 //@{
116 void disableGestures();
117 void enableGestures();
118 bool areGesturesDisabled() const;
120 int gestureMouseButton() const;
121 void setGestureMouseButton( int );
123 int gestureTimeOut() const;
124 void setGestureTimeOut(int);
126 void setGesturesExclude( Windowdef_list *gestures );
127 Windowdef_list *gesturesExclude();
128 const Windowdef_list *gesturesExclude() const;
129 //@}
132 * @name Voice Commands
134 //@{
135 void setVoiceShortcut( const KShortcut &shortcut );
136 KShortcut voiceShortcut() const;
137 //@}
139 protected:
142 * Read settings from \a cfg_P. \a include_disabled_P controls whether
143 * disabled actions should be discarded.
145 bool read_settings( KConfig& cfg_P, bool include_disabled_P, ImportType import_P );
148 * Read settings in the v1 legacy format from \a cfg_P .
150 void read_settings_v1( KConfig& cfg_P );
153 * Read settings in the v2 format from \a cfg_P .
155 void read_settings_v2( KConfig& cfg_P, bool include_disabled_P );
158 * Write \a parent_P recursively to \a cfg_P
160 int write_actions_recursively_v2(
161 KConfigGroup& cfg_P,
162 ActionDataGroup* parent_P,
163 bool enabled_P );
166 * Read \a parent_P recursively to \a cfg_P
168 void read_actions_recursively_v2(
169 KConfigGroup& cfg_P,
170 ActionDataGroup* parent_P,
171 bool include_disabled_P );
174 * Initialize the settings
176 void initialize();
178 private:
181 * TODO
183 ActionDataGroup* m_actions;
186 * @name Gestures
188 //@{
190 * Gestures globally disabled?
192 bool gestures_disabled;
195 * Mouse button used for gestures.
197 int gesture_mouse_button;
200 * Gesture timeout
202 int gesture_timeout;
205 * Windows to exclude from gestures
207 Windowdef_list* gestures_exclude;
208 //@}
211 * KHotKeys daemon disabled?
213 bool daemon_disabled;
216 * The shortcut that triggers a voice command
218 KShortcut voice_shortcut;
221 * List of id's for all imported files.
223 QStringList already_imported;
228 } // namespace KHotKeys
230 #endif