-
Notifications
You must be signed in to change notification settings - Fork 53
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
save dialogs don't automatically add extensions #421
Comments
@wxl That's the app's job. Our dialog supports everything that a file dialog needs -- including For example, ScreenGrab, lximage-qt, Falkon and many other Qt apps add a default extension with "Save As" when no extension is given. I think what you see with K3b is K3b's fault but I'll look into it. |
OK, I investigated it. Unlike other apps, K3b doesn't set a default suffix — and so, we have no responsibility — but the KDE file dialog adds it when the current name filter starts with a usable extension. That isn't a Qt standard. However, I patched libfm-qt to do the same thing, i.e if (1) there is no default suffix, (2) the dialog is in the save mode, and (3) the file name doesn't end with an extension, LXQt file dialog could extract the first extension in the current name filter and add it to the file name. It worked with K3b and I don't think it could have any side effect. But I should try it for a while before making a PR. |
This needs some discussion. I tell my opinion to see who dares to disagree ;) When there isn't a default suffix (bad code like K3b's?) but there is a name filter (like Image If the user doesn't want an extension for whatever reason (?), he/she could choose Now, this looks logical to me and, I think, it's better than cluttering the GUI with a checkbox that says, "Save with extension" (saying nothing about the extra codes the latter would need). KDE GUI's are all cluttered but I don't think we want that for LXQt when we can avoid it reasonably. Any objection? |
Thanks for the further investigation. I didn't think this was an LXQt problem, per se, but I think this will be a nice feature that will provide a consistent experience for users despite the fallibility of other software. Totally agree that KDE is cluttered. I mean they like to pitch how configurable their software is and while I agree, my common retort is: if you can find where to change the setting you want 😉 That said, I think what you're saying makes sense. The idea of not having an extension seems, as you implied, like a pretty strange edge case. That person will get annoyed by the behavior, I'm sure, but in the effort of serving the vast majority of users in the best possible way (KISS), I think what you suggest is a good idea. Oh, and this is totally tangential, but I also note that Featherpad doesn't seem to have a default extension. I guess it shouldn't necessarily have one, but there should be a whole variety of different text file types, no? I mean, Kate behaves similar, so maybe not. |
Yes, but it's still possible if the filter is The more I use it, the more reasonable it seems to me. Why should we save a file without extension when the File Type combo has one? IMO, KDE's way makes sense.
That's intentional. Text documents aren't just simple texts. They can be C/C++/Python/Bash... codes or markdown, config, etc. There's a huge number of them and apps may add to them. So, adding a filter doesn't make sense — multiple screens would be needed for showing it ;) FeatherPad only adds a proper extension when a suffixed file is opened and the save-as dialog is called. I made it so for security reasons (it has a story) before the first version of FeatherPad. |
Sounds good to me! |
Thanks for the feedback! |
Actually I noticed Falkon defaults to saving pages as MIME HTML archives, but provides options for HTML pages, both single and complete. The default filename ends in .mhtml. If you toggle the file type, the extension does not change. That said, would you be adding anything to allow one to change different extensions? |
I use it a lot with Falkon. With the patch, it'll be the default extension when the user doesn't type it. Apart from that, no file dialog can change which extensions an app provides or prefers. |
That's not exactly what I mean. Consider:
1. Right click on page in Falkon
2. Click Save As
3. Note File Type is MIME Type Archive (*.mhtml) and extension of file
name is .mhtml
4. Change File Type to HTML page, single (*.html)
5. Note extension of file name is still .mhtml
So what I'm suggesting is not that somehow we overwrite or modify the
defaults or the options available in the File Types, but that where an
application provides more than one option, selecting a different File
Type will result in a change to the file name extension. The result
would be:
1. Right click on page in Falkon
2. Click Save As
3. Note File Type is MIME Type Archive (*.mhtml) and extension of file
name is .mhtml
4. Change File Type to HTML page, single (*.html)
5. Note extension of file name is now .html
|
Please open another issue for that! I agree that it should be as you said. I may make the patch more complete to cover it too because both issues/features are about extensions and I'm lazy. But opening a separate issue for it would show its importance. |
Closes #421 and closes #423 This is how extensions are handled in the save mode: * If the file name has no extension and there isn't a default suffix but there is a filter in "File type" combo — like `Image Files (*.png *.jpg)` — the first extension provided by the filter will be added to the saved file name. * If the file name has an extension and the contents of "File type" combo is changed by the user, the extension will be updated accordingly. Overwrite prompts are also handled appropriately.
Closes #421 and closes #423 and fixes lxqt/lxqt-archiver#29 This is how extensions are handled in the save mode: * If the file name has no extension and there isn't a default suffix but there is a filter in "File type" combo — like `Image Files (*.png *.jpg)` — the first extension provided by the filter will be added to the saved file name. * If the file name has an extension and the contents of "File type" combo is changed by the user, the extension will be updated accordingly. * Filters like `NAME (DESCRIPTION) (*.X *.Y)` are covered. Overwrite prompts are also handled appropriately. NOTE: Recompile libfm-qt based apps after this.
Closes #421 and closes #423 and fixes lxqt/lxqt-archiver#29 This is how extensions are handled in the save mode: * If the file name has no extension and there isn't a default suffix but there is a filter in "File type" combo — like `Image Files (*.png *.jpg)` — the first extension provided by the filter will be added to the saved file name. * If the file name has an extension and the contents of "File type" combo is changed by the user, the extension will be updated accordingly. * Filters like `NAME (DESCRIPTION) (*.X *.Y)` are covered. Overwrite prompts are also handled appropriately. NOTE: Recompile libfm-qt based apps after this.
Save dialogs in don't provide an option to automatically add extensions, so even where some application understands one particular extension, saving a file in it doesn't result in an extension being added.
Expected Behavior
Save dialogs should at least have a checkbox providing an option to automatically add an extension.
Current Behavior
Save dialogs have no options regarding extensions and files get saved without them unless manually added.
Possible Solution
To be fair, I'm not sure. I know it's not reasonable to imagine that LXQt is going to provide every single app-specific option known to man (e.g. LibreOffice's encrypt with a password), but I would imagine that having the option to automatically add a file extension seems pretty universally applicable.
Steps to Reproduce (for bugs)
I originally noticed this in k3b, so:
Context
@agaida suggested I file this here.
System Information
Downstream bug
The text was updated successfully, but these errors were encountered: