[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 15:45:03
[Download RAW message or body]
It looks like this :
http://shift.free.fr/trash/kde/question3.png
http://shift.free.fr/trash/kde/question4.png
http://shift.free.fr/trash/kde/question5.png
for patch 3
but what about this instead of the previous example ?
http://shift.free.fr/trash/kde/question6.png
for patch 2
Make your choice ;-)
Franck
On Sunday 20 July 2003 14:33, David Faure wrote:
> On Sunday 20 July 2003 14:23, Waldo Bastian wrote:
> > On Sunday 20 July 2003 13:53, Shift wrote:
> > > 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.
> >
> > I think the "Open" button should read "Open with..." to give a better
> > indication what happens when you select it.
>
> Right - although not when the app is known.
>
> "Shift", can you integrate this?
> QString openText = (offer && !offer->name().isEmpty()) ? i18n("&Open") :
> i18n("&Open with..."); and then using that in the kmessagebox.
["browserrun2.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 15:19:26 -0000
@@ -275,20 +275,29 @@ 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);
+ question = i18n("Open '%1'?\nType:%2").arg(surl).arg(comment);
+
} 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);
+ question = i18n("Open \
'%1'?\nName:%2\nType:%3").arg(surl).arg(suggestedFilename).arg(comment); }
+
+ // Text used for the open button
+ QString openText = (offer && !offer->name().isEmpty()) ? i18n("&Open with \
'%1'").arg(offer->name()) : i18n("&Open with..."); +
int choice = KMessageBox::questionYesNoCancel(
0L, question, QString::null,
- KStdGuiItem::saveAs(), i18n("&Open"),
+ KStdGuiItem::saveAs(), openText,
QString::fromLatin1("askSave")+ mimeType ); // dontAskAgainName
return choice == KMessageBox::Yes ? Save : ( choice == KMessageBox::No ? Open : \
Cancel ); }
["browserrun3.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 15:20:18 -0000
@@ -275,20 +275,34 @@ 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 '%1' using '%2'?\nType:%3").arg(surl).arg(offer->name()).arg(comment)
+ : i18n("Open '%1'?\nType:%2").arg(surl).arg(comment);
+
} 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 '%1' using '%2'?\nName:%3\nType:%4").
+ arg(surl).arg(offer->name()).arg(suggestedFilename).arg(comment)
+ : i18n("Open '%1'?\nName:%2\nType:%3").arg(surl).arg(suggestedFilename).arg(comment);
}
+
+ // Text used for the open button
+ QString openText = (offer && !offer->name().isEmpty()) ? i18n("&Open") : i18n("&Open with...");
+
int choice = KMessageBox::questionYesNoCancel(
0L, question, QString::null,
- KStdGuiItem::saveAs(), i18n("&Open"),
+ KStdGuiItem::saveAs(), openText,
QString::fromLatin1("askSave")+ mimeType ); // dontAskAgainName
return choice == KMessageBox::Yes ? Save : ( choice == KMessageBox::No ? Open : Cancel );
}
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic