2020-01-12 18:16:24 +03:00
|
|
|
import QtQml 2.1
|
|
|
|
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
|
2019-12-08 13:32:22 +03:00
|
|
|
import QtQuick.Controls 2.2
|
|
|
|
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
|
|
|
|
|
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
|
|
|
|
2020-01-19 22:13:12 +03:00
|
|
|
width: Style.trayWindowWidth
|
|
|
|
height: Style.trayWindowHeight
|
|
|
|
color: "transparent"
|
|
|
|
flags: Qt.FramelessWindowHint
|
2019-12-08 13:32:22 +03:00
|
|
|
|
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: {
|
|
|
|
if(!active) {
|
|
|
|
trayWindow.hide();
|
2020-01-05 18:25:32 +03:00
|
|
|
systrayBackend.setClosed();
|
2019-12-30 13:39:21 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-01-03 15:09:29 +03:00
|
|
|
onVisibleChanged: {
|
|
|
|
currentAccountAvatar.source = ""
|
|
|
|
currentAccountAvatar.source = "image://avatars/currentUser"
|
|
|
|
currentAccountUser.text = userModelBackend.currentUserName();
|
|
|
|
currentAccountServer.text = userModelBackend.currentUserServer();
|
|
|
|
trayWindowTalkButton.visible = userModelBackend.currentServerHasTalk() ? true : false;
|
2020-01-12 13:06:48 +03:00
|
|
|
currentAccountStateIndicator.source = ""
|
|
|
|
currentAccountStateIndicator.source = userModelBackend.isUserConnected(userModelBackend.currentUserId()) ? "qrc:///client/theme/colored/state-ok.svg" : "qrc:///client/theme/colored/state-offline.svg"
|
2020-01-11 17:05:37 +03:00
|
|
|
|
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 {
|
2019-12-30 13:52:07 +03:00
|
|
|
target: userModelBackend
|
2019-12-08 13:32:22 +03:00
|
|
|
onRefreshCurrentUserGui: {
|
2020-01-03 15:09:29 +03:00
|
|
|
currentAccountAvatar.source = ""
|
|
|
|
currentAccountAvatar.source = "image://avatars/currentUser"
|
|
|
|
currentAccountUser.text = userModelBackend.currentUserName();
|
|
|
|
currentAccountServer.text = userModelBackend.currentUserServer();
|
2020-01-12 11:10:06 +03:00
|
|
|
currentAccountStateIndicator.source = ""
|
|
|
|
currentAccountStateIndicator.source = userModelBackend.isUserConnected(userModelBackend.currentUserId()) ? "qrc:///client/theme/colored/state-ok.svg" : "qrc:///client/theme/colored/state-offline.svg"
|
2019-12-08 13:32:22 +03:00
|
|
|
}
|
|
|
|
onNewUserSelected: {
|
2020-01-03 15:09:29 +03:00
|
|
|
accountMenu.close();
|
|
|
|
trayWindowTalkButton.visible = userModelBackend.currentServerHasTalk() ? true : false;
|
2019-12-08 13:32:22 +03:00
|
|
|
}
|
2019-12-30 13:52:07 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
Connections {
|
|
|
|
target: systrayBackend
|
2019-12-30 13:39:21 +03:00
|
|
|
onShowWindow: {
|
2020-01-05 18:25:32 +03:00
|
|
|
accountMenu.close();
|
2019-12-30 13:39:21 +03:00
|
|
|
trayWindow.show();
|
2020-01-05 18:25:32 +03:00
|
|
|
trayWindow.raise();
|
2019-12-30 13:39:21 +03:00
|
|
|
trayWindow.requestActivate();
|
2020-01-21 15:54:04 +03:00
|
|
|
trayWindow.setX( Qt.application.screens[systrayBackend.screenIndex()].virtualX + systrayBackend.calcTrayWindowX());
|
|
|
|
trayWindow.setY( Qt.application.screens[systrayBackend.screenIndex()].virtualY + systrayBackend.calcTrayWindowY());
|
2020-01-05 18:25:32 +03:00
|
|
|
systrayBackend.setOpened();
|
2020-01-13 16:35:58 +03:00
|
|
|
userModelBackend.fetchCurrentActivityModel();
|
2019-12-30 13:39:21 +03:00
|
|
|
}
|
|
|
|
onHideWindow: {
|
|
|
|
trayWindow.hide();
|
2020-01-05 18:25:32 +03:00
|
|
|
systrayBackend.setClosed();
|
2019-12-30 13:39:21 +03:00
|
|
|
}
|
2019-12-08 13:32:22 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
Rectangle {
|
|
|
|
id: trayWindowBackground
|
2020-01-19 22:13:12 +03:00
|
|
|
|
|
|
|
anchors.fill: parent
|
|
|
|
radius: Style.trayWindowRadius
|
|
|
|
border.width: Style.trayWindowBorderWidth
|
|
|
|
border.color: Style.ncBlue
|
2019-12-08 13:32:22 +03:00
|
|
|
|
|
|
|
Rectangle {
|
|
|
|
id: trayWindowHeaderBackground
|
|
|
|
|
2020-01-19 22:13:12 +03:00
|
|
|
anchors.left: trayWindowBackground.left
|
|
|
|
anchors.top: trayWindowBackground.top
|
|
|
|
height: Style.trayWindowHeaderHeight
|
|
|
|
width: Style.trayWindowWidth
|
|
|
|
radius: (Style.trayWindowRadius > 0) ? (Style.trayWindowRadius - 1) : 0
|
|
|
|
color: Style.ncBlue
|
|
|
|
|
|
|
|
// The overlay rectangle below eliminates the rounded corners from the bottom of the header
|
|
|
|
// as Qt only allows setting the radius for all corners right now, not specific ones
|
2019-12-08 13:32:22 +03:00
|
|
|
Rectangle {
|
2020-01-19 22:13:12 +03:00
|
|
|
id: trayWindowHeaderButtomHalfBackground
|
|
|
|
|
|
|
|
anchors.left: trayWindowHeaderBackground.left
|
2019-12-08 13:32:22 +03:00
|
|
|
anchors.bottom: trayWindowHeaderBackground.bottom
|
2020-01-19 22:13:12 +03:00
|
|
|
height: Style.trayWindowHeaderHeight / 2
|
|
|
|
width: Style.trayWindowWidth
|
|
|
|
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
|
|
|
|
|
|
|
MouseArea {
|
|
|
|
id: accountBtnMouseArea
|
2020-01-19 22:13:12 +03:00
|
|
|
|
|
|
|
anchors.fill: parent
|
|
|
|
hoverEnabled: Style.hoverEffectsEnabled
|
|
|
|
|
|
|
|
// HACK: Imitate Qt hover effect brightness (which is not accessible as property)
|
|
|
|
// so that indicator background also flicks when hovered
|
2020-01-15 22:11:50 +03:00
|
|
|
onContainsMouseChanged: {
|
2020-01-19 22:13:12 +03:00
|
|
|
currentAccountStateIndicatorBackground.color = (containsMouse ? Style.ncBlueHover : Style.ncBlue)
|
2020-01-15 22:11:50 +03:00
|
|
|
}
|
2020-01-19 22:13:12 +03:00
|
|
|
|
|
|
|
// We call open() instead of popup() because we want to position it
|
|
|
|
// exactly below the dropdown button, not the mouse
|
2019-12-08 13:32:22 +03:00
|
|
|
onClicked:
|
|
|
|
{
|
2020-01-14 09:59:28 +03:00
|
|
|
syncPauseButton.text = systrayBackend.syncIsPaused() ? qsTr("Resume sync for all") : qsTr("Pause sync for all")
|
2019-12-08 13:32:22 +03:00
|
|
|
accountMenu.open()
|
|
|
|
}
|
|
|
|
|
|
|
|
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-01-05 23:06:42 +03:00
|
|
|
closePolicy: "CloseOnPressOutside"
|
2019-12-08 13:32:22 +03:00
|
|
|
|
|
|
|
background: Rectangle {
|
2020-01-19 22:13:12 +03:00
|
|
|
border.color: Style.ncBlue
|
|
|
|
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
|
2019-12-30 13:52:07 +03:00
|
|
|
model: userModelBackend
|
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-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-01-04 19:22:56 +03:00
|
|
|
onClicked: userModelBackend.addAccount()
|
|
|
|
}
|
|
|
|
|
2020-01-05 23:06:42 +03:00
|
|
|
MenuSeparator { id: accountMenuSeparator }
|
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-01-05 18:25:32 +03:00
|
|
|
onClicked: systrayBackend.pauseResumeSync()
|
|
|
|
}
|
|
|
|
|
2020-01-04 19:22:56 +03:00
|
|
|
MenuItem {
|
2020-01-14 09:59:28 +03:00
|
|
|
text: qsTr("Open settings")
|
2020-01-19 22:13:12 +03:00
|
|
|
font.pixelSize: Style.topLinePixelSize
|
2020-01-04 19:22:56 +03:00
|
|
|
onClicked: systrayBackend.openSettings()
|
|
|
|
}
|
|
|
|
|
2020-01-05 23:06:42 +03:00
|
|
|
MenuItem {
|
2020-01-14 09:59:28 +03:00
|
|
|
text: qsTr("Help")
|
2020-01-19 22:13:12 +03:00
|
|
|
font.pixelSize: Style.topLinePixelSize
|
2020-01-05 23:06:42 +03:00
|
|
|
onClicked: systrayBackend.openHelp()
|
|
|
|
}
|
|
|
|
|
2020-01-04 19:22:56 +03:00
|
|
|
MenuItem {
|
2020-01-14 09:59:28 +03:00
|
|
|
text: qsTr("Quit Nextcloud")
|
2020-01-19 22:13:12 +03:00
|
|
|
font.pixelSize: Style.topLinePixelSize
|
2020-01-04 19:22:56 +03:00
|
|
|
onClicked: systrayBackend.shutdown()
|
|
|
|
}
|
2019-12-08 13:32:22 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
background:
|
|
|
|
Item {
|
|
|
|
id: leftHoverContainer
|
2020-01-19 22:13:12 +03:00
|
|
|
|
|
|
|
height: Style.trayWindowHeaderHeight
|
|
|
|
width: Style.currentAccountButtonWidth
|
2019-12-08 13:32:22 +03:00
|
|
|
Rectangle {
|
2020-01-19 22:13:12 +03:00
|
|
|
width: Style.currentAccountButtonWidth / 2
|
|
|
|
height: Style.trayWindowHeaderHeight / 2
|
2019-12-08 13:32:22 +03:00
|
|
|
color: "transparent"
|
|
|
|
clip: true
|
|
|
|
Rectangle {
|
2020-01-19 22:13:12 +03:00
|
|
|
width: Style.currentAccountButtonWidth
|
|
|
|
height: Style.trayWindowHeaderHeight
|
|
|
|
radius: Style.trayWindowRadius
|
2019-12-08 13:32:22 +03:00
|
|
|
color: "white"
|
|
|
|
opacity: 0.2
|
|
|
|
visible: accountBtnMouseArea.containsMouse
|
|
|
|
}
|
|
|
|
}
|
|
|
|
Rectangle {
|
2020-01-19 22:13:12 +03:00
|
|
|
width: Style.currentAccountButtonWidth / 2
|
|
|
|
height: Style.trayWindowHeaderHeight / 2
|
2019-12-08 13:32:22 +03:00
|
|
|
anchors.bottom: leftHoverContainer.bottom
|
|
|
|
color: "white"
|
|
|
|
opacity: 0.2
|
|
|
|
visible: accountBtnMouseArea.containsMouse
|
|
|
|
}
|
|
|
|
Rectangle {
|
2020-01-19 22:13:12 +03:00
|
|
|
width: Style.currentAccountButtonWidth / 2
|
|
|
|
height: Style.trayWindowHeaderHeight / 2
|
2019-12-08 13:32:22 +03:00
|
|
|
anchors.right: leftHoverContainer.right
|
|
|
|
color: "white"
|
|
|
|
opacity: 0.2
|
|
|
|
visible: accountBtnMouseArea.containsMouse
|
|
|
|
}
|
|
|
|
Rectangle {
|
2020-01-19 22:13:12 +03:00
|
|
|
width: Style.currentAccountButtonWidth / 2
|
|
|
|
height: Style.trayWindowHeaderHeight / 2
|
2019-12-08 13:32:22 +03:00
|
|
|
anchors.right: leftHoverContainer.right
|
|
|
|
anchors.bottom: leftHoverContainer.bottom
|
|
|
|
color: "white"
|
|
|
|
opacity: 0.2
|
|
|
|
visible: accountBtnMouseArea.containsMouse
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
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
|
|
|
|
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
|
|
|
|
source: "image://avatars/currentUser"
|
2020-01-19 22:13:12 +03:00
|
|
|
Layout.preferredHeight: Style.accountAvatarSize
|
|
|
|
Layout.preferredWidth: Style.accountAvatarSize
|
|
|
|
|
2020-01-15 22:11:50 +03:00
|
|
|
Rectangle {
|
|
|
|
id: currentAccountStateIndicatorBackground
|
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-01-12 11:10:06 +03:00
|
|
|
Image {
|
|
|
|
id: currentAccountStateIndicator
|
|
|
|
source: userModelBackend.isUserConnected(userModelBackend.currentUserId()) ? "qrc:///client/theme/colored/state-ok.svg" : "qrc:///client/theme/colored/state-offline.svg"
|
|
|
|
cache: false
|
2020-01-15 22:11:50 +03:00
|
|
|
x: currentAccountStateIndicatorBackground.x + 1
|
|
|
|
y: currentAccountStateIndicatorBackground.y + 1
|
2020-01-19 22:13:12 +03:00
|
|
|
sourceSize.width: Style.accountAvatarStateIndicatorSize
|
|
|
|
sourceSize.height: Style.accountAvatarStateIndicatorSize
|
2020-01-12 11:10:06 +03:00
|
|
|
}
|
2019-12-08 13:32:22 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
Column {
|
|
|
|
id: accountLabels
|
|
|
|
spacing: 4
|
|
|
|
Layout.alignment: Qt.AlignLeft
|
|
|
|
Layout.leftMargin: 6
|
|
|
|
Label {
|
|
|
|
id: currentAccountUser
|
2020-01-19 22:13:12 +03:00
|
|
|
width: Style.currentAccountLabelWidth
|
2019-12-30 13:52:07 +03:00
|
|
|
text: userModelBackend.currentUserName()
|
2020-01-05 23:06:42 +03:00
|
|
|
elide: Text.ElideRight
|
2019-12-08 13:32:22 +03:00
|
|
|
color: "white"
|
2020-01-19 22:13:12 +03:00
|
|
|
font.pixelSize: Style.topLinePixelSize
|
2019-12-08 13:32:22 +03:00
|
|
|
font.bold: true
|
|
|
|
}
|
|
|
|
Label {
|
|
|
|
id: currentAccountServer
|
2020-01-19 22:13:12 +03:00
|
|
|
width: Style.currentAccountLabelWidth
|
2019-12-30 13:52:07 +03:00
|
|
|
text: userModelBackend.currentUserServer()
|
2020-01-05 23:06:42 +03:00
|
|
|
elide: Text.ElideRight
|
2019-12-08 13:32:22 +03:00
|
|
|
color: "white"
|
2020-01-19 22:13:12 +03:00
|
|
|
font.pixelSize: Style.subLinePixelSize
|
2019-12-08 13:32:22 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Image {
|
2020-01-05 23:06:42 +03:00
|
|
|
Layout.alignment: Qt.AlignRight
|
2019-12-08 13:32:22 +03:00
|
|
|
verticalAlignment: Qt.AlignCenter
|
2020-01-19 22:13:12 +03:00
|
|
|
Layout.margins: Style.accountDropDownCaretMargin
|
2019-12-08 13:32:22 +03:00
|
|
|
source: "qrc:///client/theme/white/caret-down.svg"
|
2020-01-19 22:13:12 +03:00
|
|
|
sourceSize.width: Style.accountDropDownCaretSize
|
|
|
|
sourceSize.height: Style.accountDropDownCaretSize
|
2019-12-08 13:32:22 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-01-19 22:13:12 +03:00
|
|
|
// Filler between account dropdown and header app buttons
|
2019-12-08 13:32:22 +03:00
|
|
|
Item {
|
|
|
|
id: trayWindowHeaderSpacer
|
|
|
|
Layout.fillWidth: true
|
|
|
|
}
|
|
|
|
|
|
|
|
Button {
|
|
|
|
id: openLocalFolderButton
|
2020-01-19 22:13:12 +03:00
|
|
|
|
2019-12-08 13:32:22 +03:00
|
|
|
Layout.alignment: Qt.AlignRight
|
|
|
|
display: AbstractButton.IconOnly
|
2020-01-19 22:13:12 +03:00
|
|
|
Layout.preferredWidth: Style.trayWindowHeaderHeight
|
|
|
|
Layout.preferredHeight: Style.trayWindowHeaderHeight
|
2019-12-08 13:32:22 +03:00
|
|
|
flat: true
|
|
|
|
|
|
|
|
icon.source: "qrc:///client/theme/white/folder.svg"
|
2020-01-19 22:13:12 +03:00
|
|
|
icon.width: Style.headerButtonIconSize
|
|
|
|
icon.height: Style.headerButtonIconSize
|
2019-12-08 13:32:22 +03:00
|
|
|
icon.color: "transparent"
|
|
|
|
|
|
|
|
MouseArea {
|
|
|
|
id: folderBtnMouseArea
|
2020-01-19 22:13:12 +03:00
|
|
|
|
2019-12-08 13:32:22 +03:00
|
|
|
anchors.fill: parent
|
2020-01-19 22:13:12 +03:00
|
|
|
hoverEnabled: Style.hoverEffectsEnabled
|
2019-12-08 13:32:22 +03:00
|
|
|
onClicked:
|
|
|
|
{
|
2020-01-02 11:55:37 +03:00
|
|
|
userModelBackend.openCurrentAccountLocalFolder();
|
2019-12-08 13:32:22 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
background:
|
|
|
|
Rectangle {
|
|
|
|
color: folderBtnMouseArea.containsMouse ? "white" : "transparent"
|
|
|
|
opacity: 0.2
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Button {
|
|
|
|
id: trayWindowTalkButton
|
2020-01-19 22:13:12 +03:00
|
|
|
|
2019-12-08 13:32:22 +03:00
|
|
|
Layout.alignment: Qt.AlignRight
|
|
|
|
display: AbstractButton.IconOnly
|
2020-01-19 22:13:12 +03:00
|
|
|
Layout.preferredWidth: Style.trayWindowHeaderHeight
|
|
|
|
Layout.preferredHeight: Style.trayWindowHeaderHeight
|
2019-12-08 13:32:22 +03:00
|
|
|
flat: true
|
2020-01-03 15:09:29 +03:00
|
|
|
visible: userModelBackend.currentServerHasTalk() ? true : false
|
2019-12-08 13:32:22 +03:00
|
|
|
|
|
|
|
icon.source: "qrc:///client/theme/white/talk-app.svg"
|
2020-01-19 22:13:12 +03:00
|
|
|
icon.width: Style.headerButtonIconSize
|
|
|
|
icon.height: Style.headerButtonIconSize
|
2019-12-08 13:32:22 +03:00
|
|
|
icon.color: "transparent"
|
|
|
|
|
|
|
|
MouseArea {
|
|
|
|
id: talkBtnMouseArea
|
2020-01-19 22:13:12 +03:00
|
|
|
|
2019-12-08 13:32:22 +03:00
|
|
|
anchors.fill: parent
|
2020-01-19 22:13:12 +03:00
|
|
|
hoverEnabled: Style.hoverEffectsEnabled
|
2019-12-08 13:32:22 +03:00
|
|
|
onClicked:
|
|
|
|
{
|
2020-01-03 16:00:07 +03:00
|
|
|
userModelBackend.openCurrentAccountTalk();
|
2019-12-08 13:32:22 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
background:
|
|
|
|
Rectangle {
|
|
|
|
color: talkBtnMouseArea.containsMouse ? "white" : "transparent"
|
|
|
|
opacity: 0.2
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Button {
|
|
|
|
id: trayWindowAppsButton
|
2020-01-19 22:13:12 +03:00
|
|
|
|
2019-12-08 13:32:22 +03:00
|
|
|
Layout.alignment: Qt.AlignRight
|
|
|
|
display: AbstractButton.IconOnly
|
2020-01-19 22:13:12 +03:00
|
|
|
Layout.preferredWidth: Style.trayWindowHeaderHeight
|
|
|
|
Layout.preferredHeight: Style.trayWindowHeaderHeight
|
2019-12-08 13:32:22 +03:00
|
|
|
flat: true
|
|
|
|
|
|
|
|
icon.source: "qrc:///client/theme/white/more-apps.svg"
|
2020-01-19 22:13:12 +03:00
|
|
|
icon.width: Style.headerButtonIconSize
|
|
|
|
icon.height: Style.headerButtonIconSize
|
2019-12-08 13:32:22 +03:00
|
|
|
icon.color: "transparent"
|
|
|
|
|
|
|
|
MouseArea {
|
|
|
|
id: appsBtnMouseArea
|
2020-01-19 22:13:12 +03:00
|
|
|
|
2019-12-08 13:32:22 +03:00
|
|
|
anchors.fill: parent
|
2020-01-19 22:13:12 +03:00
|
|
|
hoverEnabled: Style.hoverEffectsEnabled
|
2019-12-08 13:32:22 +03:00
|
|
|
onClicked:
|
|
|
|
{
|
2020-01-15 18:42:06 +03:00
|
|
|
/*
|
|
|
|
// The count() property was introduced in QtQuick.Controls 2.3 (Qt 5.10)
|
|
|
|
// so we handle this with userModelBackend.openCurrentAccountServer()
|
|
|
|
//
|
|
|
|
// See UserModel::openCurrentAccountServer() to disable this workaround
|
|
|
|
// in the future for Qt >= 5.10
|
|
|
|
|
|
|
|
if(appsMenu.count() > 0) {
|
|
|
|
appsMenu.popup();
|
|
|
|
} else {
|
|
|
|
userModelBackend.openCurrentAccountServer();
|
|
|
|
}
|
|
|
|
*/
|
|
|
|
|
|
|
|
appsMenu.open();
|
2020-01-03 16:00:07 +03:00
|
|
|
userModelBackend.openCurrentAccountServer();
|
2019-12-08 13:32:22 +03:00
|
|
|
}
|
2020-01-15 18:42:06 +03:00
|
|
|
|
|
|
|
Menu {
|
|
|
|
id: appsMenu
|
|
|
|
y: (trayWindowAppsButton.y + trayWindowAppsButton.height + 2)
|
2020-01-19 22:13:12 +03:00
|
|
|
width: (Style.headerButtonIconSize * 3)
|
2020-01-15 18:42:06 +03:00
|
|
|
closePolicy: "CloseOnPressOutside"
|
|
|
|
|
|
|
|
background: Rectangle {
|
2020-01-19 22:13:12 +03:00
|
|
|
border.color: Style.ncBlue
|
2020-01-15 18:42:06 +03:00
|
|
|
radius: 2
|
|
|
|
}
|
|
|
|
|
|
|
|
Instantiator {
|
|
|
|
id: appsMenuInstantiator
|
|
|
|
model: appsMenuModelBackend
|
|
|
|
onObjectAdded: appsMenu.insertItem(index, object)
|
|
|
|
onObjectRemoved: appsMenu.removeItem(object)
|
|
|
|
delegate: MenuItem {
|
|
|
|
text: appName
|
2020-01-19 22:13:12 +03:00
|
|
|
font.pixelSize: Style.topLinePixelSize
|
2020-01-16 20:43:48 +03:00
|
|
|
icon.source: appIconUrl
|
2020-01-15 18:42:06 +03:00
|
|
|
onTriggered: appsMenuModelBackend.openAppUrl(appUrl)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2019-12-08 13:32:22 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
background:
|
|
|
|
Item {
|
|
|
|
id: rightHoverContainer
|
2020-01-19 22:13:12 +03:00
|
|
|
height: Style.trayWindowHeaderHeight
|
|
|
|
width: Style.trayWindowHeaderHeight
|
2019-12-08 13:32:22 +03:00
|
|
|
Rectangle {
|
2020-01-19 22:13:12 +03:00
|
|
|
width: Style.trayWindowHeaderHeight / 2
|
|
|
|
height: Style.trayWindowHeaderHeight / 2
|
2019-12-08 13:32:22 +03:00
|
|
|
color: "white"
|
|
|
|
opacity: 0.2
|
|
|
|
visible: appsBtnMouseArea.containsMouse
|
|
|
|
}
|
|
|
|
Rectangle {
|
2020-01-19 22:13:12 +03:00
|
|
|
width: Style.trayWindowHeaderHeight / 2
|
|
|
|
height: Style.trayWindowHeaderHeight / 2
|
2019-12-08 13:32:22 +03:00
|
|
|
anchors.bottom: rightHoverContainer.bottom
|
|
|
|
color: "white"
|
|
|
|
opacity: 0.2
|
|
|
|
visible: appsBtnMouseArea.containsMouse
|
|
|
|
}
|
|
|
|
Rectangle {
|
2020-01-19 22:13:12 +03:00
|
|
|
width: Style.trayWindowHeaderHeight / 2
|
|
|
|
height: Style.trayWindowHeaderHeight / 2
|
2019-12-08 13:32:22 +03:00
|
|
|
anchors.bottom: rightHoverContainer.bottom
|
|
|
|
anchors.right: rightHoverContainer.right
|
|
|
|
color: "white"
|
|
|
|
opacity: 0.2
|
|
|
|
visible: appsBtnMouseArea.containsMouse
|
|
|
|
}
|
|
|
|
Rectangle {
|
|
|
|
id: rightHoverContainerClipper
|
|
|
|
anchors.right: rightHoverContainer.right
|
2020-01-19 22:13:12 +03:00
|
|
|
width: Style.trayWindowHeaderHeight / 2
|
|
|
|
height: Style.trayWindowHeaderHeight / 2
|
2019-12-08 13:32:22 +03:00
|
|
|
color: "transparent"
|
|
|
|
clip: true
|
|
|
|
Rectangle {
|
2020-01-19 22:13:12 +03:00
|
|
|
width: Style.trayWindowHeaderHeight
|
|
|
|
height: Style.trayWindowHeaderHeight
|
2019-12-08 13:32:22 +03:00
|
|
|
anchors.right: rightHoverContainerClipper.right
|
2020-01-19 22:13:12 +03:00
|
|
|
radius: Style.trayWindowRadius
|
2019-12-08 13:32:22 +03:00
|
|
|
color: "white"
|
|
|
|
opacity: 0.2
|
|
|
|
visible: appsBtnMouseArea.containsMouse
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} // Rectangle trayWindowHeaderBackground
|
|
|
|
|
|
|
|
ListView {
|
|
|
|
id: activityListView
|
2020-01-19 22:13:12 +03:00
|
|
|
|
2019-12-08 13:32:22 +03:00
|
|
|
anchors.top: trayWindowHeaderBackground.bottom
|
2020-01-19 22:13:12 +03:00
|
|
|
anchors.horizontalCenter: trayWindowBackground.horizontalCenter
|
|
|
|
width: Style.trayWindowWidth - Style.trayWindowBorderWidth
|
|
|
|
height: Style.trayWindowHeight - Style.trayWindowHeaderHeight
|
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-01-02 12:39:53 +03:00
|
|
|
model: activityModel
|
2019-12-08 13:32:22 +03:00
|
|
|
|
|
|
|
delegate: RowLayout {
|
|
|
|
id: activityItem
|
2020-01-19 22:13:12 +03:00
|
|
|
|
|
|
|
width: parent.width
|
|
|
|
height: Style.trayWindowHeaderHeight
|
2019-12-08 13:32:22 +03:00
|
|
|
spacing: 0
|
2020-01-14 21:48:21 +03:00
|
|
|
|
2019-12-08 13:32:22 +03:00
|
|
|
Image {
|
|
|
|
id: activityIcon
|
2020-01-19 22:13:12 +03:00
|
|
|
|
2020-01-14 21:48:21 +03:00
|
|
|
Layout.leftMargin: 8
|
2020-01-15 20:44:33 +03:00
|
|
|
Layout.rightMargin: 8
|
2020-01-14 21:48:21 +03:00
|
|
|
Layout.preferredWidth: activityButton1.icon.width
|
|
|
|
Layout.preferredHeight: activityButton1.icon.height
|
2019-12-08 13:32:22 +03:00
|
|
|
verticalAlignment: Qt.AlignCenter
|
2020-01-13 11:59:34 +03:00
|
|
|
cache: true
|
|
|
|
source: icon
|
2020-01-17 12:38:21 +03:00
|
|
|
sourceSize.height: 64
|
|
|
|
sourceSize.width: 64
|
2019-12-08 13:32:22 +03:00
|
|
|
}
|
|
|
|
Column {
|
2020-01-03 18:15:15 +03:00
|
|
|
id: activityTextColumn
|
2020-01-19 22:13:12 +03:00
|
|
|
|
2019-12-08 13:32:22 +03:00
|
|
|
spacing: 4
|
|
|
|
Layout.alignment: Qt.AlignLeft
|
|
|
|
Text {
|
|
|
|
id: activityTextTitle
|
2020-01-17 16:50:05 +03:00
|
|
|
text: (type === "Activity" || type === "Notification") ? subject : message
|
2020-01-19 22:13:12 +03:00
|
|
|
width: Style.activityLabelBaseWidth + ((path === "") ? activityItem.height : 0) + ((link === "") ? activityItem.height : 0) - 8
|
2020-01-03 18:15:15 +03:00
|
|
|
elide: Text.ElideRight
|
2020-01-19 22:13:12 +03:00
|
|
|
font.pixelSize: Style.topLinePixelSize
|
2020-01-17 22:26:48 +03:00
|
|
|
color: activityTextTitleColor
|
2019-12-08 13:32:22 +03:00
|
|
|
}
|
2020-01-14 21:48:21 +03:00
|
|
|
|
2019-12-08 13:32:22 +03:00
|
|
|
Text {
|
|
|
|
id: activityTextInfo
|
2020-01-17 16:50:05 +03:00
|
|
|
text: (type === "Activity" || type === "File" || type === "Sync") ? displaypath : message
|
|
|
|
height: (text === "") ? 0 : activityTextTitle.height
|
2020-01-19 22:13:12 +03:00
|
|
|
width: Style.activityLabelBaseWidth + ((path === "") ? activityItem.height : 0) + ((link === "") ? activityItem.height : 0) - 8
|
2020-01-03 18:15:15 +03:00
|
|
|
elide: Text.ElideRight
|
2020-01-19 22:13:12 +03:00
|
|
|
font.pixelSize: Style.subLinePixelSize
|
2019-12-08 13:32:22 +03:00
|
|
|
}
|
2020-01-17 22:16:20 +03:00
|
|
|
|
|
|
|
Text {
|
|
|
|
id: activityTextDateTime
|
|
|
|
text: dateTime
|
|
|
|
height: (text === "") ? 0 : activityTextTitle.height
|
2020-01-19 22:13:12 +03:00
|
|
|
width: Style.activityLabelBaseWidth + ((path === "") ? activityItem.height : 0) + ((link === "") ? activityItem.height : 0) - 8
|
2020-01-17 22:16:20 +03:00
|
|
|
elide: Text.ElideRight
|
2020-01-19 22:13:12 +03:00
|
|
|
font.pixelSize: Style.subLinePixelSize
|
2020-01-17 22:16:20 +03:00
|
|
|
color: "#808080"
|
|
|
|
}
|
2019-12-08 13:32:22 +03:00
|
|
|
}
|
|
|
|
Item {
|
|
|
|
id: activityItemFiller
|
|
|
|
Layout.fillWidth: true
|
|
|
|
}
|
|
|
|
Button {
|
2020-01-03 18:15:15 +03:00
|
|
|
id: activityButton1
|
2020-01-19 22:13:12 +03:00
|
|
|
|
|
|
|
Layout.preferredWidth: (path === "") ? 0 : parent.height
|
|
|
|
Layout.preferredHeight: parent.height
|
2019-12-08 13:32:22 +03:00
|
|
|
Layout.alignment: Qt.AlignRight
|
|
|
|
flat: true
|
2020-01-03 18:15:15 +03:00
|
|
|
hoverEnabled: false
|
2020-01-15 21:15:25 +03:00
|
|
|
visible: (path === "") ? false : true
|
2019-12-08 13:32:22 +03:00
|
|
|
display: AbstractButton.IconOnly
|
2020-01-18 19:47:17 +03:00
|
|
|
icon.source: "qrc:///client/theme/files.svg"
|
2019-12-08 13:32:22 +03:00
|
|
|
icon.color: "transparent"
|
2020-01-03 18:15:15 +03:00
|
|
|
|
2020-01-13 13:46:49 +03:00
|
|
|
onClicked: {
|
2020-01-03 18:15:15 +03:00
|
|
|
Qt.openUrlExternally(path)
|
|
|
|
}
|
2019-12-08 13:32:22 +03:00
|
|
|
}
|
|
|
|
Button {
|
2020-01-15 21:15:25 +03:00
|
|
|
id: activityButton2
|
2020-01-19 22:13:12 +03:00
|
|
|
|
|
|
|
Layout.preferredWidth: (link === "") ? 0 : parent.height
|
|
|
|
Layout.preferredHeight: parent.height
|
2019-12-08 13:32:22 +03:00
|
|
|
Layout.alignment: Qt.AlignRight
|
|
|
|
flat: true
|
2020-01-03 18:15:15 +03:00
|
|
|
hoverEnabled: false
|
2020-01-15 21:15:25 +03:00
|
|
|
visible: (link === "") ? false : true
|
2019-12-08 13:32:22 +03:00
|
|
|
display: AbstractButton.IconOnly
|
2020-01-18 19:47:17 +03:00
|
|
|
icon.source: "qrc:///client/theme/public.svg"
|
2019-12-08 13:32:22 +03:00
|
|
|
icon.color: "transparent"
|
2020-01-13 13:46:49 +03:00
|
|
|
|
|
|
|
onClicked: {
|
|
|
|
Qt.openUrlExternally(link)
|
|
|
|
}
|
2019-12-08 13:32:22 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-01-16 19:11:08 +03:00
|
|
|
/*add: Transition {
|
2019-12-08 13:32:22 +03:00
|
|
|
NumberAnimation { properties: "y"; from: -60; duration: 100; easing.type: Easing.Linear }
|
|
|
|
}
|
|
|
|
|
|
|
|
remove: Transition {
|
|
|
|
NumberAnimation { property: "opacity"; from: 1.0; to: 0; duration: 100 }
|
|
|
|
}
|
|
|
|
|
|
|
|
removeDisplaced: Transition {
|
|
|
|
SequentialAnimation {
|
|
|
|
PauseAnimation { duration: 100}
|
|
|
|
NumberAnimation { properties: "y"; duration: 100; easing.type: Easing.Linear }
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
displaced: Transition {
|
|
|
|
NumberAnimation { properties: "y"; duration: 100; easing.type: Easing.Linear }
|
2020-01-16 19:11:08 +03:00
|
|
|
}*/
|
2019-12-08 13:32:22 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
} // Rectangle trayWindowBackground
|
|
|
|
}
|