-
-
Notifications
You must be signed in to change notification settings - Fork 278
Allow QFieldCloud to access Project folder view without opening Project #6647
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weβll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 11 commits
802971b
ca9d564
ff0f79b
b84bc0d
adb2109
797beb0
0df0e1b
7bc5b4e
a8a5d45
39f9314
c23c6a7
6de52d3
fce9b82
291008f
987cb75
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -445,6 +445,23 @@ Page { | |
bottomMargin: sceneBottomMargin | ||
paddingMultiplier: 2 | ||
|
||
MenuItem { | ||
id: viewFile | ||
|
||
enabled: itemMenu.itemMetaType != LocalFilesModel.Folder | ||
nirvn marked this conversation as resolved.
Show resolved
Hide resolved
|
||
visible: enabled | ||
|
||
font: Theme.defaultFont | ||
width: parent.width | ||
height: enabled ? 48 : 0 | ||
leftPadding: Theme.menuItemLeftPadding | ||
|
||
text: qsTr("View file") | ||
onTriggered: { | ||
platformUtilities.open(itemMenu.itemPath); | ||
} | ||
} | ||
|
||
// File items | ||
MenuItem { | ||
id: sendDatasetTo | ||
|
@@ -464,7 +481,7 @@ Page { | |
|
||
MenuItem { | ||
id: pushDatasetToCloud | ||
enabled: (itemMenu.itemMetaType == LocalFilesModel.Dataset && itemMenu.itemType == LocalFilesModel.RasterDataset && cloudProjectsModel.currentProjectId) || (itemMenu.itemMetaType == LocalFilesModel.Folder && itemMenu.itemWithinQFieldCloudProjectFolder) | ||
enabled: (itemMenu.itemMetaType == LocalFilesModel.File) || (itemMenu.itemMetaType == LocalFilesModel.Dataset && itemMenu.itemType == LocalFilesModel.RasterDataset && cloudProjectsModel.currentProjectId) || (itemMenu.itemMetaType == LocalFilesModel.Folder && itemMenu.itemWithinQFieldCloudProjectFolder) | ||
nirvn marked this conversation as resolved.
Show resolved
Hide resolved
|
||
visible: enabled | ||
|
||
font: Theme.defaultFont | ||
|
@@ -474,9 +491,9 @@ Page { | |
|
||
text: qsTr("Push to QFieldCloud") | ||
onTriggered: { | ||
QFieldCloudUtils.addPendingAttachments(projectInfo.cloudUserInformation.username, cloudProjectsModel.currentProjectId, [itemMenu.itemPath], cloudConnection, true); | ||
platformUtilities.uploadPendingAttachments(cloudConnection); | ||
displayToast(qsTr("β%1β is being uploaded to QFieldCloud").arg(FileUtils.fileName(itemMenu.itemPath))); | ||
pushFilesToQFieldCloudConnection.enabled = true; | ||
pushFilesToQFieldCloudConnection.sendingItem = true; | ||
QFieldCloudUtils.addPendingAttachments(cloudConnection.userInformation.username, QFieldCloudUtils.getProjectId(table.model.currentPath), [itemMenu.itemPath], cloudConnection, true); | ||
} | ||
} | ||
|
||
|
@@ -862,9 +879,8 @@ Page { | |
} | ||
} | ||
if (fileNames.length > 0) { | ||
QFieldCloudUtils.addPendingAttachments(projectInfo.cloudUserInformation.username, cloudProjectsModel.currentProjectId, fileNames, cloudConnection, true); | ||
platformUtilities.uploadPendingAttachments(cloudConnection); | ||
localFilesModel.clearSelection(); | ||
pushFilesToQFieldCloudConnection.enabled = true; | ||
QFieldCloudUtils.addPendingAttachments(cloudConnection.userInformation.username, QFieldCloudUtils.getProjectId(table.model.currentPath), fileNames, cloudConnection, true); | ||
} else { | ||
displayToast(qsTr("Please select one or more files to push to QFieldCloud.")); | ||
} | ||
|
@@ -873,6 +889,25 @@ Page { | |
} | ||
} | ||
|
||
Connections { | ||
id: pushFilesToQFieldCloudConnection | ||
enabled: false | ||
target: cloudConnection | ||
|
||
property bool sendingItem: false | ||
|
||
function onPendingAttachmentsAdded() { | ||
platformUtilities.uploadPendingAttachments(cloudConnection); | ||
if (pushFilesToQFieldCloudConnection.sendingItem) { | ||
displayToast(qsTr("β%1β is being uploaded to QFieldCloud").arg(FileUtils.fileName(itemMenu.itemPath))); | ||
pushFilesToQFieldCloudConnection.sendingItem = false; | ||
} else { | ||
localFilesModel.clearSelection(); | ||
} | ||
Comment on lines
904
to
907
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't understand this logic. Whether we push a single file or a folder, we'll end up wanting the toaster message in. Am I missing something due to jet lag? :) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Exactly! I didnβt want to change the logic we already had, but I also think the toast should be shown for both cases. It wasnβt happening before, but Iβll fix it in an upcoming commit. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. So, we need 2 different toast messages:
Also, we only need to clear the selection when sending multiple items, so I tweaked the logic a bit. Do you see a better approach here? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. also, are you happy with enabling - disabling the |
||
pushFilesToQFieldCloudConnection.enabled = false; | ||
} | ||
} | ||
|
||
QfDialog { | ||
id: importUrlDialog | ||
title: qsTr("Import URL") | ||
|
Uh oh!
There was an error while loading. Please reload this page.