katepart displays source code without konqueror knowing it
Erik Sjölund
erik.sjolund at home.se
Tue May 14 17:38:25 BST 2002
This is a reflexion over:
Bug#42464: Konqueror doesn't switch between
text editor KPart and web broswer mode
I'm not so familiar with the code, so
this is more like speculating...
The katepart is able to display source code
of different mime types, e.g.
text/x-makefile, text/html, text/x-c++ ....
These mime types are all listed in the file
kdelibs/kate/data/katepart.desktop
Let say konqueror has just shown a text/plain
file. After that a text/html url is requested by
the user. Konqueror checks if the previously loaded
view can handle the newly requested service type.
Katepart can handle text/html, so konqueror uses
it ones more. The requested html page now gets
shown in source code format.
What I just showed here was that konqueror
didn't know how the part was going to display
the URL.
A suggestion:
Maybe, one could introduce a new entry
type in the desktop files, such as
X-KDE-SourceViewer=yes
And konqueror handles user request to
open URLs by requesting,
*partServiceOffers = KTrader::self()->query( serviceType,
"KParts/ReadOnlyPart","[X-KDE-SourceViewer] != 'yes'", QString::null );
as default,
and when the user explicitly wants to see source code,
*partServiceOffers = KTrader::self()->query( serviceType,
"KParts/ReadOnlyPart","[X-KDE-SourceViewer] == 'yes' or ", QString::null
);
The type "text/plain" could be an exception here,
leading to query like,
*partServiceOffers = KTrader::self()->query( serviceType,
"KParts/ReadOnlyPart",QString::null, QString::null );
What do you think? Maybe I'm missing something important?
regards
Erik Sjölund
More information about the kfm-devel
mailing list