Currently, we store the "untagged image" tag in ~/.config/kphotoalbum.rc. This leads to the fact that, in a multi-user environment, each user could choose their own untagged image tag. As this setting is hard-linked to a tag present in the database, it should somehow also be stored there, so that each user always sees the same tag and functionality. Also, this way, we could ensure that the respective tag is set and present whilst creating a new database or configuring KPA to use an existing one. In my case, I has a non-standard untagged images tag set, which is of course present in the database, but when setting up another machine to use the same database, KPA complains about the untagged images tag not being present on the first startup as it will try to use the default one.
What about this: We introduce a new tag <sharedSettings> or such. Which holds key-value settings like <setting key="..." value="..."/>. Along with this, we introduce a new SharedSettings class that will hold those values. When reading the database, everything in the sharedSettings tag is put in the SharedSettings object, which will hold a simple QHash<QString, QVariant> map with those values. In the header, we define a list of all possible keys. When the XML database is saved, the SharedSettings object's content is dumped into the <sharedSettings> tag. This way, we would get a general-purpose infrastructure for a third kind of settings/data storage that can be used where it's needed and will be shared across different KPA instances/installations using the same database.
There is a task on the phabricator workboard for this exact issue: https://phabricator.kde.org/T12933 Short story: yes, you are right, this should be stored within the database file. IMO the information, which tag is used for the untagged image feature is not really a (shared) setting, but a property of the data itself (much like the tokens category being handled specially). That's why I would favor the same approach taken with the tokens category, adding a 'meta="mark-untagged"' attribute or similar. When I added the task, I hoped to be faster with the refactoring and therefore be able to postpone the implementation until the database was better isolated. OTOH this change is not really that hard, so I'm not against implementing this before The Great Refactoring(tm).
Well, this approach would also work, as whilst reading the database, we have to read through all tags anyway, and thus can identify the untagged images tag. Anyway, to keep the current functionality, a "meta='untagged'" structure is not sufficient, as the user can choose whether the tag should be visible or not. Either, we extend this (e.g. store some JSON key-value data inside that meta property or such), or we remove the setting and decide that the untagged images tag should always be hidden. If we always hide the untagged images tag, the benefit would be we can simply generate any name (e.g. an UUID or such) for it and don't have to mess too much with possible collisions.
IMO the decision whether to hide the untagged tag is a user preference. If you share the database with someone else, they might want to hide the tag, while you may want to see it. If you conflate that with the tag itself, you end up with edit-wars of two people who constantly change the setting and get annoyed that the setting randomly gets lost whenever the other person saves the database... As far as always hiding the tag is concerned: I don't like that at all. This would mean that I have to mark images as untagged by hand again, which seems pointless given that KPA clearly has the required data in the database but just won't tell me...
Okay, so then, you would just mark the tag as the "untagged images" tag inside index.xml and put the "visible" setting in kphotoalbumrc, right? Seems reasonable.
Git commit dc9b1b199a33b94d22078f23248d83c6e41009f6 by Johannes Zarl-Zierl. Committed on 24/11/2022 at 21:44. Pushed by johanneszarl into branch 'master'. Update Changelog M +1 -0 CHANGELOG.md https://invent.kde.org/graphics/kphotoalbum/commit/dc9b1b199a33b94d22078f23248d83c6e41009f6
Git commit d7eef7845b9e6b01d72c656bebd8cf8103b17430 by Johannes Zarl-Zierl. Committed on 26/11/2022 at 13:56. Pushed by johanneszarl into branch 'master'. Fix regression leading to incorrect untagged tag settings. As introduced in 1499e4482d980166ef80dee64cdb1147be857a69, the untagged tag settings data was incorrectly saved as a database-specific value instead of a global configuration value. This commit restores the old behaviour. M +4 -4 lib/kpabase/SettingsData.cpp https://invent.kde.org/graphics/kphotoalbum/commit/d7eef7845b9e6b01d72c656bebd8cf8103b17430