Bug 61669 - Create new (File Type) should add extension
Summary: Create new (File Type) should add extension
Status: RESOLVED FIXED
Alias: None
Product: frameworks-kio
Classification: Frameworks and Libraries
Component: general (show other bugs)
Version: unspecified
Platform: openSUSE Linux
: NOR wishlist
Target Milestone: ---
Assignee: David Faure
URL:
Keywords: usability
: 245494 (view as bug list)
Depends on:
Blocks:
 
Reported: 2003-07-25 18:44 UTC by tim
Modified: 2020-03-28 18:18 UTC (History)
9 users (show)

See Also:
Latest Commit:
Version Fixed In: 5.69


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description tim 2003-07-25 18:44:32 UTC
Version:           3.1.1 (using KDE 3.1.1)
Installed from:    SuSE
Compiler:          gcc version 3.3 20030226 (prerelease) (SuSE Linux)
OS:          Linux (i686) release 2.4.20-4GB

When I use the "Create new..." function in Konqueror file mode to create a new file the extension will not be added. 

I enter a directory, right-click on the background for the context menu, select "Create new..." and "Text Document...", and I am asked to enter a name. I enter "Test" and it will create a document called "Test", not "Test.kwd". This is a problem, especially on non-local file systems, because there the mime magic does not always work. When I use fish the document is shown as a Zip file, not as a KWord file.
Comment 1 Luke Plant 2003-12-26 18:30:12 UTC
Extra comments:
Mime magic doesn't always work even when browsing normally
E.g.
A new 'Illustration Document' is guessed to be a Zip Archive (because it is)
A new 'Zip Archive' is guessed to be plain text

Even if the mime-magic works perfectly on my system, many systems rely on file name extension, so there should be some attempt to provide the correct extension.
Comment 2 Michael Leupold 2008-05-04 19:33:46 UTC
I can confirm this bug for 3.5.9 and trunk r803905.
If possible maybe the part could propose a name containing the right extension but this depends on what the developers want it to do.
Comment 3 FiNeX 2009-09-13 23:27:23 UTC
This is still valid on KDE 4.
Comment 4 Frank Reininghaus 2010-07-23 10:11:27 UTC
*** Bug 245494 has been marked as a duplicate of this bug. ***
Comment 5 Mark 2010-08-29 23:27:24 UTC
Confirmed on 4.5

in my opinion the extension should be added to the file name for all entries under the "Create New" menu. Even if it where only to be consistent with the majority of files on a computer that all have a extension.

Peter, what's your opinion?
Or why did you even choose to do it without extensions in the first place?
Comment 6 Peter Penz 2010-09-01 15:27:28 UTC
I also think adding an extension automatically would be a nice thing.

> Or why did you even choose to do it without extensions in the first place?

The code is not part of Dolphin, but somewhere handled in the context of the kdelibs class KNewFileMenu.
Comment 7 Nikos Platis 2012-03-30 09:55:55 UTC
Confirming on Dolphin / KDE 4.8.1 / Arch Linux x86_64.

Moreover, if the name you specify contains something like an extension (for example, "1.txt") then the file is created with a .desktop extension ("1.txt.desktop"). This happens for many of the file types available on my system (Text document, HTML document, Link to URL).
Comment 8 FiNeX 2012-03-30 11:05:52 UTC
@Nikos: indeed, this bug has been introduced in KDE 4.8 :-(  ( bug #295490 )
Comment 9 stu109382 2016-10-10 10:32:52 UTC
Ohh, this bug is from 2003? Propably won't be changed then. Bummer!
Comment 10 Ahmad Samir 2020-03-28 16:59:17 UTC
Git commit ad0bbeebc568bc3d33bd3d17212d5b44b3d3bb79 by Ahmad Samir.
Committed on 28/03/2020 at 16:59.
Pushed by ahmadsamir into branch 'master'.

[KNewFileMenu] Add extension to proposed filename

Summary:
Using "create new" text or html file, add the extension to the proposed
filename, this makes those plain text files work for other OS's e.g.
Windows (with Linux plain text files (.txt) don't usually have a extension
relying on mimetype detection); as for but HTML filenames they do have
extensions even on Linux.

Adapt the knewfilemenutest to the changes.

Test Plan: make && ctest; and using the create name text/html file menu in dolphin

Reviewers: #frameworks, dfaure

Reviewed By: dfaure

Subscribers: kde-frameworks-devel

Tags: #frameworks

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

M  +3    -3    autotests/knewfilemenutest.cpp
M  +6    -1    src/filewidgets/knewfilemenu.cpp

https://commits.kde.org/kio/ad0bbeebc568bc3d33bd3d17212d5b44b3d3bb79