Bug 138883 - Improve template renaming in Template Manager, with better feedback and/or prevent forbidden actions (see comment 19)
Summary: Improve template renaming in Template Manager, with better feedback and/or pr...
Status: VERIFIED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: LibreOffice (show other bugs)
Version:
(earliest affected)
7.2.0.0.alpha0+
Hardware: All All
: medium enhancement
Assignee: VertD
URL:
Whiteboard: target:7.2.0
Keywords:
Depends on:
Blocks: Template-Manager
  Show dependency treegraph
 
Reported: 2020-12-13 22:54 UTC by sdc.blanco
Modified: 2021-05-07 16:11 UTC (History)
2 users (show)

See Also:
Crash report or crash signature:


Attachments
Illustration of problem situation (19.39 KB, image/png)
2020-12-15 14:48 UTC, sdc.blanco
Details
Screencast (301.81 KB, image/gif)
2020-12-15 14:54 UTC, Heiko Tietze
Details

Note You need to log in before you can comment on or make changes to this bug.
Description sdc.blanco 2020-12-13 22:54:26 UTC
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).
Comment 1 Heiko Tietze 2020-12-15 10:06:12 UTC
What is a non-predefined template?
Comment 2 sdc.blanco 2020-12-15 10:28:31 UTC
(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
Comment 3 Heiko Tietze 2020-12-15 12:47:18 UTC
I can rename the user-defined template to "CV", for example.
Comment 4 sdc.blanco 2020-12-15 14:23:16 UTC Comment hidden (no-value)
Comment 5 Heiko Tietze 2020-12-15 14:40:35 UTC
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
Comment 6 sdc.blanco 2020-12-15 14:48:53 UTC
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.
Comment 7 Heiko Tietze 2020-12-15 14:54:14 UTC Comment hidden (obsolete)
Comment 8 sdc.blanco 2020-12-15 15:02:47 UTC
(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.
Comment 9 Heiko Tietze 2020-12-15 15:27:29 UTC
If renaming the templates effects the actual file name we should definitely give a warning or better avoid by setting the warning text type.
Comment 10 sdc.blanco 2020-12-15 16:38:29 UTC Comment hidden (obsolete)
Comment 11 Heiko Tietze 2020-12-16 08:35:11 UTC Comment hidden (obsolete)
Comment 12 Heiko Tietze 2020-12-16 08:39:50 UTC Comment hidden (off-topic)
Comment 13 sdc.blanco 2020-12-16 09:31:41 UTC
(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.
Comment 14 sdc.blanco 2020-12-16 12:53:03 UTC
(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.
Comment 15 sdc.blanco 2020-12-16 14:13:59 UTC Comment hidden (off-topic)
Comment 16 sdc.blanco 2020-12-16 20:42:39 UTC Comment hidden (off-topic)
Comment 17 Heiko Tietze 2020-12-17 11:04:54 UTC Comment hidden (off-topic)
Comment 18 sdc.blanco 2020-12-20 08:42:20 UTC Comment hidden (no-value)
Comment 19 Heiko Tietze 2021-01-15 10:04:23 UTC
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.
Comment 20 sdc.blanco 2021-01-17 23:02:56 UTC
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
Comment 21 VertD 2021-04-07 20:34:50 UTC
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."
Comment 22 sdc.blanco 2021-04-07 23:29:43 UTC
(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."
Comment 23 Heiko Tietze 2021-04-08 10:57:43 UTC
Commented on Gerrit; Seth has a point with the reasons.
Comment 24 Heiko Tietze 2021-04-14 13:32:27 UTC
* 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.
Comment 25 sdc.blanco 2021-04-14 22:13:16 UTC
(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.
Comment 26 Commit Notification 2021-04-27 11:58:12 UTC
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.
Comment 27 BogdanB 2021-05-07 16:11:20 UTC
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.