1 /****************************************************************************
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 ****************************************************************************/
14 #include "actions/actions.h"
15 #include "action_data/action_data_group.h"
16 #include <kshortcut.h>
23 class ActionDataGroup
;
26 * How to handle imports.
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)
37 * Handles KHotKeys Settings.
39 * Settings are saved to the khotkeysrc file.
41 class KDE_EXPORT Settings
43 Q_DISABLE_COPY( Settings
)
51 * Get the system group.
53 ActionDataGroup
*get_system_group(ActionDataGroup::system_group_t group_id
);
58 * \param include_disabled_P Load disabled shortcuts?
60 bool read_settings( bool include_disabled_P
);
65 void write_settings();
68 * Import settings from \a cfg_P.
70 bool import( KConfig
& cfg_P
, bool ask_P
);
75 ActionDataGroup
*actions();
80 * \note Ownership is transfered to you. Subsequent calls to action() will
83 ActionDataGroup
*takeActions();
88 * \note Ownership is taken. The current action list will be deleted.
90 void setActions( ActionDataGroup
*actions
);
93 * @name KHotkeys Daemon
107 * Is the daemon disabled?
109 bool isDaemonDisabled() const;
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;
132 * @name Voice Commands
135 void setVoiceShortcut( const KShortcut
&shortcut
);
136 KShortcut
voiceShortcut() const;
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(
162 ActionDataGroup
* parent_P
,
166 * Read \a parent_P recursively to \a cfg_P
168 void read_actions_recursively_v2(
170 ActionDataGroup
* parent_P
,
171 bool include_disabled_P
);
174 * Initialize the settings
183 ActionDataGroup
* m_actions
;
190 * Gestures globally disabled?
192 bool gestures_disabled
;
195 * Mouse button used for gestures.
197 int gesture_mouse_button
;
205 * Windows to exclude from gestures
207 Windowdef_list
* gestures_exclude
;
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