mirror of
https://github.com/KDE/latte-dock.git
synced 2025-03-09 00:58:15 +03:00
improvement for Container::OnPositionShortcuts
--bind On Position Shortcuts Container ability with View::ExtendedContainmentInterface implementation
This commit is contained in:
parent
f32937ca6d
commit
dc78257962
@ -71,9 +71,9 @@ ContainmentInterface::~ContainmentInterface()
|
||||
{
|
||||
}
|
||||
|
||||
void ContainmentInterface::identifyMainItem()
|
||||
void ContainmentInterface::identifyShortcutsHost()
|
||||
{
|
||||
if (m_mainItem) {
|
||||
if (m_shortcutsHost) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -82,9 +82,13 @@ void ContainmentInterface::identifyMainItem()
|
||||
|
||||
for (QQuickItem *item : childItems) {
|
||||
if (item->objectName() == "containmentViewLayout" ) {
|
||||
m_mainItem = item;
|
||||
identifyMethods();
|
||||
return;
|
||||
for (QQuickItem *subitem : item->childItems()) {
|
||||
if (subitem->objectName() == "PositionShortcutsAbilityHost") {
|
||||
m_shortcutsHost = subitem;
|
||||
identifyMethods();
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -92,15 +96,15 @@ void ContainmentInterface::identifyMainItem()
|
||||
|
||||
void ContainmentInterface::identifyMethods()
|
||||
{
|
||||
int aeIndex = m_mainItem->metaObject()->indexOfMethod("activateEntryAtIndex(QVariant)");
|
||||
int niIndex = m_mainItem->metaObject()->indexOfMethod("newInstanceForEntryAtIndex(QVariant)");
|
||||
int sbIndex = m_mainItem->metaObject()->indexOfMethod("setShowAppletShortcutBadges(QVariant,QVariant,QVariant,QVariant)");
|
||||
int afiIndex = m_mainItem->metaObject()->indexOfMethod("appletIdForIndex(QVariant)");
|
||||
int aeIndex = m_shortcutsHost->metaObject()->indexOfMethod("activateEntryAtIndex(QVariant)");
|
||||
int niIndex = m_shortcutsHost->metaObject()->indexOfMethod("newInstanceForEntryAtIndex(QVariant)");
|
||||
int sbIndex = m_shortcutsHost->metaObject()->indexOfMethod("setShowAppletShortcutBadges(QVariant,QVariant,QVariant,QVariant)");
|
||||
int afiIndex = m_shortcutsHost->metaObject()->indexOfMethod("appletIdForIndex(QVariant)");
|
||||
|
||||
m_activateEntryMethod = m_mainItem->metaObject()->method(aeIndex);
|
||||
m_appletIdForIndexMethod = m_mainItem->metaObject()->method(afiIndex);
|
||||
m_newInstanceMethod = m_mainItem->metaObject()->method(niIndex);
|
||||
m_showShortcutsMethod = m_mainItem->metaObject()->method(sbIndex);
|
||||
m_activateEntryMethod = m_shortcutsHost->metaObject()->method(aeIndex);
|
||||
m_appletIdForIndexMethod = m_shortcutsHost->metaObject()->method(afiIndex);
|
||||
m_newInstanceMethod = m_shortcutsHost->metaObject()->method(niIndex);
|
||||
m_showShortcutsMethod = m_shortcutsHost->metaObject()->method(sbIndex);
|
||||
}
|
||||
|
||||
bool ContainmentInterface::applicationLauncherHasGlobalShortcut() const
|
||||
@ -149,7 +153,7 @@ bool ContainmentInterface::containsApplicationLauncher() const
|
||||
|
||||
bool ContainmentInterface::isCapableToShowShortcutBadges()
|
||||
{
|
||||
identifyMainItem();
|
||||
identifyShortcutsHost();
|
||||
|
||||
if (!hasLatteTasks() && hasPlasmaTasks()) {
|
||||
return false;
|
||||
@ -322,35 +326,35 @@ bool ContainmentInterface::newInstanceForPlasmaTask(const int index)
|
||||
|
||||
bool ContainmentInterface::activateEntry(const int index)
|
||||
{
|
||||
identifyMainItem();
|
||||
identifyShortcutsHost();
|
||||
|
||||
if (!m_activateEntryMethod.isValid()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return m_activateEntryMethod.invoke(m_mainItem, Q_ARG(QVariant, index));
|
||||
return m_activateEntryMethod.invoke(m_shortcutsHost, Q_ARG(QVariant, index));
|
||||
}
|
||||
|
||||
bool ContainmentInterface::newInstanceForEntry(const int index)
|
||||
{
|
||||
identifyMainItem();
|
||||
identifyShortcutsHost();
|
||||
|
||||
if (!m_newInstanceMethod.isValid()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return m_newInstanceMethod.invoke(m_mainItem, Q_ARG(QVariant, index));
|
||||
return m_newInstanceMethod.invoke(m_shortcutsHost, Q_ARG(QVariant, index));
|
||||
}
|
||||
|
||||
bool ContainmentInterface::hideShortcutBadges()
|
||||
{
|
||||
identifyMainItem();
|
||||
identifyShortcutsHost();
|
||||
|
||||
if (!m_showShortcutsMethod.isValid()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return m_showShortcutsMethod.invoke(m_mainItem, Q_ARG(QVariant, false), Q_ARG(QVariant, false), Q_ARG(QVariant, false), Q_ARG(QVariant, -1));
|
||||
return m_showShortcutsMethod.invoke(m_shortcutsHost, Q_ARG(QVariant, false), Q_ARG(QVariant, false), Q_ARG(QVariant, false), Q_ARG(QVariant, -1));
|
||||
}
|
||||
|
||||
bool ContainmentInterface::showOnlyMeta()
|
||||
@ -364,7 +368,7 @@ bool ContainmentInterface::showOnlyMeta()
|
||||
|
||||
bool ContainmentInterface::showShortcutBadges(const bool showLatteShortcuts, const bool showMeta)
|
||||
{
|
||||
identifyMainItem();
|
||||
identifyShortcutsHost();
|
||||
|
||||
if (!m_showShortcutsMethod.isValid() || !isCapableToShowShortcutBadges()) {
|
||||
return false;
|
||||
@ -372,12 +376,12 @@ bool ContainmentInterface::showShortcutBadges(const bool showLatteShortcuts, con
|
||||
|
||||
int appLauncherId = m_corona->universalSettings()->kwin_metaForwardedToLatte() && showMeta ? applicationLauncherId() : -1;
|
||||
|
||||
return m_showShortcutsMethod.invoke(m_mainItem, Q_ARG(QVariant, showLatteShortcuts), Q_ARG(QVariant, true), Q_ARG(QVariant, showMeta), Q_ARG(QVariant, appLauncherId));
|
||||
return m_showShortcutsMethod.invoke(m_shortcutsHost, Q_ARG(QVariant, showLatteShortcuts), Q_ARG(QVariant, true), Q_ARG(QVariant, showMeta), Q_ARG(QVariant, appLauncherId));
|
||||
}
|
||||
|
||||
int ContainmentInterface::appletIdForVisualIndex(const int index)
|
||||
{
|
||||
identifyMainItem();
|
||||
identifyShortcutsHost();
|
||||
|
||||
if (!m_appletIdForIndexMethod.isValid()) {
|
||||
return false;
|
||||
@ -385,7 +389,7 @@ int ContainmentInterface::appletIdForVisualIndex(const int index)
|
||||
|
||||
QVariant appletId{-1};
|
||||
|
||||
m_appletIdForIndexMethod.invoke(m_mainItem, Q_RETURN_ARG(QVariant, appletId), Q_ARG(QVariant, index));
|
||||
m_appletIdForIndexMethod.invoke(m_shortcutsHost, Q_RETURN_ARG(QVariant, appletId), Q_ARG(QVariant, index));
|
||||
|
||||
return appletId.toInt();
|
||||
}
|
||||
|
@ -104,7 +104,7 @@ signals:
|
||||
void plasmaTasksModelChanged();
|
||||
|
||||
private slots:
|
||||
void identifyMainItem();
|
||||
void identifyShortcutsHost();
|
||||
void identifyMethods();
|
||||
|
||||
void updateAppletsTracking();
|
||||
@ -130,7 +130,7 @@ private:
|
||||
|
||||
QPointer<Latte::Corona> m_corona;
|
||||
QPointer<Latte::View> m_view;
|
||||
QPointer<QQuickItem> m_mainItem;
|
||||
QPointer<QQuickItem> m_shortcutsHost;
|
||||
|
||||
//! startup timer to initialize
|
||||
//! applets tracking
|
||||
|
@ -23,6 +23,8 @@ import org.kde.plasma.plasmoid 2.0
|
||||
import "./privates" as Ability
|
||||
|
||||
Ability.IndexerPrivate {
|
||||
objectName: "IndexerAbilityHost"
|
||||
|
||||
//! do not update during dragging/moving applets inConfigureAppletsMode
|
||||
updateIsBlocked: (root.dragOverlay && root.dragOverlay.pressed)
|
||||
|| layouter.appletsInParentChange
|
||||
@ -43,15 +45,34 @@ Ability.IndexerPrivate {
|
||||
return false;
|
||||
}
|
||||
|
||||
function visibleIndex(actualIndex) {
|
||||
if ((separators.indexOf(actualIndex) >= 0) || (hidden.indexOf(actualIndex) >= 0)) {
|
||||
return -1;
|
||||
function appletIdForVisibleIndex(itemVisibleIndex) {
|
||||
var sLayout = layouts.startLayout;
|
||||
for (var i=0; i<sLayout.children.length; ++i){
|
||||
var appletItem = sLayout.children[i];
|
||||
|
||||
if (visibleIndexBelongsAtApplet(appletItem, itemVisibleIndex)) {
|
||||
return appletItem.index;
|
||||
}
|
||||
}
|
||||
|
||||
var visibleItems = visibleItemsBeforeCount(layouts.startLayout, actualIndex) +
|
||||
visibleItemsBeforeCount(layouts.mainLayout, actualIndex) +
|
||||
visibleItemsBeforeCount(layouts.endLayout, actualIndex);
|
||||
var mLayout = layouts.mainLayout;
|
||||
for (var i=0; i<mLayout.children.length; ++i){
|
||||
var appletItem = sLayout.children[i];
|
||||
|
||||
return visibleItems;
|
||||
if (visibleIndexBelongsAtApplet(appletItem, itemVisibleIndex)) {
|
||||
return appletItem.index;
|
||||
}
|
||||
}
|
||||
|
||||
var eLayout = layouts.endLayout;
|
||||
for (var i=0; i<eLayout.children.length; ++i){
|
||||
var appletItem = sLayout.children[i];
|
||||
|
||||
if (visibleIndexBelongsAtApplet(appletItem, itemVisibleIndex)) {
|
||||
return appletItem.index;
|
||||
}
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
@ -25,5 +25,42 @@ import org.kde.plasma.plasmoid 2.0
|
||||
import "./privates" as Ability
|
||||
|
||||
Ability.PositionShortcutsPrivate {
|
||||
id: _shortcuts
|
||||
objectName: "PositionShortcutsAbilityHost"
|
||||
|
||||
//! do not update during dragging/moving applets inConfigureAppletsMode
|
||||
updateIsBlocked: (root.dragOverlay && root.dragOverlay.pressed)
|
||||
|| layouter.appletsInParentChange
|
||||
|
||||
|
||||
//! this is called from globalshortcuts c++ side
|
||||
function setShowAppletShortcutBadges(showPositionShortcuts, showShortcuts, showMeta, applicationLauncher){
|
||||
showPositionShortcutBadges = showPositionShortcuts;
|
||||
showAppletShortcutBadges = showShortcuts;
|
||||
showMetaBadge = showMeta;
|
||||
applicationLauncherId = applicationLauncher;
|
||||
}
|
||||
|
||||
//! this is called from Latte::View::ContainmentInterface
|
||||
function activateEntryAtIndex(index) {
|
||||
if (typeof index !== "number") {
|
||||
return;
|
||||
}
|
||||
|
||||
sglActivateEntryAtIndex(index);
|
||||
}
|
||||
|
||||
//! this is called from Latte::View::ContainmentInterface
|
||||
function newInstanceForEntryAtIndex(index) {
|
||||
if (typeof index !== "number") {
|
||||
return;
|
||||
}
|
||||
|
||||
sglNewInstanceForEntryAtIndex(index);
|
||||
}
|
||||
|
||||
//! this is called from Latte::View::ContainmentInterface
|
||||
function appletIdForIndex(index) {
|
||||
return indexer.appletIdForVisibleIndex(index);
|
||||
}
|
||||
}
|
||||
|
@ -24,9 +24,7 @@ import org.kde.latte.abilities.definitions 0.1 as AbilityDefinition
|
||||
|
||||
AbilityDefinition.Indexer {
|
||||
id: indxr
|
||||
|
||||
property Item layouts: null
|
||||
|
||||
property bool updateIsBlocked: false
|
||||
|
||||
property var clients: []
|
||||
@ -217,4 +215,38 @@ AbilityDefinition.Indexer {
|
||||
|
||||
return visibleItems;
|
||||
}
|
||||
|
||||
function visibleIndex(actualIndex) {
|
||||
if ((separators.indexOf(actualIndex) >= 0) || (hidden.indexOf(actualIndex) >= 0)) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
var visibleItems = visibleItemsBeforeCount(layouts.startLayout, actualIndex) +
|
||||
visibleItemsBeforeCount(layouts.mainLayout, actualIndex) +
|
||||
visibleItemsBeforeCount(layouts.endLayout, actualIndex);
|
||||
|
||||
return visibleItems;
|
||||
}
|
||||
|
||||
function visibleIndexBelongsAtApplet(applet, itemVisibleIndex) {
|
||||
if (itemVisibleIndex<0 || !applet) {
|
||||
return false;
|
||||
}
|
||||
|
||||
var vIndexBase = visibleIndex(applet.index);
|
||||
|
||||
if (vIndexBase === itemVisibleIndex) {
|
||||
return true;
|
||||
} else if (applet.communicator
|
||||
&& applet.communicator.indexerIsSupported
|
||||
&& applet.communicator.bridge
|
||||
&& applet.communicator.bridge.indexer) {
|
||||
if (itemVisibleIndex >= vIndexBase
|
||||
&& itemVisibleIndex< (vIndexBase + appletItem.communicator.bridge.indexer.client.visibleItemsCount)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -20,96 +20,64 @@
|
||||
import QtQuick 2.7
|
||||
|
||||
Item {
|
||||
objectName: "PositionShortcuts"
|
||||
id: _shortcutsprivate
|
||||
property Item layouts: null
|
||||
property bool updateIsBlocked: false
|
||||
|
||||
property bool unifiedGlobalShortcuts: true
|
||||
readonly property bool unifiedGlobalShortcuts: appletIdStealingPositionShortcuts === -1
|
||||
|
||||
property bool showLatteShortcutBadges: false
|
||||
property bool showPositionShortcutBadges: false
|
||||
property bool showAppletShortcutBadges: false
|
||||
property bool showMetaBadge: false
|
||||
property int applicationLauncherId: -1
|
||||
|
||||
property int appletIdStealingPositionShortcuts: -1
|
||||
|
||||
signal sglActivateEntryAtIndex(int entryIndex);
|
||||
signal sglNewInstanceForEntryAtIndex(int entryIndex);
|
||||
|
||||
//! this is called from globalshortcuts c++ side
|
||||
function setShowAppletShortcutBadges(showLatteShortcuts, showShortcuts, showMeta, applicationLauncher){
|
||||
if (latteApplet) {
|
||||
var base = unifiedGlobalShortcuts ? parabolicManager.pseudoAppletIndex(latteAppletPos) : 1;
|
||||
latteApplet.setTasksBaseIndex(base - 1);
|
||||
latteApplet.setShowTaskShortcutBadges(showLatteShortcuts);
|
||||
}
|
||||
Binding {
|
||||
target: _shortcutsprivate
|
||||
property: "appletIdStealingPositionShortcuts"
|
||||
when: !updateIsBlocked
|
||||
value: {
|
||||
var sLayout = layouts.startLayout;
|
||||
for (var i=0; i<sLayout.children.length; ++i){
|
||||
var appletItem = sLayout.children[i];
|
||||
if (appletItem
|
||||
&& appletItem.index>=0
|
||||
&& appletItem.communicator
|
||||
&& appletItem.communicator.onPositionShortcutsAreSupported
|
||||
&& appletItem.communicator.bridge.shortcuts.client.isStealingGlobalPositionShortcuts) {
|
||||
return appletItem.index;
|
||||
}
|
||||
}
|
||||
|
||||
showLatteShortcutBadges = showLatteShortcuts;
|
||||
showAppletShortcutBadges = showShortcuts;
|
||||
showMetaBadge = showMeta;
|
||||
applicationLauncherId = applicationLauncher;
|
||||
var mLayout = layouts.mainLayout;
|
||||
for (var i=0; i<mLayout.children.length; ++i){
|
||||
var appletItem = mLayout.children[i];
|
||||
if (appletItem
|
||||
&& appletItem.index>=0
|
||||
&& appletItem.communicator
|
||||
&& appletItem.communicator.onPositionShortcutsAreSupported
|
||||
&& appletItem.communicator.bridge.shortcuts.client.isStealingGlobalPositionShortcuts) {
|
||||
return appletItem.index;
|
||||
}
|
||||
}
|
||||
|
||||
if (latteApplet) {
|
||||
latteApplet.parabolicManager.updateTasksEdgesIndexes();
|
||||
}
|
||||
}
|
||||
var eLayout = layouts.endLayout;
|
||||
for (var i=0; i<eLayout.children.length; ++i){
|
||||
var appletItem = eLayout.children[i];
|
||||
if (appletItem
|
||||
&& appletItem.index>=0
|
||||
&& appletItem.communicator
|
||||
&& appletItem.communicator.onPositionShortcutsAreSupported
|
||||
&& appletItem.communicator.bridge.shortcuts.client.isStealingGlobalPositionShortcuts) {
|
||||
return appletItem.index;
|
||||
}
|
||||
}
|
||||
|
||||
//! this is called from Latte::View::ContainmentInterface
|
||||
function activateEntryAtIndex(index) {
|
||||
if (typeof index !== "number") {
|
||||
return;
|
||||
}
|
||||
|
||||
if (latteApplet) {
|
||||
var base = unifiedGlobalShortcuts ? parabolicManager.pseudoAppletIndex(latteAppletPos) : 1;
|
||||
latteApplet.setTasksBaseIndex(base - 1);
|
||||
latteApplet.parabolicManager.updateTasksEdgesIndexes();
|
||||
}
|
||||
|
||||
signalActivateEntryAtIndex(index);
|
||||
}
|
||||
|
||||
//! this is called from Latte::View::ContainmentInterface
|
||||
function newInstanceForEntryAtIndex(index) {
|
||||
if (typeof index !== "number") {
|
||||
return;
|
||||
}
|
||||
|
||||
if (latteApplet) {
|
||||
var base = unifiedGlobalShortcuts ? parabolicManager.pseudoAppletIndex(latteAppletPos) : 1;
|
||||
latteApplet.setTasksBaseIndex(base - 1);
|
||||
latteApplet.parabolicManager.updateTasksEdgesIndexes();
|
||||
}
|
||||
|
||||
signalNewInstanceForEntryAtIndex(index);
|
||||
}
|
||||
|
||||
//! this is called from Latte::View::ContainmentInterface
|
||||
function appletIdForIndex(index) {
|
||||
if (!root.unifiedGlobalShortcuts || parabolicManager.pseudoIndexBelongsToLatteApplet(index)) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
for (var i=0; i<layoutsContainer.startLayout.children.length; ++i){
|
||||
var appletItem = layoutsContainer.startLayout.children[i];
|
||||
|
||||
if (appletItem && appletItem.refersEntryIndex(index)) {
|
||||
return appletItem.applet.id;
|
||||
}
|
||||
}
|
||||
|
||||
for (var j=0; j<layoutsContainer.mainLayout.children.length; ++j){
|
||||
var appletItem2 = layoutsContainer.mainLayout.children[j];
|
||||
|
||||
if (appletItem2 && appletItem2.refersEntryIndex(index)) {
|
||||
return appletItem2.applet.id;
|
||||
}
|
||||
}
|
||||
|
||||
for (var k=0; j<layoutsContainer.endLayout.children.length; ++k){
|
||||
var appletItem3 = layoutsContainer.endLayout.children[k];
|
||||
|
||||
if (appletItem3 && appletItem3.refersEntryIndex(index)) {
|
||||
return appletItem3.applet.id;
|
||||
}
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
@ -288,6 +288,7 @@ Item {
|
||||
property Item layouter: null
|
||||
property Item metrics: null
|
||||
property Item parabolic: null
|
||||
property Item shortcuts: null
|
||||
|
||||
property bool containsMouse: appletMouseArea.containsMouse || (isLattePlasmoid && latteApplet.containsMouse)
|
||||
property bool pressed: viewSignalsConnector.pressed || clickedAnimation.running
|
||||
@ -612,20 +613,20 @@ Item {
|
||||
|
||||
//! Connections
|
||||
Connections{
|
||||
target: root
|
||||
target: appletItem.shortcuts
|
||||
|
||||
onSignalActivateEntryAtIndex: {
|
||||
onSglActivateEntryAtIndex: {
|
||||
if (parabolicManager.pseudoIndexBelongsToLatteApplet(entryIndex) && appletItem.isLattePlasmoid) {
|
||||
latteApplet.activateTaskAtIndex(entryIndex - latteApplet.tasksBaseIndex);
|
||||
} else if (root.unifiedGlobalShortcuts && refersEntryIndex(entryIndex)) {
|
||||
} else if (shortcuts.unifiedGlobalShortcuts && refersEntryIndex(entryIndex)) {
|
||||
latteView.extendedInterface.toggleAppletExpanded(applet.id);
|
||||
}
|
||||
}
|
||||
|
||||
onSignalNewInstanceForEntryAtIndex: {
|
||||
onSglNewInstanceForEntryAtIndex: {
|
||||
if (parabolicManager.pseudoIndexBelongsToLatteApplet(entryIndex) && appletItem.isLattePlasmoid) {
|
||||
latteApplet.newInstanceForTaskAtIndex(entryIndex - latteApplet.tasksBaseIndex);
|
||||
} else if (root.unifiedGlobalShortcuts && refersEntryIndex(entryIndex)) {
|
||||
} else if (shortcuts.unifiedGlobalShortcuts && refersEntryIndex(entryIndex)) {
|
||||
latteView.extendedInterface.toggleAppletExpanded(applet.id);
|
||||
}
|
||||
}
|
||||
|
@ -26,9 +26,9 @@ Loader{
|
||||
id: appletNumberLoader
|
||||
|
||||
active: appletItem.canShowAppletNumberBadge &&
|
||||
(root.showLatteShortcutBadges
|
||||
|| root.showAppletShortcutBadges
|
||||
|| root.showMetaBadge && applet.id===applicationLauncherId)
|
||||
(appletItem.shortcuts.showPositionShortcutBadges
|
||||
|| appletItem.shortcuts.showAppletShortcutBadges
|
||||
|| appletItem.shortcuts.showMetaBadge && applet.id===appletItem.shortcuts.applicationLauncherId)
|
||||
|
||||
asynchronous: true
|
||||
visible: badgeString!==""
|
||||
@ -37,7 +37,7 @@ Loader{
|
||||
property string badgeString: ""
|
||||
|
||||
onActiveChanged: {
|
||||
if (active && root.showLatteShortcutBadges && root.unifiedGlobalShortcuts) {
|
||||
if (active && appletItem.shortcuts.showPositionShortcutBadges && appletItem.shortcuts.unifiedGlobalShortcuts) {
|
||||
fixedIndex = appletItem.indexer.visibleIndex(index);
|
||||
} else {
|
||||
fixedIndex = -1;
|
||||
@ -45,7 +45,7 @@ Loader{
|
||||
}
|
||||
|
||||
Component.onCompleted: {
|
||||
if (active && root.showLatteShortcutBadges && root.unifiedGlobalShortcuts) {
|
||||
if (active && appletItem.shortcuts.showPositionShortcutBadges && appletItem.shortcuts.unifiedGlobalShortcuts) {
|
||||
fixedIndex = appletItem.indexer.visibleIndex(index);
|
||||
} else {
|
||||
fixedIndex = -1;
|
||||
@ -55,13 +55,13 @@ Loader{
|
||||
Binding{
|
||||
target: appletNumberLoader
|
||||
property:"badgeString"
|
||||
when: root.showMetaBadge || root.showAppletShortcutBadges
|
||||
when: appletItem.shortcuts.showMetaBadge || appletItem.shortcuts.showAppletShortcutBadges
|
||||
value: {
|
||||
if (root.showMetaBadge && applet && applet.id === applicationLauncherId) {
|
||||
if (appletItem.shortcuts.showMetaBadge && applet && applet.id === appletItem.shortcuts.applicationLauncherId) {
|
||||
return '\u2318';
|
||||
}
|
||||
|
||||
if (root.showAppletShortcutBadges) {
|
||||
if (appletItem.shortcuts.showAppletShortcutBadges) {
|
||||
var plasmaShortcut = applet ? shortcutsEngine.appletShortcutBadge(applet.id) : "";
|
||||
|
||||
if (plasmaShortcut !== "") {
|
||||
|
@ -59,6 +59,7 @@ Item{
|
||||
|
||||
//! BEGIN OF ABILITIES SUPPORT
|
||||
readonly property bool indexerIsSupported: bridge && bridge.indexer.client
|
||||
readonly property bool onPositionShortcutsAreSupported: bridge && bridge.shortcuts.client
|
||||
readonly property bool parabolicEffectIsSupported: bridge && bridge.parabolic.client
|
||||
|
||||
readonly property Item bridge: bridgeLoader.active ? bridgeLoader.item : null
|
||||
|
@ -132,6 +132,11 @@ Item{
|
||||
appletIndex: index
|
||||
}
|
||||
|
||||
readonly property AbilityBridge.PositionShortcuts shortcuts: AbilityBridge.PositionShortcuts {
|
||||
host: appletItem.shortcuts
|
||||
appletIndex: index
|
||||
}
|
||||
|
||||
Connections {
|
||||
target: root
|
||||
onBroadcastedToApplet: {
|
||||
|
@ -1294,6 +1294,7 @@ Item {
|
||||
layouter: _layouter
|
||||
metrics: _metrics
|
||||
parabolic: _parabolic
|
||||
shortcuts: _shortcuts
|
||||
}
|
||||
}
|
||||
|
||||
@ -1542,6 +1543,11 @@ Item {
|
||||
view: latteView
|
||||
}
|
||||
|
||||
Ability.PositionShortcuts {
|
||||
id: _shortcuts
|
||||
layouts: layoutsContainer
|
||||
}
|
||||
|
||||
LatteApp.Interfaces {
|
||||
id: _interfaces
|
||||
plasmoidInterface: plasmoid
|
||||
|
28
declarativeimports/abilities/bridge/PositionShortcuts.qml
Normal file
28
declarativeimports/abilities/bridge/PositionShortcuts.qml
Normal file
@ -0,0 +1,28 @@
|
||||
/*
|
||||
* Copyright 2020 Michail Vourlakos <mvourlakos@gmail.com>
|
||||
*
|
||||
* This file is part of Latte-Dock
|
||||
*
|
||||
* Latte-Dock is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License as
|
||||
* published by the Free Software Foundation; either version 2 of
|
||||
* the License, or (at your option) any later version.
|
||||
*
|
||||
* Latte-Dock 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 General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import QtQuick 2.0
|
||||
|
||||
Item {
|
||||
id: shortcutsBridge
|
||||
property int appletIndex: -1
|
||||
|
||||
property Item host: null
|
||||
property Item client: null
|
||||
}
|
@ -2,3 +2,4 @@ module org.kde.latte.abilities.applets
|
||||
|
||||
Indexer 0.1 Indexer.qml
|
||||
ParabolicEffect 0.1 ParabolicEffect.qml
|
||||
PositionShortcuts 0.1 PositionShortcuts.qml
|
||||
|
Loading…
x
Reference in New Issue
Block a user