2021-06-21 21:50:49 +03:00
|
|
|
import QtQml 2.12
|
2020-01-12 18:16:24 +03:00
|
|
|
import QtQml.Models 2.1
|
2019-12-08 13:32:22 +03:00
|
|
|
import QtQuick 2.9
|
2020-01-21 15:54:04 +03:00
|
|
|
import QtQuick.Window 2.3
|
2020-09-14 18:25:20 +03:00
|
|
|
import QtQuick.Controls 2.3
|
2019-12-08 13:32:22 +03:00
|
|
|
import QtQuick.Layouts 1.2
|
|
|
|
import QtGraphicalEffects 1.0
|
|
|
|
|
2020-01-19 22:13:12 +03:00
|
|
|
// Custom qml modules are in /theme (and included by resources.qrc)
|
|
|
|
import Style 1.0
|
|
|
|
|
2020-06-15 18:01:39 +03:00
|
|
|
import com.nextcloud.desktopclient 1.0
|
|
|
|
|
2019-12-08 13:32:22 +03:00
|
|
|
Window {
|
2020-01-19 22:13:12 +03:00
|
|
|
id: trayWindow
|
2019-12-08 13:32:22 +03:00
|
|
|
|
2021-06-21 14:33:22 +03:00
|
|
|
title: Systray.windowTitle
|
|
|
|
// If the main dialog is displayed as a regular window we want it to be quadratic
|
|
|
|
width: Systray.useNormalWindow ? Style.trayWindowHeight : Style.trayWindowWidth
|
2020-01-19 22:13:12 +03:00
|
|
|
height: Style.trayWindowHeight
|
|
|
|
color: "transparent"
|
2021-07-22 11:34:13 +03:00
|
|
|
flags: Systray.useNormalWindow ? Qt.Window : Qt.Dialog | Qt.FramelessWindowHint
|
2021-06-21 14:33:22 +03:00
|
|
|
|
2019-12-08 13:32:22 +03:00
|
|
|
|
2020-07-06 21:12:58 +03:00
|
|
|
readonly property int maxMenuHeight: Style.trayWindowHeight - Style.trayWindowHeaderHeight - 2 * Style.trayWindowBorderWidth
|
|
|
|
|
2020-10-22 13:39:40 +03:00
|
|
|
Component.onCompleted: Systray.forceWindowInit(trayWindow)
|
|
|
|
|
2020-01-19 22:13:12 +03:00
|
|
|
// Close tray window when focus is lost (e.g. click somewhere else on the screen)
|
2019-12-30 13:39:21 +03:00
|
|
|
onActiveChanged: {
|
2021-06-21 14:33:22 +03:00
|
|
|
if (!Systray.useNormalWindow && !active) {
|
|
|
|
hide();
|
2021-07-20 13:56:00 +03:00
|
|
|
Systray.setClosed();
|
2019-12-30 13:39:21 +03:00
|
|
|
}
|
2021-06-21 14:33:22 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
onClosing: {
|
|
|
|
Systray.setClosed()
|
2019-12-30 13:39:21 +03:00
|
|
|
}
|
|
|
|
|
2020-01-03 15:09:29 +03:00
|
|
|
onVisibleChanged: {
|
2020-01-19 22:13:12 +03:00
|
|
|
// HACK: reload account Instantiator immediately by restting it - could be done better I guess
|
|
|
|
// see also id:accountMenu below
|
2020-01-11 17:05:37 +03:00
|
|
|
userLineInstantiator.active = false;
|
|
|
|
userLineInstantiator.active = true;
|
2020-01-03 15:09:29 +03:00
|
|
|
}
|
|
|
|
|
2019-12-08 13:32:22 +03:00
|
|
|
Connections {
|
2020-06-15 18:01:39 +03:00
|
|
|
target: UserModel
|
2019-12-08 13:32:22 +03:00
|
|
|
onNewUserSelected: {
|
2020-01-03 15:09:29 +03:00
|
|
|
accountMenu.close();
|
2019-12-08 13:32:22 +03:00
|
|
|
}
|
2019-12-30 13:52:07 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
Connections {
|
2020-06-15 18:01:39 +03:00
|
|
|
target: Systray
|
2019-12-30 13:39:21 +03:00
|
|
|
onShowWindow: {
|
2020-01-05 18:25:32 +03:00
|
|
|
accountMenu.close();
|
2020-06-15 20:01:04 +03:00
|
|
|
appsMenu.close();
|
2021-07-13 11:11:32 +03:00
|
|
|
Systray.positionWindow(trayWindow);
|
2020-05-20 20:36:57 +03:00
|
|
|
|
|
|
|
trayWindow.show();
|
|
|
|
trayWindow.raise();
|
|
|
|
trayWindow.requestActivate();
|
|
|
|
|
2020-06-15 18:01:39 +03:00
|
|
|
Systray.setOpened();
|
|
|
|
UserModel.fetchCurrentActivityModel();
|
2019-12-30 13:39:21 +03:00
|
|
|
}
|
|
|
|
onHideWindow: {
|
|
|
|
trayWindow.hide();
|
2020-06-15 18:01:39 +03:00
|
|
|
Systray.setClosed();
|
2019-12-30 13:39:21 +03:00
|
|
|
}
|
2019-12-08 13:32:22 +03:00
|
|
|
}
|
|
|
|
|
2020-07-27 18:27:23 +03:00
|
|
|
OpacityMask {
|
|
|
|
anchors.fill: parent
|
|
|
|
source: ShaderEffectSource {
|
|
|
|
sourceItem: trayWindowBackground
|
|
|
|
hideSource: true
|
|
|
|
}
|
|
|
|
maskSource: Rectangle {
|
|
|
|
width: trayWindowBackground.width
|
|
|
|
height: trayWindowBackground.height
|
2021-06-21 14:33:22 +03:00
|
|
|
radius: Systray.useNormalWindow ? 0.0 : Style.trayWindowRadius
|
2020-07-27 18:27:23 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-12-08 13:32:22 +03:00
|
|
|
Rectangle {
|
|
|
|
id: trayWindowBackground
|
2020-01-19 22:13:12 +03:00
|
|
|
|
|
|
|
anchors.fill: parent
|
2021-06-21 14:33:22 +03:00
|
|
|
radius: Systray.useNormalWindow ? 0.0 : Style.trayWindowRadius
|
2020-01-19 22:13:12 +03:00
|
|
|
border.width: Style.trayWindowBorderWidth
|
2020-06-15 20:06:59 +03:00
|
|
|
border.color: Style.menuBorder
|
2019-12-08 13:32:22 +03:00
|
|
|
|
2020-08-25 14:16:42 +03:00
|
|
|
Accessible.role: Accessible.Grouping
|
2020-08-25 17:52:05 +03:00
|
|
|
Accessible.name: qsTr("Nextcloud desktop main dialog")
|
2020-08-25 14:16:42 +03:00
|
|
|
|
2019-12-08 13:32:22 +03:00
|
|
|
Rectangle {
|
|
|
|
id: trayWindowHeaderBackground
|
|
|
|
|
2020-01-19 22:13:12 +03:00
|
|
|
anchors.left: trayWindowBackground.left
|
2020-11-18 18:42:37 +03:00
|
|
|
anchors.right: trayWindowBackground.right
|
2020-01-19 22:13:12 +03:00
|
|
|
anchors.top: trayWindowBackground.top
|
|
|
|
height: Style.trayWindowHeaderHeight
|
|
|
|
color: Style.ncBlue
|
|
|
|
|
2019-12-08 13:32:22 +03:00
|
|
|
RowLayout {
|
|
|
|
id: trayWindowHeaderLayout
|
2020-01-19 22:13:12 +03:00
|
|
|
|
|
|
|
spacing: 0
|
|
|
|
anchors.fill: parent
|
2019-12-08 13:32:22 +03:00
|
|
|
|
|
|
|
Button {
|
|
|
|
id: currentAccountButton
|
2020-01-19 22:13:12 +03:00
|
|
|
|
|
|
|
Layout.preferredWidth: Style.currentAccountButtonWidth
|
|
|
|
Layout.preferredHeight: Style.trayWindowHeaderHeight
|
|
|
|
display: AbstractButton.IconOnly
|
|
|
|
flat: true
|
2019-12-08 13:32:22 +03:00
|
|
|
|
2020-08-25 13:54:56 +03:00
|
|
|
Accessible.role: Accessible.ButtonMenu
|
2020-08-25 15:59:10 +03:00
|
|
|
Accessible.name: qsTr("Current account")
|
2020-09-15 17:45:22 +03:00
|
|
|
Accessible.onPressAction: currentAccountButton.clicked()
|
2020-08-25 13:54:56 +03:00
|
|
|
|
2019-12-08 13:32:22 +03:00
|
|
|
MouseArea {
|
|
|
|
id: accountBtnMouseArea
|
2020-01-19 22:13:12 +03:00
|
|
|
|
|
|
|
anchors.fill: parent
|
|
|
|
hoverEnabled: Style.hoverEffectsEnabled
|
|
|
|
|
|
|
|
// We call open() instead of popup() because we want to position it
|
|
|
|
// exactly below the dropdown button, not the mouse
|
2020-06-15 18:01:39 +03:00
|
|
|
onClicked: {
|
|
|
|
syncPauseButton.text = Systray.syncIsPaused() ? qsTr("Resume sync for all") : qsTr("Pause sync for all")
|
2020-09-14 19:03:57 +03:00
|
|
|
if (accountMenu.visible) {
|
|
|
|
accountMenu.close()
|
|
|
|
} else {
|
|
|
|
accountMenu.open()
|
|
|
|
}
|
2019-12-08 13:32:22 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
Menu {
|
|
|
|
id: accountMenu
|
2020-01-19 22:13:12 +03:00
|
|
|
|
|
|
|
// x coordinate grows towards the right
|
|
|
|
// y coordinate grows towards the bottom
|
2019-12-08 13:32:22 +03:00
|
|
|
x: (currentAccountButton.x + 2)
|
2020-01-19 22:13:12 +03:00
|
|
|
y: (currentAccountButton.y + Style.trayWindowHeaderHeight + 2)
|
|
|
|
|
|
|
|
width: (Style.currentAccountButtonWidth - 2)
|
2020-07-06 21:12:58 +03:00
|
|
|
height: Math.min(implicitHeight, maxMenuHeight)
|
2020-09-14 19:03:57 +03:00
|
|
|
closePolicy: Menu.CloseOnPressOutsideParent | Menu.CloseOnEscape
|
2019-12-08 13:32:22 +03:00
|
|
|
|
|
|
|
background: Rectangle {
|
2020-06-15 20:06:59 +03:00
|
|
|
border.color: Style.menuBorder
|
2020-01-19 22:13:12 +03:00
|
|
|
radius: Style.currentAccountButtonRadius
|
2019-12-08 13:32:22 +03:00
|
|
|
}
|
|
|
|
|
2020-01-12 13:06:48 +03:00
|
|
|
onClosed: {
|
2020-01-19 22:13:12 +03:00
|
|
|
// HACK: reload account Instantiator immediately by restting it - could be done better I guess
|
|
|
|
// see also onVisibleChanged above
|
2020-01-12 13:06:48 +03:00
|
|
|
userLineInstantiator.active = false;
|
|
|
|
userLineInstantiator.active = true;
|
|
|
|
}
|
|
|
|
|
2019-12-08 13:32:22 +03:00
|
|
|
Instantiator {
|
2020-01-10 18:28:53 +03:00
|
|
|
id: userLineInstantiator
|
2020-06-15 18:01:39 +03:00
|
|
|
model: UserModel
|
2019-12-08 13:32:22 +03:00
|
|
|
delegate: UserLine {}
|
2020-01-05 23:06:42 +03:00
|
|
|
onObjectAdded: accountMenu.insertItem(index, object)
|
2019-12-08 13:32:22 +03:00
|
|
|
onObjectRemoved: accountMenu.removeItem(object)
|
|
|
|
}
|
|
|
|
|
2020-01-04 19:22:56 +03:00
|
|
|
MenuItem {
|
2020-01-11 22:28:00 +03:00
|
|
|
id: addAccountButton
|
2020-01-19 22:13:12 +03:00
|
|
|
height: Style.addAccountButtonHeight
|
2020-07-06 14:55:14 +03:00
|
|
|
hoverEnabled: true
|
|
|
|
|
|
|
|
background: Item {
|
|
|
|
height: parent.height
|
|
|
|
width: parent.menu.width
|
|
|
|
Rectangle {
|
|
|
|
anchors.fill: parent
|
|
|
|
anchors.margins: 1
|
|
|
|
color: parent.parent.hovered ? Style.lightHover : "transparent"
|
|
|
|
}
|
|
|
|
}
|
2020-01-11 22:28:00 +03:00
|
|
|
|
|
|
|
RowLayout {
|
2020-01-19 22:13:12 +03:00
|
|
|
anchors.fill: parent
|
2020-01-11 22:28:00 +03:00
|
|
|
spacing: 0
|
|
|
|
|
|
|
|
Image {
|
2020-01-19 22:13:12 +03:00
|
|
|
Layout.leftMargin: 12
|
2020-01-11 22:28:00 +03:00
|
|
|
verticalAlignment: Qt.AlignCenter
|
|
|
|
source: "qrc:///client/theme/black/add.svg"
|
2020-01-19 22:13:12 +03:00
|
|
|
sourceSize.width: Style.headerButtonIconSize
|
|
|
|
sourceSize.height: Style.headerButtonIconSize
|
2020-01-11 22:28:00 +03:00
|
|
|
}
|
|
|
|
Label {
|
2020-01-15 10:01:54 +03:00
|
|
|
Layout.leftMargin: 14
|
2020-01-14 09:59:28 +03:00
|
|
|
text: qsTr("Add account")
|
2020-01-11 22:28:00 +03:00
|
|
|
color: "black"
|
2020-01-19 22:13:12 +03:00
|
|
|
font.pixelSize: Style.topLinePixelSize
|
2020-01-11 22:28:00 +03:00
|
|
|
}
|
2020-01-19 22:13:12 +03:00
|
|
|
// Filler on the right
|
2020-01-11 22:28:00 +03:00
|
|
|
Item {
|
|
|
|
Layout.fillWidth: true
|
|
|
|
Layout.fillHeight: true
|
|
|
|
}
|
|
|
|
}
|
2020-06-15 18:01:39 +03:00
|
|
|
onClicked: UserModel.addAccount()
|
2020-08-25 14:16:42 +03:00
|
|
|
|
|
|
|
Accessible.role: Accessible.MenuItem
|
|
|
|
Accessible.name: qsTr("Add new account")
|
2020-09-15 17:45:22 +03:00
|
|
|
Accessible.onPressAction: addAccountButton.clicked()
|
2020-01-04 19:22:56 +03:00
|
|
|
}
|
|
|
|
|
2020-06-22 01:49:06 +03:00
|
|
|
MenuSeparator {
|
|
|
|
contentItem: Rectangle {
|
|
|
|
implicitHeight: 1
|
|
|
|
color: Style.menuBorder
|
|
|
|
}
|
|
|
|
}
|
2020-01-04 19:22:56 +03:00
|
|
|
|
2020-01-05 18:25:32 +03:00
|
|
|
MenuItem {
|
2020-01-05 23:06:42 +03:00
|
|
|
id: syncPauseButton
|
2020-01-19 22:13:12 +03:00
|
|
|
font.pixelSize: Style.topLinePixelSize
|
2020-07-06 14:55:14 +03:00
|
|
|
hoverEnabled: true
|
2020-06-15 18:01:39 +03:00
|
|
|
onClicked: Systray.pauseResumeSync()
|
2020-07-06 14:55:14 +03:00
|
|
|
|
|
|
|
background: Item {
|
|
|
|
height: parent.height
|
|
|
|
width: parent.menu.width
|
|
|
|
Rectangle {
|
|
|
|
anchors.fill: parent
|
|
|
|
anchors.margins: 1
|
|
|
|
color: parent.parent.hovered ? Style.lightHover : "transparent"
|
|
|
|
}
|
|
|
|
}
|
2020-08-25 13:54:56 +03:00
|
|
|
|
|
|
|
Accessible.role: Accessible.MenuItem
|
|
|
|
Accessible.name: Systray.syncIsPaused() ? qsTr("Resume sync for all") : qsTr("Pause sync for all")
|
2020-09-15 17:45:22 +03:00
|
|
|
Accessible.onPressAction: syncPauseButton.clicked()
|
2020-01-05 18:25:32 +03:00
|
|
|
}
|
|
|
|
|
2020-01-04 19:22:56 +03:00
|
|
|
MenuItem {
|
2020-09-15 17:45:22 +03:00
|
|
|
id: settingsButton
|
2020-06-29 20:41:51 +03:00
|
|
|
text: qsTr("Settings")
|
2020-01-19 22:13:12 +03:00
|
|
|
font.pixelSize: Style.topLinePixelSize
|
2020-07-06 14:55:14 +03:00
|
|
|
hoverEnabled: true
|
2020-06-15 18:01:39 +03:00
|
|
|
onClicked: Systray.openSettings()
|
2020-07-06 14:55:14 +03:00
|
|
|
|
|
|
|
background: Item {
|
|
|
|
height: parent.height
|
|
|
|
width: parent.menu.width
|
|
|
|
Rectangle {
|
|
|
|
anchors.fill: parent
|
|
|
|
anchors.margins: 1
|
|
|
|
color: parent.parent.hovered ? Style.lightHover : "transparent"
|
|
|
|
}
|
|
|
|
}
|
2020-08-25 13:54:56 +03:00
|
|
|
|
|
|
|
Accessible.role: Accessible.MenuItem
|
|
|
|
Accessible.name: text
|
2020-09-15 17:45:22 +03:00
|
|
|
Accessible.onPressAction: settingsButton.clicked()
|
2020-01-04 19:22:56 +03:00
|
|
|
}
|
|
|
|
|
2020-01-05 23:06:42 +03:00
|
|
|
MenuItem {
|
2020-09-15 17:45:22 +03:00
|
|
|
id: exitButton
|
2020-06-29 20:41:51 +03:00
|
|
|
text: qsTr("Exit");
|
2020-01-19 22:13:12 +03:00
|
|
|
font.pixelSize: Style.topLinePixelSize
|
2020-07-06 14:55:14 +03:00
|
|
|
hoverEnabled: true
|
2020-06-15 18:01:39 +03:00
|
|
|
onClicked: Systray.shutdown()
|
2020-07-06 14:55:14 +03:00
|
|
|
|
|
|
|
background: Item {
|
|
|
|
height: parent.height
|
|
|
|
width: parent.menu.width
|
|
|
|
Rectangle {
|
|
|
|
anchors.fill: parent
|
|
|
|
anchors.margins: 1
|
|
|
|
color: parent.parent.hovered ? Style.lightHover : "transparent"
|
|
|
|
}
|
|
|
|
}
|
2020-08-25 13:54:56 +03:00
|
|
|
|
|
|
|
Accessible.role: Accessible.MenuItem
|
|
|
|
Accessible.name: text
|
2020-09-15 17:45:22 +03:00
|
|
|
Accessible.onPressAction: exitButton.clicked()
|
2020-01-04 19:22:56 +03:00
|
|
|
}
|
2019-12-08 13:32:22 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-07-27 18:27:23 +03:00
|
|
|
background: Rectangle {
|
|
|
|
color: accountBtnMouseArea.containsMouse ? "white" : "transparent"
|
|
|
|
opacity: 0.2
|
2019-12-08 13:32:22 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
RowLayout {
|
|
|
|
id: accountControlRowLayout
|
2020-01-19 22:13:12 +03:00
|
|
|
|
|
|
|
height: Style.trayWindowHeaderHeight
|
|
|
|
width: Style.currentAccountButtonWidth
|
2019-12-08 13:32:22 +03:00
|
|
|
spacing: 0
|
2020-08-25 13:54:56 +03:00
|
|
|
|
2019-12-08 13:32:22 +03:00
|
|
|
Image {
|
|
|
|
id: currentAccountAvatar
|
2020-01-19 22:13:12 +03:00
|
|
|
|
2019-12-08 13:32:22 +03:00
|
|
|
Layout.leftMargin: 8
|
|
|
|
verticalAlignment: Qt.AlignCenter
|
2020-01-03 15:09:29 +03:00
|
|
|
cache: false
|
2020-07-21 14:24:59 +03:00
|
|
|
source: UserModel.currentUser.avatar != "" ? UserModel.currentUser.avatar : "image://avatars/fallbackWhite"
|
2020-01-19 22:13:12 +03:00
|
|
|
Layout.preferredHeight: Style.accountAvatarSize
|
|
|
|
Layout.preferredWidth: Style.accountAvatarSize
|
|
|
|
|
2020-08-25 13:54:56 +03:00
|
|
|
Accessible.role: Accessible.Graphic
|
|
|
|
Accessible.name: qsTr("Current user avatar")
|
|
|
|
|
2020-01-15 22:11:50 +03:00
|
|
|
Rectangle {
|
2021-03-16 22:24:11 +03:00
|
|
|
id: currentAccountStatusIndicatorBackground
|
2021-05-17 22:34:22 +03:00
|
|
|
visible: UserModel.currentUser.isConnected
|
|
|
|
&& UserModel.currentUser.serverHasUserStatus
|
2020-01-19 22:13:12 +03:00
|
|
|
width: Style.accountAvatarStateIndicatorSize + 2
|
2020-01-15 22:11:50 +03:00
|
|
|
height: width
|
|
|
|
anchors.bottom: currentAccountAvatar.bottom
|
|
|
|
anchors.right: currentAccountAvatar.right
|
2020-01-19 22:13:12 +03:00
|
|
|
color: Style.ncBlue
|
2020-01-15 22:11:50 +03:00
|
|
|
radius: width*0.5
|
|
|
|
}
|
2020-01-19 22:13:12 +03:00
|
|
|
|
2020-10-21 12:24:06 +03:00
|
|
|
Rectangle {
|
2021-04-19 18:19:04 +03:00
|
|
|
id: currentAccountStatusIndicatorMouseHover
|
2021-05-17 22:34:22 +03:00
|
|
|
visible: UserModel.currentUser.isConnected
|
|
|
|
&& UserModel.currentUser.serverHasUserStatus
|
2020-10-21 12:24:06 +03:00
|
|
|
width: Style.accountAvatarStateIndicatorSize + 2
|
|
|
|
height: width
|
|
|
|
anchors.bottom: currentAccountAvatar.bottom
|
|
|
|
anchors.right: currentAccountAvatar.right
|
|
|
|
color: accountBtnMouseArea.containsMouse ? "white" : "transparent"
|
|
|
|
opacity: 0.2
|
|
|
|
radius: width*0.5
|
|
|
|
}
|
|
|
|
|
2020-01-12 11:10:06 +03:00
|
|
|
Image {
|
2021-03-16 22:24:11 +03:00
|
|
|
id: currentAccountStatusIndicator
|
2021-05-17 22:34:22 +03:00
|
|
|
visible: UserModel.currentUser.isConnected
|
2021-05-18 21:45:34 +03:00
|
|
|
&& UserModel.currentUser.serverHasUserStatus
|
2021-03-16 22:24:11 +03:00
|
|
|
source: UserModel.currentUser.statusIcon
|
2020-01-12 11:10:06 +03:00
|
|
|
cache: false
|
2021-03-16 22:24:11 +03:00
|
|
|
x: currentAccountStatusIndicatorBackground.x + 1
|
|
|
|
y: currentAccountStatusIndicatorBackground.y + 1
|
2020-01-19 22:13:12 +03:00
|
|
|
sourceSize.width: Style.accountAvatarStateIndicatorSize
|
|
|
|
sourceSize.height: Style.accountAvatarStateIndicatorSize
|
2020-08-25 13:54:56 +03:00
|
|
|
|
|
|
|
Accessible.role: Accessible.Indicator
|
2021-04-26 21:40:38 +03:00
|
|
|
Accessible.name: UserModel.desktopNotificationsAllowed ? qsTr("Current user status is online") : qsTr("Current user status is do not disturb")
|
2020-01-12 11:10:06 +03:00
|
|
|
}
|
2019-12-08 13:32:22 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
Column {
|
|
|
|
id: accountLabels
|
2021-05-25 23:17:33 +03:00
|
|
|
spacing: 0
|
|
|
|
Layout.alignment: Qt.AlignLeft | Qt.AlignVCenter
|
2021-05-18 23:28:59 +03:00
|
|
|
Layout.leftMargin: Style.userStatusSpacing
|
2021-07-15 14:06:04 +03:00
|
|
|
Layout.fillWidth: true
|
|
|
|
Layout.maximumWidth: parent.width
|
|
|
|
|
2019-12-08 13:32:22 +03:00
|
|
|
Label {
|
|
|
|
id: currentAccountUser
|
2021-05-25 23:17:33 +03:00
|
|
|
Layout.alignment: Qt.AlignLeft | Qt.AlignBottom
|
2020-01-19 22:13:12 +03:00
|
|
|
width: Style.currentAccountLabelWidth
|
2020-06-16 15:06:30 +03:00
|
|
|
text: UserModel.currentUser.name
|
2020-01-05 23:06:42 +03:00
|
|
|
elide: Text.ElideRight
|
2020-10-21 14:40:42 +03:00
|
|
|
color: Style.ncTextColor
|
2020-01-19 22:13:12 +03:00
|
|
|
font.pixelSize: Style.topLinePixelSize
|
2019-12-08 13:32:22 +03:00
|
|
|
font.bold: true
|
|
|
|
}
|
2021-07-15 14:06:04 +03:00
|
|
|
|
2021-05-25 23:17:33 +03:00
|
|
|
RowLayout {
|
2020-10-03 18:12:16 +03:00
|
|
|
id: currentUserStatus
|
2021-05-17 22:34:22 +03:00
|
|
|
visible: UserModel.currentUser.isConnected &&
|
2021-05-18 21:45:34 +03:00
|
|
|
UserModel.currentUser.serverHasUserStatus
|
2021-05-25 23:17:33 +03:00
|
|
|
spacing: Style.accountLabelsSpacing
|
2021-07-15 14:06:04 +03:00
|
|
|
width: parent.width
|
|
|
|
|
2021-05-18 21:45:34 +03:00
|
|
|
Label {
|
|
|
|
id: emoji
|
|
|
|
visible: UserModel.currentUser.statusEmoji !== ""
|
|
|
|
width: Style.userStatusEmojiSize
|
|
|
|
text: UserModel.currentUser.statusEmoji
|
|
|
|
}
|
|
|
|
Label {
|
|
|
|
id: message
|
2021-05-25 23:17:33 +03:00
|
|
|
Layout.alignment: Qt.AlignLeft | Qt.AlignBottom
|
2021-07-15 14:06:04 +03:00
|
|
|
Layout.fillWidth: true
|
2021-05-18 21:45:34 +03:00
|
|
|
visible: UserModel.currentUser.statusMessage !== ""
|
|
|
|
width: Style.currentAccountLabelWidth
|
|
|
|
text: UserModel.currentUser.statusMessage !== ""
|
|
|
|
? UserModel.currentUser.statusMessage
|
|
|
|
: UserModel.currentUser.server
|
|
|
|
elide: Text.ElideRight
|
|
|
|
color: Style.ncTextColor
|
|
|
|
font.pixelSize: Style.subLinePixelSize
|
|
|
|
}
|
2021-04-19 18:19:04 +03:00
|
|
|
}
|
2019-12-08 13:32:22 +03:00
|
|
|
}
|
|
|
|
|
2020-12-10 19:43:45 +03:00
|
|
|
ColorOverlay {
|
|
|
|
cached: true
|
|
|
|
color: Style.ncTextColor
|
|
|
|
width: source.width
|
|
|
|
height: source.height
|
|
|
|
source: Image {
|
|
|
|
Layout.alignment: Qt.AlignRight
|
|
|
|
verticalAlignment: Qt.AlignCenter
|
|
|
|
Layout.margins: Style.accountDropDownCaretMargin
|
|
|
|
source: "qrc:///client/theme/white/caret-down.svg"
|
|
|
|
sourceSize.width: Style.accountDropDownCaretSize
|
|
|
|
sourceSize.height: Style.accountDropDownCaretSize
|
2021-06-08 22:04:53 +03:00
|
|
|
Accessible.role: Accessible.PopupMenu
|
2021-05-25 16:07:21 +03:00
|
|
|
Accessible.name: qsTr("Account switcher and settings menu")
|
2020-12-10 19:43:45 +03:00
|
|
|
}
|
2019-12-08 13:32:22 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-06-21 14:33:22 +03:00
|
|
|
// Add space between items
|
|
|
|
Item {
|
|
|
|
Layout.fillWidth: true
|
|
|
|
}
|
|
|
|
|
2021-04-06 23:52:32 +03:00
|
|
|
RowLayout {
|
|
|
|
id: openLocalFolderRowLayout
|
|
|
|
spacing: 0
|
|
|
|
Layout.preferredWidth: Style.trayWindowHeaderHeight
|
|
|
|
Layout.preferredHeight: Style.trayWindowHeaderHeight
|
2021-05-25 22:12:41 +03:00
|
|
|
Layout.alignment: Qt.AlignHCenter | Qt.AlignVCenter
|
2021-04-06 23:52:32 +03:00
|
|
|
|
|
|
|
HeaderButton {
|
|
|
|
id: openLocalFolderButton
|
|
|
|
visible: UserModel.currentUser.hasLocalFolder
|
|
|
|
icon.source: "qrc:///client/theme/white/folder.svg"
|
|
|
|
onClicked: UserModel.openCurrentAccountLocalFolder()
|
2021-04-07 14:29:22 +03:00
|
|
|
|
|
|
|
Rectangle {
|
|
|
|
id: folderStateIndicatorBackground
|
|
|
|
width: Style.folderStateIndicatorSize
|
|
|
|
height: width
|
|
|
|
anchors.top: openLocalFolderButton.verticalCenter
|
|
|
|
anchors.left: openLocalFolderButton.horizontalCenter
|
|
|
|
color: Style.ncBlue
|
|
|
|
radius: width*0.5
|
|
|
|
z: 1
|
|
|
|
}
|
2021-04-06 23:52:32 +03:00
|
|
|
|
2021-05-25 22:12:41 +03:00
|
|
|
Image {
|
|
|
|
id: folderStateIndicator
|
|
|
|
visible: UserModel.currentUser.hasLocalFolder
|
|
|
|
source: UserModel.currentUser.isConnected
|
|
|
|
? Style.stateOnlineImageSource
|
|
|
|
: Style.stateOfflineImageSource
|
|
|
|
cache: false
|
|
|
|
|
|
|
|
anchors.top: openLocalFolderButton.verticalCenter
|
|
|
|
anchors.left: openLocalFolderButton.horizontalCenter
|
|
|
|
sourceSize.width: Style.folderStateIndicatorSize
|
|
|
|
sourceSize.height: Style.folderStateIndicatorSize
|
|
|
|
|
|
|
|
Accessible.role: Accessible.Indicator
|
|
|
|
Accessible.name: UserModel.currentUser.isConnected ? qsTr("Connected") : qsTr("Disconnected")
|
|
|
|
z: 2
|
|
|
|
}
|
2021-04-06 23:52:32 +03:00
|
|
|
}
|
2021-05-25 22:12:41 +03:00
|
|
|
|
|
|
|
|
2020-08-25 13:54:56 +03:00
|
|
|
|
|
|
|
Accessible.role: Accessible.Button
|
2020-08-25 17:52:05 +03:00
|
|
|
Accessible.name: qsTr("Open local folder of current account")
|
2021-03-16 22:24:11 +03:00
|
|
|
}
|
|
|
|
|
2020-06-15 16:35:34 +03:00
|
|
|
HeaderButton {
|
2019-12-08 13:32:22 +03:00
|
|
|
id: trayWindowTalkButton
|
2021-04-07 13:06:37 +03:00
|
|
|
|
2020-06-16 15:06:30 +03:00
|
|
|
visible: UserModel.currentUser.serverHasTalk
|
2019-12-08 13:32:22 +03:00
|
|
|
icon.source: "qrc:///client/theme/white/talk-app.svg"
|
2020-06-15 18:01:39 +03:00
|
|
|
onClicked: UserModel.openCurrentAccountTalk()
|
2021-04-06 23:52:32 +03:00
|
|
|
|
2020-08-25 13:54:56 +03:00
|
|
|
Accessible.role: Accessible.Button
|
2020-08-25 17:52:05 +03:00
|
|
|
Accessible.name: qsTr("Open Nextcloud Talk in browser")
|
2020-09-15 17:45:22 +03:00
|
|
|
Accessible.onPressAction: trayWindowTalkButton.clicked()
|
2019-12-08 13:32:22 +03:00
|
|
|
}
|
|
|
|
|
2020-06-15 16:35:34 +03:00
|
|
|
HeaderButton {
|
2019-12-08 13:32:22 +03:00
|
|
|
id: trayWindowAppsButton
|
|
|
|
icon.source: "qrc:///client/theme/white/more-apps.svg"
|
2021-04-07 13:06:37 +03:00
|
|
|
|
2020-06-15 16:35:34 +03:00
|
|
|
onClicked: {
|
2020-09-14 19:03:57 +03:00
|
|
|
if(appsMenu.count <= 0) {
|
2020-09-14 18:25:20 +03:00
|
|
|
UserModel.openCurrentAccountServer()
|
2020-09-14 19:03:57 +03:00
|
|
|
} else if (appsMenu.visible) {
|
|
|
|
appsMenu.close()
|
|
|
|
} else {
|
|
|
|
appsMenu.open()
|
2019-12-08 13:32:22 +03:00
|
|
|
}
|
2020-06-15 16:35:34 +03:00
|
|
|
}
|
2020-01-15 18:42:06 +03:00
|
|
|
|
2020-08-25 13:54:56 +03:00
|
|
|
Accessible.role: Accessible.ButtonMenu
|
2020-08-25 17:52:05 +03:00
|
|
|
Accessible.name: qsTr("More apps")
|
2020-09-15 17:45:22 +03:00
|
|
|
Accessible.onPressAction: trayWindowAppsButton.clicked()
|
2020-08-25 13:54:56 +03:00
|
|
|
|
2020-06-15 16:35:34 +03:00
|
|
|
Menu {
|
|
|
|
id: appsMenu
|
|
|
|
y: (trayWindowAppsButton.y + trayWindowAppsButton.height + 2)
|
2020-07-06 15:44:23 +03:00
|
|
|
readonly property Item listContentItem: contentItem.contentItem
|
|
|
|
width: Math.min(listContentItem.childrenRect.width + 4, Style.trayWindowWidth / 2)
|
2020-07-06 21:12:58 +03:00
|
|
|
height: Math.min(implicitHeight, maxMenuHeight)
|
2020-09-14 19:03:57 +03:00
|
|
|
closePolicy: Menu.CloseOnPressOutsideParent | Menu.CloseOnEscape
|
2020-01-15 18:42:06 +03:00
|
|
|
|
2020-06-15 16:35:34 +03:00
|
|
|
background: Rectangle {
|
2020-06-15 20:06:59 +03:00
|
|
|
border.color: Style.menuBorder
|
2020-06-15 16:35:34 +03:00
|
|
|
radius: 2
|
2020-01-15 18:42:06 +03:00
|
|
|
}
|
2019-12-08 13:32:22 +03:00
|
|
|
|
2020-06-15 16:35:34 +03:00
|
|
|
Instantiator {
|
|
|
|
id: appsMenuInstantiator
|
2020-06-15 18:01:39 +03:00
|
|
|
model: UserAppsModel
|
2020-06-15 16:35:34 +03:00
|
|
|
onObjectAdded: appsMenu.insertItem(index, object)
|
|
|
|
onObjectRemoved: appsMenu.removeItem(object)
|
|
|
|
delegate: MenuItem {
|
2020-06-17 20:39:12 +03:00
|
|
|
id: appEntry
|
2020-06-15 16:35:34 +03:00
|
|
|
text: appName
|
|
|
|
font.pixelSize: Style.topLinePixelSize
|
|
|
|
icon.source: appIconUrl
|
|
|
|
width: contentItem.implicitWidth + leftPadding + rightPadding
|
2020-06-15 18:01:39 +03:00
|
|
|
onTriggered: UserAppsModel.openAppUrl(appUrl)
|
2020-06-17 20:39:12 +03:00
|
|
|
hoverEnabled: true
|
|
|
|
|
|
|
|
background: Item {
|
|
|
|
width: appsMenu.width
|
|
|
|
height: parent.height
|
|
|
|
|
|
|
|
Rectangle {
|
|
|
|
anchors.fill: parent
|
|
|
|
anchors.margins: 1
|
|
|
|
color: appEntry.hovered ? Style.lightHover : "transparent"
|
|
|
|
}
|
2021-05-25 16:07:21 +03:00
|
|
|
|
|
|
|
Accessible.role: Accessible.PopupMenu
|
|
|
|
Accessible.name: qsTr("Apps menu")
|
2020-06-17 20:39:12 +03:00
|
|
|
}
|
2020-08-25 13:54:56 +03:00
|
|
|
|
|
|
|
Accessible.role: Accessible.MenuItem
|
2020-10-10 01:26:18 +03:00
|
|
|
Accessible.name: qsTr("Open %1 in browser").arg(appName)
|
2020-09-15 17:45:22 +03:00
|
|
|
Accessible.onPressAction: appEntry.triggered()
|
2019-12-08 13:32:22 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} // Rectangle trayWindowHeaderBackground
|
|
|
|
|
|
|
|
ListView {
|
|
|
|
id: activityListView
|
|
|
|
anchors.top: trayWindowHeaderBackground.bottom
|
2020-11-18 18:42:37 +03:00
|
|
|
anchors.left: trayWindowBackground.left
|
|
|
|
anchors.right: trayWindowBackground.right
|
|
|
|
anchors.bottom: trayWindowBackground.bottom
|
2019-12-08 13:32:22 +03:00
|
|
|
clip: true
|
2020-01-13 11:59:34 +03:00
|
|
|
ScrollBar.vertical: ScrollBar {
|
|
|
|
id: listViewScrollbar
|
|
|
|
}
|
2019-12-08 13:32:22 +03:00
|
|
|
|
2020-11-18 18:42:37 +03:00
|
|
|
readonly property int maxActionButtons: 2
|
|
|
|
|
2020-08-25 14:16:42 +03:00
|
|
|
keyNavigationEnabled: true
|
|
|
|
|
2020-08-25 13:54:56 +03:00
|
|
|
Accessible.role: Accessible.List
|
|
|
|
Accessible.name: qsTr("Activity list")
|
|
|
|
|
2020-01-02 12:39:53 +03:00
|
|
|
model: activityModel
|
2019-12-08 13:32:22 +03:00
|
|
|
|
2021-06-21 21:50:49 +03:00
|
|
|
delegate: ActivityItem {
|
|
|
|
width: activityListView.width
|
2020-01-19 22:13:12 +03:00
|
|
|
height: Style.trayWindowHeaderHeight
|
2021-06-21 21:50:49 +03:00
|
|
|
onClicked: activityModel.triggerDefaultAction(model.index)
|
2019-12-08 13:32:22 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
} // Rectangle trayWindowBackground
|
|
|
|
}
|