Skip to content

Commit

Permalink
Fix #2085 new tray menu.
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
Camila committed Jul 2, 2020
1 parent 6081ef6 commit 00f1e12
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 9 deletions.
5 changes: 4 additions & 1 deletion src/gui/owncloudgui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down Expand Up @@ -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) {
Expand Down
9 changes: 9 additions & 0 deletions src/gui/systray.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
#include <QQmlContext>
#include <QQuickWindow>
#include <QScreen>
#include <QMenu>

#ifdef USE_FDO_NOTIFICATIONS
#include <QDBusConnection>
Expand Down Expand Up @@ -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);

Expand Down
1 change: 1 addition & 0 deletions src/gui/systray.h
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ class Systray

signals:
void currentUserChanged();
void openMainDialog();
void openSettings();
void openHelp();
void shutdown();
Expand Down
10 changes: 2 additions & 8 deletions src/gui/tray/Window.qml
Original file line number Diff line number Diff line change
Expand Up @@ -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()
}
Expand Down

0 comments on commit 00f1e12

Please sign in to comment.