mirror of
https://github.com/nextcloud/desktop.git
synced 2024-10-24 13:25:52 +03:00
Merge pull request #2417 from nextcloud/fix_menu_popup_in_main_dialog
Fix menu popup in main dialog
This commit is contained in:
commit
14993d4de6
3 changed files with 21 additions and 25 deletions
|
@ -43,7 +43,7 @@ MenuItem {
|
|||
|
||||
background: Item {
|
||||
height: parent.height
|
||||
width: parent.menu.width
|
||||
width: userLine.menu ? userLine.menu.width : 0
|
||||
Rectangle {
|
||||
anchors.fill: parent
|
||||
anchors.margins: 1
|
||||
|
@ -123,9 +123,12 @@ MenuItem {
|
|||
id: userMoreButtonMouseArea
|
||||
anchors.fill: parent
|
||||
hoverEnabled: true
|
||||
onClicked:
|
||||
{
|
||||
userMoreButtonMenu.popup()
|
||||
onClicked: {
|
||||
if (userMoreButtonMenu.visible) {
|
||||
userMoreButtonMenu.close()
|
||||
} else {
|
||||
userMoreButtonMenu.popup()
|
||||
}
|
||||
}
|
||||
}
|
||||
background:
|
||||
|
@ -139,6 +142,7 @@ MenuItem {
|
|||
Menu {
|
||||
id: userMoreButtonMenu
|
||||
width: 120
|
||||
closePolicy: Menu.CloseOnPressOutsideParent | Menu.CloseOnEscape
|
||||
|
||||
background: Rectangle {
|
||||
border.color: Style.menuBorder
|
||||
|
|
|
@ -654,9 +654,6 @@ Q_INVOKABLE void UserModel::openCurrentAccountTalk()
|
|||
|
||||
Q_INVOKABLE void UserModel::openCurrentAccountServer()
|
||||
{
|
||||
// Don't open this URL when the QML appMenu pops up on click (see Window.qml)
|
||||
if (appList().count() > 0)
|
||||
return;
|
||||
if (_users.isEmpty())
|
||||
return;
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@ import QtQml 2.1
|
|||
import QtQml.Models 2.1
|
||||
import QtQuick 2.9
|
||||
import QtQuick.Window 2.3
|
||||
import QtQuick.Controls 2.2
|
||||
import QtQuick.Controls 2.3
|
||||
import QtQuick.Layouts 1.2
|
||||
import QtGraphicalEffects 1.0
|
||||
|
||||
|
@ -147,7 +147,11 @@ Window {
|
|||
// exactly below the dropdown button, not the mouse
|
||||
onClicked: {
|
||||
syncPauseButton.text = Systray.syncIsPaused() ? qsTr("Resume sync for all") : qsTr("Pause sync for all")
|
||||
accountMenu.open()
|
||||
if (accountMenu.visible) {
|
||||
accountMenu.close()
|
||||
} else {
|
||||
accountMenu.open()
|
||||
}
|
||||
}
|
||||
|
||||
Menu {
|
||||
|
@ -160,7 +164,7 @@ Window {
|
|||
|
||||
width: (Style.currentAccountButtonWidth - 2)
|
||||
height: Math.min(implicitHeight, maxMenuHeight)
|
||||
closePolicy: "CloseOnPressOutside"
|
||||
closePolicy: Menu.CloseOnPressOutsideParent | Menu.CloseOnEscape
|
||||
|
||||
background: Rectangle {
|
||||
border.color: Style.menuBorder
|
||||
|
@ -387,22 +391,13 @@ Window {
|
|||
id: trayWindowAppsButton
|
||||
icon.source: "qrc:///client/theme/white/more-apps.svg"
|
||||
onClicked: {
|
||||
/*
|
||||
// The count() property was introduced in QtQuick.Controls 2.3 (Qt 5.10)
|
||||
// so we handle this with UserModel.openCurrentAccountServer()
|
||||
//
|
||||
// See UserModel::openCurrentAccountServer() to disable this workaround
|
||||
// in the future for Qt >= 5.10
|
||||
|
||||
if(appsMenu.count() > 0) {
|
||||
appsMenu.popup();
|
||||
if(appsMenu.count <= 0) {
|
||||
UserModel.openCurrentAccountServer()
|
||||
} else if (appsMenu.visible) {
|
||||
appsMenu.close()
|
||||
} else {
|
||||
UserModel.openCurrentAccountServer();
|
||||
appsMenu.open()
|
||||
}
|
||||
*/
|
||||
|
||||
appsMenu.open();
|
||||
UserModel.openCurrentAccountServer();
|
||||
}
|
||||
|
||||
Menu {
|
||||
|
@ -411,7 +406,7 @@ Window {
|
|||
readonly property Item listContentItem: contentItem.contentItem
|
||||
width: Math.min(listContentItem.childrenRect.width + 4, Style.trayWindowWidth / 2)
|
||||
height: Math.min(implicitHeight, maxMenuHeight)
|
||||
closePolicy: "CloseOnPressOutside"
|
||||
closePolicy: Menu.CloseOnPressOutsideParent | Menu.CloseOnEscape
|
||||
|
||||
background: Rectangle {
|
||||
border.color: Style.menuBorder
|
||||
|
|
Loading…
Reference in a new issue