Skip to content

Commit

Permalink
Close dashboard when opening cloud popup, cleanup dashboard signals
Browse files Browse the repository at this point in the history
  • Loading branch information
nirvn committed Jan 21, 2025
1 parent 556d25c commit e061855
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 18 deletions.
27 changes: 14 additions & 13 deletions src/qml/DashBoard.qml
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@ Drawer {
id: dashBoard
objectName: "dashBoard"

signal showMenu
signal showCloudMenu
signal showMainMenu(point p)
signal showPrintLayouts(point p)
signal showCloudPopup
signal showProjectFolder
signal toggleMeasurementTool
signal returnHome
signal measurementClicked
signal printClicked(Item item)
signal projectFolderClicked

property bool allowInteractive: true
property alias allowActiveLayerChange: legend.allowActiveLayerChange
Expand Down Expand Up @@ -47,9 +47,6 @@ Drawer {
focus: visible
clip: true

onShowMenu: mainMenu.popup(menuButton.x + menuButton.width - mainMenu.width - 2, menuButton.y - 2)
onShowCloudMenu: qfieldCloudPopup.show()

onActiveLayerChanged: {
if (activeLayer && activeLayer.readOnly && stateMachine.state == "digitize")
displayToast(qsTr("The layer %1 is read only.").arg(activeLayer.name));
Expand Down Expand Up @@ -120,7 +117,7 @@ Drawer {
iconColor: Theme.mainOverlayColor
bgcolor: "transparent"
onClicked: {
measurementClicked();
toggleMeasurementTool();
highlighted = false;
}
}
Expand All @@ -132,7 +129,8 @@ Drawer {
iconSource: Theme.getThemeVectorIcon("ic_print_black_24dp")
iconColor: Theme.mainOverlayColor
onClicked: {
printClicked(printItem);
const p = mapToItem(mainWindow.contentItem, 0, 0);
showPrintLayouts(p);
highlighted = false;
}
}
Expand Down Expand Up @@ -183,7 +181,7 @@ Drawer {
if (featureForm.visible) {
featureForm.hide();
}
showCloudMenu();
showCloudPopup();
}
bottomRightIndicatorText: cloudProjectsModel.layerObserver.deltaFileWrapper.count > 0 ? cloudProjectsModel.layerObserver.deltaFileWrapper.count : cloudProjectsModel.layerObserver.deltaFileWrapper.count >= 10 ? '+' : ''

Expand Down Expand Up @@ -217,7 +215,7 @@ Drawer {
iconColor: Theme.mainOverlayColor
round: true
onClicked: {
projectFolderClicked();
showProjectFolder();
}
}
}
Expand All @@ -230,7 +228,10 @@ Drawer {
iconSource: Theme.getThemeVectorIcon('ic_dot_menu_black_24dp')
iconColor: Theme.mainOverlayColor
bgcolor: "transparent"
onClicked: showMenu()
onClicked: {
let p = mapToItem(mainWindow.contentItem, width, 0);
showMainMenu(p)
}
}
}

Expand Down
19 changes: 14 additions & 5 deletions src/qml/qgismobileapp.qml
Original file line number Diff line number Diff line change
Expand Up @@ -2331,18 +2331,27 @@ ApplicationWindow {
}
}

onMeasurementClicked: {
onShowMainMenu: p => {
mainMenu.popup(p.x- mainMenu.width - 2, p.y - 2)
}

onShowCloudPopup: {
dashBoard.close();
qfieldCloudPopup.show()
}

onToggleMeasurementTool: {
if (featureForm.state === "ProcessingAlgorithmForm") {
cancelAlgorithmDialog.visible = true;
} else {
activateMeasurementMode();
}
}

onPrintClicked: printItem => {
onShowPrintLayouts: p => {
if (layoutListInstantiator.count > 1) {
printMenu.popup(mainMenu.x, mainMenu.y + printItem.y);
} else if (layoutListInstantiator.count == 1) {
printMenu.popup(p.x, p.y);
} else if (layoutListInstantiator.count === 1) {
mainMenu.close();
displayToast(qsTr('Printing...'));
printMenu.printName = layoutListInstantiator.model.titleAt(0);
Expand All @@ -2355,7 +2364,7 @@ ApplicationWindow {
}
}

onProjectFolderClicked: {
onShowProjectFolder: {
dashBoard.close();
qfieldLocalDataPickerScreen.projectFolderView = true;
qfieldLocalDataPickerScreen.model.resetToPath(projectInfo.filePath);
Expand Down

0 comments on commit e061855

Please sign in to comment.