Quit/settings button in tray menu, disable context menu, font size fixes

Signed-off-by: Dominique Fuchs <32204802+DominiqueFuchs@users.noreply.github.com>
This commit is contained in:
Dominique Fuchs 2020-01-04 17:22:56 +01:00
parent d653618b0a
commit aa9921c6f5
4 changed files with 39 additions and 30 deletions

View file

@ -85,6 +85,12 @@ ownCloudGui::ownCloudGui(Application *parent)
connect(_tray.data(), &QSystemTrayIcon::activated,
this, &ownCloudGui::slotTrayClicked);
connect(_tray.data(), &Systray::openSettings,
this, &ownCloudGui::slotShowSettings);
connect(_tray.data(), &Systray::shutdown,
this, &ownCloudGui::slotShutdown);
ProgressDispatcher *pd = ProgressDispatcher::instance();
connect(pd, &ProgressDispatcher::progressInfo, this,
&ownCloudGui::slotUpdateProgress);
@ -171,17 +177,7 @@ void ownCloudGui::slotTrayClicked(QSystemTrayIcon::ActivationReason reason)
raiseDialog(shareDialog);
}
} else {
#ifdef Q_OS_MAC
// on macOS, a left click always opens menu.
// However if the settings dialog is already visible but hidden
// by other applications, this will bring it to the front.
if (!_settingsDialog.isNull() && _settingsDialog->isVisible()) {
raiseDialog(_settingsDialog.data());
}
#else
_tray->showWindow();
//slotOpenSettingsDialog();
#endif
}
}
// FIXME: Also make sure that any auto updater dialogue https://github.com/owncloud/client/issues/5613
@ -522,10 +518,6 @@ void ownCloudGui::setupContextMenu()
_recentActionsMenu = new QMenu(tr("Recent Changes"), _contextMenu.data());
// this must be called only once after creating the context menu, or
// it will trigger a bug in Ubuntu's SNI bridge patch (11.10, 12.04).
_tray->setContextMenu(_contextMenu.data());
// The tray menu is surprisingly problematic. Being able to switch to
// a minimal version of it is a useful workaround and testing tool.
if (minimalTrayMenu()) {
@ -1099,6 +1091,7 @@ void ownCloudGui::slotShutdown()
_settingsDialog->close();
if (!_logBrowser.isNull())
_logBrowser->deleteLater();
_app->quit();
}
void ownCloudGui::slotToggleLogBrowser()

View file

@ -53,6 +53,8 @@ public:
signals:
void currentUserChanged();
void openSettings();
void shutdown();
Q_INVOKABLE void hideWindow();
Q_INVOKABLE void showWindow();

View file

@ -68,14 +68,14 @@ MenuItem {
id: accountUser
text: name
color: "black"
font.pointSize: 9
font.pixelSize: 12
font.bold: true
}
Label {
id: accountServer
text: server
color: "black"
font.pointSize: 8
font.pixelSize: 10
}
}

View file

@ -113,33 +113,47 @@ Window {
Instantiator {
model: userModelBackend
delegate: UserLine {}
onObjectAdded: accountMenu.insertItem(index, object)
onObjectAdded: accountMenu.insertItem(3, object)
onObjectRemoved: accountMenu.removeItem(object)
}
MenuItem {
id: accMenuLoginButton
onClicked: (userModelBackend.isCurrentUserConnected()
? userModelBackend.logout()
: userModelBackend.login() )
}
MenuItem {
text: "Remove account"
onClicked: userModelBackend.removeAccount()
}
MenuSeparator { id: accountMenuSeparator }
MenuItem {
text: "Add account"
onClicked: userModelBackend.addAccount()
}
MenuSeparator { id: otherMenuSeparator }
MenuItem {
id: accMenuLoginButton
onClicked: (userModelBackend.isCurrentUserConnected()
? userModelBackend.logout()
: userModelBackend.login() )
}
MenuItem {
text: "Remove account"
onClicked: userModelBackend.removeAccount()
text: "Open settings"
onClicked: systrayBackend.openSettings()
}
Component.onCompleted: {
if(userModelBackend.numUsers() === 0) {
MenuItem {
text: "Quit Nextcloud"
onClicked: systrayBackend.shutdown()
}
Component.onCompleted: {/*
if(userModelBackend.numUsers() === 1) {
accountMenuSeparator.height = 0
} else {
accountMenuSeparator.height = 13
}
}*/
}
}
}
@ -214,14 +228,14 @@ Window {
id: currentAccountUser
text: userModelBackend.currentUserName()
color: "white"
font.pointSize: 9
font.pixelSize: 12
font.bold: true
}
Label {
id: currentAccountServer
text: userModelBackend.currentUserServer()
color: "white"
font.pointSize: 8
font.pixelSize: 10
}
}