[-]
[+]
|
Changed |
kglobalaccel.spec
|
|
[-]
[+]
|
Changed |
kglobalaccel-5.10.0.tar.xz/CMakeLists.txt
^
|
@@ -3,7 +3,7 @@
project(KGlobalAccel)
# ECM setup
-find_package(ECM 5.9.0 REQUIRED NO_MODULE)
+find_package(ECM 5.10.0 REQUIRED NO_MODULE)
set(CMAKE_MODULE_PATH ${ECM_MODULE_PATH} ${ECM_KDE_MODULE_DIR})
include(FeatureSummary)
@@ -14,8 +14,8 @@
include(ECMPoQmTools)
-set(KF5_VERSION "5.9.0") # handled by release scripts
-set(KF5_DEP_VERSION "5.9.0") # handled by release scripts
+set(KF5_VERSION "5.10.0") # handled by release scripts
+set(KF5_DEP_VERSION "5.10.0") # handled by release scripts
ecm_setup_version(${KF5_VERSION} VARIABLE_PREFIX KGLOBALACCEL
VERSION_HEADER "${CMAKE_CURRENT_BINARY_DIR}/kglobalaccel_version.h"
|
[-]
[+]
|
Changed |
kglobalaccel-5.10.0.tar.xz/autotests/kglobalshortcuttest.cpp
^
|
@@ -42,6 +42,15 @@
#include <xcb/xtest.h>
#endif
+/*
+ * NOTE
+ * ----
+ * These tests could be better. They don't include actually triggering actions,
+ * and we just choose very improbable shortcuts to avoid conflicts with real
+ * applications' shortcuts.
+ *
+*/
+
const QKeySequence sequenceA = QKeySequence(Qt::SHIFT + Qt::META + Qt::CTRL + Qt::ALT + Qt::Key_F12);
const QKeySequence sequenceB = QKeySequence(Qt::Key_F29);
const QKeySequence sequenceC = QKeySequence(Qt::SHIFT + Qt::META + Qt::CTRL + Qt::Key_F28);
@@ -49,10 +58,6 @@
const QKeySequence sequenceE = QKeySequence(Qt::META + Qt::Key_F29);
const QKeySequence sequenceF = QKeySequence(Qt::META + Qt::Key_F27);
-/* These tests could be better. They don't include actually triggering actions,
- and we just choose very improbable shortcuts to avoid conflicts with real
- applications' shortcuts. */
-
//we need a GUI so that the implementation can grab keys
QTEST_MAIN(KGlobalShortcutTest)
@@ -70,8 +75,24 @@
}
}
-void KGlobalShortcutTest::setupTest(QString id)
+/**
+ * NOTE: This method alters a KDE config file in your home directory.
+ *
+ * KDE4: ~/.kde4/share/config/kglobalshortcutsrc
+ * KF5: ~/.config/kglobalshortcutsrc
+ *
+ * At least on KDE4 this file cannot be modified by hand if the Plasma session
+ * is running. So in case you have to clean the file of spurious entries
+ * (e.g. because of broken or failing test cases)
+ * you have to logout from Plasma.
+ *
+ * The following sections are created and normally removed automatically:
+ * [qttest]
+ */
+void KGlobalShortcutTest::setupTest(const QString& id)
{
+ QString componentName = "qttest";
+
if (m_actionA) {
KGlobalAccel::self()->removeAllShortcuts(m_actionA);
delete m_actionA;
@@ -87,20 +108,20 @@
#ifndef KGLOBALACCEL_NO_DEPRECATED
QList<QStringList> components = kga->allMainComponents();
QStringList componentId;
- componentId << "qttest" << QString() << "KDE Test Program" << QString();
+ componentId << componentName << QString() << "KDE Test Program" << QString();
// QVERIFY(!components.contains(componentId));
#endif
m_actionA = new QAction("Text For Action A", this);
m_actionA->setObjectName("Action A:" + id);
- m_actionA->setProperty("componentName", "qttest");
+ m_actionA->setProperty("componentName", componentName);
m_actionA->setProperty("componentDisplayName", "KDE Test Program");
KGlobalAccel::self()->setShortcut(m_actionA, QList<QKeySequence>() << sequenceA << sequenceB, KGlobalAccel::NoAutoloading);
KGlobalAccel::self()->setDefaultShortcut(m_actionA, QList<QKeySequence>() << sequenceA << sequenceB, KGlobalAccel::NoAutoloading);
m_actionB = new QAction("Text For Action B", this);
m_actionB->setObjectName("Action B:" + id);
- m_actionB->setProperty("componentName", "qttest");
+ m_actionB->setProperty("componentName", componentName);
m_actionA->setProperty("componentDisplayName", "KDE Test Program");
KGlobalAccel::self()->setShortcut(m_actionB, QList<QKeySequence>(), KGlobalAccel::NoAutoloading);
KGlobalAccel::self()->setDefaultShortcut(m_actionB, QList<QKeySequence>(), KGlobalAccel::NoAutoloading);
@@ -117,6 +138,7 @@
// Just ensure that the desired values are set for both actions
QList<QKeySequence> cutA;
cutA << sequenceA << sequenceB;
+
QCOMPARE(KGlobalAccel::self()->shortcut(m_actionA), cutA);
QCOMPARE(KGlobalAccel::self()->defaultShortcut(m_actionA), cutA);
@@ -333,8 +355,10 @@
#ifndef KGLOBALACCEL_NO_DEPRECATED
QList<QStringList> actions = kga->allActionsForComponent(componentId);
QVERIFY(!actions.isEmpty());
- QStringList actionIdA; actionIdA << "qttest" << "Action A:testListActions" << "KDE Test Program" << "Text For Action A";
- QStringList actionIdB; actionIdB << "qttest" << "Action B:testListActions" << "KDE Test Program" << "Text For Action B";
+ QStringList actionIdA;
+ actionIdA << "qttest" << "Action A:testListActions" << "KDE Test Program" << "Text For Action A";
+ QStringList actionIdB;
+ actionIdB << "qttest" << "Action B:testListActions" << "KDE Test Program" << "Text For Action B";
//qDebug() << actions;
QVERIFY(actions.contains(actionIdA));
QVERIFY(actions.contains(actionIdB));
@@ -450,6 +474,22 @@
KGlobalAccel::self()->removeAllShortcuts(action);
}
+void KGlobalShortcutTest::testGetGlobalShortcut()
+{
+ setupTest("testLoadShortcutFromGlobalSettings"); // cleanup see testForgetGlobalShortcut
+ if (!m_daemonInstalled) {
+ QSKIP("kglobalaccel not installed");
+ }
+
+ // retrieve shortcut list
+ auto shortcutList = KGlobalAccel::self()->globalShortcut("qttest", "Action A:testLoadShortcutFromGlobalSettings");
+ QCOMPARE(shortcutList.count(), 2); // see setupTest
+
+ // test for a real shortcut:
+// shortcutList = KGlobalAccel::self()->shortcut("kwin", "Kill Window");
+// QCOMPARE(shortcutList.count(), 1);
+}
+
void KGlobalShortcutTest::testForgetGlobalShortcut()
{
setupTest("testForgetGlobalShortcut");
@@ -479,3 +519,4 @@
#endif
}
+
|
[-]
[+]
|
Changed |
kglobalaccel-5.10.0.tar.xz/autotests/kglobalshortcuttest.h
^
|
@@ -41,9 +41,13 @@
void testComponentAssignment();
void testConfigurationActions();
void testNotification();
+
+ void testGetGlobalShortcut();
+
// This has to be the last before forgetGlobalShortcut
void testOverrideMainComponentData();
- void testForgetGlobalShortcut();
+
+ void testForgetGlobalShortcut(); // clean global config altered by setupTest
public:
@@ -51,7 +55,7 @@
{}
private:
- void setupTest(QString id);
+ void setupTest(const QString& id);
QAction *m_actionA;
QAction *m_actionB;
|
[-]
[+]
|
Changed |
kglobalaccel-5.10.0.tar.xz/src/kglobalaccel.cpp
^
|
@@ -261,9 +261,9 @@
actionShortcuts.remove(action);
}
-void KGlobalAccelPrivate::updateGlobalShortcut(QAction *action,
- ShortcutTypes actionFlags,
- KGlobalAccel::GlobalShortcutLoading globalFlags)
+void KGlobalAccelPrivate::updateGlobalShortcut(/*const would be better*/QAction* action,
+ ShortcutTypes actionFlags,
+ KGlobalAccel::GlobalShortcutLoading globalFlags)
{
// No action or no objectname -> Do nothing
if (!action || action->objectName().isEmpty()) {
@@ -642,6 +642,19 @@
return d->actionShortcuts.value(action);
}
+QList<QKeySequence> KGlobalAccel::globalShortcut(const QString& componentName, const QString& actionId) const
+{
+ // see also d->updateGlobalShortcut(action, KGlobalAccelPrivate::ActiveShortcut, KGlobalAccel::Autoloading);
+
+ // how componentName and actionId map to QAction, e.g:
+ // action->setProperty("componentName", "kwin");
+ // action->setObjectName("Kill Window");
+
+ const QList<int> result = self()->d->iface.shortcut({ componentName, actionId, QString(), QString() });
+ const QList<QKeySequence> scResult(d->shortcutFromIntList(result));
+ return scResult;
+}
+
void KGlobalAccel::removeAllShortcuts(QAction *action)
{
d->remove(action, KGlobalAccelPrivate::UnRegister);
|
[-]
[+]
|
Changed |
kglobalaccel-5.10.0.tar.xz/src/kglobalaccel.h
^
|
@@ -258,12 +258,24 @@
* Unlike regular shortcuts, the application's window does not need focus
* for them to be activated.
*
+ * @note that this method only works together with setShortcut() because the action pointer
+ * is used to retrieve the result. If you would like to retrieve the shortcut as stored
+ * in the global settings, use the globalShortcut(componentName, actionId) instead.
+ *
* @sa setShortcut()
* @since 5.0
*/
QList<QKeySequence> shortcut(const QAction *action) const;
/**
+ * Retrieves the shortcut as defined in global settings by
+ * componentName (e.g. "kwin") and actionId (e.g. "Kill Window").
+ *
+ * @since 5.10
+ */
+ QList<QKeySequence> globalShortcut(const QString& componentName, const QString& actionId) const;
+
+ /**
* Unregister and remove all defined global shortcuts for the given action.
*
* @since 5.0
@@ -349,8 +361,10 @@
* @see setGlobalShortcut
* @see setDefaultShortcut
* @since 5.0
+ *
+ * @todo KF6: add const to the QAction parameter
*/
- void globalShortcutChanged(QAction *action, const QKeySequence &seq);
+ void globalShortcutChanged(/*const would be better*/QAction *action, const QKeySequence &seq);
private:
/// Creates a new KGlobalAccel object
|
[-]
[+]
|
Changed |
kglobalaccel-5.10.0.tar.xz/src/kglobalaccel_p.h
^
|
@@ -57,7 +57,8 @@
///Propagate any shortcut changes to the KDED module that does the bookkeeping
///and the key grabbing.
- void updateGlobalShortcut(QAction *action, ShortcutTypes actionFlags, KGlobalAccel::GlobalShortcutLoading globalFlags);
+ ///@todo KF6
+ void updateGlobalShortcut(/*const would be better*/QAction* action, KGlobalAccelPrivate::ShortcutTypes actionFlags, KGlobalAccel::GlobalShortcutLoading globalFlags);
///Register the action in this class and in the KDED module
bool doRegister(QAction *action); //"register" is a C keyword :p
|
[-]
[+]
|
Changed |
kglobalaccel-5.10.0.tar.xz/src/runtime/CMakeLists.txt
^
|
@@ -9,6 +9,7 @@
main.cpp
kglobalacceld.cpp
component.cpp
+ logging.cpp
globalshortcut.cpp
globalshortcutsregistry.cpp
globalshortcutcontext.cpp)
|
[-]
[+]
|
Changed |
kglobalaccel-5.10.0.tar.xz/src/runtime/component.cpp
^
|
@@ -21,6 +21,7 @@
#include "globalshortcut.h"
#include "globalshortcutcontext.h"
#include "globalshortcutsregistry.h"
+#include "logging_p.h"
#include <config-kglobalaccel.h>
#include <QDebug>
@@ -165,7 +166,7 @@
Q_FOREACH (GlobalShortcut *shortcut, _current->_actions)
{
- qDebug() << _current->_actions.size();
+ qCDebug(KGLOBALACCELD) << _current->_actions.size();
if (!shortcut->isPresent())
{
changed = true;
@@ -189,7 +190,7 @@
{
if (_contexts.value(uniqueName))
{
- qDebug() << "Shortcut Context " << uniqueName << "already exists for component " << _uniqueName;
+ qCDebug(KGLOBALACCELD) << "Shortcut Context " << uniqueName << "already exists for component " << _uniqueName;
return false;
}
_contexts.insert(uniqueName, new GlobalShortcutContext(uniqueName, friendlyName, this));
@@ -327,7 +328,7 @@
const QString &component,
const QString &context) const
{
- qDebug() << QKeySequence(key).toString() << component;
+ qCDebug(KGLOBALACCELD) << QKeySequence(key).toString() << component;
// if this component asks for the key. only check the keys in the same
// context
@@ -382,7 +383,7 @@
// The shortcut is already used. The config file is
// broken. Ignore the request.
keys.removeAll(key);
- qWarning() << "Shortcut found twice in kglobalshortcutsrc.";
+ qCWarning(KGLOBALACCELD) << "Shortcut found twice in kglobalshortcutsrc.";
}
}
}
@@ -466,11 +467,11 @@
contextGroup.writeEntry("_k_friendly_name", context->friendlyName());
}
- // qDebug() << "writing group " << _uniqueName << ":" << context->uniqueName();
+ // qCDebug(KGLOBALACCELD) << "writing group " << _uniqueName << ":" << context->uniqueName();
Q_FOREACH(const GlobalShortcut *shortcut, context->_actions)
{
- // qDebug() << "writing" << shortcut->uniqueName();
+ // qCDebug(KGLOBALACCELD) << "writing" << shortcut->uniqueName();
// We do not write fresh shortcuts.
// We do not write session shortcuts
@@ -478,7 +479,7 @@
{
continue;
}
- // qDebug() << "really writing" << shortcut->uniqueName();
+ // qCDebug(KGLOBALACCELD) << "really writing" << shortcut->uniqueName();
QStringList entry(stringFromKeys(shortcut->keys()));
entry.append(stringFromKeys(shortcut->defaultKeys()));
|
[-]
[+]
|
Changed |
kglobalaccel-5.10.0.tar.xz/src/runtime/globalshortcut.cpp
^
|
@@ -26,7 +26,7 @@
#include "component.h"
#include "globalshortcutcontext.h"
#include "globalshortcutsregistry.h"
-
+#include "logging_p.h"
#include <QDebug>
@@ -189,7 +189,7 @@
}
else
{
- qDebug() << _uniqueName << "skipping because key" << QKeySequence(key).toString() << "is already taken";
+ qCDebug(KGLOBALACCELD) << _uniqueName << "skipping because key" << QKeySequence(key).toString() << "is already taken";
_keys.append(0);
}
}
@@ -226,7 +226,7 @@
{
if (key != 0 && !GlobalShortcutsRegistry::self()->registerKey(key, this))
{
- qDebug() << uniqueName() << ": Failed to register " << QKeySequence(key).toString();
+ qCDebug(KGLOBALACCELD) << uniqueName() << ": Failed to register " << QKeySequence(key).toString();
}
}
@@ -246,7 +246,7 @@
{
if (key != 0 && !GlobalShortcutsRegistry::self()->unregisterKey(key, this))
{
- qDebug() << uniqueName() << ": Failed to unregister " << QKeySequence(key).toString();
+ qCDebug(KGLOBALACCELD) << uniqueName() << ": Failed to unregister " << QKeySequence(key).toString();
}
}
|
[-]
[+]
|
Changed |
kglobalaccel-5.10.0.tar.xz/src/runtime/globalshortcutsregistry.cpp
^
|
@@ -21,6 +21,7 @@
#include "globalshortcut.h"
#include "globalshortcutcontext.h"
#include <config-kglobalaccel.h>
+#include "logging_p.h"
#include <QDebug>
#include <KLocalizedString>
@@ -189,20 +190,20 @@
// ALT+PRINT is SYSREQ on my keyboard. So we grab something we think
// is ALT+PRINT but symXToKeyQt and modXToQt make ALT+SYSREQ of it
// when pressed (correctly). We can't match that.
- qDebug() << "Got unknown key" << QKeySequence(keyQt).toString();
+ qCDebug(KGLOBALACCELD) << "Got unknown key" << QKeySequence(keyQt).toString();
// In production mode just do nothing.
return false;
}
else if (!shortcut->isActive())
{
- qDebug() << "Got inactive key" << QKeySequence(keyQt).toString();
+ qCDebug(KGLOBALACCELD) << "Got inactive key" << QKeySequence(keyQt).toString();
// In production mode just do nothing.
return false;
}
- qDebug() << QKeySequence(keyQt).toString() << "=" << shortcut->uniqueName();
+ qCDebug(KGLOBALACCELD) << QKeySequence(keyQt).toString() << "=" << shortcut->uniqueName();
QStringList data(shortcut->context()->component()->uniqueName());
data.append(shortcut->uniqueName());
@@ -228,7 +229,7 @@
{
foreach (const QString &groupName, _config.groupList())
{
- qDebug() << "Loading group " << groupName;
+ qCDebug(KGLOBALACCELD) << "Loading group " << groupName;
Q_ASSERT(groupName.indexOf('\x1d')==-1);
@@ -288,17 +289,17 @@
{
if (key == 0)
{
- qDebug() << shortcut->uniqueName() << ": Key '" << QKeySequence(key).toString()
+ qCDebug(KGLOBALACCELD) << shortcut->uniqueName() << ": Key '" << QKeySequence(key).toString()
<< "' already taken by " << _active_keys.value(key)->uniqueName() << ".";
return false;
}
else if (_active_keys.value(key))
{
- qDebug() << shortcut->uniqueName() << ": Attempt to register key 0.";
+ qCDebug(KGLOBALACCELD) << shortcut->uniqueName() << ": Attempt to register key 0.";
return false;
}
- qDebug() << "Registering key" << QKeySequence(key).toString() << "for"
+ qCDebug(KGLOBALACCELD) << "Registering key" << QKeySequence(key).toString() << "for"
<< shortcut->context()->component()->uniqueName() << ":" << shortcut->uniqueName();
_active_keys.insert(key, shortcut);
@@ -340,7 +341,7 @@
return false;
}
- qDebug() << "Unregistering key" << QKeySequence(key).toString() << "for"
+ qCDebug(KGLOBALACCELD) << "Unregistering key" << QKeySequence(key).toString() << "for"
<< shortcut->context()->component()->uniqueName() << ":" << shortcut->uniqueName();
_manager->grabKey(key, false);
|
[-]
[+]
|
Changed |
kglobalaccel-5.10.0.tar.xz/src/runtime/kglobalaccel_mac.cpp
^
|
@@ -29,6 +29,7 @@
#include "globalshortcutsregistry.h"
#include "kkeyserver.h"
+#include "logging_p.h"
OSStatus hotKeyEventHandler(EventHandlerCallRef inHandlerCallRef, EventRef inEvent, void * inUserData)
{
@@ -36,14 +37,14 @@
if (eventKind == kEventRawKeyDown) {
UInt32 keycode;
if (GetEventParameter(inEvent, kEventParamKeyCode, typeUInt32, NULL, sizeof(keycode), NULL, &keycode) != noErr) {
- qWarning() << "Error retrieving keycode parameter from event";
+ qCWarning(KGLOBALACCELD) << "Error retrieving keycode parameter from event";
}
- qDebug() << " key down, keycode = " << keycode;
+ qCDebug(KGLOBALACCELD) << " key down, keycode = " << keycode;
} else if (eventKind == kEventHotKeyPressed) {
KGlobalAccelImpl* impl = static_cast<KGlobalAccelImpl *>(inUserData);
EventHotKeyID hotkey;
if (GetEventParameter(inEvent, kEventParamDirectObject, typeEventHotKeyID, NULL, sizeof(hotkey), NULL, &hotkey) != noErr) {
- qWarning() << "Error retrieving hotkey parameter from event";
+ qCWarning(KGLOBALACCELD) << "Error retrieving hotkey parameter from event";
return eventNotHandledErr;
}
// Typecasts necesary to prevent a warning from gcc
@@ -72,7 +73,7 @@
CFNotificationCenterAddObserver(CFNotificationCenterGetDistributedCenter(), this, layoutChanged, str, NULL, CFNotificationSuspensionBehaviorHold);
CFRelease(str);
} else {
- qWarning() << "Couldn't create CFString to register for keyboard notifications";
+ qCWarning(KGLOBALACCELD) << "Couldn't create CFString to register for keyboard notifications";
}
}
@@ -86,15 +87,15 @@
bool KGlobalAccelImpl::grabKey( int keyQt, bool grab )
{
if (grab) {
- qDebug() << "Grabbing key " << keyQt;
+ qCDebug(KGLOBALACCELD) << "Grabbing key " << keyQt;
QList<uint> keyCodes;
uint mod;
KKeyServer::keyQtToCodeMac( keyQt, keyCodes );
KKeyServer::keyQtToModMac( keyQt, mod );
- qDebug() << "keyQt: " << keyQt << " mod: " << mod;
+ qCDebug(KGLOBALACCELD) << "keyQt: " << keyQt << " mod: " << mod;
foreach (uint keyCode, keyCodes) {
- qDebug() << " keyCode: " << keyCode;
+ qCDebug(KGLOBALACCELD) << " keyCode: " << keyCode;
}
EventHotKeyID ehkid;
@@ -104,17 +105,17 @@
foreach (uint keyCode, keyCodes) {
EventHotKeyRef ref;
if (RegisterEventHotKey(keyCode, mod, ehkid, m_eventTarget, 0, &ref) != noErr) {
- qWarning() << "RegisterEventHotKey failed!";
+ qCWarning(KGLOBALACCELD) << "RegisterEventHotKey failed!";
}
hotkeys.append(ref);
}
refs->insert(keyQt, hotkeys);
} else {
- qDebug() << "Ungrabbing key " << keyQt;
- if (refs->count(keyQt) == 0) qWarning() << "Trying to ungrab a key thas is not grabbed";
+ qCDebug(KGLOBALACCELD) << "Ungrabbing key " << keyQt;
+ if (refs->count(keyQt) == 0) qCWarning(KGLOBALACCELD) << "Trying to ungrab a key thas is not grabbed";
foreach (const EventHotKeyRef &ref, refs->value(keyQt)) {
if (UnregisterEventHotKey(ref) != noErr) {
- qWarning() << "UnregisterEventHotKey should not fail!";
+ qCWarning(KGLOBALACCELD) << "UnregisterEventHotKey should not fail!";
}
}
refs->remove(keyQt);
@@ -126,10 +127,10 @@
{
if (enable) {
if (InstallEventHandler(m_eventTarget, m_eventHandler, 1, m_eventType, this, &m_curHandler) != noErr)
- qWarning() << "InstallEventHandler failed!";
+ qCWarning(KGLOBALACCELD) << "InstallEventHandler failed!";
} else {
if (RemoveEventHandler(m_curHandler) != noErr)
- qWarning() << "RemoveEventHandler failed!";
+ qCWarning(KGLOBALACCELD) << "RemoveEventHandler failed!";
}
}
|
[-]
[+]
|
Changed |
kglobalaccel-5.10.0.tar.xz/src/runtime/kglobalaccel_win.cpp
^
|
@@ -26,6 +26,7 @@
#include "kglobalaccel.h"
#include "globalshortcutsregistry.h"
+#include "logging_p.h"
#include <QDebug>
@@ -39,7 +40,7 @@
bool KGlobalAccelImpl::grabKey( int keyQt, bool grab )
{
if( !keyQt ) {
- qWarning() << "Tried to grab key with null code.";
+ qCWarning(KGLOBALACCELD) << "Tried to grab key with null code.";
return false;
}
|
[-]
[+]
|
Changed |
kglobalaccel-5.10.0.tar.xz/src/runtime/kglobalaccel_x11.cpp
^
|
@@ -20,6 +20,7 @@
#include "kglobalaccel_x11.h"
+#include "logging_p.h"
#include "globalshortcutsregistry.h"
#include "kkeyserver.h"
#include <netwm.h>
@@ -54,7 +55,7 @@
KKeyServer::modXNumLock() |
KKeyServer::modXScrollLock() |
KKeyServer::modXModeSwitch();
- //qDebug() << "g_keyModMaskXAccel = " << g_keyModMaskXAccel
+ //qCDebug(KGLOBALACCELD) << "g_keyModMaskXAccel = " << g_keyModMaskXAccel
// << "g_keyModMaskXOnOrOff = " << g_keyModMaskXOnOrOff << endl;
}
@@ -91,7 +92,7 @@
return false;
}
if( !keyQt ) {
- qDebug() << "Tried to grab key with null code.";
+ qCDebug(KGLOBALACCELD) << "Tried to grab key with null code.";
return false;
}
@@ -100,13 +101,13 @@
// Resolve the modifier
if( !KKeyServer::keyQtToModX(keyQt, &keyModX) ) {
- qDebug() << "keyQt (0x" << hex << keyQt << ") failed to resolve to x11 modifier";
+ qCDebug(KGLOBALACCELD) << "keyQt (0x" << hex << keyQt << ") failed to resolve to x11 modifier";
return false;
}
// Resolve the X symbol
if( !KKeyServer::keyQtToSymX(keyQt, (int *)&keySymX) ) {
- qDebug() << "keyQt (0x" << hex << keyQt << ") failed to resolve to x11 keycode";
+ qCDebug(KGLOBALACCELD) << "keyQt (0x" << hex << keyQt << ") failed to resolve to x11 keycode";
return false;
}
@@ -124,14 +125,14 @@
keySymX != xcb_key_symbols_get_keysym(m_keySymbols, keyCodeX, 0) &&
keySymX == xcb_key_symbols_get_keysym(m_keySymbols, keyCodeX, 1) )
{
- qDebug() << "adding shift to the grab";
+ qCDebug(KGLOBALACCELD) << "adding shift to the grab";
keyModX |= KKeyServer::modXShift();
}
keyModX &= g_keyModMaskXAccel; // Get rid of any non-relevant bits in mod
if( !keyCodeX ) {
- qDebug() << "keyQt (0x" << hex << keyQt << ") was resolved to x11 keycode 0";
+ qCDebug(KGLOBALACCELD) << "keyQt (0x" << hex << keyQt << ") was resolved to x11 keycode 0";
return false;
}
@@ -169,7 +170,7 @@
}
}
if( failed ) {
- qDebug() << "grab failed!\n";
+ qCDebug(KGLOBALACCELD) << "grab failed!\n";
for( uint m = 0; m <= 0xff; m++ ) {
if(( m & keyModMaskX ) == 0 )
xcb_ungrab_key(QX11Info::connection(), keyCodeX, QX11Info::appRootWindow(), keyModX | m);
@@ -189,13 +190,13 @@
const uint8_t responseType = event->response_type & ~0x80;
switch (responseType) {
case XCB_MAPPING_NOTIFY:
- qDebug() << "Got XMappingNotify event";
+ qCDebug(KGLOBALACCELD) << "Got XMappingNotify event";
xcb_refresh_keyboard_mapping(m_keySymbols, reinterpret_cast<xcb_mapping_notify_event_t*>(event));
x11MappingNotify();
return true;
case XCB_KEY_PRESS:
- qDebug() << "Got XKeyPress event";
+ qCDebug(KGLOBALACCELD) << "Got XKeyPress event";
return x11KeyPress(reinterpret_cast<xcb_key_press_event_t*>(event));
default:
@@ -228,7 +229,7 @@
bool KGlobalAccelImpl::x11KeyPress(xcb_key_press_event_t *pEvent)
{
if (QWidget::keyboardGrabber() || QApplication::activePopupWidget()) {
- qWarning() << "kglobalacceld should be popup and keyboard grabbing free!";
+ qCWarning(KGLOBALACCELD) << "kglobalacceld should be popup and keyboard grabbing free!";
}
// Keyboard needs to be ungrabed after XGrabKey() activates the grab,
@@ -270,7 +271,7 @@
KKeyServer::modXToQt(keyModX, &keyModQt);
if( keyModQt & Qt::SHIFT && !KKeyServer::isShiftAsModifierAllowed( keyCodeQt ) ) {
- qDebug() << "removing shift modifier";
+ qCDebug(KGLOBALACCELD) << "removing shift modifier";
keyModQt &= ~Qt::SHIFT;
}
|
[-]
[+]
|
Changed |
kglobalaccel-5.10.0.tar.xz/src/runtime/kglobalacceld.cpp
^
|
@@ -26,6 +26,7 @@
#include "globalshortcut.h"
#include "globalshortcutcontext.h"
#include "globalshortcutsregistry.h"
+#include "logging_p.h"
#include <QtCore/QTimer>
#include <QtCore/QMetaMethod>
@@ -85,7 +86,7 @@
// Check if actionId is valid
if (actionId.size() != 4)
{
- qDebug() << "Invalid! '" << actionId << "'";
+ qCDebug(KGLOBALACCELD) << "Invalid! '" << actionId << "'";
return NULL;
}
@@ -117,7 +118,7 @@
if (!component)
{
#ifdef KDEDGLOBALACCEL_TRACE
- qDebug() << componentUnique << "not found";
+ qCDebug(KGLOBALACCELD) << componentUnique << "not found";
#endif
return NULL;
}
@@ -129,13 +130,13 @@
#ifdef KDEDGLOBALACCEL_TRACE
if (shortcut)
{
- qDebug() << componentUnique
+ qCDebug(KGLOBALACCELD) << componentUnique
<< contextUnique
<< shortcut->uniqueName();
}
else
{
- qDebug() << "No match for" << shortcutUnique;
+ qCDebug(KGLOBALACCELD) << "No match for" << shortcutUnique;
}
#endif
return shortcut;
@@ -219,7 +220,7 @@
reg, SLOT(writeSettings()));
if (!QDBusConnection::sessionBus().registerService(QLatin1String("org.kde.kglobalaccel"))) {
- qWarning() << "Failed to register service org.kde.kglobalaccel";
+ qCWarning(KGLOBALACCELD) << "Failed to register service org.kde.kglobalaccel";
return false;
}
@@ -227,7 +228,7 @@
QStringLiteral("/kglobalaccel"),
this,
QDBusConnection::ExportScriptableContents)) {
- qWarning() << "Failed to register object kglobalaccel in org.kde.kglobalaccel";
+ qCWarning(KGLOBALACCELD) << "Failed to register object kglobalaccel in org.kde.kglobalaccel";
return false;
}
@@ -336,7 +337,7 @@
void KGlobalAccelD::blockGlobalShortcuts(bool block)
{
#ifdef KDEDGLOBALACCEL_TRACE
- qDebug() << block;
+ qCDebug(KGLOBALACCELD) << block;
#endif
block
? GlobalShortcutsRegistry::self()->deactivateShortcuts(true)
@@ -367,7 +368,7 @@
void KGlobalAccelD::doRegister(const QStringList &actionId)
{
#ifdef KDEDGLOBALACCEL_TRACE
- qDebug() << actionId;
+ qCDebug(KGLOBALACCELD) << actionId;
#endif
// Check because we would not want to add a action for an invalid
@@ -397,7 +398,7 @@
QDBusObjectPath KGlobalAccelD::getComponent(const QString &componentUnique) const
{
#ifdef KDEDGLOBALACCEL_TRACE
- qDebug() << componentUnique;
+ qCDebug(KGLOBALACCELD) << componentUnique;
#endif
KdeDGlobalAccel::Component *component =
@@ -418,7 +419,7 @@
QList<KGlobalShortcutInfo> KGlobalAccelD::getGlobalShortcutsByKey(int key) const
{
#ifdef KDEDGLOBALACCEL_TRACE
- qDebug() << key;
+ qCDebug(KGLOBALACCELD) << key;
#endif
QList<GlobalShortcut*> shortcuts =
GlobalShortcutsRegistry::self()->getShortcutsByKey(key);
@@ -427,7 +428,7 @@
Q_FOREACH(const GlobalShortcut *sc, shortcuts)
{
#ifdef KDEDGLOBALACCEL_TRACE
- qDebug() << sc->context()->uniqueName() << sc->uniqueName();
+ qCDebug(KGLOBALACCELD) << sc->context()->uniqueName() << sc->uniqueName();
#endif
rc.append(static_cast<KGlobalShortcutInfo>(*sc));
}
@@ -448,7 +449,7 @@
void KGlobalAccelD::setInactive(const QStringList &actionId)
{
#ifdef KDEDGLOBALACCEL_TRACE
- qDebug() << actionId;
+ qCDebug(KGLOBALACCELD) << actionId;
#endif
GlobalShortcut *shortcut = d->findAction(actionId);
@@ -460,7 +461,7 @@
bool KGlobalAccelD::unregister(const QString &componentUnique, const QString &shortcutUnique)
{
#ifdef KDEDGLOBALACCEL_TRACE
- qDebug() << componentUnique << shortcutUnique;
+ qCDebug(KGLOBALACCELD) << componentUnique << shortcutUnique;
#endif
// Stop grabbing the key
@@ -478,7 +479,7 @@
void KGlobalAccelD::unRegister(const QStringList &actionId)
{
#ifdef KDEDGLOBALACCEL_TRACE
- qDebug() << actionId;
+ qCDebug(KGLOBALACCELD) << actionId;
#endif
// Stop grabbing the key
@@ -545,7 +546,7 @@
void KGlobalAccelD::setForeignShortcut(const QStringList &actionId, const QList<int> &keys)
{
#ifdef KDEDGLOBALACCEL_TRACE
- qDebug() << actionId;
+ qCDebug(KGLOBALACCELD) << actionId;
#endif
GlobalShortcut *shortcut = d->findAction(actionId);
|
[-]
[+]
|
Added |
kglobalaccel-5.10.0.tar.xz/src/runtime/logging.cpp
^
|
@@ -0,0 +1,21 @@
+/********************************************************************
+Copyright 2015 Martin Gräßlin <mgraesslin@kde.org>
+
+This library is free software; you can redistribute it and/or
+modify it under the terms of the GNU Lesser General Public
+License as published by the Free Software Foundation; either
+version 2.1 of the License, or (at your option) version 3, or any
+later version accepted by the membership of KDE e.V. (or its
+successor approved by the membership of KDE e.V.), which shall
+act as a proxy defined in Section 6 of version 3 of the license.
+
+This library is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public
+License along with this library. If not, see <http://www.gnu.org/licenses/>.
+*********************************************************************/
+#include "logging_p.h"
+Q_LOGGING_CATEGORY(KGLOBALACCELD, "kglobalaccel-runtime");
|
[-]
[+]
|
Added |
kglobalaccel-5.10.0.tar.xz/src/runtime/logging_p.h
^
|
@@ -0,0 +1,26 @@
+/********************************************************************
+Copyright 2015 Martin Gräßlin <mgraesslin@kde.org>
+
+This library is free software; you can redistribute it and/or
+modify it under the terms of the GNU Lesser General Public
+License as published by the Free Software Foundation; either
+version 2.1 of the License, or (at your option) version 3, or any
+later version accepted by the membership of KDE e.V. (or its
+successor approved by the membership of KDE e.V.), which shall
+act as a proxy defined in Section 6 of version 3 of the license.
+
+This library is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public
+License along with this library. If not, see <http://www.gnu.org/licenses/>.
+*********************************************************************/
+#ifndef KGLOBALACCELD_LOGGING_P_H
+#define KGLOBALACCELD_LOGGING_P_H
+#include <QDebug>
+#include <QLoggingCategory>
+Q_DECLARE_LOGGING_CATEGORY(KGLOBALACCELD)
+
+#endif
|
[-]
[+]
|
Changed |
kglobalaccel-5.10.0.tar.xz/src/runtime/main.cpp
^
|
@@ -20,6 +20,7 @@
*/
#include "kglobalacceld.h"
+#include "logging_p.h"
#include <kcrash.h>
#include <KAboutData>
@@ -71,7 +72,7 @@
// check if kglobalaccel is disabled
if (!isEnabled()) {
- qDebug() << "kglobalaccel is disabled!";
+ qCDebug(KGLOBALACCELD) << "kglobalaccel is disabled!";
return 0;
}
|
[-]
[+]
|
Changed |
kglobalaccel.yaml
^
|
@@ -1,5 +1,5 @@
Name : kglobalaccel
-Version : 5.9.0
+Version : 5.10.0
Release : 1
Group : System/Base
License : GPLv2+
|