diff --git a/app/universalsettings.cpp b/app/universalsettings.cpp index b74367fae..398abec15 100644 --- a/app/universalsettings.cpp +++ b/app/universalsettings.cpp @@ -45,6 +45,7 @@ UniversalSettings::UniversalSettings(KSharedConfig::Ptr config, QObject *parent) connect(this, &UniversalSettings::mouseSensitivityChanged, this, &UniversalSettings::saveConfig); connect(this, &UniversalSettings::screenTrackerIntervalChanged, this, &UniversalSettings::saveConfig); connect(this, &UniversalSettings::showInfoWindowChanged, this, &UniversalSettings::saveConfig); + connect(this, &UniversalSettings::unifiedGlobalShortcutsChanged, this, &UniversalSettings::saveConfig); connect(this, &UniversalSettings::versionChanged, this, &UniversalSettings::saveConfig); } @@ -86,6 +87,21 @@ void UniversalSettings::setShowInfoWindow(bool show) emit showInfoWindowChanged(); } +bool UniversalSettings::unifiedGlobalShortcuts() const +{ + return m_unifiedGlobalShortcuts; +} + +void UniversalSettings::setUnifiedGlobalShortcuts(bool unified) +{ + if (m_unifiedGlobalShortcuts == unified) { + return; + } + + m_unifiedGlobalShortcuts = unified; + emit unifiedGlobalShortcutsChanged(); +} + int UniversalSettings::version() const { return m_version; @@ -304,6 +320,7 @@ void UniversalSettings::loadConfig() m_launchers = m_universalGroup.readEntry("launchers", QStringList()); m_screenTrackerInterval = m_universalGroup.readEntry("screenTrackerInterval", 2500); m_showInfoWindow = m_universalGroup.readEntry("showInfoWindow", true); + m_unifiedGlobalShortcuts = m_universalGroup.readEntry("unifiedGlobalShortcuts", true); m_memoryUsage = static_cast(m_universalGroup.readEntry("memoryUsage", (int)Dock::SingleLayout)); m_mouseSensitivity = static_cast(m_universalGroup.readEntry("mouseSensitivity", (int)Dock::HighSensitivity)); } @@ -320,6 +337,7 @@ void UniversalSettings::saveConfig() m_universalGroup.writeEntry("launchers", m_launchers); m_universalGroup.writeEntry("screenTrackerInterval", m_screenTrackerInterval); m_universalGroup.writeEntry("showInfoWindow", m_showInfoWindow); + m_universalGroup.writeEntry("unifiedGlobalShortcuts", m_unifiedGlobalShortcuts); m_universalGroup.writeEntry("memoryUsage", (int)m_memoryUsage); m_universalGroup.writeEntry("mouseSensitivity", (int)m_mouseSensitivity); diff --git a/app/universalsettings.h b/app/universalsettings.h index 016eb0280..5110eb3bb 100644 --- a/app/universalsettings.h +++ b/app/universalsettings.h @@ -42,6 +42,10 @@ class UniversalSettings : public QObject Q_OBJECT Q_PROPERTY(bool autostart READ autostart WRITE setAutostart NOTIFY autostartChanged) Q_PROPERTY(bool showInfoWindow READ showInfoWindow WRITE setShowInfoWindow NOTIFY showInfoWindowChanged) + //! some v0.7 users wanted the previous global shortcuts behavior that applets werent taken + //! into account. By default unification will take place but the user will be able to change + //! this from latte global settings + Q_PROPERTY(bool unifiedGlobalShortcuts READ unifiedGlobalShortcuts NOTIFY unifiedGlobalShortcutsChanged) Q_PROPERTY(QString currentLayoutName READ currentLayoutName WRITE setCurrentLayoutName NOTIFY currentLayoutNameChanged) @@ -65,6 +69,8 @@ public: bool showInfoWindow() const; void setShowInfoWindow(bool show); + bool unifiedGlobalShortcuts() const; + int version() const; void setVersion(int ver); @@ -117,6 +123,7 @@ signals: void runningActivitiesModelChanged(); void screenTrackerIntervalChanged(); void showInfoWindowChanged(); + void unifiedGlobalShortcutsChanged(); void versionChanged(); private slots: @@ -126,12 +133,15 @@ private slots: private: void cleanupSettings(); + void setUnifiedGlobalShortcuts(bool unified); + Dock::LayoutsMemoryUsage layoutsMemoryUsage() const; void setLayoutsMemoryUsage(Dock::LayoutsMemoryUsage layoutsMemoryUsage); private: bool m_canDisableBorders{false}; bool m_showInfoWindow{true}; + bool m_unifiedGlobalShortcuts{true}; //when there isnt a version it is an old universal file int m_version{1}; diff --git a/containment/package/contents/ui/applet/AppletItem.qml b/containment/package/contents/ui/applet/AppletItem.qml index c16011ef1..0489b48c2 100644 --- a/containment/package/contents/ui/applet/AppletItem.qml +++ b/containment/package/contents/ui/applet/AppletItem.qml @@ -438,7 +438,7 @@ Item { onSignalActivateEntryAtIndex: { if (parabolicManager.pseudoIndexBelongsToLatteApplet(entryIndex) && container.isLattePlasmoid) { latteApplet.activateTaskAtIndex(entryIndex - latteApplet.tasksNumbersBase); - } else if (entryIndex === parabolicManager.pseudoAppletIndex(container.index)) { + } else if (universalSettings.unifiedGlobalShortcuts && (entryIndex === parabolicManager.pseudoAppletIndex(container.index))) { dock.toggleAppletExpanded(applet.id); } } @@ -446,7 +446,7 @@ Item { onSignalNewInstanceForEntryAtIndex: { if (parabolicManager.pseudoIndexBelongsToLatteApplet(entryIndex) && container.isLattePlasmoid) { latteApplet.newInstanceForTaskAtIndex(entryIndex - latteApplet.tasksNumbersBase); - } else if (entryIndex === parabolicManager.pseudoAppletIndex(container.index)) { + } else if (universalSettings.unifiedGlobalShortcuts && (entryIndex === parabolicManager.pseudoAppletIndex(container.index))) { dock.toggleAppletExpanded(applet.id); } } diff --git a/containment/package/contents/ui/applet/AppletItemWrapper.qml b/containment/package/contents/ui/applet/AppletItemWrapper.qml index 4526222d8..285c4a905 100644 --- a/containment/package/contents/ui/applet/AppletItemWrapper.qml +++ b/containment/package/contents/ui/applet/AppletItemWrapper.qml @@ -607,7 +607,8 @@ Item{ Component.onCompleted: fixedIndex = parabolicManager.pseudoAppletIndex(index); - property real opacityN: root.showAppletsNumbers && container.canShowAppletNumberBadge && fixedIndex<20 ? 1 : 0 + property real opacityN: universalSettings && universalSettings.unifiedGlobalShortcuts && root.showAppletsNumbers + && container.canShowAppletNumberBadge && fixedIndex<20 ? 1 : 0 Behavior on opacityN { NumberAnimation { duration: root.durationTime*2*units.longDuration } diff --git a/containment/package/contents/ui/main.qml b/containment/package/contents/ui/main.qml index 79f34ac19..0f79f47e2 100644 --- a/containment/package/contents/ui/main.qml +++ b/containment/package/contents/ui/main.qml @@ -1090,7 +1090,7 @@ DragDrop.DropArea { //! this is called from globalshortcuts c++ side function setShowAppletsNumbers(showNumbers){ if (latteApplet) { - var base = parabolicManager.pseudoAppletIndex(latteAppletPos); + var base = universalSettings.unifiedGlobalShortcuts ? parabolicManager.pseudoAppletIndex(latteAppletPos) : 1; latteApplet.setTasksNumbersBase(base - 1); latteApplet.setShowTasksNumbers(showNumbers); } @@ -1105,7 +1105,7 @@ DragDrop.DropArea { } if (latteApplet) { - var base = parabolicManager.pseudoAppletIndex(latteAppletPos); + var base = universalSettings.unifiedGlobalShortcuts ? parabolicManager.pseudoAppletIndex(latteAppletPos) : 1; latteApplet.setTasksNumbersBase(base - 1); } @@ -1119,7 +1119,7 @@ DragDrop.DropArea { } if (latteApplet) { - var base = parabolicManager.pseudoAppletIndex(latteAppletPos); + var base = universalSettings.unifiedGlobalShortcuts ? parabolicManager.pseudoAppletIndex(latteAppletPos) : 1; latteApplet.setTasksNumbersBase(base - 1); }