From kde-core-devel Mon Apr 08 20:58:07 2002 From: aleXXX Date: Mon, 08 Apr 2002 20:58:07 +0000 To: kde-core-devel Subject: Re: mimetypes for zipped files X-MARC-Message: https://marc.info/?l=kde-core-devel&m=101829806217197 MIME-Version: 1 Content-Type: multipart/mixed; boundary="--------------Boundary-00=_VWO9D569VK0HNYW7NVS3" --------------Boundary-00=_VWO9D569VK0HNYW7NVS3 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 8bit On Monday 08 April 2002 14:46, David Faure wrote: > On Sunday 07 April 2002 23:32, Alex Zepeda wrote: > > On Sun, Apr 07, 2002 at 11:50:14AM +0200, aleXXX wrote: > > > Do you have another suggestion which can be implemented without major > > > problems for KDE 3.x ? > > > > Is there any way that having the appropiate ([gb]zip) filter slave modify > > the resulting mimetype would work? > > Yes, one could decompress the file with one of the above, perform a > mime-magic-from-contents on the beginning of the result, to get the inner > mimetype... but then what? The next step is to launch the appropriate > application / part, > and either > - feed it the compressed file, assuming the app can decompress it by itself > (this might need some flag in the .desktop file saying "yes, I'm using > KFilterDev so I can handle compressed files" > - or feed it the uncompressed data. For parts, the new "streaming" API > would allow just that. But for apps, I don't see a way. > > Anyway, alex's current approach is most probably to add support for > KFilterDev in the apps, which fits the above first point. If apps can Yes. > handle compressed files just fine, the only missing bit is the mimetype > determination (e.g. when clicking on a file in Konq, i.e. more generally in > KRun), to launch the right app. If that's done using the above, then > there's no need for combined mimetypes like application/postscript-gzip > etc. I.e. app/postscript-gzip would be simply also app/postscript ? Yes, this was basically my question whether we'd need new mimetypes or not. Well, here's my source. Of course it could be simply modified to return only the "inner" mimetype. Bye Alex --------------Boundary-00=_VWO9D569VK0HNYW7NVS3 Content-Type: text/x-diff; charset="iso-8859-1"; name="kmimemagic.cpp.diff" Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename="kmimemagic.cpp.diff" SW5kZXg6IGttaW1lbWFnaWMuY3BwCj09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09 PT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sKKyAgICAgICAgICAgICAgICAg ICAgICAgUVN0cmluZyBiYWNrdXA9cmVzdWx0QnVmOworICAgICAgICAgICAgICAgICAgICAgICBR SU9EZXZpY2UgKmRldj0gS0ZpbHRlckRldjo6ZGV2aWNlKCZiLHJlc3VsdEJ1Zik7CisgICAgICAg ICAgICAgICAgICAgICAgIGlmIChkZXYhPTApCisgICAgICAgICAgICAgICAgICAgICAgIHsKKyAg ICAgICAgICAgICAgICAgICAgICAgICAgZGV2LT5vcGVuKElPX1JlYWRPbmx5KTsKKyAgICAgICAg ICAgICAgICAgICAgICAgICAgdW5zaWduZWQgY2hhciBidWZmZXJbSE9XTUFOWSsxXTsKKyAgICAg ICAgICAgICAgICAgICAgICAgICAgaW50IHJlYWQ9ZGV2LT5yZWFkQmxvY2soKGNoYXIqKWJ1ZmZl ciwgSE9XTUFOWSk7CisgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnN0IHVuc2lnbmVkIGNo YXIqIGNvbnQ9YnVmZmVyOworICAgICAgICAgICAgICAgICAgICAgICAgICB0cnlpdChidWZmZXIs cmVhZCk7CisgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChhY2N1cmFjeT4wKQorICAgICAg ICAgICAgICAgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChi YWNrdXA9PSJhcHBsaWNhdGlvbi94LWd6aXAiKQorICAgICAgICAgICAgICAgICAgICAgICAgICAg ICAgICByZXN1bHRCdWYrPSItZ3ppcCI7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVs c2UKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmVzdWx0QnVmKz0iLWJ6aXAyIjsK KyAgICAgICAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgICAgICAgICAgICBl bHNlCisgICAgICAgICAgICAgICAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICAgICAgICAg ICAgICAgcmVzdWx0QnVmPWJhY2t1cDsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgfTsKKyAg ICAgICAgICAgICAgICAgICAgICAgICAgZGV2LT5jbG9zZSgpOworICAgICAgICAgICAgICAgICAg ICAgICAgICBkZWxldGUgZGV2OworICAgICAgICAgICAgICAgICAgICAgICB9OworICAgICAgICAg ICAgICAgICAgICAgICBhLnJlc2V0UmF3RGF0YSgoY29uc3QgY2hhciopcyxuYnl0ZXMpOworICAg ICAgICAgICAgICAgICAgICB9OworCisKICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIDE7ICAg ICAgIC8qIGFsbCB0aHJvdWdoICovCiAgICAgICAgICAgICAgICAgfQogCX0K --------------Boundary-00=_VWO9D569VK0HNYW7NVS3--