Bug 462899 - Add shortcut for creating files
Summary: Add shortcut for creating files
Status: RESOLVED FIXED
Alias: None
Product: dolphin
Classification: Applications
Component: general (show other bugs)
Version: unspecified
Platform: unspecified All
: NOR wishlist
Target Milestone: ---
Assignee: Dolphin Bug Assignee
URL:
Keywords: efficiency-and-performance
: 387762 (view as bug list)
Depends on:
Blocks:
 
Reported: 2022-12-11 11:23 UTC by qaz.cetelic@gmail.com
Modified: 2025-02-03 18:23 UTC (History)
7 users (show)

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


Attachments
New file shortcut patch progress (110.48 KB, image/png)
2025-01-18 11:47 UTC, kde
Details

Note You need to log in before you can comment on or make changes to this bug.
Description qaz.cetelic@gmail.com 2022-12-11 11:23:49 UTC
SUMMARY
There currently is a shortcut for creating folders (bug 155704), this can be very useful, and I think a shortcut for creating other files would be too. There are several default file creation actions in the Create New menu, and I think each one should get a shortcut:

- Text file
- Empty file
- HTML file
- Link to Location
- Link to file or directory
- Link to application

These do not need to be enabled / defined by default, the user could choose to assign a key combination themselves.
Comment 1 quazgar 2025-01-16 10:00:04 UTC
[+1] for this. IMHO it is not necessary that there are shortcuts defined by default, but exposing these actions so that they can receive shortcuts would already help.
Comment 2 quazgar 2025-01-17 21:38:12 UTC
Talking about keywords, does this deserve the "junior-jobs" keyword?
Comment 3 kde 2025-01-18 09:15:51 UTC
I've been looking into how to add this myself, and it seems like this issue might be a duplicate: https://bugs.kde.org/show_bug.cgi?id=387762
Comment 4 kde 2025-01-18 11:47:01 UTC
Created attachment 177497 [details]
New file shortcut patch progress

I've managed to set up the development environment and add a shortcut, but `KNewFileMenu::createFile` seems to be hardcoded to use the first entry (`d->m_firstFileEntry`).
https://api.kde.org/frameworks/kio/html/knewfilemenu_8cpp_source.html#l01524

Commit with changes:
https://invent.kde.org/qazcetelic/dolphin/-/commit/5a00237b6ff48e6cca0d581d86ac023a4bfb934e
Comment 5 TraceyC 2025-01-30 17:54:01 UTC
*** Bug 387762 has been marked as a duplicate of this bug. ***
Comment 6 TraceyC 2025-01-30 18:06:44 UTC
(In reply to kde from comment #4)
> Created attachment 177497 [details]
> New file shortcut patch progress
> 
> I've managed to set up the development environment and add a shortcut, but
> `KNewFileMenu::createFile` seems to be hardcoded to use the first entry
> (`d->m_firstFileEntry`).
> https://api.kde.org/frameworks/kio/html/knewfilemenu_8cpp_source.html#l01524
> 
> Commit with changes:
> https://invent.kde.org/qazcetelic/dolphin/-/commit/
> 5a00237b6ff48e6cca0d581d86ac023a4bfb934e

Thanks for the patch! The next step is to create a merge request. In the MR, please add "Fixes: Bug 462899" so it gets linked to this report.
https://community.kde.org/Infrastructure/GitLab#Submitting_a_merge_request

If you want to discuss the development work, please reach out in our Matrix channel for new contributors
https://community.kde.org/Get_Involved#New_Contributor?_Say_Hello_In_Matrix

Thanks again.
Comment 7 TraceyC 2025-01-30 18:08:41 UTC
.
Comment 8 kde 2025-02-03 10:35:29 UTC
I don't think it's ready for a merge request, since it creates a file of the first entry type instead of an empty file
Comment 9 TraceyC 2025-02-03 17:51:35 UTC
In order for the patch to be accepted, it needs the work done to make it ready for a Merge Request. Unfortunately here on the bug tracker, we cannot offer help with software development. You can find appropriate ways to get in contact with the development team for assistance with your patch at https://community.kde.org/Get_Involved/development#Communicate_with_the_dev_team.

Thanks for helping to make KDE software better!
Comment 10 Méven 2025-02-03 18:23:19 UTC
Git commit f81d73a7f3a851dc755ef0cd1fd2a2507587a900 by Méven Car, on behalf of Christian Schwarz.
Committed on 03/02/2025 at 18:23.
Pushed by meven into branch 'master'.

implement shortcut action for file creation

M  +4    -1    src/dolphincontextmenu.cpp
M  +20   -3    src/dolphinmainwindow.cpp
M  +1    -0    src/dolphinmainwindow.h
M  +2    -1    src/dolphinnewfilemenu.cpp
M  +1    -1    src/dolphinnewfilemenu.h
M  +4    -2    src/dolphinpart.cpp
M  +1    -0    src/settings/viewmodes/generalviewsettingspage.cpp
M  +74   -0    src/tests/dolphinmainwindowtest.cpp
M  +9    -1    src/views/dolphinviewactionhandler.cpp
M  +7    -0    src/views/dolphinviewactionhandler.h

https://invent.kde.org/system/dolphin/-/commit/f81d73a7f3a851dc755ef0cd1fd2a2507587a900