mirror of
https://github.com/nextcloud/desktop.git
synced 2024-11-22 04:55:48 +03:00
Merge pull request #2317 from nextcloud/tray-accessibility
Tray accessibility
This commit is contained in:
commit
10b23200ab
2 changed files with 102 additions and 1 deletions
|
@ -11,6 +11,9 @@ MenuItem {
|
|||
id: userLine
|
||||
height: Style.trayWindowHeaderHeight
|
||||
|
||||
Accessible.role: Accessible.MenuItem
|
||||
Accessible.name: qsTr("Account entry")
|
||||
|
||||
RowLayout {
|
||||
id: userLineLayout
|
||||
spacing: 0
|
||||
|
@ -25,6 +28,9 @@ MenuItem {
|
|||
hoverEnabled: true
|
||||
flat: true
|
||||
|
||||
Accessible.role: Accessible.Button
|
||||
Accessible.name: qsTr("Switch to account") + " " + name
|
||||
|
||||
MouseArea {
|
||||
anchors.fill: parent
|
||||
hoverEnabled: true
|
||||
|
@ -81,6 +87,9 @@ MenuItem {
|
|||
y: accountStateIndicatorBackground.y + 1
|
||||
sourceSize.width: Style.accountAvatarStateIndicatorSize
|
||||
sourceSize.height: Style.accountAvatarStateIndicatorSize
|
||||
|
||||
Accessible.role: Accessible.Indicator
|
||||
Accessible.name: isConnected ? qsTr("Account connected") : qsTr("Account not connected")
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -119,6 +128,10 @@ MenuItem {
|
|||
icon.source: "qrc:///client/theme/more.svg"
|
||||
icon.color: "transparent"
|
||||
|
||||
Accessible.role: Accessible.ButtonMenu
|
||||
Accessible.name: qsTr("Account actions")
|
||||
Accessible.onPressAction: userMoreButtonMouseArea.clicked()
|
||||
|
||||
MouseArea {
|
||||
id: userMoreButtonMouseArea
|
||||
anchors.fill: parent
|
||||
|
@ -167,10 +180,23 @@ MenuItem {
|
|||
color: parent.parent.hovered ? Style.lightHover : "transparent"
|
||||
}
|
||||
}
|
||||
|
||||
Accessible.role: Accessible.Button
|
||||
Accessible.name: isConnected ? qsTr("Log out") : qsTr("Log in")
|
||||
|
||||
onPressed: {
|
||||
if (isConnected) {
|
||||
UserModel.logout(index)
|
||||
} else {
|
||||
UserModel.login(index)
|
||||
}
|
||||
accountMenu.close()
|
||||
}
|
||||
}
|
||||
|
||||
MenuItem {
|
||||
text: qsTr("Remove Account")
|
||||
id: removeAccountButton
|
||||
text: qsTr("Remove account")
|
||||
font.pixelSize: Style.topLinePixelSize
|
||||
hoverEnabled: true
|
||||
onClicked: {
|
||||
|
@ -187,6 +213,10 @@ MenuItem {
|
|||
color: parent.parent.hovered ? Style.lightHover : "transparent"
|
||||
}
|
||||
}
|
||||
|
||||
Accessible.role: Accessible.Button
|
||||
Accessible.name: text
|
||||
Accessible.onPressAction: removeAccountButton.clicked()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -21,6 +21,9 @@ Window {
|
|||
|
||||
readonly property int maxMenuHeight: Style.trayWindowHeight - Style.trayWindowHeaderHeight - 2 * Style.trayWindowBorderWidth
|
||||
|
||||
Accessible.role: Accessible.Application
|
||||
Accessible.name: qsTr("Nextcloud desktop main dialog")
|
||||
|
||||
// Close tray window when focus is lost (e.g. click somewhere else on the screen)
|
||||
onActiveChanged: {
|
||||
if(!active) {
|
||||
|
@ -96,6 +99,9 @@ Window {
|
|||
border.width: Style.trayWindowBorderWidth
|
||||
border.color: Style.menuBorder
|
||||
|
||||
Accessible.role: Accessible.Grouping
|
||||
Accessible.name: qsTr("Nextcloud desktop main dialog")
|
||||
|
||||
Rectangle {
|
||||
id: trayWindowHeaderBackground
|
||||
|
||||
|
@ -131,6 +137,10 @@ Window {
|
|||
display: AbstractButton.IconOnly
|
||||
flat: true
|
||||
|
||||
Accessible.role: Accessible.ButtonMenu
|
||||
Accessible.name: qsTr("Current account")
|
||||
Accessible.onPressAction: currentAccountButton.clicked()
|
||||
|
||||
MouseArea {
|
||||
id: accountBtnMouseArea
|
||||
|
||||
|
@ -171,6 +181,9 @@ Window {
|
|||
radius: Style.currentAccountButtonRadius
|
||||
}
|
||||
|
||||
Accessible.role: PopupMenu
|
||||
Accessible.name: qsTr("Account switcher and settings menu")
|
||||
|
||||
onClosed: {
|
||||
// HACK: reload account Instantiator immediately by restting it - could be done better I guess
|
||||
// see also onVisibleChanged above
|
||||
|
@ -225,6 +238,10 @@ Window {
|
|||
}
|
||||
}
|
||||
onClicked: UserModel.addAccount()
|
||||
|
||||
Accessible.role: Accessible.MenuItem
|
||||
Accessible.name: qsTr("Add new account")
|
||||
Accessible.onPressAction: addAccountButton.clicked()
|
||||
}
|
||||
|
||||
MenuSeparator {
|
||||
|
@ -249,9 +266,14 @@ Window {
|
|||
color: parent.parent.hovered ? Style.lightHover : "transparent"
|
||||
}
|
||||
}
|
||||
|
||||
Accessible.role: Accessible.MenuItem
|
||||
Accessible.name: Systray.syncIsPaused() ? qsTr("Resume sync for all") : qsTr("Pause sync for all")
|
||||
Accessible.onPressAction: syncPauseButton.clicked()
|
||||
}
|
||||
|
||||
MenuItem {
|
||||
id: settingsButton
|
||||
text: qsTr("Settings")
|
||||
font.pixelSize: Style.topLinePixelSize
|
||||
hoverEnabled: true
|
||||
|
@ -266,9 +288,14 @@ Window {
|
|||
color: parent.parent.hovered ? Style.lightHover : "transparent"
|
||||
}
|
||||
}
|
||||
|
||||
Accessible.role: Accessible.MenuItem
|
||||
Accessible.name: text
|
||||
Accessible.onPressAction: settingsButton.clicked()
|
||||
}
|
||||
|
||||
MenuItem {
|
||||
id: exitButton
|
||||
text: qsTr("Exit");
|
||||
font.pixelSize: Style.topLinePixelSize
|
||||
hoverEnabled: true
|
||||
|
@ -283,6 +310,10 @@ Window {
|
|||
color: parent.parent.hovered ? Style.lightHover : "transparent"
|
||||
}
|
||||
}
|
||||
|
||||
Accessible.role: Accessible.MenuItem
|
||||
Accessible.name: text
|
||||
Accessible.onPressAction: exitButton.clicked()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -298,6 +329,7 @@ Window {
|
|||
height: Style.trayWindowHeaderHeight
|
||||
width: Style.currentAccountButtonWidth
|
||||
spacing: 0
|
||||
|
||||
Image {
|
||||
id: currentAccountAvatar
|
||||
|
||||
|
@ -308,6 +340,9 @@ Window {
|
|||
Layout.preferredHeight: Style.accountAvatarSize
|
||||
Layout.preferredWidth: Style.accountAvatarSize
|
||||
|
||||
Accessible.role: Accessible.Graphic
|
||||
Accessible.name: qsTr("Current user avatar")
|
||||
|
||||
Rectangle {
|
||||
id: currentAccountStateIndicatorBackground
|
||||
width: Style.accountAvatarStateIndicatorSize + 2
|
||||
|
@ -326,6 +361,9 @@ Window {
|
|||
y: currentAccountStateIndicatorBackground.y + 1
|
||||
sourceSize.width: Style.accountAvatarStateIndicatorSize
|
||||
sourceSize.height: Style.accountAvatarStateIndicatorSize
|
||||
|
||||
Accessible.role: Accessible.Indicator
|
||||
Accessible.name: UserModel.isUserConnected(UserModel.currentUserId()) ? qsTr("Connected") : qsTr("Disconnected")
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -377,6 +415,10 @@ Window {
|
|||
visible: UserModel.currentUser.hasLocalFolder
|
||||
icon.source: "qrc:///client/theme/white/folder.svg"
|
||||
onClicked: UserModel.openCurrentAccountLocalFolder()
|
||||
|
||||
Accessible.role: Accessible.Button
|
||||
Accessible.name: qsTr("Open local folder of current account")
|
||||
Accessible.onPressAction: openLocalFolderButton.clicked()
|
||||
}
|
||||
|
||||
HeaderButton {
|
||||
|
@ -385,6 +427,10 @@ Window {
|
|||
visible: UserModel.currentUser.serverHasTalk
|
||||
icon.source: "qrc:///client/theme/white/talk-app.svg"
|
||||
onClicked: UserModel.openCurrentAccountTalk()
|
||||
|
||||
Accessible.role: Accessible.Button
|
||||
Accessible.name: qsTr("Open Nextcloud Talk in browser")
|
||||
Accessible.onPressAction: trayWindowTalkButton.clicked()
|
||||
}
|
||||
|
||||
HeaderButton {
|
||||
|
@ -400,6 +446,10 @@ Window {
|
|||
}
|
||||
}
|
||||
|
||||
Accessible.role: Accessible.ButtonMenu
|
||||
Accessible.name: qsTr("More apps")
|
||||
Accessible.onPressAction: trayWindowAppsButton.clicked()
|
||||
|
||||
Menu {
|
||||
id: appsMenu
|
||||
y: (trayWindowAppsButton.y + trayWindowAppsButton.height + 2)
|
||||
|
@ -413,6 +463,9 @@ Window {
|
|||
radius: 2
|
||||
}
|
||||
|
||||
Accessible.role: Accessible.PopupMenu
|
||||
Accessible.name: qsTr("Apps menu")
|
||||
|
||||
Instantiator {
|
||||
id: appsMenuInstantiator
|
||||
model: UserAppsModel
|
||||
|
@ -437,6 +490,10 @@ Window {
|
|||
color: appEntry.hovered ? Style.lightHover : "transparent"
|
||||
}
|
||||
}
|
||||
|
||||
Accessible.role: Accessible.MenuItem
|
||||
Accessible.name: qsTr("Open ") + appName + qsTr(" in browser")
|
||||
Accessible.onPressAction: appEntry.triggered()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -456,6 +513,11 @@ Window {
|
|||
id: listViewScrollbar
|
||||
}
|
||||
|
||||
keyNavigationEnabled: true
|
||||
|
||||
Accessible.role: Accessible.List
|
||||
Accessible.name: qsTr("Activity list")
|
||||
|
||||
model: activityModel
|
||||
|
||||
delegate: RowLayout {
|
||||
|
@ -465,6 +527,11 @@ Window {
|
|||
height: Style.trayWindowHeaderHeight
|
||||
spacing: 0
|
||||
|
||||
Accessible.role: Accessible.ListItem
|
||||
Accessible.name: path !== "" ? qsTr("Open") + " " + displayPath + " " + qsTr("locally")
|
||||
: message
|
||||
Accessible.onPressAction: activityMouseArea.clicked()
|
||||
|
||||
MouseArea {
|
||||
id: activityMouseArea
|
||||
enabled: (path !== "" || link !== "")
|
||||
|
@ -573,6 +640,10 @@ Window {
|
|||
ToolTip.delay: 1000
|
||||
ToolTip.text: qsTr("Open share dialog")
|
||||
onClicked: Systray.openShareDialog(displayPath,absolutePath)
|
||||
|
||||
Accessible.role: Accessible.Button
|
||||
Accessible.name: qsTr("Share") + " " + displayPath
|
||||
Accessible.onPressAction: shareButton.clicked()
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue