diff --git a/src/core/utils/qfieldcloudutils.h b/src/core/utils/qfieldcloudutils.h index 2e05af263c..38ab644527 100644 --- a/src/core/utils/qfieldcloudutils.h +++ b/src/core/utils/qfieldcloudutils.h @@ -112,7 +112,7 @@ class QFieldCloudUtils : public QObject static const QMultiMap getPendingAttachments(); //! Adds an \a fileName for a given \a projectId to the pending attachments list - static void addPendingAttachment( const QString &projectId, const QString &fileName ); + Q_INVOKABLE static void addPendingAttachment( const QString &projectId, const QString &fileName ); //! Adds removes a \a fileName for a given \a projectId to the pending attachments list static void removePendingAttachment( const QString &projectId, const QString &fileName ); diff --git a/src/qml/QFieldLocalDataPickerScreen.qml b/src/qml/QFieldLocalDataPickerScreen.qml index bfa109cce2..11eea830c9 100644 --- a/src/qml/QFieldLocalDataPickerScreen.qml +++ b/src/qml/QFieldLocalDataPickerScreen.qml @@ -128,12 +128,8 @@ Page { property int itemType: ItemType property string itemTitle: ItemTitle property string itemPath: ItemPath - property bool itemMenuLoadable: !projectFolderView && - (ItemMetaType === LocalFilesModel.Project || ItemMetaType === LocalFilesModel.Dataset) - property bool itemMenuVisible: (platformUtilities.capabilities & PlatformUtilities.CustomExport || - platformUtilities.capabilities & PlatformUtilities.CustomSend) && - (ItemMetaType === LocalFilesModel.Dataset - || (ItemType === LocalFilesModel.SimpleFolder && table.model.currentPath !== 'root')) + property bool itemMenuLoadable: !projectFolderView && (ItemMetaType === LocalFilesModel.Project || ItemMetaType === LocalFilesModel.Dataset) + property bool itemMenuVisible: ((platformUtilities.capabilities & PlatformUtilities.CustomExport || platformUtilities.capabilities & PlatformUtilities.CustomSend) && (ItemMetaType === LocalFilesModel.Dataset || (ItemType === LocalFilesModel.SimpleFolder && table.model.currentPath !== 'root'))) || (ItemMetaType === LocalFilesModel.Dataset && ItemType === LocalFilesModel.RasterDataset && cloudProjectsModel.currentProjectId) width: parent ? parent.width : undefined height: line.height @@ -392,6 +388,24 @@ Page { onTriggered: { platformUtilities.sendDatasetTo(itemMenu.itemPath); } } + MenuItem { + id: pushDatasetToCloud + enabled: itemMenu.itemMetaType == LocalFilesModel.Dataset && itemMenu.itemType == LocalFilesModel.RasterDataset && cloudProjectsModel.currentProjectId + visible: enabled + + font: Theme.defaultFont + width: parent.width + height: enabled ? undefined : 0 + leftPadding: Theme.menuItemLeftPadding + + text: qsTr("Push to QFieldCloud...") + onTriggered: { + QFieldCloudUtils.addPendingAttachment(cloudProjectsModel.currentProjectId, itemMenu.itemPath); + platformUtilities.uploadPendingAttachments(cloudConnection); + displayToast(qsTr("‘%1’ is being uploaded to QFieldCloud").arg(FileUtils.fileName(itemMenu.itemPath))); + } + } + MenuItem { id: exportDatasetTo enabled: platformUtilities.capabilities & PlatformUtilities.CustomExport