Bug 191632 - It should be easier to add a template to "Create New..." menu (e.g. look into ~/Templates)
Summary: It should be easier to add a template to "Create New..." menu (e.g. look into...
Status: RESOLVED FIXED
Alias: None
Product: frameworks-kio
Classification: Frameworks and Libraries
Component: general (show other bugs)
Version: unspecified
Platform: unspecified Linux
: NOR wishlist
Target Milestone: ---
Assignee: David Faure
URL:
Keywords: usability
: 257062 351896 400263 412657 (view as bug list)
Depends on:
Blocks:
 
Reported: 2009-05-05 01:12 UTC by skierpage
Modified: 2024-09-08 11:39 UTC (History)
13 users (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description skierpage 2009-05-05 01:12:33 UTC
Version:           1.2.1 (using 4.2.2 (KDE 4.2.2), Kubuntu packages)
Compiler:          cc
OS:                Linux (x86_64) release 2.6.28-11-generic

I wanted to modify Create New...  There's no documentation for this (I filed bug 191630).  If the thread http://forum.kde.org/customizing-create-new-menu-t-36907.html is right, you have to create a file in an XDG template directory and create a complicated .desktop file for it.  There should be a friendlier front-end to this.

In Kubuntu 9.04 I have an empty ~/Templates directory.  Maybe Dolphin could automatically append files in this to Create New...

The Folder View plasmoid also has a Create New... menu, I'm not sure if this uses the same code as Dolphin.
Comment 1 dE 2010-11-17 01:59:38 UTC
*** Bug 257062 has been marked as a duplicate of this bug. ***
Comment 2 Jeroen van Meeuwen (Kolab Systems) 2012-08-24 16:19:41 UTC
Resetting assignee to default as per bug #305719
Comment 3 Elvis Angelaccio 2016-12-24 17:17:11 UTC
*** Bug 351896 has been marked as a duplicate of this bug. ***
Comment 4 Elvis Angelaccio 2018-06-21 21:05:40 UTC
Git commit de5ab5e74b4c5a6ce482af8ded7b7b60966d20bb by Elvis Angelaccio, on behalf of Marijo Mustac.
Committed on 21/06/2018 at 20:53.
Pushed by elvisangelaccio into branch 'master'.

[KIO] Add support for XDG_TEMPLATES_DIR in KNewFileMenu

Summary:
This patch adds the support for templates in the XDG_TEMPLATES_DIR location which points in default to:
[en] /home/user/templates
[de] /home/user/Vorlagen
As is all templates have to be a .desktop file maybe a second patch will follow changing this but it seems to be tricky without breaking something.

Test Plan: Add new valid .desktop file to your template folder -> shows up in the menu

Reviewers: #frameworks, dfaure

Reviewed By: dfaure

Subscribers: kde-frameworks-devel, broulik, ngraham

Tags: #frameworks

Differential Revision: https://phabricator.kde.org/D10363

M  +33   -4    src/filewidgets/knewfilemenu.cpp

https://commits.kde.org/kio/de5ab5e74b4c5a6ce482af8ded7b7b60966d20bb
Comment 5 Christoph Feck 2018-07-18 21:48:31 UTC
Anything left to do for this ticket?
Comment 6 Nate Graham 2019-03-12 17:22:02 UTC
Yeah, you should be able to add templates by just adding files themselves into XDG_TEMPLATES_DIR without the need to manually create a .desktop file for them.
Comment 7 Pussy Boots 2020-12-20 17:26:12 UTC
Creating templates by simply adding files to $HOME/templates without creating .desktop files would be a great addition.

Tell me if I can help in implementing it
Comment 8 Loucura 2021-10-23 16:30:41 UTC
This would be really useful (along with KDE already shows on the "Create New" menu).

The default file managers of most Linux desktop environments do this, except for KDE.
Comment 9 stellarpower 2023-06-17 17:29:35 UTC
The comments on phabricator linked above seem to indicate this was mostly complete, could someone possibly review please, or is there a reason it's not been merged and closed thus far? Thanks!
Comment 10 Thiago Sueto 2023-11-20 16:29:30 UTC
*** Bug 400263 has been marked as a duplicate of this bug. ***
Comment 11 Thiago Sueto 2023-11-20 16:29:42 UTC
*** Bug 412657 has been marked as a duplicate of this bug. ***
Comment 12 Antti Savolainen 2024-01-20 14:24:40 UTC
I too would like to express my desire to have easy to create templates in the ~/Templates folder. 
Keep ~/.local/share/templates and /usr/share/templates as they are (as in they require a .desktop file) if changing that would break things and make the ~/Templates folder be as easy as it is on XFCE. Similar to this video: https://www.youtube.com/watch?v=967yhGf1JbQ
Comment 13 n0body_special 2024-01-25 20:38:07 UTC
I came here after much research. I would also like to see that implemented. I don't know how difficult it is, since I am not a coder. Judging by the ages that have passed without a solution, it has to be very difficult
Comment 14 Antti Savolainen 2024-02-13 15:09:39 UTC
Further comment on the usability of the templates folder. It probably should allow for creating template folders as well. As in the function that searches the ~/Templates folder for menu entries shouldn't do it recursively. Instead it lists each top level folder as a folder structure template that you can deploy anywhere. This could be useful for initializing custom project folder structures.
Comment 15 Bug Janitor Service 2024-08-15 17:24:15 UTC
A possibly relevant merge request was started @ https://invent.kde.org/frameworks/kio/-/merge_requests/1688
Comment 16 Méven 2024-09-07 10:52:09 UTC
Git commit a72c50527f6d38d49050b97e026e4c44bb550c9e by Méven Car, on behalf of Antti Savolainen.
Committed on 07/09/2024 at 10:52.
Pushed by meven into branch 'master'.

knewfilemenu: Make ~/Templates work by simply placing files and folders there

Adds functionality so that placing any file in `~/Templates` creates the same file in the context menu as a template. This also works for directories so you are able to create project skeletons. I think I accidentally made it so that if you already have a `.desktop` file in `~/.local/share/templates` that points to `~/Templates`, the `.desktop` file will take priority and there is no duplication. 

M  +12   -5    autotests/knewfilemenutest.cpp
M  +39   -32   src/filewidgets/knewfilemenu.cpp

https://invent.kde.org/frameworks/kio/-/commit/a72c50527f6d38d49050b97e026e4c44bb550c9e