Bug 125342 - Preview in a GNOME desktop causes invalid "text/plain" MIME-TYPE request for evince
Summary: Preview in a GNOME desktop causes invalid "text/plain" MIME-TYPE request for ...
Status: CLOSED NOT A BUG
Alias: None
Product: kdeprint
Classification: Unmaintained
Component: general (show other bugs)
Version: unspecified
Platform: Ubuntu Linux
: NOR normal
Target Milestone: ---
Assignee: KDEPrint Devel Mailinglist
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-04-11 11:38 UTC by Philip Van Hoof
Modified: 2008-12-31 19:54 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments
Attached (19.40 KB, application/octet-stream)
2006-04-12 16:45 UTC, Philip Van Hoof
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Philip Van Hoof 2006-04-11 11:38:05 UTC
Version:            (using KDE KDE 3.5.2)
Installed from:    Ubuntu Packages
OS:                Linux

When choosing the preview checkbox in a KDE application on a GNOME desktop, evince (the gnome document viewer) will tell you the "text/plain" mime type isn't a supported document type.

Please don't downplay this bug as unimportant because it's a "gnome" issue yadi yadi. The MIME type of the document should be correct. So it's a bug. Period.
Comment 1 Philip Van Hoof 2006-04-11 11:46:05 UTC
I don't really know in depth the architecture of KDE. So perhaps this is important (imho it shouldn't be but I don't know): The application I was trying was called umbrello. This is a UML diagram editor and code generator suite. I basically tried printing a class diagram.

Oh and ... I'm not interested in fully switching to a KDE desktop just to fix this bug. ;-). It would be nice if applications just worked on whatever preferred desktop environment I choose.

Comment 2 Michael Goffioul 2006-04-11 12:03:39 UTC
Does it happen also with other KDE applications?
When you open the printer properties dialog and go to the "Filters" tab, do you see any filter enabled?
Could you try to print to a PS file (without preview) and then view the result with evince?

Michael.
Comment 3 Philip Van Hoof 2006-04-11 12:30:08 UTC
Writing to a .ps file does work (and evince can show it). It happens with all applications (I also tested kedit, which looks to me as a very typical application that can print). I don't see any filters enabled.
Comment 4 Philip Van Hoof 2006-04-11 12:31:13 UTC
I can post some screenshots if you want? Please let me know. The exact error message in evince is ->Unhandled MIME type: 'text/plain'<-
Comment 5 Philip Van Hoof 2006-04-11 12:31:41 UTC
Writing to a PDF file also works.
Comment 6 Thiago Macieira 2006-04-12 16:03:55 UTC
Michael, Cristian: how does kdeprint know to find the preview application? Does it search for the application/postscript handler? I also thought it required a KPart for that...

Philip: what are your file associations for application/postscript? (You'll have to open Konqueror, Settings, Configure Konqueror, File Associations)

What happens if you take a PostScript file, rename it so it doesn't end in .ps and try to open it in evince?
Comment 7 Thiago Macieira 2006-04-12 16:05:09 UTC
Local testing here indicates KDEPrint loads a KPart, so I have no idea how it is possible to get evince loaded...
Comment 8 Michael Goffioul 2006-04-12 16:37:18 UTC
Actually, an external viewer can be started by kdeprint if:
1) no PS viewer component (KParts) could be loaded
2) an external preview program has been specified in the kdeprint settings

The preview component searching involves:
1) detect mimetype of the file to preview
2) if PS
  2a) using KTrader, looking for KParts/ReadOnlyPart that handle application/postscript
  2b) look for libkghostviewpart
3) using KServiceTypeProfile::preferredService, look for a PS viewe app

What would be interesting is to catch the file that evince is trying to view and check if it's correct PS or not. This file exists as long as the preview is not closed. If the error message from evince doesn't tell which file it's viewing, you should be able to find it somewhere in the KDE temporary directory. This temp dir might depend on your settings, but look in /tmp/kde-xxxxx/ or ~/.kde/tmp. The kdeprint temporary file has the name kdeprint.XXXXXXX. If you find it, please post it to the bug report.

Michael.
Comment 9 Philip Van Hoof 2006-04-12 16:45:53 UTC
Created attachment 15584 [details]
Attached

If I rename that file to "kdeprint_xh2Tysak.ps" it does work.
Comment 10 Michael Goffioul 2006-04-12 16:52:07 UTC
It looks like the PS is OK. I can view it here with ghostview (under Windows). I don't get why evince isn't able to view it...

When you mention that you renamed the file, do you mean that evince cannot view it if the filename doesn't end with ".ps"?

Michael.
Comment 11 Philip Van Hoof 2006-04-12 16:55:44 UTC
Michael, that is correct. I don't know whether or not evince should. I'm guessing it should.
Comment 12 Michael Goffioul 2006-04-12 17:05:56 UTC
As far as I could see on the web, evince is a multi-purpose viewer (PS, PDF, DVI...). IMO, it should be able to detect the file type correctly, whatever the filename (except if the filename uses a well-known extension, but it's not the case here). I don't want to start a flamewar, but I'm tempted to say that in this specific case, it's evince's fault.

The only thing do-able at kdeprint-level is to use temporary filenames ending with ".ps". However, this would assume that kdeprint *always* generate PS, which is not automatically the case (if you use filters, for instance). I doubt this would ever be implemented in kdeprint.

Maybe you should report the problem to evince's developers.

Michael.
Comment 13 Philip Van Hoof 2006-04-12 17:07:35 UTC
Added a gnome-bug on gnome-vfs about this issue (after some discussion with some other gnome developers, we think this is a gnome-vfs issue):

http://bugzilla.gnome.org/show_bug.cgi?id=338228

Let's solve this one ;-)
Comment 14 Michael Goffioul 2006-04-13 11:23:02 UTC
Let's close this one then. If it appears there's still a problem with kdeprint, please re-open it.
Comment 15 Thiago Macieira 2006-04-13 22:07:22 UTC
Michael: how does KDEPrint know to load the PostScript viewer if it can't tell whether its output is PS or not?
Comment 16 Michael Goffioul 2006-04-14 09:18:46 UTC
It does not load a PS viewer, but loads a viewer component that is registered to view the preview file, which is determined at run-time. It's usually PS, but it could be something else: if the preview file is PNG and there's a PNG viewer component, it will be used instead.

The only additional trick is when the preview file is PS and the default PS viewer component could not be loaded, then kdeprint tries to load libkghostviewpart directly. All the logic is the file kdelibs/kdeprint/kprintpreview.cpp.

Michael.
Comment 17 John Layt 2008-12-31 19:54:38 UTC
Closing old Resolved status bug.