From 96c104615817cd97ad5aaa5cfc855cad34fb5634 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Gr=C3=A4=C3=9Flin?= Date: Thu, 29 Mar 2012 10:34:33 +0200 Subject: [PATCH] Synchronize Show Desktop Wording in TabBox Effects Use "Show Desktop" for the desktop entry with the same message as in "normal" TabBox. FEATURE: 273478 FIXED-IN: 4.9.0 REVIEW: 104436 --- effects/coverswitch/coverswitch.cpp | 17 +++++++++++++++-- effects/coverswitch/coverswitch.h | 5 +++++ effects/flipswitch/flipswitch.cpp | 21 +++++++++++++++++---- effects/flipswitch/flipswitch.h | 5 +++++ 4 files changed, 42 insertions(+), 6 deletions(-) diff --git a/effects/coverswitch/coverswitch.cpp b/effects/coverswitch/coverswitch.cpp index fe517d0312..b931934c50 100644 --- a/effects/coverswitch/coverswitch.cpp +++ b/effects/coverswitch/coverswitch.cpp @@ -577,7 +577,7 @@ void CoverSwitchEffect::slotTabBoxAdded(int mode) captionFrame->setGeometry(frameRect); captionFrame->setIconSize(QSize(frameRect.height(), frameRect.height())); // And initial contents - captionFrame->setText(selected_window->caption()); + updateCaption(); captionFrame->setIcon(selected_window->icon()); } @@ -657,7 +657,7 @@ void CoverSwitchEffect::slotTabBoxUpdated() } selected_window = effects->currentTabBoxWindow(); currentWindowList = effects->currentTabBoxWindowList(); - captionFrame->setText(selected_window->caption()); + updateCaption(); captionFrame->setIcon(selected_window->icon()); } } @@ -1000,4 +1000,17 @@ bool CoverSwitchEffect::isActive() const return mActivated || stop || stopRequested; } +void CoverSwitchEffect::updateCaption() +{ + if (!selected_window || !windowTitle) { + return; + } + if (selected_window->isDesktop()) { + captionFrame->setText(i18nc("Special entry in alt+tab list for minimizing all windows", + "Show Desktop")); + } else { + captionFrame->setText(selected_window->caption()); + } +} + } // namespace diff --git a/effects/coverswitch/coverswitch.h b/effects/coverswitch/coverswitch.h index b7a9da3672..b33a202ddb 100644 --- a/effects/coverswitch/coverswitch.h +++ b/effects/coverswitch/coverswitch.h @@ -65,6 +65,11 @@ private: void paintFrontWindow(EffectWindow* frontWindow, int width, int leftWindows, int rightWindows, bool reflectedWindow); void paintWindows(const EffectWindowList& windows, bool left, bool reflectedWindows, EffectWindow* additionalWindow = NULL); void abort(); + /** + * Updates the caption of the caption frame. + * Taking care of rewording the desktop client. + **/ + void updateCaption(); bool mActivated; float angle; diff --git a/effects/flipswitch/flipswitch.cpp b/effects/flipswitch/flipswitch.cpp index a32c47ceac..eda9e98c6f 100644 --- a/effects/flipswitch/flipswitch.cpp +++ b/effects/flipswitch/flipswitch.cpp @@ -564,7 +564,7 @@ void FlipSwitchEffect::slotTabBoxUpdated() } } m_selectedWindow = effects->currentTabBoxWindow(); - m_captionFrame->setText(m_selectedWindow->caption()); + updateCaption(); m_captionFrame->setIcon(m_selectedWindow->icon()); } } @@ -662,7 +662,7 @@ void FlipSwitchEffect::setActive(bool activate, FlipSwitchMode mode) QFontMetrics(m_captionFont).height()); m_captionFrame->setGeometry(frameRect); m_captionFrame->setIconSize(QSize(frameRect.height(), frameRect.height())); - m_captionFrame->setText(m_selectedWindow->caption()); + updateCaption(); m_captionFrame->setIcon(m_selectedWindow->icon()); effects->addRepaintFull(); } else { @@ -886,7 +886,7 @@ void FlipSwitchEffect::grabbedKeyboardEvent(QKeyEvent* e) } } if (found) { - m_captionFrame->setText(m_selectedWindow->caption()); + updateCaption(); m_captionFrame->setIcon(m_selectedWindow->icon()); scheduleAnimation(DirectionForward); } @@ -914,7 +914,7 @@ void FlipSwitchEffect::grabbedKeyboardEvent(QKeyEvent* e) } } if (found) { - m_captionFrame->setText(m_selectedWindow->caption()); + updateCaption(); m_captionFrame->setIcon(m_selectedWindow->icon()); scheduleAnimation(DirectionBackward); } @@ -939,6 +939,19 @@ bool FlipSwitchEffect::isActive() const return m_active; } +void FlipSwitchEffect::updateCaption() +{ + if (!m_selectedWindow) { + return; + } + if (m_selectedWindow->isDesktop()) { + m_captionFrame->setText(i18nc("Special entry in alt+tab list for minimizing all windows", + "Show Desktop")); + } else { + m_captionFrame->setText(m_selectedWindow->caption()); + } +} + //************************************************************* // Item Info //************************************************************* diff --git a/effects/flipswitch/flipswitch.h b/effects/flipswitch/flipswitch.h index f3fca73e3b..1087cf2a65 100644 --- a/effects/flipswitch/flipswitch.h +++ b/effects/flipswitch/flipswitch.h @@ -76,6 +76,11 @@ private: bool isSelectableWindow(EffectWindow *w) const; void scheduleAnimation(const SwitchingDirection& direction, int distance = 1); void adjustWindowMultiScreen(const EffectWindow *w, WindowPaintData& data); + /** + * Updates the caption of the caption frame. + * Taking care of rewording the desktop client. + **/ + void updateCaption(); QQueue< SwitchingDirection> m_scheduledDirections; EffectWindow* m_selectedWindow; QTimeLine m_timeLine;