fix #330, visibility mode and options

Visibility doesn't load when switch to session
pull/1/head
Johan Smith Agudelo Rodriguez 8 years ago
parent 9a2b2e5d18
commit 8420245102

@ -170,6 +170,7 @@ inline void VisibilityManagerPrivate::setMode(Dock::Visibility mode)
break;
}
view->containment()->config().writeEntry("visibility", static_cast<int>(mode));
emit q->modeChanged();
}
@ -428,7 +429,7 @@ inline void VisibilityManagerPrivate::saveConfig()
return;
auto config = view->containment()->config();
config.writeEntry("visibility", static_cast<int>(mode));
config.writeEntry("timerShow", timerShow.interval());
config.writeEntry("timerHide", timerHide.interval());
config.writeEntry("raiseOnDesktopChange", raiseOnDesktopChange);
@ -444,18 +445,22 @@ inline void VisibilityManagerPrivate::restoreConfig()
auto config = view->containment()->config();
timerShow.setInterval(config.readEntry("timerShow", 200));
timerHide.setInterval(config.readEntry("timerHide", 700));
auto mode = static_cast<Dock::Visibility>(config.readEntry("visibility", static_cast<int>(Dock::DodgeActive)));
emit q->timerShowChanged();
emit q->timerHideChanged();
setRaiseOnDesktop(config.readEntry("raiseOnDesktopChange", false));
setRaiseOnActivity(config.readEntry("raiseOnActivityChange", false));
if (mode == Dock::AlwaysVisible) {
setMode(mode);
auto mode = [&]() {
return static_cast<Dock::Visibility>(view->containment()->config()
.readEntry("visibility", static_cast<int>(Dock::DodgeActive)));
};
if (mode() == Dock::AlwaysVisible) {
setMode(Dock::AlwaysVisible);
} else {
QTimer::singleShot(5000, this, [ &, mode]() {
setMode(mode);
QTimer::singleShot(5000, this, [&, mode]() {
setMode(mode());
});
}
@ -527,6 +532,9 @@ VisibilityManager::~VisibilityManager()
Dock::Visibility VisibilityManager::mode() const
{
if (d->mode == Dock::None)
return static_cast<Dock::Visibility>(d->view->containment()->config().readEntry("visibility", -1));
return d->mode;
}

@ -138,6 +138,7 @@ PlasmaComponents.Page {
Layout.leftMargin: units.smallSpacing * 2
text: i18n("Raise dock on desktop change")
checked: dock.visibility.raiseOnDesktop
enabled: dock.visibility.mode !== Latte.Dock.AlwaysVisible
onClicked: {
dock.visibility.raiseOnDesktop = checked
@ -148,6 +149,7 @@ PlasmaComponents.Page {
Layout.leftMargin: units.smallSpacing * 2
text: i18n("Raise dock on activity change")
checked: dock.visibility.raiseOnActivity
enabled: dock.visibility.mode !== Latte.Dock.AlwaysVisible
onClicked: {
dock.visibility.raiseOnActivity = checked

Loading…
Cancel
Save