Bug 138975 - category dialogs in template manager should not show "None" as category
Summary: category dialogs in template manager should not show "None" as category
Status: NEW
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: Not Assigned
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: Template-Manager
  Show dependency treegraph
 
Reported: 2020-12-16 17:01 UTC by sdc.blanco
Modified: 2022-12-17 16:44 UTC (History)
5 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 sdc.blanco 2020-12-16 17:01:05 UTC
In template manager (ctrl+shift+N):

  1. choose Settings (gear icon), Delete Category

    (see "None" as choice, but it cannot be deleted)

    (maybe no focus on choices is appropriate)


  2.  Select a template, press Move button.

     (see "None" as first choice, but cannot move a template to "None")

      (maybe "My Templates" is appropriate default selection)
 

 code pointer:  sfx2/source/doc/templatedlg.cxx


   3.  File > Templates > Save as Template

    (see "None" as first choice, but cannot save a template to "None")

    "My Templates" (as default first choice is appropriate)


code pointer:  https://opengrok.libreoffice.org/xref/core/sfx2/source/doc/saveastemplatedlg.cxx?r=f03310ea#46
Comment 1 Heiko Tietze 2020-12-18 10:28:29 UTC
Caolan, you added this with https://gerrit.libreoffice.org/c/core/+/63336/. Any particular reason, maybe to be sure there is at least one item?
Comment 2 Caolán McNamara 2020-12-18 13:22:56 UTC
That commit just moved the string out from sfx2/uiconfig/ui/saveastemplatedlg.ui and sfx2/uiconfig/ui/templatecategorydlg.ui and into STR_CATEGORY_NONE. The "None" entries exist since https://cgit.freedesktop.org/libreoffice/core/commit/?id=ca040d16d06fead95ad7ed8d10f5995fbade1219 e.g. "SfxSaveAsTemplateDialog::SetCategoryLBEntries" the original "New Template Manager"
Comment 3 Heiko Tietze 2020-12-18 14:00:32 UTC
So it looks like "None" was add to allow mpLBCategory->SelectEntryPos(0) in SfxTemplateCategoryDialog::SetCategoryLBEntries. Could be resolved by testing if the item count is greater than zero.
Comment 4 Peter Toye 2020-12-18 15:14:00 UTC
Is the question why "none" appears as a category without any apparent function, or is it whether a template should be allowed without a category?

What happens if there is a template file in the top level of a template directory? Presumably it has no category, and this needs to be catered for in the Template manager. If this isn't allowed, the template manager needs to check and warn if it finds any such files; I agree that this is an extension of its scope. If it is allowed, the 'none' category should stay - and then what happens if someone decides to have a subdirectory called 'none'? This exposes what seems to me to be a design problem - by using the same mechanism (subdirectory) to expose two separate concepts (category and file container), they get confused.
Comment 5 sdc.blanco 2020-12-18 16:02:57 UTC
(In reply to Peter Toye from comment #4)
> and then what happens if someone decides to have a subdirectory called
> 'none'? 
In my tests:

1.  In Template Manager:  Can add a new category "None" and delete the category "None" as well. (no problem)

2.  Can add manually the directory "None" to a "user path" and it shows up in the Category list  (as expected).  And can be deleted.

Can be a little fiddly, if you try your own tests -- because of "refresh" problem -- but summa summarum:   No problem with a user-created category called "None" 

> This exposes what seems to me to be a design problem - by using the
> same mechanism (subdirectory) to expose two separate concepts (category and
> file container), they get confused.
I think this assertion is wrong. You have not studied my updated help about categories and groupuinames.xml