Skip to content

Ask to overwrite on importing duplicate resource file

Before this commit, Krita wouldn't ask whether the user wants to overwrite the resource or not. The import would just fail. This commit adds a question dialog.

Test Plan

Test 1

  1. Create a resource to import. It can be any resource type (of those that have their own files, as in, not layer styles for example). Or use this: Stupid_little_preset.kpp
  2. Import a resource. (Make sure to remove the previous resource first, if you created it in your resource folder; using a temporary empty resource folder is a good idea here).
  3. Potentially: create multiple versions of the resource (make different thumbnails to easier see it in the folder!). Check the database (using DB Browser for SQLite, for example) if you have all versions in the versioned_resources table and the resources table. Note which id the resource has.
  4. Import a different resource with the same name, for example this: Stupid_little_preset.kpp
  5. Answer "yes" to the overwrite dialog.
  6. Note that (1) all traces of the previous resource disappeared from the database; (2) the new resource was added to the database; (3) all of the old versions of the old resources disappeared; (4) the new resource was added to the resource folder.

Test 2

  1. Create a resource to import. It can be any resource type (of those that have their own files, as in, not layer styles for example). Or use this: Stupid_little_preset.kpp
  2. Import a resource. (Make sure to remove the previous resource first, if you created it in your resource folder; using a temporary empty resource folder is a good idea here).
  3. Potentially: create multiple versions of the resource (make different thumbnails to easier see it in the folder!). Check the database (using DB Browser for SQLite, for example) if you have all versions in the versioned_resources table and the resources table. Note which id the resource has.
  4. Import the same resource.
  5. Note that nothing happens; the same resource is used (old behaviour, before this MR).

Formalities Checklist

  • I confirmed this builds.
  • I confirmed Krita ran and the relevant functions work.
  • I tested the relevant unit tests and can confirm they are not broken. (If not possible, don't hesitate to ask for help!)
  • I made sure my commits build individually and have good descriptions as per KDE guidelines.
  • I made sure my code conforms to the standards set in the HACKING file.
  • I can confirm the code is licensed and attributed appropriately, and that unattributed code is mine, as per KDE Licensing Policy.
Edited by Agata Cacko

Merge request reports