sync launchers correctly between docks,def session

pull/1/head
Michail Vourlakos
parent d75dfa1a64
commit cf7b820e2e

@ -124,6 +124,37 @@ QAction *GlobalSettings::addWidgetsAction() const
return m_addWidgetsAction;
}
bool GlobalSettings::syncLaunchers() const
{
return m_syncLaunchers;
}
void GlobalSettings::setSyncLaunchers(bool sync)
{
if (m_syncLaunchers == sync)
return;
m_syncLaunchers = sync;
save();
emit syncLaunchersChanged();
}
QStringList GlobalSettings::globalLaunchers() const
{
return m_globalLaunchers;
}
void GlobalSettings::setGlobalLaunchers(QStringList launchers)
{
if (m_globalLaunchers == launchers)
return;
m_globalLaunchers = launchers;
save();
emit globalLaunchersChanged();
}
bool GlobalSettings::autostart() const
{
QFile autostartFile(QDir::homePath() + "/.config/autostart/latte-dock.desktop");
@ -168,7 +199,19 @@ void GlobalSettings::setCurrentSession(Dock::SessionType session)
//!BEGIN configuration functions
void GlobalSettings::load()
{
setExposeAltSession(m_configGroup.readEntry("exposeAltSession", false));
m_exposeAltSession = m_configGroup.readEntry("exposeAltSession", false);
if (m_corona->currentSession() == Latte::Dock::AlternativeSession) {
m_syncLaunchers = m_configGroup.readEntry("syncLaunchers_alternative", false);
m_globalLaunchers = m_configGroup.readEntry("globalLaunchers_alternative", QStringList());
} else {
m_syncLaunchers = m_configGroup.readEntry("syncLaunchers_default", false);
m_globalLaunchers = m_configGroup.readEntry("globalLaunchers_default", QStringList());
}
emit exposeAltSessionChanged();
emit syncLaunchersChanged();
emit globalLaunchersChanged();
loadExtConfiguration();
}
@ -176,6 +219,15 @@ void GlobalSettings::load()
void GlobalSettings::save()
{
m_configGroup.writeEntry("exposeAltSession", m_exposeAltSession);
if (m_corona->currentSession() == Latte::Dock::AlternativeSession) {
m_configGroup.writeEntry("syncLaunchers_alternative", m_syncLaunchers);
m_configGroup.writeEntry("globalLaunchers_alternative", m_globalLaunchers);
} else {
m_configGroup.writeEntry("syncLaunchers_default", m_syncLaunchers);
m_configGroup.writeEntry("globalLaunchers_default", m_globalLaunchers);
}
m_configGroup.sync();
}

@ -39,6 +39,9 @@ class GlobalSettings : public QObject {
Q_PROPERTY(bool autostart READ autostart WRITE setAutostart NOTIFY autostartChanged)
Q_PROPERTY(bool exposeAltSession READ exposeAltSession WRITE setExposeAltSession NOTIFY exposeAltSessionChanged)
Q_PROPERTY(bool syncLaunchers READ syncLaunchers WRITE setSyncLaunchers NOTIFY syncLaunchersChanged)
Q_PROPERTY(QStringList globalLaunchers READ globalLaunchers WRITE setGlobalLaunchers NOTIFY globalLaunchersChanged)
Q_PROPERTY(Latte::Dock::SessionType currentSession READ currentSession WRITE setCurrentSession NOTIFY currentSessionChanged)
Q_PROPERTY(QAction *altSessionAction READ altSessionAction NOTIFY altSessionActionChanged)
@ -57,6 +60,12 @@ public:
void setExposeAltSession(bool state);
QAction *altSessionAction() const;
bool syncLaunchers() const;
void setSyncLaunchers(bool sync);
QStringList globalLaunchers() const;
void setGlobalLaunchers(QStringList launchers);
QAction *addWidgetsAction() const;
Latte::Dock::SessionType currentSession() const;
@ -71,10 +80,12 @@ public:
signals:
void addWidgetsActionChanged();
void altSessionActionChanged();
void autostartChanged();
void clearLayoutSelection();
void currentSessionChanged();
void autostartChanged();
void exposeAltSessionChanged();
void globalLaunchersChanged();
void syncLaunchersChanged();
private slots:
void currentSessionChangedSlot(Dock::SessionType type);
@ -90,6 +101,8 @@ private:
void saveExtConfiguration();
bool m_exposeAltSession{false};
bool m_syncLaunchers{false};
QAction *m_addWidgetsAction{nullptr};
QAction *m_altSessionAction{nullptr};
DockCorona *m_corona{nullptr};
@ -97,6 +110,7 @@ private:
QVariantList m_defaultLayouts;
QVariantList m_userLayouts;
QStringList m_userLayoutsFiles;
QStringList m_globalLaunchers;
KConfigGroup m_configGroup;
KConfigGroup m_externalGroup;

@ -126,7 +126,7 @@ Item {
//! it is used to play the animation correct when the user removes a launcher
property string launcherForRemoval: ""
//BEGIN Now Dock Panel properties
//BEGIN Latte Dock properties
property bool enableShadows: latteDock ? latteDock.enableShadows > 0 : plasmoid.configuration.showShadows
property bool forceHidePanel: false
property bool disableLeftSpacer: false
@ -185,6 +185,7 @@ Item {
property alias hoveredIndex: icList.hoveredIndex
property QtObject altSessionAction : latteDock ? latteDock.altSessionAction : null
property QtObject globalSettings : latteDock && latteDock.globalSettings ? latteDock.globalSettings : null
property Item latteDock: null
//END Now Dock Panel properties
@ -252,6 +253,35 @@ Item {
}
}
Connections{
target: latteDock && latteDock.globalSettings ? latteDock.globalSettings : null
onSyncLaunchersChanged: {
if (latteDock.globalSettings.syncLaunchers) {
tasksModel.launcherList = latteDock.globalSettings.globalLaunchers;
} else {
tasksModel.launcherList = plasmoid.configuration.launchers59;
}
}
onGlobalLaunchersChanged: {
if (latteDock.globalSettings.syncLaunchers) {
tasksModel.launcherList = latteDock.globalSettings.globalLaunchers;
}
}
}
//is used to load correctly the launcherslist on startup
onGlobalSettingsChanged: {
if (globalSettings === latteDock.globalSettings ) {
if (latteDock.globalSettings.syncLaunchers) {
tasksModel.launcherList = latteDock.globalSettings.globalLaunchers;
} else {
tasksModel.launcherList = plasmoid.configuration.launchers59;
}
}
}
/////
PlasmaCore.ColorScope{
id: colorScopePalette
@ -518,7 +548,12 @@ Item {
}
onLauncherListChanged: {
plasmoid.configuration.launchers59 = launcherList;
if (latteDock && latteDock.globalSettings && latteDock.globalSettings.syncLaunchers) {
latteDock.globalSettings.globalLaunchers = launcherList;
} else {
plasmoid.configuration.launchers59 = launcherList;
}
checkSeparator();
}
@ -545,7 +580,12 @@ Item {
//var loadedLaunchers = ActivitiesTools.restoreLaunchers();
ActivitiesTools.importLaunchersToNewArchitecture();
launcherList = plasmoid.configuration.launchers59;
if (latteDock && latteDock.globalSettings && latteDock.globalSettings.syncLaunchers) {
launcherList = latteDock.globalSettings.globalLaunchers;
} else {
launcherList = plasmoid.configuration.launchers59;
}
groupingAppIdBlacklist = plasmoid.configuration.groupingAppIdBlacklist;
groupingLauncherUrlBlacklist = plasmoid.configuration.groupingLauncherUrlBlacklist;

@ -1049,7 +1049,7 @@ MouseArea{
var pa = pulseAudio.item;
if (!pa) {
task.audioStreams = [];
audioStreams = [];
return;
}

@ -130,14 +130,13 @@ PlasmaComponents.Page {
}
PlasmaComponents.CheckBox {
id: windowActionsChk
id: syncLaunchersChk
Layout.leftMargin: units.smallSpacing * 2
text: i18n("Show window actions in the context menu")
checked: plasmoid.configuration.showWindowActions
visible: plasmoid.configuration.advanced
text: i18n("Sync launchers between all docks")
checked: globalSettings.syncLaunchers
onClicked: {
plasmoid.configuration.showWindowActions = checked
globalSettings.syncLaunchers = checked;
}
}
@ -153,6 +152,18 @@ PlasmaComponents.Page {
}
}
PlasmaComponents.CheckBox {
id: windowActionsChk
Layout.leftMargin: units.smallSpacing * 2
text: i18n("Show window actions in the context menu")
checked: plasmoid.configuration.showWindowActions
visible: plasmoid.configuration.advanced
onClicked: {
plasmoid.configuration.showWindowActions = checked
}
}
PlasmaComponents.CheckBox {
id: audioIndicatorChk
Layout.leftMargin: units.smallSpacing * 2

Loading…
Cancel
Save