dont block shortcuts execution

--when trying to activate an entry through
global shortcuts we should take into
account the docks that we have already
access but that should not block the action
code.
pull/2/head
Michail Vourlakos 7 years ago
parent 973090906d
commit 9cb58d0d43

@ -337,22 +337,26 @@ bool GlobalShortcuts::activatePlasmaTaskManagerEntryAtContainment(const Plasma::
continue; continue;
} }
int showMethodIndex = -1;
if (!m_calledItems.contains(item)) { if (!m_calledItems.contains(item)) {
m_calledItems.append(item); m_calledItems.append(item);
m_methodsShowNumbers.append(metaObject->method(methodIndex)); m_methodsShowNumbers.append(metaObject->method(methodIndex));
showMethodIndex = m_methodsShowNumbers.count() - 1;
} else {
showMethodIndex = m_methodsShowNumbers.indexOf(metaObject->method(methodIndex));
}
QMetaMethod method = metaObject->method(methodIndex); QMetaMethod method = metaObject->method(methodIndex);
if (method.invoke(item, Q_ARG(QVariant, index - 1))) { if (method.invoke(item, Q_ARG(QVariant, index - 1))) {
if (methodIndex2 != -1) { if (methodIndex2 != -1) {
m_methodsShowNumbers[m_methodsShowNumbers.count() - 1].invoke(item, Q_ARG(QVariant, true)); m_methodsShowNumbers[showMethodIndex].invoke(item, Q_ARG(QVariant, true));
} }
return true; return true;
} }
} else {
return true;
}
} }
} }
} }
@ -387,16 +391,21 @@ bool GlobalShortcuts::activateLatteEntryAtContainment(const DockView *view, int
int appLauncher = m_corona->universalSettings()->metaForwardedToLatte() ? int appLauncher = m_corona->universalSettings()->metaForwardedToLatte() ?
applicationLauncherId(view->containment()) : -1; applicationLauncherId(view->containment()) : -1;
int showMethodIndex = -1;
if (!m_calledItems.contains(item)) { if (!m_calledItems.contains(item)) {
m_calledItems.append(item); m_calledItems.append(item);
m_methodsShowNumbers.append(metaObject->method(methodIndex2)); m_methodsShowNumbers.append(metaObject->method(methodIndex2));
int lastMethod = m_methodsShowNumbers.count() - 1; showMethodIndex = m_methodsShowNumbers.count() - 1;
} else {
showMethodIndex = m_methodsShowNumbers.indexOf(metaObject->method(methodIndex2));
}
QMetaMethod method = metaObject->method(methodIndex); QMetaMethod method = metaObject->method(methodIndex);
if (view->visibility()->isHidden()) { if (view->visibility()->isHidden()) {
//! delay the execution in order to show first the dock //! delay the execution in order to show first the dock
if (m_methodsShowNumbers[lastMethod].invoke(item, Q_ARG(QVariant, true), Q_ARG(QVariant, true), Q_ARG(QVariant, appLauncher))) { if (m_methodsShowNumbers[showMethodIndex].invoke(item, Q_ARG(QVariant, true), Q_ARG(QVariant, true), Q_ARG(QVariant, appLauncher))) {
QTimer::singleShot(APPLETEXECUTIONDELAY, [this, item, method, index]() { QTimer::singleShot(APPLETEXECUTIONDELAY, [this, item, method, index]() {
method.invoke(item, Q_ARG(QVariant, index)); method.invoke(item, Q_ARG(QVariant, index));
}); });
@ -405,14 +414,11 @@ bool GlobalShortcuts::activateLatteEntryAtContainment(const DockView *view, int
return true; return true;
} else { } else {
if (method.invoke(item, Q_ARG(QVariant, index))) { if (method.invoke(item, Q_ARG(QVariant, index))) {
m_methodsShowNumbers[lastMethod].invoke(item, Q_ARG(QVariant, true), Q_ARG(QVariant, true), Q_ARG(QVariant, appLauncher)); m_methodsShowNumbers[showMethodIndex].invoke(item, Q_ARG(QVariant, true), Q_ARG(QVariant, true), Q_ARG(QVariant, appLauncher));
return true; return true;
} }
} }
} else {
return true;
}
} }
} }
} }
@ -569,18 +575,20 @@ void GlobalShortcuts::showDocks()
int appLauncher = m_corona->universalSettings()->metaForwardedToLatte() ? int appLauncher = m_corona->universalSettings()->metaForwardedToLatte() ?
applicationLauncherId(c) : -1; applicationLauncherId(c) : -1;
int showMethodIndex = -1;
if (!m_calledItems.contains(item)) { if (!m_calledItems.contains(item)) {
m_calledItems.append(item); m_calledItems.append(item);
m_methodsShowNumbers.append(metaObject->method(methodIndex)); m_methodsShowNumbers.append(metaObject->method(methodIndex));
showMethodIndex = m_methodsShowNumbers.count() - 1;
int lastMethod = m_methodsShowNumbers.count() - 1;
if (m_methodsShowNumbers[lastMethod].invoke(item, Q_ARG(QVariant, true), Q_ARG(QVariant, true), Q_ARG(QVariant, appLauncher))) {
return true;
}
} else { } else {
showMethodIndex = m_methodsShowNumbers.indexOf(metaObject->method(methodIndex));
}
if (m_methodsShowNumbers[showMethodIndex].invoke(item, Q_ARG(QVariant, true), Q_ARG(QVariant, true), Q_ARG(QVariant, appLauncher))) {
return true; return true;
} }
} }
} }
} }
@ -608,15 +616,17 @@ void GlobalShortcuts::showDocks()
int appLauncher = m_corona->universalSettings()->metaForwardedToLatte() ? int appLauncher = m_corona->universalSettings()->metaForwardedToLatte() ?
applicationLauncherId(c) : -1; applicationLauncherId(c) : -1;
int showMethodIndex = -1;
if (!m_calledItems.contains(item)) { if (!m_calledItems.contains(item)) {
m_calledItems.append(item); m_calledItems.append(item);
m_methodsShowNumbers.append(metaObject->method(methodIndex)); m_methodsShowNumbers.append(metaObject->method(methodIndex));
int lastMethod = m_methodsShowNumbers.count() - 1; showMethodIndex = m_methodsShowNumbers.count() - 1;
if (m_methodsShowNumbers[lastMethod].invoke(item, Q_ARG(QVariant, false), Q_ARG(QVariant, true), Q_ARG(QVariant, appLauncher))) {
return true;
}
} else { } else {
showMethodIndex = m_methodsShowNumbers.indexOf(metaObject->method(methodIndex));
}
if (m_methodsShowNumbers[showMethodIndex].invoke(item, Q_ARG(QVariant, false), Q_ARG(QVariant, true), Q_ARG(QVariant, appLauncher))) {
return true; return true;
} }
} }

Loading…
Cancel
Save