SUMMARY Konqueror doesn't load text/plain in katepart according to system setting STEPS TO REPRODUCE 1. Open konqueror 2. Enter an https:// URL pointing to a text/plain OBSERVED RESULT It loads katepart EXPECTED RESULT It loads WebEnginePart SOFTWARE/OS VERSIONS Linux/KDE Plasma: Ubuntu 21.10 (available in About System) KDE Plasma Version: 5.23.5 KDE Frameworks Version: 5.90.0 Qt Version: 5.15.2 ADDITIONAL INFORMATION
I guess you meant that the expected result is Kate part being loaded while the observed result is the URL being loaded in WebEngineView. Unfortunately, this is caused by a limitation of QtWebEngine which, as far as I know, can't be worked around. The problem is that when you enter an HTTP URL, Konqueror has no way to know which kind of mimetype it is. The previous web engines, KHTML and QtWebKit, could be integrated with the KDE infrastructure, meaning that a single HTTP request was enough for Konqueror ti obtain the mimetype (which allowed it to choose the part according to the user preferences) and for the chosen part to download the data. QtWebEngine, instead, doesn't allow such integration. This means that we have two choices: - have Konqueror make an HTTP request to determine the mimetype, decide which part should handle the URL, and in case it's WebEnginePart have it make another (identical) request to download the data - unconditionally have WebEnginePart handle the URL and determine the mimetype. Only if it finds out it can display it, it'll pass it back to Konqueror which, knowing the mimetype, will be able to decide what to do. We chose the second option, even if it's far from perfect because it's the simpler one for the most common case (the URL is a web page). However, QtWebEngine tries to handle a large number of mimetypes: besides html pages, it wants to display text files, images, audio files and even PDFs. Unfortunately, there's no way to stop this behavior, except (luckily) for PDFs files, for which there's the option to use an external viewer. Even had we chosen the first option, it would only have helped when the user directly enters the URL of the text file in the location bar and not when he wanted to open it from a link in a web page. In this case, it's all managed by QtWebEngine and Konqueror is only notified after the page has been loaded (except, of course, if it can't display the URL, but that's not the case for text files). I've been thinking about ways to work around this limitation of QtWebEngine since we ported Konqueror to use it some years ago, but I haven't been able to find a solution. If such a solution could be found, I'd be very happy to implement it.