Skip to content

Conversation

mohsenD98
Copy link
Collaborator

@mohsenD98 mohsenD98 commented Sep 13, 2025

🚀 Description

This pull request enhances QFieldCloud by enabling access to the Project folder view without opening the project. It also adds confirmation when deleting projects and introduces file viewing directly from the folder view.

✨ Key Changes

  • Folder view: Added support for accessing the folder view independently of the project's open state.
  • Confirmation: Implemented a delete confirmation dialog to prevent accidental deletions.
  • File viewing: Introduced a "View file" option for directly previewing files.

Demo

Screencast.From.2025-09-13.16-46-47.webm

@mohsenD98 mohsenD98 self-assigned this Sep 13, 2025
@duke-nyuki
Copy link

@qfield-fairy
Copy link
Collaborator

qfield-fairy commented Sep 13, 2025

@mohsenD98 mohsenD98 force-pushed the QF-6684_cloud-project-folder-view branch from f71aea5 to c108993 Compare September 14, 2025 12:31

text: qsTr("View Project Folder")
onTriggered: {
cloudProjectsModel.currentProjectId = QFieldCloudUtils.getProjectId(projectActions.projectLocalPath);
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@nirvn , i set this because i need project id to push in qfc.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh no, this should not happen here, worlds will collide. Let's work out a better solution.

MenuItem {
id: viewFile

enabled: itemMenu.itemMetaType != LocalFilesModel.Folder
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@nirvn , is this condition enough?

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)
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@nirvn , Here i am not sure about (itemMenu.itemMetaType == LocalFilesModel.File) ||

@mohsenD98 mohsenD98 marked this pull request as ready for review September 16, 2025 09:59
Comment on lines +857 to +860
if ( httpCode == 201 )
{
qInfo() << QStringLiteral( "Upload succeeded for %1" ).arg( fileName );
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's get rid of t his

void providerConfigurationChanged();
void userInformationChanged();
void pendingAttachmentsUploadFinished();
void allAttachmentsWritten();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
void allAttachmentsWritten();
void pendingAttachmentsAdded();


text: qsTr("View Project Folder")
onTriggered: {
cloudProjectsModel.currentProjectId = QFieldCloudUtils.getProjectId(projectActions.projectLocalPath);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh no, this should not happen here, worlds will collide. Let's work out a better solution.

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)));
QFieldCloudUtils.addPendingAttachments(cloudConnection.userInformation.username, cloudProjectsModel.currentProjectId, [itemMenu.itemPath], cloudConnection, true);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, you'll need to change the cloudProjectsModel.currentProjectId to something like:

QFieldCloudUtils.getProjectId(projectActions.projectLocalPath)

And insure that the getProjectId() function there supports children path to a parent cloud project.

Comment on lines +495 to +499
cloudConnection.onAllAttachmentsWritten.connect(function handler() {
platformUtilities.uploadPendingAttachments(cloudConnection);
displayToast(qsTr("‘%1’ is being uploaded to QFieldCloud").arg(FileUtils.fileName(itemMenu.itemPath)));
cloudConnection.onAllAttachmentsWritten.disconnect(handler);
});
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think I'd rather have a Connections { target: cloudConnection; enabled: false; function onAllAttachment... } QML item instead of this javascript driven option. Thoughts?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants