[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kfm-devel
Subject:    Re: "Open http://...../trucmuche" and content-type
From:       Shift <shift () free ! fr>
Date:       2003-07-20 11:53:09
[Download RAW message or body]

Hi again,

Here is a patch for what I propose. You need to patch from the kdelibs/kparts 
folder.
It doesn't need to update the translation files because it use the same i18n 
string than the current ones.
Here is what it looks like when the mimetype is unknown : 
http://shift.free.fr/trash/kde/question1.png
And when it is known : http://shift.free.fr/trash/kde/question2.png

If you can test it and commit it if you like it, it will be great.

Thanks,

Franck

On Monday 14 July 2003 22:47, Shift wrote:
> Hi everybody,
>
> I have a wish for Konqueror and I think that I can look at it personnaly if
> it is not so difficult.
>
> When I clic on a link on konqueror and if konqueror don't know how to
> handle it because of an unknow mime-type, it show a popup window saying
> "Open http://.../trucmuche ?" with "Save as", "Open" and "Open with".
> When I clic on "Open" I get the classic application chooser (also visible
> when doing "open with" in the file manger".
>
> the problem is that sometimes the name of the file doesn't reflect the
> content-type of the file. (ex : http://somewhere.com/myimages/holiday2002
> can be the url of a jpeg or of a tiif. Who know ?). So is it possible to
> show (or to easily access) the content-type of the file ? Perhaps by adding
> a line in the "Open..." window ?
>
> Content-type : application/x-bzip2
>
> What do you think about that ?
> I will create a whish at bugs.kde.org after your answers :)
>
> Franck

["browserrun.diff" (text/x-diff)]

Index: browserrun.cpp
===================================================================
RCS file: /home/kde/kdelibs/kparts/browserrun.cpp,v
retrieving revision 1.23
diff -u -3 -p -u -r1.23 browserrun.cpp
--- browserrun.cpp	8 Jul 2003 15:13:37 -0000	1.23
+++ browserrun.cpp	20 Jul 2003 11:13:53 -0000
@@ -275,16 +275,25 @@ BrowserRun::AskSaveResult BrowserRun::as
 {
     QString surl = KStringHandler::csqueeze( url.prettyURL() );
     QString question;
+    KMimeType::Ptr mime = KMimeType::mimeType( mimeType );
+    QString comment = mimeType;
+
+    // Test if the mimeType is not recognize as octet-stream. 
+    // If so then keep mime-type as comment 
+    if (mime->name() != KMimeType::defaultMimeType()) {
+	// The mime-type is known so display the comment instead of mime-type
+	comment = mime->comment();
+    }
     if ( suggestedFilename.isEmpty() )
     {
         question = (offer && !offer->name().isEmpty())
 	       	   ? i18n("Open '%2' using '%1'?").arg(offer->name()).arg(surl)
-                   : i18n("Open '%1'?").arg(surl);
+                   : i18n("Open '%2' (%1)?").arg(comment).arg(surl);
     } else {
         question = (offer && !offer->name().isEmpty())
 		   ? i18n("Open '%3' (%2) using '%1'?").
                      arg(offer->name()).arg(suggestedFilename).arg(surl)
-                   : i18n("Open '%2' (%1)?").arg(suggestedFilename).arg(surl);
+                   : i18n("Open '%2' (%1)?").arg(suggestedFilename + " : " + comment).arg(surl);
     }
     int choice = KMessageBox::questionYesNoCancel(
         0L, question, QString::null,


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic