not quite so much needs to be delayed to the init() function
[personal-kdebase.git] / workspace / kcontrol / keys / kglobalshortcutseditor.h
blob8d153f8f73bfe2745eb158d81994212d07871292
1 /*
2 * Copyright 2008 Michael Jansen <kde@michael-jansen.biz>
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18 #ifndef KGLOBALSHORTCUTSEDITOR_H
19 #define KGLOBALSHORTCUTSEDITOR_H
21 #include <QWidget>
23 #include "kshortcutseditor.h"
25 class KActionCollection;
26 class KShortcut;
27 class KConfig;
29 /**
30 * Combine a KShortcutsEditor with a KComboBox.
32 * @see KShortcutsEditor
33 * @author Michael Jansen <kde@michael-jansen.biz>
35 class KGlobalShortcutsEditor : public QWidget
37 Q_OBJECT
39 public:
41 /**
42 * Constructor
44 * @param parent parent widget
46 KGlobalShortcutsEditor(QWidget *parent,
47 KShortcutsEditor::ActionTypes actionTypes = KShortcutsEditor::AllActions);
48 ~KGlobalShortcutsEditor();
50 /**
51 * Insert an action collection, i.e. add all it's actions to the ones already associated
52 * with the KShortcutsEditor object.
54 * @param collection the collection to add
55 * @param component title for the component
56 * @param title title for the subtree in the component
58 void addCollection(KActionCollection *, const QString &id, const QString &name);
60 /**
61 * Clear all collections were currently hosting.
63 void clear();
66 /**
67 * Revert all changes made since the last save.
69 void undo();
72 /**
73 * Load the shortcuts from the configuration.
75 void importConfiguration(KConfig *config);
78 /**
79 * Save the shortcuts to the configuration.
81 void exportConfiguration(KConfig *config) const;
84 /**
85 * Are the unsaved changes?
87 bool isModified() const;
89 Q_SIGNALS:
91 /**
92 * Indicate that state of the modules contents has changed.
94 * @param state changed or not
96 void changed(bool);
99 public Q_SLOTS:
102 * Activate the component \a component.
104 * @param component the component
106 void activateComponent(const QString &component);
110 * Make the changes persistent.
112 * That's function is not really saving. Global shortcuts are saved immediately. This
113 * prevent the undo on deleting the editor.
115 void save();
118 * Reset all \a components to default values.
120 void allDefault();
123 private Q_SLOTS:
124 void _k_key_changed();
126 private:
128 friend class KGlobalShortcutsEditorPrivate;
129 class KGlobalShortcutsEditorPrivate;
130 KGlobalShortcutsEditorPrivate *const d;
131 Q_DISABLE_COPY(KGlobalShortcutsEditor)
132 }; // class KGlobalShortcutsEditor
134 #endif // KGLOBALSHORTCUTSEDITOR_H