delay a few things on startup, such as setting the visibility mode, which ensures...
[personal-kdebase.git] / runtime / kdedglobalaccel / globalshortcutcontext.cpp
blob3cca1334b369d1e91e0bae7397c23642ef1e378e
1 /* Copyright (C) 2008 Michael Jansen <kde@michael-jansen.biz>
3 This library is free software; you can redistribute it and/or
4 modify it under the terms of the GNU Library General Public
5 License as published by the Free Software Foundation; either
6 version 2 of the License, or (at your option) any later version.
8 This library is distributed in the hope that it will be useful,
9 but WITHOUT ANY WARRANTY; without even the implied warranty of
10 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 Library General Public License for more details.
13 You should have received a copy of the GNU Library General Public License
14 along with this library; see the file COPYING.LIB. If not, write to
15 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
16 Boston, MA 02110-1301, USA.
19 #include "globalshortcutcontext.h"
21 #include "globalshortcut.h"
23 #include "kdebug.h"
25 GlobalShortcutContext::GlobalShortcutContext(
26 const QString &uniqueName,
27 const QString &friendlyName,
28 KdeDGlobalAccel::Component *component)
30 : _uniqueName(uniqueName),
31 _friendlyName(friendlyName),
32 _component(component),
33 _actions()
37 GlobalShortcutContext::~GlobalShortcutContext()
41 void GlobalShortcutContext::addShortcut(GlobalShortcut *shortcut)
43 _actions.insert(shortcut->uniqueName(), shortcut);
47 QList<KGlobalShortcutInfo> GlobalShortcutContext::allShortcutInfos() const
49 QList<KGlobalShortcutInfo> rc;
50 Q_FOREACH (GlobalShortcut *shortcut, _actions)
52 rc.append(static_cast<KGlobalShortcutInfo>(*shortcut));
54 return rc;
58 KdeDGlobalAccel::Component const *GlobalShortcutContext::component() const
60 return _component;
64 KdeDGlobalAccel::Component *GlobalShortcutContext::component()
66 return _component;
70 QString GlobalShortcutContext::friendlyName() const
72 return _friendlyName;
76 GlobalShortcut *GlobalShortcutContext::getShortcutByKey(int key) const
78 Q_FOREACH(GlobalShortcut *sc, _actions)
80 if (sc->keys().contains(key)) return sc;
82 return NULL;
86 GlobalShortcut *GlobalShortcutContext::takeShortcut(GlobalShortcut *shortcut)
88 // Try to take the shortcut. Result could be null if the shortcut doesn't
89 // belong ti this component.
90 return _actions.take(shortcut->uniqueName()); }
93 QString GlobalShortcutContext::uniqueName() const { return _uniqueName; }