MerginMaps / qgis-plugin

QGIS plugin for managing Mergin Maps projects
GNU General Public License v3.0
35 stars 13 forks source link

Updating QSettings variables #162

Open sklencar opened 4 years ago

sklencar commented 4 years ago

Lets have a mergin project and its local copy on a disc. Either a) a mergin project has been deleted from a web, b) a local copy has been deleted from a disk, a localProjects/<namespace>/<name> is kept in QSettings.

Therefore in a case a) it is causing a problem of uploading the same project folder back on Mergin as a new project (not sure if a bug or feature) due to having .mergin folder and probably a QSettings variable. It may cause other weird, but rather edge use cases issues.

wonder-sk commented 3 years ago

Related to #110

jelzo commented 2 months ago

I encountered a bug regarding this issue.

Description When uploading a new project with a name matching a deleted project but a different server, you will not be able to sync this project. It seems like the sync button is only looking for the first matching project name in the QSettings, disregarding the namespace. Thus, the project will be looking for the old server url.

Symptoms It will produce the following error:

Current project was created for another Mergin Maps server.

[old url, not existing in the plugin configuration]

You need to reconfigure Mergin Maps plugin to syncronize the project.

Screenshot bug

Steps to reproduce Load a project from server1 and delete it, then delete the project from QGIS. Create a project with the same name on server2, reconfigure the plugin and download the new project. When you try to sync this project, it will be trying to sync to the server1 url (which is still existent in the QSettings).

Environment QGIS 3.28.15-Firenze Python 3.9.18

Temporary workaround Delete the old project settings from Extra > Options > Advanced > Mergin/localProjects//

jelzo commented 2 months ago

Related to #307#issuecomment-1065241147

jelzo commented 2 months ago

Also, when removing the plugin entirely, QSettings are not cleared. When reinstalling the plugin and using projects with the same name, unexpected behaviour is observed. The plugin is missing the following code in the unload method of the plugin around line 547: QSettings().remove("Mergin")