diff options
author | Ken Moore <ken@ixsystems.com> | 2017-05-22 12:01:07 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-05-22 12:01:07 -0400 |
commit | 18cfd9259e3d5356d3a0524a9a44a503f1f4edf1 (patch) | |
tree | 4f1d9795e730cc4d1bc3cb71d1d2065684169a4a /src-qt5/core | |
parent | Translated using Weblate (lumina_DESKTOP@da (generated)) (diff) | |
parent | Summary: (diff) | |
download | lumina-18cfd9259e3d5356d3a0524a9a44a503f1f4edf1.tar.gz lumina-18cfd9259e3d5356d3a0524a9a44a503f1f4edf1.tar.bz2 lumina-18cfd9259e3d5356d3a0524a9a44a503f1f4edf1.zip |
Merge pull request #421 from fjs-github/workspace-switcher-fix-01
Summary: Fix the workspace switcher panel plugin when using a keyboard shortcut to change the workspace.
Diffstat (limited to 'src-qt5/core')
4 files changed, 19 insertions, 5 deletions
diff --git a/src-qt5/core/lumina-desktop-unified/src-DE/panel-plugins/desktopswitcher/LDesktopSwitcher.cpp b/src-qt5/core/lumina-desktop-unified/src-DE/panel-plugins/desktopswitcher/LDesktopSwitcher.cpp index c51e4b4a..8e0a9d28 100644 --- a/src-qt5/core/lumina-desktop-unified/src-DE/panel-plugins/desktopswitcher/LDesktopSwitcher.cpp +++ b/src-qt5/core/lumina-desktop-unified/src-DE/panel-plugins/desktopswitcher/LDesktopSwitcher.cpp @@ -15,7 +15,7 @@ LDesktopSwitcher::LDesktopSwitcher(QWidget *parent, QString id, bool horizontal) label->setPopupMode(QToolButton::DelayedPopup); label->setAutoRaise(true); label->setToolButtonStyle(Qt::ToolButtonIconOnly); - label->setIcon( LXDG::findIcon("preferences-desktop-display-color", "") ); + label->setIcon( LXDG::findIcon("format-view-carousel", "preferences-desktop-display") ); label->setToolTip(QString("Workspace 1")); connect(label, SIGNAL(clicked()), this, SLOT(openMenu())); menu = new QMenu(this); @@ -29,6 +29,9 @@ LDesktopSwitcher::LDesktopSwitcher(QWidget *parent, QString id, bool horizontal) QTimer::singleShot(500, this, SLOT(createMenu()) ); //needs a delay to make sure it works right the first time QTimer::singleShot(0,this, SLOT(OrientationChange()) ); //adjust icon size + + //Process the signal which is sent when the workspace is changed via keyboard-shortcuts + connect(QApplication::instance(), SIGNAL(WorkspaceChanged()), this, SLOT(updateWorkspaceMenu())); } LDesktopSwitcher::~LDesktopSwitcher(){ @@ -133,10 +136,13 @@ void LDesktopSwitcher::createMenu() { if(i == cur){ name.prepend("*"); name.append("*");} //identify which desktop this is currently menu->addAction(newAction(i, name)); } + label->setToolTip(QString(tr("Workspace %1")).arg(QString::number(cur + 1))); } void LDesktopSwitcher::menuActionTriggered(QAction* act) { LSession::handle()->XCB->SetCurrentWorkspace(act->whatsThis().toInt()); - label->setToolTip(QString(tr("Workspace %1")).arg(act->whatsThis().toInt() +1)); - QTimer::singleShot(500, this, SLOT(createMenu()) ); //make sure the menu gets updated +} + +void LDesktopSwitcher::updateWorkspaceMenu() { + createMenu(); } diff --git a/src-qt5/core/lumina-desktop-unified/src-DE/panel-plugins/desktopswitcher/LDesktopSwitcher.h b/src-qt5/core/lumina-desktop-unified/src-DE/panel-plugins/desktopswitcher/LDesktopSwitcher.h index af9250b7..69fe46da 100644 --- a/src-qt5/core/lumina-desktop-unified/src-DE/panel-plugins/desktopswitcher/LDesktopSwitcher.h +++ b/src-qt5/core/lumina-desktop-unified/src-DE/panel-plugins/desktopswitcher/LDesktopSwitcher.h @@ -49,6 +49,7 @@ private slots: void openMenu(); void createMenu(); void menuActionTriggered(QAction*); + void updateWorkspaceMenu(); public slots: void LocaleChange(){ diff --git a/src-qt5/core/lumina-desktop/panel-plugins/desktopswitcher/LDesktopSwitcher.cpp b/src-qt5/core/lumina-desktop/panel-plugins/desktopswitcher/LDesktopSwitcher.cpp index a0c42774..8e0a9d28 100644 --- a/src-qt5/core/lumina-desktop/panel-plugins/desktopswitcher/LDesktopSwitcher.cpp +++ b/src-qt5/core/lumina-desktop/panel-plugins/desktopswitcher/LDesktopSwitcher.cpp @@ -29,6 +29,9 @@ LDesktopSwitcher::LDesktopSwitcher(QWidget *parent, QString id, bool horizontal) QTimer::singleShot(500, this, SLOT(createMenu()) ); //needs a delay to make sure it works right the first time QTimer::singleShot(0,this, SLOT(OrientationChange()) ); //adjust icon size + + //Process the signal which is sent when the workspace is changed via keyboard-shortcuts + connect(QApplication::instance(), SIGNAL(WorkspaceChanged()), this, SLOT(updateWorkspaceMenu())); } LDesktopSwitcher::~LDesktopSwitcher(){ @@ -133,10 +136,13 @@ void LDesktopSwitcher::createMenu() { if(i == cur){ name.prepend("*"); name.append("*");} //identify which desktop this is currently menu->addAction(newAction(i, name)); } + label->setToolTip(QString(tr("Workspace %1")).arg(QString::number(cur + 1))); } void LDesktopSwitcher::menuActionTriggered(QAction* act) { LSession::handle()->XCB->SetCurrentWorkspace(act->whatsThis().toInt()); - label->setToolTip(QString(tr("Workspace %1")).arg(act->whatsThis().toInt() +1)); - QTimer::singleShot(500, this, SLOT(createMenu()) ); //make sure the menu gets updated +} + +void LDesktopSwitcher::updateWorkspaceMenu() { + createMenu(); } diff --git a/src-qt5/core/lumina-desktop/panel-plugins/desktopswitcher/LDesktopSwitcher.h b/src-qt5/core/lumina-desktop/panel-plugins/desktopswitcher/LDesktopSwitcher.h index af9250b7..69fe46da 100644 --- a/src-qt5/core/lumina-desktop/panel-plugins/desktopswitcher/LDesktopSwitcher.h +++ b/src-qt5/core/lumina-desktop/panel-plugins/desktopswitcher/LDesktopSwitcher.h @@ -49,6 +49,7 @@ private slots: void openMenu(); void createMenu(); void menuActionTriggered(QAction*); + void updateWorkspaceMenu(); public slots: void LocaleChange(){ |