delay a few things on startup, such as setting the visibility mode, which ensures...
[personal-kdebase.git] / runtime / kdedglobalaccel / kdedglobalaccel.h
blob0aa8a819aa274655a7f5509bd3c4e01e9b6f9e46
1 /*
2 This file is part of the KDE libraries
4 Copyright (c) 2007 Andreas Hartmetz <ahartmetz@gmail.com>
5 Copyright (c) 2008 Michael Jansen <kde@michael-jansen.biz>
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 #ifndef KDEDGLOBALACCEL_H
23 #define KDEDGLOBALACCEL_H
25 #include <kdedmodule.h>
26 #include <kglobalshortcutinfo.h>
28 #include <QtCore/QStringList>
29 #include <QtCore/QList>
30 #include <QtDBus/QDBusObjectPath>
32 class KdedGlobalAccelPrivate;
34 class KdedGlobalAccel : public KDEDModule
36 Q_OBJECT
37 Q_CLASSINFO("D-Bus Interface", "org.kde.KdedGlobalAccel")
38 Q_ENUMS(SetShortcutFlag)
40 public:
42 enum SetShortcutFlag
44 SetPresent = 2,
45 NoAutoloading = 4,
46 IsDefault = 8
48 Q_FLAGS(SetShortcutFlags)
50 KdedGlobalAccel(QObject*, const QList<QVariant>&);
51 ~KdedGlobalAccel();
53 public Q_SLOTS:
55 /**
56 * Get the dbus path for all known components.
58 * The returned path is absolute. No need to prepend anything.
60 Q_SCRIPTABLE QList<QDBusObjectPath> allComponents() const;
62 Q_SCRIPTABLE QList<QStringList> allMainComponents() const;
64 Q_SCRIPTABLE QList<QStringList> allActionsForComponent(const QStringList &actionId) const;
66 Q_SCRIPTABLE QStringList action(int key) const;
68 //to be called by main components not owning the action
69 Q_SCRIPTABLE QList<int> shortcut(const QStringList &actionId) const;
71 //to be called by main components not owning the action
72 Q_SCRIPTABLE QList<int> defaultShortcut(const QStringList &actionId) const;
74 //to be called by main components owning the action
75 Q_SCRIPTABLE QList<int> setShortcut(const QStringList &actionId,
76 const QList<int> &keys, uint flags);
78 //this is used if application A wants to change shortcuts of application B
79 Q_SCRIPTABLE void setForeignShortcut(const QStringList &actionId, const QList<int> &keys);
81 //to be called when a KAction is destroyed. The shortcut stays in the data structures for
82 //conflict resolution but won't trigger.
83 Q_SCRIPTABLE void setInactive(const QStringList &actionId);
85 Q_SCRIPTABLE void doRegister(const QStringList &actionId);
87 Q_SCRIPTABLE void unRegister(const QStringList &actionId);
89 Q_SCRIPTABLE void activateGlobalShortcutContext(
90 const QString &component,
91 const QString &context);
94 /**
95 * Returns the shortcuts registered for @p key.
97 * If there is more than one shortcut they are guaranteed to be from the
98 * same component but different contexts. All shortcuts are searched.
100 Q_SCRIPTABLE QList<KGlobalShortcutInfo> getGlobalShortcutsByKey(int key) const;
103 * Return true if the @p shortcut is available for @p component.
105 Q_SCRIPTABLE bool isGlobalShortcutAvailable(
106 int key,
107 const QString &component) const;
109 Q_SIGNALS:
111 // this is qlonglong because manually written adaptor is used and just long doesn't work
112 Q_SCRIPTABLE void invokeAction(const QStringList &actionId, qlonglong timestamp);
114 Q_SCRIPTABLE void yourShortcutGotChanged(const QStringList &actionId, const QList<int> &newKeys);
116 private Q_SLOTS:
118 void blockGlobalShortcuts(int);
120 private:
122 Q_PRIVATE_SLOT(d, void _k_initializeDBus(const QDBusObjectPath&))
124 void scheduleWriteSettings() const;
126 KdedGlobalAccelPrivate *const d;
129 #endif //KDEDGLOBALACCEL_H