Skip to content
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

Fix LocalModification flag not properly restored when opening a cloud project prior successfully logging into the server #5711

Merged
merged 1 commit into from
Oct 3, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 17 additions & 9 deletions src/core/qfieldcloudprojectsmodel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,15 +57,6 @@ QFieldCloudProjectsModel::QFieldCloudProjectsModel()
refreshProjectModification( mCurrentProjectId );
} );

connect( this, &QFieldCloudProjectsModel::modelReset, this, [=]() {
if ( mCurrentProjectId.isEmpty() || !findProject( mCurrentProjectId ) )
return;

emit currentProjectDataChanged();

refreshProjectModification( mCurrentProjectId );
} );

connect( this, &QFieldCloudProjectsModel::dataChanged, this, [=]( const QModelIndex &topLeft, const QModelIndex &bottomRight, const QVector<int> &roles ) {
Q_UNUSED( bottomRight )
Q_UNUSED( roles )
Expand Down Expand Up @@ -338,9 +329,13 @@ bool QFieldCloudProjectsModel::canSyncProject( const QString &projectId ) const
return false;

if ( mCurrentProjectId.isEmpty() )
{
return false;
}
else if ( projectStatus( projectId ) == ProjectStatus::Idle )
{
return true;
}

return false;
}
Expand Down Expand Up @@ -1297,10 +1292,14 @@ void QFieldCloudProjectsModel::projectUpload( const QString &projectId, const bo
}

if ( !( project->modification & LocalModification ) )
{
return;
}

if ( !mLayerObserver->deltaFileWrapper()->toFile() )
{
return;
}

if ( deltaFileWrapper->hasError() )
{
Expand Down Expand Up @@ -1714,6 +1713,15 @@ void QFieldCloudProjectsModel::projectListReceived()
{
refreshProjectsList( isPublic, projectFetchOffset + mProjectsPerFetch );
}
else
{
// All projects fetched, refresh current project details if found
if ( !mCurrentProjectId.isEmpty() && findProject( mCurrentProjectId ) )
{
emit currentProjectDataChanged();
refreshProjectModification( mCurrentProjectId );
}
}
}

NetworkReply *QFieldCloudProjectsModel::downloadFile( const QString &projectId, const QString &fileName )
Expand Down
Loading