Bug 500244

Summary: Konqueror does not show source files in new tabs
Product: [Applications] konqueror Reporter: bug2017
Component: tabbingAssignee: Konqueror Bugs <konqueror-bugs-null>
Status: REPORTED ---    
Severity: normal CC: stefano.crocco
Priority: NOR    
Version First Reported In: unspecified   
Target Milestone: ---   
Platform: Other   
OS: Linux   
Latest Commit: Version Fixed/Implemented In:
Sentry Crash Report:

Description bug2017 2025-02-17 10:21:13 UTC
SUMMARY
Konqueror does not show source files in new tabs, instead they are opened in a random kate window.

STEPS TO REPRODUCE
1.  In konqueror navigate to a directory with source files
2.  Open a .h .cpp or other file in a new tab via context menu

OBSERVED RESULT
A new tab is always created. For source files like .h or.cpp a new empty tab is created. The text document then is opened in a random instance of kate, that might be even on a differen Desktop.

In case of html files: It is first renderen with WebEngine, there switching to Embedded Advanced Text Editor works without issue.

EXPECTED RESULT
Show the text / source file in that new tab of konqueror. Don't polute kate sessions with random documents.

SOFTWARE/OS VERSIONS
Operating System: Gentoo Linux 2.17
KDE Plasma Version: 6.3.0
KDE Frameworks Version: 6.10.0
Qt Version: 6.8.2
Kernel Version: 6.13.2-gentoo-x86_64 (64-bit)
Graphics Platform: X11
Processors: 16 × 11th Gen Intel® Core™ i9-11900H @ 2.50GHz
Memory: 62.5 GiB of RAM
Graphics Processor 1: Intel® UHD Graphics
Graphics Processor 2: NVIDIA GeForce RTX 3080 Laptop GPU

ADDITIONAL INFORMATION
The issue was present in the previous version (plasma 6.2) too.
Comment 1 Stefano Crocco 2025-02-23 17:12:36 UTC
When you write "Open a .h .cpp or other file in a new tab via context menu", do you mean using the "Open in New Tab" entry in the context menu? If so, I think that the behavior you see is caused by the fact that your settings are to open .h and .cpp files in an external application rather than embed them in Konqueror. This can be changed from the "File associations" page in Konqueror configuration dialog.

When you choose to open a file type in an external application, Konqueror will always try to do so, including when using "Open in New Tab" (even if the name gives the impression that it will always try to open it inside Konqueror). You can force opening in an external application or opening inside Konqueror by using the "Open With" or "Preview In" menu entries (even if there's no way to force a preview in a new tab).
Comment 2 bug2017 2025-02-23 17:39:29 UTC
Indeed "Open in New Tab" context menu. For me it looks like the default was changed. Now I've changed all enties to "embedded viewer", it restores mostly the old behavior. But unknown text files are still opened in kwrite. Examples are *.cu files. But now it creates a new different behavior: If a file get double clicked, it does not open in the associated program, but in the same konqueror tab. So changing the configuration does not fix the issue without breaking something else.

I think that open in a new tab should always mean open i a new tab. Not create an empty tab and launch it in a different application. For opening in a different aplication there is already the Open with contex menu entry or the double click.
Comment 3 Stefano Crocco 2025-02-23 18:10:28 UTC
(In reply to bug2017 from comment #2)
> Indeed "Open in New Tab" context menu. For me it looks like the default was
> changed. Now I've changed all enties to "embedded viewer", it restores
> mostly the old behavior. But unknown text files are still opened in kwrite.
> Examples are *.cu files. 

If you click on the "text" category in the list of file associations, you can choose what to do for all text files, which you can then change for specific file types.

> But now it creates a new different behavior: If a
> file get double clicked, it does not open in the associated program, but in
> the same konqueror tab. So changing the configuration does not fix the issue
> without breaking something else.
> 
> I think that open in a new tab should always mean open i a new tab. Not
> create an empty tab and launch it in a different application. For opening in
> a different aplication there is already the Open with contex menu entry or
> the double click.

I agree with you, and I was actually going to implement the changes needed to do so after reading your bug report, but doing so would create another issue. For example, forcing displaying an OpenDocument file in Konqueror would show it as a .zip file (in the Ark part), because OpenDocument files are a special type of .zip files. This isn't what the user wants, however: most likely, he'll want to see the file opened in LibreOffice or some other program which can interpret the content of the .zip file. Since there's no KPart able to do so, however, Konqueror can't display the file that way. This is a relatively common situation, as many file types are specialized versions of common file types and Konqueror can display the content of the generic type but not of the specific type.