Pass mime type to KMail when using Location->Send File

Ingo Klöcker kloecker at kde.org
Sat Jun 14 17:47:04 BST 2003


[Please keep kmail at kde.org cc'ed, as I'm not subscribed to 
kfm-devel at kde.org.]

Hi,

this is about http://bugs.kde.org/show_bug.cgi?id=53009 (kmail --attach 
<url> does not preserve mime type in attachment). The problem is that 
KMimeType::findByURL returns application/octet-stream for all HTTP 
URLs, i. e. for all webpages someone wants to send his friends.

As Konqueror very often already knows the mime types of the current 
files it would make sense that Konqueror passes this knowledge to 
KMail. The hackish solution I came up with is to prepend the URLs of 
the files with the mime type in brackets.

Example: [index/html]http://www.kde.org

Since KApplication::invokeMailer excepts a QStringList and no KURL::List 
it wouldn't be a problem that the URLs are prepended with something.

My questions are now:
1. Is it possible to change KonqMainWindow::slotSendFile() so that it 
adds the mime type to the URLs?
2. Is using brackets okay?
3. Do you have a better solution?


BTW, the cleanest solution (for KMail) from the point of view of command 
line options would be a --mimetype <mimetype> command line option which 
would set the mimetype of all following --attach <url> options to 
<mimetype>.

Example:
kmail --mimetype text/html --attach <URL of HTML page> --attach <URL of 
another HTML page> --mimetype application/pdf --attach <URL of PDF 
file>

But:
1. invokeMailer would have to be changed (okay, that's probably not 
really a problem).
2. Parsing such a command line is impossible with KCmdLineArgs because 
it's impossible to tell the order of --mimetype and --attach options 
and it seems to be pretty much impossible to change KCmdLineArgs to 
allow this without a major rewrite.
3. I really don't want to write my own command line parser.

Regards,
Ingo

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: signature
URL: <https://mail.kde.org/mailman/private/kfm-devel/attachments/20030614/98c52b1a/attachment.sig>
-------------- next part --------------
_______________________________________________
KMail Developers mailing list
kmail at mail.kde.org
http://mail.kde.org/mailman/listinfo/kmail


More information about the kfm-devel mailing list