File indexing completed on 2024-05-19 05:29:56

0001 /*
0002     This file is part of the KDE libraries
0003     SPDX-FileCopyrightText: 2015 Martin Gräßlin <mgraesslin@kde.org>
0004 
0005     SPDX-License-Identifier: LGPL-2.0-or-later
0006 */
0007 
0008 #include "kglobalaccel_interface.h"
0009 #include "globalshortcutsregistry.h"
0010 
0011 class KGlobalAccelInterface::Private
0012 {
0013 public:
0014     Private(GlobalShortcutsRegistry *owner)
0015         : owner(owner)
0016     {
0017     }
0018     GlobalShortcutsRegistry *owner;
0019 };
0020 
0021 KGlobalAccelInterface::KGlobalAccelInterface(QObject *owner)
0022     : QObject(owner)
0023     , d(new Private(qobject_cast<GlobalShortcutsRegistry *>(owner)))
0024 {
0025 }
0026 
0027 KGlobalAccelInterface::~KGlobalAccelInterface() = default;
0028 
0029 void KGlobalAccelInterface::setRegistry(GlobalShortcutsRegistry *registry)
0030 {
0031     setParent(registry);
0032     d->owner = registry;
0033 }
0034 
0035 bool KGlobalAccelInterface::keyPressed(int keyQt)
0036 {
0037     return d->owner->keyPressed(keyQt);
0038 }
0039 
0040 void KGlobalAccelInterface::grabKeys()
0041 {
0042     d->owner->grabKeys();
0043 }
0044 
0045 void KGlobalAccelInterface::ungrabKeys()
0046 {
0047     d->owner->ungrabKeys();
0048 }
0049 
0050 bool KGlobalAccelInterface::keyReleased(int keyQt)
0051 {
0052     return d->owner->keyReleased(keyQt);
0053 }