mirror of
https://github.com/KDE/latte-dock.git
synced 2025-01-27 06:03:51 +03:00
update based on position shortcuts implementation
--the new fix provides totally valid position shortcut badges based on what the user has chosen as global shortcut to trigger an item in latte dock based on its position in it
This commit is contained in:
parent
cdaefbc775
commit
8ae3b4ecfb
@ -125,33 +125,22 @@ void ShortcutsTracker::parseGlobalShortcuts()
|
||||
{
|
||||
KConfigGroup latteGroup = KConfigGroup(m_shortcutsConfigPtr, "lattedock");
|
||||
|
||||
//! make sure that latte dock records in global shortcuts where found correctly
|
||||
bool recordExists{true};
|
||||
|
||||
if (!latteGroup.exists()) {
|
||||
recordExists = false;
|
||||
}
|
||||
|
||||
if (recordExists) {
|
||||
for (int i = 1; i <= 19; ++i) {
|
||||
QString entry = "activate entry " + QString::number(i);
|
||||
|
||||
if (!latteGroup.hasKey(entry)) {
|
||||
recordExists = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (recordExists) {
|
||||
if (latteGroup.exists()) {
|
||||
m_badgesForActivate.clear();
|
||||
m_appletShortcuts.clear();
|
||||
|
||||
for (int i = 1; i <= 19; ++i) {
|
||||
QString entry = "activate entry " + QString::number(i);
|
||||
QStringList records = latteGroup.readEntry(entry, QStringList());
|
||||
|
||||
m_badgesForActivate << shortcutToBadge(records);
|
||||
if (latteGroup.hasKey(entry)) {
|
||||
QStringList records = latteGroup.readEntry(entry, QStringList());
|
||||
if (records.count() > 0) {
|
||||
records[0] = records[0].split("\t")[0];
|
||||
}
|
||||
m_badgesForActivate << shortcutToBadge(records);
|
||||
} else {
|
||||
m_badgesForActivate << "";
|
||||
}
|
||||
}
|
||||
|
||||
m_basedOnPositionEnabled = (!m_badgesForActivate[0].isEmpty() && !m_badgesForActivate[1].isEmpty());
|
||||
@ -165,8 +154,8 @@ void ShortcutsTracker::parseGlobalShortcuts()
|
||||
}
|
||||
}
|
||||
|
||||
qDebug() << "badges updated to :: " << m_badgesForActivate;
|
||||
qDebug() << "applet shortcuts updated to :: " << m_appletShortcuts;
|
||||
qDebug() << "badges based on position updated to :: " << m_badgesForActivate;
|
||||
qDebug() << "badges for applet shortcuts updated to :: " << m_appletShortcuts;
|
||||
|
||||
emit badgesForActivateChanged();
|
||||
}
|
||||
|
@ -26,10 +26,13 @@ AbilityDefinition.PositionShortcuts {
|
||||
property Item bridge: null
|
||||
property Item indexer: null
|
||||
|
||||
badges: ref.shortcuts.badges
|
||||
showPositionShortcutBadges: ref.shortcuts.showPositionShortcutBadges
|
||||
|
||||
property bool isStealingGlobalPositionShortcuts: false
|
||||
|
||||
readonly property bool isActive: bridge !== null
|
||||
readonly property bool showPositionShortcutBadges: bridge && bridge.shortcuts.host ? bridge.shortcuts.host.showPositionShortcutBadges : false
|
||||
|
||||
readonly property bool isEnabled: {
|
||||
if (bridge) {
|
||||
return bridge.shortcuts.host.unifiedGlobalShortcuts
|
||||
@ -39,8 +42,17 @@ AbilityDefinition.PositionShortcuts {
|
||||
return true;
|
||||
}
|
||||
|
||||
onBadgesChanged: console.log("org/kde/latte :: " + badges);
|
||||
|
||||
signal disabledIsStealingGlobalPositionShortcuts();
|
||||
|
||||
readonly property AbilityDefinition.PositionShortcuts local: AbilityDefinition.PositionShortcuts {}
|
||||
|
||||
Item {
|
||||
id: ref
|
||||
readonly property Item shortcuts: bridge ? bridge.shortcuts.host : local
|
||||
}
|
||||
|
||||
onIsActiveChanged: {
|
||||
if (isActive) {
|
||||
bridge.shortcuts.client = shortcuts;
|
||||
|
Loading…
x
Reference in New Issue
Block a user