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

List:       kfm-devel
Subject:    Re: KIO/KHTML Error Handling Update
From:       Hamish Rodda <meddie () yoyo ! cc ! monash ! edu ! au>
Date:       2002-01-27 12:40:27
[Download RAW message or body]

>I personally think that even for HTTP urls, including a link to
> automatically spam webmaster@host when it seems host is down (and it's in
> fact your dialup that's down, or your proxy settings messed up, or the moon
> not in phase with kio_http....) isn't a good idea at all.
>I think that's the kind of braindamage we don't want to copy from IE.

You are both right, I put that in when I was mocking up the page initially, 
and without much thought. It's gone in my local copy.

>OTOH a tip about how to increase the timeout value when getting a timeout
> can be useful, since we have quite a small default value for that.

On my local copy, I have both given this tip and retrieved the actual values 
for the user to see.

BTW, I have finished converting KIO::Job::errorDialog() to use the new error 
messages. The error type and description are presented in the dialog; the 
rest of the details are hidden behind a "Details >>" button. Here are some 
screenshots:

http://yoyo.cc.monash.edu.au/~meddie/patches/errors/

I have fixed several error messages since yesterday, so that the network 
doesn't get blamed for local faults, and the sysadmin doesn't get hassled so 
often.

The patch for this is small, at the bottom of err_updates (apply to kio/kio). 
The rest of this is mostly doc updates, and the move of buildHTMLErrorString 
code to khtml.

Let me know one way or the other, whether it's commit or revert... 

I don't want to press my luck, but to resolve the ioslave error reporting 
deficiency once and for all, could KURL *requestURL be added to the slavebase 
error() call with a default argument of 0L? Also I was thinking that KIO::Job 
should be able to remember the job type by a protected method setJobType(int 
type) which is called from derived classes..., and that the .protocol files 
could have a flag added to specify if they are network-based protocols or 
not.

Thanks,

Hamish
["khtml.patch" (text/x-diff)]

Index: khtml_part.cpp
===================================================================
RCS file: /home/kde/kdelibs/khtml/khtml_part.cpp,v
retrieving revision 1.640
diff -u -3 -p -r1.640 khtml_part.cpp
--- khtml_part.cpp	2002/01/27 03:56:01	1.640
+++ khtml_part.cpp	2002/01/27 12:31:27
@@ -1451,10 +1451,73 @@ void KHTMLPart::showError( KIO::Job* job
 }
 
 // This is a protected method, placed here because of it's relevance to showError
-void KHTMLPart::htmlError( int errorCode, const QString& text, const KURL& url )
+void KHTMLPart::htmlError( int errorCode, const QString& text, const KURL& reqUrl )
 {
   begin();
-  write( KIO::buildHTMLErrorString( errorCode, text, &url ) );
+
+  QString errorName, techName, description;
+  QStringList causes, solutions;
+
+  QByteArray raw = KIO::rawErrorDetail( errorCode, text, &reqUrl );
+  QDataStream stream(raw, IO_ReadOnly);
+
+  stream >> errorName >> techName >> description >> causes >> solutions;
+
+  QString url, protocol, datetime;
+  url = reqUrl.prettyURL();
+  protocol = reqUrl.protocol();
+  datetime = KGlobal::locale()->formatDateTime( QDateTime::currentDateTime(),
+                                                false );
+
+  QString doc = QString::fromLatin1( "<html><head><title>" );
+  doc += i18n( "Error: " );
+  doc += errorName;
+  doc += QString::fromLatin1( " - %1</title></head><body><h1>" ).arg( url );
+  doc += i18n( "The requested operation could not be completed" );
+  doc += QString::fromLatin1( "</h1><h2>" );
+  doc += errorName;
+  doc += QString::fromLatin1( "</h2>" );
+  if ( techName != QString::null ) {
+    doc += QString::fromLatin1( "<h2>" );
+    doc += i18n( "Technical Reason: " );
+    doc += techName;
+    doc += QString::fromLatin1( "</h2>" );
+  }
+  doc += QString::fromLatin1( "<h3>" );
+  doc += i18n( "Details of the Request:" );
+  doc += QString::fromLatin1( "</h3><ul><li>" );
+  doc += i18n( "URL: %1" ).arg( url );
+  doc += QString::fromLatin1( "</li><li>" );
+  if ( protocol != QString::null ) {
+    doc += i18n( "Protocol: %1 - <a href=\"help://kioslave/%1\">click here</a>"
+                 " for documentation." ).arg( protocol ).arg( protocol );
+    doc += QString::fromLatin1( "</li><li>" );
+  }
+  doc += i18n( "Date and Time: %1" ).arg( datetime );
+  doc += QString::fromLatin1( "</li><li>" );
+  doc += i18n( "Additional Information: %1" ).arg( text );
+  doc += QString::fromLatin1( "</li></ul><h3>" );
+  doc += i18n( "Description:" );
+  doc += QString::fromLatin1( "</h3><p>" );
+  doc += description;
+  doc += QString::fromLatin1( "</p>" );
+  if ( causes.count() ) {
+    doc += QString::fromLatin1( "<h3>" );
+    doc += i18n( "Possible Causes:" );
+    doc += QString::fromLatin1( "</h3><ul><li>" );
+    doc += causes.join( "</li><li>" );
+    doc += QString::fromLatin1( "</li></ul>" );
+  }
+  if ( solutions.count() ) {
+    doc += QString::fromLatin1( "<h3>" );
+    doc += i18n( "Possible Solutions:" );
+    doc += QString::fromLatin1( "</h3><ul><li>" );
+    doc += solutions.join( "</li><li>" );
+    doc += QString::fromLatin1( "</li></ul>" );
+  }
+  doc += QString::fromLatin1( "</body></html>" );
+
+  write( doc );
   end();
 }
 
Index: khtml_part.h
===================================================================
RCS file: /home/kde/kdelibs/khtml/khtml_part.h,v
retrieving revision 1.176
diff -u -3 -p -r1.176 khtml_part.h
--- khtml_part.h	2002/01/27 03:56:01	1.176
+++ khtml_part.h	2002/01/27 12:31:28
@@ -750,7 +750,7 @@ protected:
    * @p text kio additional information text.
    * @p url the url that triggered the error.
    */
-  void htmlError(int errorCode, const QString& text, const KURL& url);
+  void htmlError(int errorCode, const QString& text, const KURL& reqUrl);
 
   virtual void customEvent( QCustomEvent *event );
 

["err_updates.patch.bz2" (application/x-bzip2)]

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

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