From: Camila Date: Mon, 29 Jun 2020 17:41:51 +0000 (+0200) Subject: Fix #2085 new tray menu. X-Git-Tag: archive/raspbian/3.16.7-1_deb13u1+rpi1~1^2~222^2^2~122 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=fdc160460b81be45ef1ad4361bc20f69187f6f99;p=nextcloud-desktop.git Fix #2085 new tray menu. Update systray behavior and context menu: - left click brings up the new QtQuick based dialogs on all latforms - right click brings up the new QtQuick based dialog on Mac OS only - right click brings up a context menu on all other platforms than Mac OS - "Quit Nextcloud" => "Exit Nextcloud" - Add "Open main dialog" option. Signed-off-by: Camila --- diff --git a/src/gui/owncloudgui.cpp b/src/gui/owncloudgui.cpp index 5dc280bdc..c6f3aa66e 100644 --- a/src/gui/owncloudgui.cpp +++ b/src/gui/owncloudgui.cpp @@ -85,6 +85,9 @@ ownCloudGui::ownCloudGui(Application *parent) connect(_tray.data(), &Systray::openHelp, this, &ownCloudGui::slotHelp); + connect(_tray.data(), &Systray::openMainDialog, + this, &ownCloudGui::slotOpenMainDialog); + connect(_tray.data(), &Systray::openSettings, this, &ownCloudGui::slotShowSettings); @@ -164,7 +167,7 @@ void ownCloudGui::slotOpenMainDialog() void ownCloudGui::slotTrayClicked(QSystemTrayIcon::ActivationReason reason) { - if (reason == QSystemTrayIcon::Trigger || reason == QSystemTrayIcon::Context) { + if (reason == QSystemTrayIcon::Trigger) { if (OwncloudSetupWizard::bringWizardToFrontIfVisible()) { // brought wizard to front } else if (_shareDialogs.size() > 0) { diff --git a/src/gui/systray.cpp b/src/gui/systray.cpp index 93c0eba09..15f9d668e 100644 --- a/src/gui/systray.cpp +++ b/src/gui/systray.cpp @@ -25,6 +25,7 @@ #include #include #include +#include #ifdef USE_FDO_NOTIFICATIONS #include @@ -79,6 +80,14 @@ Systray::Systray() } ); +#ifndef Q_OS_MAC + auto contextMenu = new QMenu(); + contextMenu->addAction(tr("Open main dialog"), this, &Systray::openMainDialog); + contextMenu->addAction(tr("Settings"), this, &Systray::openSettings); + contextMenu->addAction(tr("Exit %1").arg(Theme::instance()->appNameGUI()), this, &Systray::shutdown); + setContextMenu(contextMenu); +#endif + connect(UserModel::instance(), &UserModel::newUserSelected, this, &Systray::slotNewUserSelected); diff --git a/src/gui/systray.h b/src/gui/systray.h index 8f1612a2a..e4d27c065 100644 --- a/src/gui/systray.h +++ b/src/gui/systray.h @@ -64,6 +64,7 @@ public: signals: void currentUserChanged(); + void openMainDialog(); void openSettings(); void openHelp(); void shutdown(); diff --git a/src/gui/tray/Window.qml b/src/gui/tray/Window.qml index 92183f59f..d940b535e 100644 --- a/src/gui/tray/Window.qml +++ b/src/gui/tray/Window.qml @@ -211,19 +211,13 @@ Window { } MenuItem { - text: qsTr("Open settings") + text: qsTr("Settings") font.pixelSize: Style.topLinePixelSize onClicked: Systray.openSettings() } MenuItem { - text: qsTr("Help") - font.pixelSize: Style.topLinePixelSize - onClicked: Systray.openHelp() - } - - MenuItem { - text: qsTr("Quit Nextcloud") + text: qsTr("Exit"); font.pixelSize: Style.topLinePixelSize onClicked: Systray.shutdown() }