Bug 133253 - Error importing a template to the Template Manager should be explained
Summary: Error importing a template to the Template Manager should be explained
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
7.0.0.0.alpha1+
Hardware: All All
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords: needsDevAdvice
Depends on:
Blocks: Template-Manager
  Show dependency treegraph
 
Reported: 2020-05-21 23:21 UTC by TorrAB
Modified: 2022-07-07 16:51 UTC (History)
3 users (show)

See Also:
Crash report or crash signature:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description TorrAB 2020-05-21 23:21:56 UTC
File>templates>Manage, click Import, choose a file; get warning: ‘Error importing the following templates…’ if the file exists already.
Cause should be explained, with option to overwrite: ‘File exists; overwrite?’.
(I hate software that says frustratingly ‘An error occurred.’)
Comment 1 Dieter 2020-05-25 11:17:29 UTC
I confirm it with

Version: 7.0.0.0.alpha1+ (x64)
Build ID: 0e5e935deb0527c64865cfcc53a0421e56b74b6f
CPU threads: 4; OS: Windows 10.0 Build 18363; UI render: Skia/Raster; VCL: win
Locale: de-DE (de_DE); UI: en-GB
Calc: CL

Additional information: Error only appears if target of import is the same category.


I think, it is more an enhancement than a bug.

cc: Desing-Team for decision about expected result.
Comment 2 Heiko Tietze 2020-05-25 11:31:51 UTC
While I agree on useful and actionable error messages, I doubt there is a simple solution. In sfx2/source/doc/templatedlg.cxx OnTemplateImportCategory() the error message shows-up in any case of errors (it's possible to multi-select files).
Comment 3 sdc.blanco 2021-01-02 17:16:33 UTC
(In reply to TorrAB from comment #0)
> File>templates>Manage, click Import, choose a file; get warning: ‘Error
> importing the following templates…’ if the file exists already.
Agree with request, but situation is slightly more complicated. 

You can import a file with same filename as an existing template, if Title is different (File>Properties - Description tab - Title) (imported filename has '1' appended to it)

Otoh, if imported file has same Title as existing template (with a different filename), then only one template is shown in Template Manager.

iow, an attempt to improve error-checking feedback will involve a different process than checking filenames...
Comment 4 sdc.blanco 2021-01-04 23:05:52 UTC
(In reply to sdc.blanco from comment #3)
> Otoh, if imported file has same Title as existing template (with a different
> filename), then only one template is shown in Template Manager.
Correction:  In this case, the title in the imported template file is removed, so that the filename becomes the template name.

If there is already a template with the same Title as the filename being imported, then you get a "cannot import" message  -- even if there is no filename with the same filename as the template to be imported.

The bottom line conclusion remains the same:

an attempt to improve error-checking feedback will involve a different
process than checking filenames...
Comment 5 sdc.blanco 2021-01-04 23:10:46 UTC
An alternative to error feedback would be "error correction"

As the examples in comment 3 and comment 4 show, Template Manager already makes "silent" correction actions in some cases.  

For the "error" cases, a simple repair would be to offer the opportunity to enter a new name for the template. 

afaict, if the same name/title does not exist in the selected category, then the template manager already knows how to handle the clash with filenames.

iow, with a "rename" function (instead of an error message), the need for giving "error" feedback messages could be completely eliminated -- because it would always be possible to successfully import templates.  

(after which, one could "rename", "delete", "move" templates within Template Manager as needed.)