From 4ea4a903fd33fa542b678ab85221f80aa9d30396 Mon Sep 17 00:00:00 2001 From: Michail Vourlakos Date: Sat, 11 Mar 2017 01:45:31 +0200 Subject: [PATCH] fix #152,support an alternative session -- On The Road was renamed at Alternative Session and more improvements to the code were added --- app/dockcorona.cpp | 8 ++++---- liblattedock/dock.h | 2 +- shell/contents/configuration/TweaksConfig.qml | 6 +++--- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/app/dockcorona.cpp b/app/dockcorona.cpp index a5bc21b7e..682075ce3 100644 --- a/app/dockcorona.cpp +++ b/app/dockcorona.cpp @@ -433,8 +433,8 @@ void DockCorona::syncDockViews() } bool onPrimary = cont->config().readEntry("onPrimary", true); - Plasma::Types::Location location = (Plasma::Types::Location)((int)cont->config().readEntry("location", (int)Plasma::Types::BottomEdge)); - Dock::SessionType session = (Dock::SessionType)((int)cont->config().readEntry("session", (int)Dock::DefaultSession)); + Plasma::Types::Location location = static_cast((int)cont->config().readEntry("location", (int)Plasma::Types::BottomEdge)); + Dock::SessionType session = static_cast((int)cont->config().readEntry("session", (int)Dock::DefaultSession)); //! two main situations that a dock must be added when it is not already running //! 1. when a dock is primary, not running and the edge for which is associated is free @@ -673,7 +673,7 @@ int DockCorona::noDocksForSession(Dock::SessionType session) int count{0}; foreach (auto cont, containments()) { - Dock::SessionType ses = (Dock::SessionType)((int)cont->config().readEntry("session", (int)Dock::DefaultSession)); + Dock::SessionType ses = static_cast(cont->config().readEntry("session", (int)Dock::DefaultSession)); if (session == ses) count++; @@ -1025,7 +1025,7 @@ bool DockCorona::heuresticForLoadingDockWithTasks() if (plugin == "org.kde.latte.containment") { bool onPrimary = containmentsEntries.group(cId).readEntry("onPrimary", true); int lastScreen = containmentsEntries.group(cId).readEntry("lastScreen", -1); - Dock::SessionType session = (Dock::SessionType)containmentsEntries.group(cId).readEntry("session", (int)Dock::DefaultSession); + Dock::SessionType session = static_cast(containmentsEntries.group(cId).readEntry("session", (int)Dock::DefaultSession)); qDebug() << "containment values: " << onPrimary << " - " << lastScreen; diff --git a/liblattedock/dock.h b/liblattedock/dock.h index 75900ccd1..9a48b680a 100644 --- a/liblattedock/dock.h +++ b/liblattedock/dock.h @@ -56,7 +56,7 @@ public: enum SessionType { DefaultSession = 0, - OnTheRoadSession + AlternativeSession }; Q_ENUM(SessionType) diff --git a/shell/contents/configuration/TweaksConfig.qml b/shell/contents/configuration/TweaksConfig.qml index c2eedb96f..9270a71e8 100644 --- a/shell/contents/configuration/TweaksConfig.qml +++ b/shell/contents/configuration/TweaksConfig.qml @@ -79,13 +79,13 @@ PlasmaComponents.Page { PlasmaComponents.Button { Layout.fillWidth: true - text: i18n("On The Road") - checked: dockConfig.currentSession === Latte.Dock.OnTheRoadSession + text: i18n("Alternative Session") + checked: dockConfig.currentSession === Latte.Dock.AlternativeSession checkable: true onClicked: { if (dockConfig.currentSession === Latte.Dock.DefaultSession){ - dockConfig.currentSession = Latte.Dock.OnTheRoadSession; + dockConfig.currentSession = Latte.Dock.AlternativeSession; } else { dockConfig.currentSession = Latte.Dock.DefaultSession; }