KGlobalAccel
kglobalaccel.cpp
29org::kde::kglobalaccel::Component *KGlobalAccelPrivate::getComponent(const QString &componentUnique, bool remember = false)
49 qCDebug(KGLOBALACCEL_LOG) << "Failed to get dbus path for component " << componentUnique << reply.error();
55 new org::kde::kglobalaccel::Component(QStringLiteral("org.kde.kglobalaccel"), reply.value().path(), QDBusConnection::sessionBus(), q);
59 qCDebug(KGLOBALACCEL_LOG) << "Failed to get component" << componentUnique << QDBusConnection::sessionBus().lastError();
105 m_watcher = new QDBusServiceWatcher(serviceName(), QDBusConnection::sessionBus(), QDBusServiceWatcher::WatchForOwnerChange, q);
117 m_iface = new org::kde::KGlobalAccel(serviceName(), QStringLiteral("/kglobalaccel"), QDBusConnection::sessionBus());
123 qCritical() << "Couldn't start kglobalaccel from org.kde.kglobalaccel.service:" << reply.error();
127 QObject::connect(m_iface, &org::kde::KGlobalAccel::yourShortcutsChanged, q, [this](const QStringList &actionId, const QList<QKeySequence> &newKeys) {
202 if (!action || action->objectName().isEmpty() || action->objectName().startsWith(QLatin1String("unnamed-"))) {
220 if (actions.contains(action) && (actionShortcuts.contains(action) || actionDefaultShortcuts.contains(action))) {
252 // If we are merely marking a callback as inactive there is nothing for kglobalaccel to do if kglobalaccel is not running
275 auto message = QDBusMessage::createMethodCall(iface()->service(), iface()->path(), iface()->interface(), QStringLiteral("unregister"));
283 auto message = QDBusMessage::createMethodCall(iface()->service(), iface()->path(), iface()->interface(), QStringLiteral("setInactive"));
341 Q_EMIT q->globalShortcutChanged(action, scResult.isEmpty() ? QKeySequence() : scResult.first());
353 QStringList ret(componentUniqueForAction(action)); // Component Unique Id ( see actionIdFields )
418QAction *KGlobalAccelPrivate::findAction(const QString &componentUnique, const QString &actionUnique)
438void KGlobalAccelPrivate::invokeAction(const QString &componentUnique, const QString &actionUnique, qlonglong timestamp)
468void KGlobalAccelPrivate::invokeDeactivate(const QString &componentUnique, const QString &actionUnique)
480void KGlobalAccelPrivate::shortcutsChanged(const QStringList &actionId, const QList<QKeySequence> &keys)
491void KGlobalAccelPrivate::serviceOwnerChanged(const QString &name, const QString &oldOwner, const QString &newOwner)
496 qCDebug(KGLOBALACCEL_LOG) << "detected kglobalaccel restarting, re-registering all shortcut keys";
520QList<KGlobalShortcutInfo> KGlobalAccel::globalShortcutsByKey(const QKeySequence &seq, MatchType type)
531bool KGlobalAccel::promptStealShortcutSystemwide(QWidget *parent, const QList<KGlobalShortcutInfo> &shortcuts, const QKeySequence &seq)
542 message = tr("The '%1' key combination is registered by application %2 for action %3.").arg(seq.toString(), component, shortcuts[0].friendlyName());
546 actionList += tr("In context '%1' for action '%2'\n").arg(info.contextFriendlyName(), info.friendlyName());
596bool KGlobalAccel::setDefaultShortcut(QAction *action, const QList<QKeySequence> &shortcut, GlobalShortcutLoading loadFlag)
611bool KGlobalAccel::setShortcut(QAction *action, const QList<QKeySequence> &shortcut, GlobalShortcutLoading loadFlag)
636QList<QKeySequence> KGlobalAccel::globalShortcut(const QString &componentName, const QString &actionId) const
638 // see also d->updateGlobalShortcut(action, KGlobalAccelPrivate::ActiveShortcut, KGlobalAccel::Autoloading);
644 const QList<QKeySequence> scResult = self()->d->iface()->shortcutKeys({componentName, actionId, QString(), QString()});
669bool KGlobalAccelPrivate::setShortcutWithDefault(QAction *action, const QList<QKeySequence> &shortcut, KGlobalAccel::GlobalShortcutLoading loadFlag)
681 updateGlobalShortcut(action, KGlobalAccelPrivate::DefaultShortcut | KGlobalAccelPrivate::ActiveShortcut, loadFlag);
static QList< KGlobalShortcutInfo > globalShortcutsByKey(const QKeySequence &seq, MatchType type=Equal)
Returns a list of global shortcuts registered for the shortcut seq.
Definition kglobalaccel.cpp:520
bool hasShortcut(const QAction *action) const
Returns true if a shortcut or a default shortcut has been registered for the given action.
Definition kglobalaccel.cpp:653
static bool promptStealShortcutSystemwide(QWidget *parent, const QList< KGlobalShortcutInfo > &shortcuts, const QKeySequence &seq)
Show a messagebox to inform the user that a global shortcut is already occupied, and ask to take it a...
Definition kglobalaccel.cpp:531
static void stealShortcutSystemwide(const QKeySequence &seq)
Take away the given shortcut from the named action it belongs to.
Definition kglobalaccel.cpp:563
static bool isComponentActive(const QString &componentName)
Check if component is active.
Definition kglobalaccel.cpp:163
static bool cleanComponent(const QString &componentUnique)
Clean the shortcuts for component componentUnique.
Definition kglobalaccel.cpp:152
static KGlobalAccel * self()
Returns (and creates if necessary) the singleton instance.
Definition kglobalaccel.cpp:195
bool setShortcut(QAction *action, const QList< QKeySequence > &shortcut, GlobalShortcutLoading loadFlag=Autoloading)
Assign a global shortcut for the given action.
Definition kglobalaccel.cpp:611
@ Autoloading
Look up the action in global settings (using its main component's name and text()) and set the shortc...
Definition kglobalaccel.h:45
void removeAllShortcuts(QAction *action)
Unregister and remove all defined global shortcuts for the given action.
Definition kglobalaccel.cpp:648
bool setDefaultShortcut(QAction *action, const QList< QKeySequence > &shortcut, GlobalShortcutLoading loadFlag=Autoloading)
Assign a default global shortcut for a given QAction.
Definition kglobalaccel.cpp:596
static bool isGlobalShortcutAvailable(const QKeySequence &seq, const QString &component=QString())
Check if the shortcut @seq is available for the component.
Definition kglobalaccel.cpp:525
static bool setGlobalShortcut(QAction *action, const QList< QKeySequence > &shortcut)
Convenient method to set both active and default shortcut.
Definition kglobalaccel.cpp:658
QList< QKeySequence > shortcut(const QAction *action) const
Get the global shortcut for this action, if one exists.
Definition kglobalaccel.cpp:631
QList< QKeySequence > globalShortcut(const QString &componentName, const QString &actionId) const
Retrieves the shortcut as defined in global settings by componentName (e.g.
Definition kglobalaccel.cpp:636
QList< QKeySequence > defaultShortcut(const QAction *action) const
Get the global default shortcut for this action, if one exists.
Definition kglobalaccel.cpp:626
Definition kglobalshortcutinfo.h:23
Type type(const QSqlDatabase &db)
KCALENDARCORE_EXPORT QDataStream & operator>>(QDataStream &in, const KCalendarCore::Alarm::Ptr &)
QString path(const QString &relativePath)
KIOCORE_EXPORT QStringList list(const QString &fileClass)
KGuiItem remove()
QDebug operator<<(QDebug dbg, const PerceptualColor::MultiSpinBoxSection &value)
void setText(const QString &text)
bool isEnabled() const const
text
void trigger()
applicationName
void beginStructure()
void endStructure()
QDBusMessage call(const QDBusMessage &message, QDBus::CallMode mode, int timeout) const const
QDBusConnectionInterface * interface() const const
QDBusError lastError() const const
QDBusConnection sessionBus()
QDBusReply< bool > isServiceRegistered(const QString &serviceName) const const
QDBusReply< void > startService(const QString &name)
QString name() const const
QDBusMessage createMethodCall(const QString &service, const QString &path, const QString &interface, const QString &method)
const QDBusError & error()
bool isValid() const const
WatchForOwnerChange
void serviceOwnerChanged(const QString &serviceName, const QString &oldOwner, const QString &newOwner)
applicationDisplayName
QString toString(SequenceFormat format) const const
void append(QList< T > &&value)
const_reference at(qsizetype i) const const
iterator begin()
qsizetype count() const const
iterator end()
T & first()
bool isEmpty() const const
T & last()
void removeLast()
void reserve(qsizetype size)
qsizetype size() const const
T value(qsizetype i) const const
QPushButton * addButton(StandardButton button)
virtual int exec() override
void setWindowTitle(const QString &title)
void setText(const QString &text)
QMetaObject::Connection connect(const QObject *sender, PointerToMemberFunction signal, Functor functor)
void destroyed(QObject *obj)
objectName
QObject * parent() const const
QVariant property(const char *name) const const
bool setProperty(const char *name, QVariant &&value)
QString tr(const char *sourceText, const char *disambiguation, int n)
void clear()
QString arg(Args &&... args) const const
bool isEmpty() const const
bool isValid() const const
bool toBool() const const
QString toString() const const
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Mon Nov 18 2024 12:10:29 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006
Documentation copyright © 1996-2024 The KDE developers.
Generated on Mon Nov 18 2024 12:10:29 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.