From 61e9e629c57228209f93804e528b19f976b5db04 Mon Sep 17 00:00:00 2001 From: Michail Vourlakos Date: Sat, 25 May 2019 18:05:24 +0300 Subject: [PATCH] rename some global shortcuts texts --protect also the Layout::lastConfigViewFor, dont sent a view that is no longer available --- app/layout/genericlayout.cpp | 7 ++++++- app/layout/genericlayout.h | 2 +- app/layout/sharedlayout.cpp | 2 +- app/layout/sharedlayout.h | 2 +- app/shortcuts/globalshortcuts.cpp | 4 ++-- 5 files changed, 11 insertions(+), 6 deletions(-) diff --git a/app/layout/genericlayout.cpp b/app/layout/genericlayout.cpp index 0fa47f323..97fc2c28e 100644 --- a/app/layout/genericlayout.cpp +++ b/app/layout/genericlayout.cpp @@ -318,8 +318,13 @@ Latte::View *GenericLayout::highestPriorityView() return (views.count() > 0 ? views[0] : nullptr); } -Latte::View *GenericLayout::lastConfigViewFor() const +Latte::View *GenericLayout::lastConfigViewFor() { + if (!latteViews().contains(m_lastConfigViewFor)) { + m_lastConfigViewFor = nullptr; + return nullptr; + } + return m_lastConfigViewFor; } diff --git a/app/layout/genericlayout.h b/app/layout/genericlayout.h index 46b3c42ac..cb88300ad 100644 --- a/app/layout/genericlayout.h +++ b/app/layout/genericlayout.h @@ -106,7 +106,7 @@ public: void unlock(); //! make it writable which it should be the default virtual void setLastConfigViewFor(Latte::View *view); - virtual Latte::View *lastConfigViewFor() const; + virtual Latte::View *lastConfigViewFor(); //! this function needs the layout to have first set the corona through initToCorona() function virtual void addView(Plasma::Containment *containment, bool forceOnPrimary = false, int explicitScreen = -1, Layout::ViewsMap *occupied = nullptr); diff --git a/app/layout/sharedlayout.cpp b/app/layout/sharedlayout.cpp index b87eb32f3..2b6d9e565 100644 --- a/app/layout/sharedlayout.cpp +++ b/app/layout/sharedlayout.cpp @@ -249,7 +249,7 @@ void SharedLayout::setLastConfigViewFor(Latte::View *view) return GenericLayout::setLastConfigViewFor(view); } -Latte::View *SharedLayout::lastConfigViewFor() const +Latte::View *SharedLayout::lastConfigViewFor() { CentralLayout *current = currentCentralLayout(); diff --git a/app/layout/sharedlayout.h b/app/layout/sharedlayout.h index 01d55b4b5..ce04712e7 100644 --- a/app/layout/sharedlayout.h +++ b/app/layout/sharedlayout.h @@ -61,7 +61,7 @@ public: Layout::Type type() const override; void setLastConfigViewFor(Latte::View *view) override; - Latte::View *lastConfigViewFor() const override; + Latte::View *lastConfigViewFor() override; //! Available edges for specific view in that screen QList availableEdgesForView(QScreen *scr, Latte::View *forView) const override; diff --git a/app/shortcuts/globalshortcuts.cpp b/app/shortcuts/globalshortcuts.cpp index ae113fca3..510d4ce2f 100644 --- a/app/shortcuts/globalshortcuts.cpp +++ b/app/shortcuts/globalshortcuts.cpp @@ -96,7 +96,7 @@ void GlobalShortcuts::init() //show-hide the main view in the primary screen QAction *showAction = generalActions->addAction(QStringLiteral("show latte view")); - showAction->setText(i18n("Show Latte View")); + showAction->setText(i18n("Show Latte Dock/Panel")); showAction->setShortcut(QKeySequence(Qt::META + '`')); KGlobalAccel::setGlobalShortcut(showAction, QKeySequence(Qt::META + '`')); connect(showAction, &QAction::triggered, this, [this]() { @@ -105,7 +105,7 @@ void GlobalShortcuts::init() //show-cycle between Latte settings windows QAction *settingsAction = generalActions->addAction(QStringLiteral("show view settings")); - settingsAction->setText(i18n("Show Latte Dock/Panel Settings")); + settingsAction->setText(i18n("Cycle Through Dock/Panel Settings Windows")); KGlobalAccel::setGlobalShortcut(settingsAction, QKeySequence(Qt::META + Qt::Key_A)); connect(settingsAction, &QAction::triggered, this, [this] { m_modifierTracker->cancelMetaPressed();