1. Open Template Manager (Ctrl+Shift+N) 2. (need to have at least one non-predefined template). If not, create one. 3. Right-click non-predefined template, choose Rename, and enter a name of another already existing template. Result: Nothing happens. Enhancement request: Give some kind of feedback to explain, for example, that template name already exists -- and ideally -- to leave the Rename dialog open (so that it is not necessary to reopen it).
What is a non-predefined template?
(In reply to Heiko Tietze from comment #1) > What is a non-predefined template? User-defined. Stored in {user profile}, not in {install}/share/template/common
I can rename the user-defined template to "CV", for example.
(In reply to Heiko Tietze from comment #3) > I can rename the user-defined template to "CV", for example. Was there already a CV template in the same directory? See Step 3: "...enter a name of another already existing template".
CV is among the shipped templates. I start from Writer and use Documents for filter and "All Categories". Version: 6.4.7.2 Build ID: 6.4.7-6 CPU threads: 8; OS: Linux 5.9; UI render: default; VCL: kf5; Locale: de-DE (en_US.UTF-8); UI-Language: en-US Calc: threaded
Created attachment 168194 [details] Illustration of problem situation Please see attached screenshot of a Template Manager. It should be clear that in that image that Template1 is selected, rename dialog is open, and just about to (attempt) to rename Template1 to "temp" (which already exists in the same category). When I click OK in that scenario - nothing happens - and no warning/failure message is given.
Created attachment 168195 [details] Screencast Testing with 6.4 on Linux/kf5
(In reply to Heiko Tietze from comment #7) > Screencast Critical difference: Your Screencast example uses "All Categories" Presumably CV is in "share" directory while "test" is in "userprofile" directory. See screenshot in attachment 168194 [details] -- all in the same Category (directory). I predict that will resolve the "mystery" -- and then the original report will make sense.
If renaming the templates effects the actual file name we should definitely give a warning or better avoid by setting the warning text type.
(In reply to Heiko Tietze from comment #9) > If renaming the templates effects the actual file name afaict, no. The change is to File-Properties-Description-Title. Is this the relevant piece of code? https://opengrok.libreoffice.org/xref/core/sfx2/source/control/templatelocalview.cxx?r=b541cd9a#189 Possibly we are getting "cheated" by the (lack of) "refresh" problem. If you can reproduce the following, then I am going to stop trying to figure out "empirically" what is going on. 1. "New Category" with one user-defined template in it. 2. Rename template to "alpha" (shows "alpha") 3. Change Category to "All Categories", then back to "New Category" (shows previous template name) 4. Settings>Refresh (in "New Category") (still shows previous name) 5. Change to "All Categories" and back to "New Category" (shows "alpha") But I think/hope this example reveals to a developer where "refresh" and "canvas" update has to take place.
(In reply to sdc.blanco from comment #10) > 5. Change to "All Categories" and back to "New Category" > (shows "alpha") New and All are the same unless I pick some other which makes All empty. Totally broken. IMHO, we should wait for the Refresh patch.
Actually I'm much afraid of all these functions. I added my Download folder (use it as a temp directory) to the templates path. All sub folders are shown as categories (makes sense) but Delete Category asks whether the folder should be deleted. I'm not going to say yes here and strongly disagree with the mixture of internal and file system operations.
(In reply to Heiko Tietze from comment #11) > New and All are the same unless I pick some other which makes All empty. I think you repro'ed, plus found another? > Totally broken. IMHO, we should wait for the Refresh patch. Agreed. NB - this bug report is only about need for feedback when a template could not be renamed. afaik, there is no "generic" bug report about "need to review refresh in template manager" (or something like that) -- your recent report and BogdanB's about deleting categories only reported specific symptoms of the problem, with my "refresh" query added on in each case to localize the problem. (In reply to Heiko Tietze from comment #12) > added my Download folder > All sub folders are shown as categories (makes sense) I did the same once from Document root. In Windows, it takes a long time to load. > but Delete Category asks whether the folder should be deleted. Good point! In such situations, "Rename Category" will also have less than optimal effect.
(In reply to Heiko Tietze from comment #12) > Delete Category asks whether the folder should be deleted. > I'm not going to say yes here The result would depend on what was set as "Default" path in your Options (Alt-F12) If your download directory was Default, then the subdirectory and its file contents would be deleted. If the default was still the default user profile directory (4/user/template), you would have gotten an error message saying that the folder could not be deleted. The present UI is deviously misleading -- unless you happen to notice that the confirmation message says "do you want to delete the folder" and you know that "folder" is referring to your filesystem. Presumably the innocent user believes that deleting a "category" means that the category name is dropped, while the templates in the category go back to the "My Templates" category -- but it is a false presumption. The proper label for the current action of "Delete Category" is: "Delete Category and all other files, templates or not, in that Category, if the Category is in the "Default Path" set in Options" (ouch!) Conversely, if the Category is not in the Default Path, then you cannot delete the category in Template Manager -- even if the subdirectory is empty. > strongly disagree with the mixture of internal and file system operations. Could "category" be a custom <meta> tag in a template? (similar to "Title", which is used for template name)? Pro: delete/rename category does not change filesystem. Con: Have to update tag in all template files in a category if category is renamed or deleted. Hijacking my own bug: changing summary to general reworking of Category system.
(In reply to sdc.blanco from comment #13) > In such situations, "Rename Category" will also have less than > optimal effect. Correction. 1. Manually creating a subdirectory in a User Path results in the subdirectory name appearing as a Category. 2. Similarly, using "Create Category" (in TM) creates subdirectory with same name. Thereafter.... 3. changes to existing category names (i.e., "rename") are recorded in groupuinames.xml (in the default path directory) -- the directory name in the filesystem is not changed. 4. But! -- if you delete a category name, the behavior in comment 14 still applies. That is, the subdirectory will be deleted. For example. 1. Make subdirectory (see that it appears in TM as category) 2. Rename category (see that groupuinames.xml records change, but directory name stays the same) 3. Delete (renamed category) (see that subdirectory -- with name that is mapped in groupuinames.xml -- is deleted)
(In reply to sdc.blanco from comment #14) >> strongly disagree with the mixture of internal and file system operations. > Could "category" be a custom <meta> tag in a template? Using groupuinames.xml is better than custom meta tag. Separates physical filesystem from "categories" of TM; does not require document modification. Here is a sketch for how to separate TM internal system from file system, building on already existing features of internal system. ( "sketch" = some proposed steps that might stimulate/motivate others to develop further or to inspire a more promising direction ) Internal TM system has to handle at least following cases when rename/delete category is used. 1. If a category (subdirectory) has templates, then "delete category" should offer (require) user to select a new category for the templates (which, on the backend, moves template files from one directory to another) (and probably "refreshes" what template manager has loaded in its memory) 2. If directory for deleted category is empty, then (on backend, silently delete the subdirectory, otherwise subdirectory continues to appear as category). (Should not be a problem to delete an empty directory, even if added manually outside of TM). (and "refresh" memory) 3. If directory for deleted category is still not empty (after case 1, where templates have been moved), then leave the directory. (It leaves an "orphaned" directory, but seems better than "deleting", especially if a user has manually changed an .ott to .ott.bak or something like that, then the directory is not deleted, even though the category is deleted and the valid templates are moved.) NB. If case 3 is used, then seems better to use groupuinames.xml for determining appearance of ALL categories in TM, not just when category name is changed to be different from directory name. Would require TM to check for new subdirectories when opening (in case user has added one manually), and to "write" all subdirectories in groupuinames.xml (even if subdirectory and category name is the same). -- (with this approach, groupuinames.xml would also have to record "orphaned" subdirectories so that they do not (re)appear as a category, but allow a "new" category to be created with the same name as an "orphaned" category, taking over again the subdirectory with the same name). Case 4. Make 2 user paths (e.g., the default 4/user/template, and, for sake of example, mytemplatedir). Create a category B in TM, where userprofile is default path. Manually create a subdirectory B to mytemplatedir. Now TM shows all templates in both directories. (in effect, replicating the operation of MyTemplates, but now with a subdirectory, rather than the path directories). One problem (also now) is that it is impossible to rename the category, even though it shows all templates in both directories. The other problem (also now) is that in deleting the category, the directory (and its contents) in the default path IS deleted, while the other subdirectory (in the non-default path) remains, and the user interface says "cannot delete category", even though it did delete the default path, and the change can be seen in TM). This case, multiple directories with same category name, could be handled with same rules as the previous three cases. Need to update the groupuinames.xml in each directory, if groupuinames.xml is used to control all category names, including those names that are identical to directory names.)
This topic needs closer inspection, back to UXEval.
As part of possible reworking of Category system, or even if not reworked, the original problem reported here still needs to be handled, namely: When it is not possible to rename a template (because the name already exists in the same category), then some feedback should be given. (at present nothing happens).
Let's keep the topic concise: if renaming is not possible we either have to give feedback or better avoid to execute the function. Meaning we test before Ok if rename can be done and otherwise disable the button and set the edit field type to warning (yellow background). Maybe a tooltip would be nice too.
Additional information 1. This issue arises only for renaming templates in the same category. 2. If bug 138246 is resolved, then part of this bug 138883 would also be resolved, because it would not be possible (and therefore unnecessary) to give feedback about changing names of built-in (predefined) templates. 3. Need to consider/handle that non-ODF templates can also appear in Template Manager. For example, at present, it is possible to rename Untitled 1 to Untitled 3 if these two templates in the same category. Untitled 1.ots Untitled 3.xltx but it is not possible (and at present no feedback is given) if you try to rename Untitled 1 to Untitled 3 with these two templates. Untitled 1.ots Untitled 3.ots
Here is my proposal https://gerrit.libreoffice.org/c/core/+/113719 It shows a message error if you enter an invalid name and returns to the naming dialog. Nothing happens when you enter an empty name or the same name. Preliminary message is "Template: $1 cannot be renamed.\nChoose another name."
(In reply to VertD from comment #21) Thanks for your interest in this problem. > It shows a message error if you enter an invalid name What makes a name invalid? > Preliminary message is "Template: $1 cannot be renamed.\nChoose another > name." Is there only "one" way for a name to be invalid? If so, then it would be good/useful for the error message to explain. For example (where I am guessing about the invalid reason). Template $1 already exists in this category. \nChoose another name."
Commented on Gerrit; Seth has a point with the reasons.
* Save Template > same name/category provides a confirmation to overwrite * Rename in Template Manager will give a feedback that it is not possible (Vert's patch) Move to the other category, eg. CV in My Templates to Personal Correspondence, shows a confirmation box to copy instead of moving. But it seems to do nothing, and what is copying in this situation anyway.
(In reply to Heiko Tietze from comment #24) > Move to the other category, eg. CV in My Templates to Personal This issue seems to be outside the scope of this ticket on "renaming". Maybe there should be a separate ticket for "moving" templates? With moving, there are interactions depending on whether predefined or user-defined templates are involved (as illustrated in the example). "Copying" is relevant in some situations, while other responses would be appropriate in other situations.
Vert D committed a patch related to this issue. It has been pushed to "master": https://git.libreoffice.org/core/commit/99482297c7dd497e41fad2e7193759043e305101 tdf#138883 Prevent renaming Templates It will be available in 7.2.0. The patch should be included in the daily builds available at https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More information about daily builds can be found at: https://wiki.documentfoundation.org/Testing_Daily_Builds Affected users are encouraged to test the fix and report feedback.
Verified. it's ok in version Version: 7.2.0.0.alpha0+ / LibreOffice Community Build ID: 1a99b4e44190e182d56a04678850d62635d74c65 CPU threads: 4; OS: Linux 5.8; UI render: default; VCL: gtk3 Locale: ro-RO (ro_RO.UTF-8); UI: en-US Calc: threaded I can not rename the template.