• Skip to content
  • Skip to link menu
KDE 4.3 API Reference
  • KDE API Reference
  • kdelibs
  • Sitemap
  • Contact Us
 

KIO

global.cpp

Go to the documentation of this file.
00001 /* This file is part of the KDE libraries
00002    Copyright (C) 2000 David Faure <faure@kde.org>
00003 
00004    This library is free software; you can redistribute it and/or
00005    modify it under the terms of the GNU Library General Public
00006    License version 2 as published by the Free Software Foundation.
00007 
00008    This library is distributed in the hope that it will be useful,
00009    but WITHOUT ANY WARRANTY; without even the implied warranty of
00010    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00011    Library General Public License for more details.
00012 
00013    You should have received a copy of the GNU Library General Public License
00014    along with this library; see the file COPYING.LIB.  If not, write to
00015    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00016    Boston, MA 02110-1301, USA.
00017 */
00018 
00019 #include "global.h"
00020 #include "job.h"
00021 
00022 #include <config.h>
00023 
00024 #include <kdebug.h>
00025 #include <klocale.h>
00026 #include <kglobal.h>
00027 #include <kiconloader.h>
00028 #include <kprotocolmanager.h>
00029 #include <kmimetype.h>
00030 #include <kdynamicjobtracker_p.h>
00031 
00032 #include <QtCore/QByteArray>
00033 #include <QtCore/QDate>
00034 #include <QtGui/QTextDocument>
00035 
00036 #include <sys/types.h>
00037 #include <sys/wait.h>
00038 #include <sys/uio.h>
00039 
00040 #include <assert.h>
00041 #include <signal.h>
00042 #include <stdlib.h>
00043 #include <string.h>
00044 #include <unistd.h>
00045 #include <stdio.h>
00046 
00047 K_GLOBAL_STATIC(KDynamicJobTracker, globalJobTracker)
00048 
00049 // If someone wants the SI-standard prefixes kB/MB/GB/TB, I would recommend
00050 // a hidden kconfig option and getting the code from #57240 into the same
00051 // method, so that all KDE apps use the same unit, instead of letting each app decide.
00052 
00053 KIO_EXPORT QString KIO::convertSize( KIO::filesize_t size )
00054 {
00055     return KGlobal::locale()->formatByteSize(size);
00056 }
00057 
00058 KIO_EXPORT QString KIO::convertSizeFromKiB( KIO::filesize_t kibSize )
00059 {
00060     return KGlobal::locale()->formatByteSize(kibSize * 1024);
00061 }
00062 
00063 KIO_EXPORT QString KIO::number( KIO::filesize_t size )
00064 {
00065     char charbuf[256];
00066     sprintf(charbuf, "%lld", size);
00067     return QLatin1String(charbuf);
00068 }
00069 
00070 KIO_EXPORT unsigned int KIO::calculateRemainingSeconds( KIO::filesize_t totalSize,
00071                                                         KIO::filesize_t processedSize, KIO::filesize_t speed )
00072 {
00073   if ( (speed != 0) && (totalSize != 0) )
00074     return ( totalSize - processedSize ) / speed;
00075   else
00076     return 0;
00077 }
00078 
00079 KIO_EXPORT QString KIO::convertSeconds( unsigned int seconds )
00080 {
00081   unsigned int days  = seconds / 86400;
00082   unsigned int hours = (seconds - (days * 86400)) / 3600;
00083   unsigned int mins  = (seconds - (days * 86400) - (hours * 3600)) / 60;
00084   seconds            = (seconds - (days * 86400) - (hours * 3600) - (mins * 60));
00085 
00086   const QTime time(hours, mins, seconds);
00087   const QString timeStr( KGlobal::locale()->formatTime(time, true /*with seconds*/, true /*duration*/) );
00088   if ( days > 0 )
00089     return i18np("1 day %2", "%1 days %2", days, timeStr);
00090   else
00091     return timeStr;
00092 }
00093 
00094 KIO_EXPORT QTime KIO::calculateRemaining( KIO::filesize_t totalSize, KIO::filesize_t processedSize, KIO::filesize_t speed )
00095 {
00096   QTime remainingTime;
00097 
00098   if ( speed != 0 ) {
00099     KIO::filesize_t secs;
00100     if ( totalSize == 0 ) {
00101       secs = 0;
00102     } else {
00103       secs = ( totalSize - processedSize ) / speed;
00104     }
00105     if (secs >= (24*60*60)) // Limit to 23:59:59
00106        secs = (24*60*60)-1;
00107     int hr = secs / ( 60 * 60 );
00108     int mn = ( secs - hr * 60 * 60 ) / 60;
00109     int sc = ( secs - hr * 60 * 60 - mn * 60 );
00110 
00111     remainingTime.setHMS( hr, mn, sc );
00112   }
00113 
00114   return remainingTime;
00115 }
00116 
00117 KIO_EXPORT QString KIO::itemsSummaryString(uint items, uint files, uint dirs, KIO::filesize_t size, bool showSize)
00118 {
00119     if ( files == 0 && dirs == 0 && items == 0 ) {
00120         return i18np( "%1 Item", "%1 Items", 0 );
00121     }
00122     
00123     QString summary;
00124     const QString foldersText = i18np( "1 Folder", "%1 Folders", dirs );
00125     const QString filesText = i18np( "1 File", "%1 Files", files );
00126     if ( files > 0 && dirs > 0 ) {
00127         summary = showSize ?
00128                   i18nc( "folders, files (size)", "%1, %2 (%3)", foldersText, filesText, KIO::convertSize( size ) ) :
00129                   i18nc( "folders, files", "%1, %2", foldersText, filesText );
00130     } else if ( files > 0 ) {
00131         summary = showSize ? i18nc( "files (size)", "%1 (%2)", filesText, KIO::convertSize( size ) ) : filesText;
00132     } else if ( dirs > 0 ) {
00133         summary = foldersText;
00134     }
00135     
00136     if ( items > dirs + files ) {
00137         const QString itemsText = i18np( "%1 Item", "%1 Items", items );
00138         summary = summary.isEmpty() ? itemsText : i18nc( "items: folders, files (size)", "%1: %2", itemsText, summary );
00139     }
00140     
00141     return summary;
00142 }
00143 
00144 KIO_EXPORT QString KIO::encodeFileName( const QString & _str )
00145 {
00146     QString str( _str );
00147     str.replace('/', QChar(0x2044)); // "Fraction slash"
00148     return str;
00149 }
00150 
00151 KIO_EXPORT QString KIO::decodeFileName( const QString & _str )
00152 {
00153     // Nothing to decode. "Fraction slash" is fine in filenames.
00154     return _str;
00155 }
00156 
00157 KIO_EXPORT QString KIO::Job::errorString() const
00158 {
00159   return KIO::buildErrorString(error(), errorText());
00160 }
00161 
00162 KIO_EXPORT QString KIO::buildErrorString(int errorCode, const QString &errorText)
00163 {
00164   QString result;
00165 
00166   switch( errorCode )
00167     {
00168     case  KIO::ERR_CANNOT_OPEN_FOR_READING:
00169       result = i18n( "Could not read %1." ,  errorText );
00170       break;
00171     case  KIO::ERR_CANNOT_OPEN_FOR_WRITING:
00172       result = i18n( "Could not write to %1." ,  errorText );
00173       break;
00174     case  KIO::ERR_CANNOT_LAUNCH_PROCESS:
00175       result = i18n( "Could not start process %1." ,  errorText );
00176       break;
00177     case  KIO::ERR_INTERNAL:
00178       result = i18n( "Internal Error\nPlease send a full bug report at http://bugs.kde.org\n%1" ,  errorText );
00179       break;
00180     case  KIO::ERR_MALFORMED_URL:
00181       result = i18n( "Malformed URL %1." ,  errorText );
00182       break;
00183     case  KIO::ERR_UNSUPPORTED_PROTOCOL:
00184       result = i18n( "The protocol %1 is not supported." ,  errorText );
00185       break;
00186     case  KIO::ERR_NO_SOURCE_PROTOCOL:
00187       result = i18n( "The protocol %1 is only a filter protocol.",  errorText );
00188       break;
00189     case  KIO::ERR_UNSUPPORTED_ACTION:
00190       result = errorText;
00191 //       result = i18n( "Unsupported action %1" ).arg( errorText );
00192       break;
00193     case  KIO::ERR_IS_DIRECTORY:
00194       result = i18n( "%1 is a folder, but a file was expected." ,  errorText );
00195       break;
00196     case  KIO::ERR_IS_FILE:
00197       result = i18n( "%1 is a file, but a folder was expected." ,  errorText );
00198       break;
00199     case  KIO::ERR_DOES_NOT_EXIST:
00200       result = i18n( "The file or folder %1 does not exist." ,  errorText );
00201       break;
00202     case  KIO::ERR_FILE_ALREADY_EXIST:
00203       result = i18n( "A file named %1 already exists." ,  errorText );
00204       break;
00205     case  KIO::ERR_DIR_ALREADY_EXIST:
00206       result = i18n( "A folder named %1 already exists." ,  errorText );
00207       break;
00208     case  KIO::ERR_UNKNOWN_HOST:
00209       result = errorText.isEmpty() ? i18n( "No hostname specified." ) : i18n( "Unknown host %1" ,  errorText );
00210       break;
00211     case  KIO::ERR_ACCESS_DENIED:
00212       result = i18n( "Access denied to %1." ,  errorText );
00213       break;
00214     case  KIO::ERR_WRITE_ACCESS_DENIED:
00215       result = i18n( "Access denied.\nCould not write to %1." ,  errorText );
00216       break;
00217     case  KIO::ERR_CANNOT_ENTER_DIRECTORY:
00218       result = i18n( "Could not enter folder %1." ,  errorText );
00219       break;
00220     case  KIO::ERR_PROTOCOL_IS_NOT_A_FILESYSTEM:
00221       result = i18n( "The protocol %1 does not implement a folder service." ,  errorText );
00222       break;
00223     case  KIO::ERR_CYCLIC_LINK:
00224       result = i18n( "Found a cyclic link in %1." ,  errorText );
00225       break;
00226     case  KIO::ERR_USER_CANCELED:
00227       // Do nothing in this case. The user doesn't need to be told what he just did.
00228       break;
00229     case  KIO::ERR_CYCLIC_COPY:
00230       result = i18n( "Found a cyclic link while copying %1." ,  errorText );
00231       break;
00232     case  KIO::ERR_COULD_NOT_CREATE_SOCKET:
00233       result = i18n( "Could not create socket for accessing %1." ,  errorText );
00234       break;
00235     case  KIO::ERR_COULD_NOT_CONNECT:
00236       result = i18n( "Could not connect to host %1." ,  errorText.isEmpty() ? QLatin1String("localhost") : errorText );
00237       break;
00238     case  KIO::ERR_CONNECTION_BROKEN:
00239       result = i18n( "Connection to host %1 is broken." ,  errorText );
00240       break;
00241     case  KIO::ERR_NOT_FILTER_PROTOCOL:
00242       result = i18n( "The protocol %1 is not a filter protocol." ,  errorText );
00243       break;
00244     case  KIO::ERR_COULD_NOT_MOUNT:
00245       result = i18n( "Could not mount device.\nThe reported error was:\n%1" ,  errorText );
00246       break;
00247     case  KIO::ERR_COULD_NOT_UNMOUNT:
00248       result = i18n( "Could not unmount device.\nThe reported error was:\n%1" ,  errorText );
00249       break;
00250     case  KIO::ERR_COULD_NOT_READ:
00251       result = i18n( "Could not read file %1." ,  errorText );
00252       break;
00253     case  KIO::ERR_COULD_NOT_WRITE:
00254       result = i18n( "Could not write to file %1." ,  errorText );
00255       break;
00256     case  KIO::ERR_COULD_NOT_BIND:
00257       result = i18n( "Could not bind %1." ,  errorText );
00258       break;
00259     case  KIO::ERR_COULD_NOT_LISTEN:
00260       result = i18n( "Could not listen %1." ,  errorText );
00261       break;
00262     case  KIO::ERR_COULD_NOT_ACCEPT:
00263       result = i18n( "Could not accept %1." ,  errorText );
00264       break;
00265     case  KIO::ERR_COULD_NOT_LOGIN:
00266       result = errorText;
00267       break;
00268     case  KIO::ERR_COULD_NOT_STAT:
00269       result = i18n( "Could not access %1." ,  errorText );
00270       break;
00271     case  KIO::ERR_COULD_NOT_CLOSEDIR:
00272       result = i18n( "Could not terminate listing %1." ,  errorText );
00273       break;
00274     case  KIO::ERR_COULD_NOT_MKDIR:
00275       result = i18n( "Could not make folder %1." ,  errorText );
00276       break;
00277     case  KIO::ERR_COULD_NOT_RMDIR:
00278       result = i18n( "Could not remove folder %1." ,  errorText );
00279       break;
00280     case  KIO::ERR_CANNOT_RESUME:
00281       result = i18n( "Could not resume file %1." ,  errorText );
00282       break;
00283     case  KIO::ERR_CANNOT_RENAME:
00284       result = i18n( "Could not rename file %1." ,  errorText );
00285       break;
00286     case  KIO::ERR_CANNOT_CHMOD:
00287       result = i18n( "Could not change permissions for %1." ,  errorText );
00288       break;
00289     case  KIO::ERR_CANNOT_CHOWN:
00290       result = i18n( "Could not change ownership for %1." ,  errorText );
00291       break;
00292     case  KIO::ERR_CANNOT_DELETE:
00293       result = i18n( "Could not delete file %1." ,  errorText );
00294       break;
00295     case  KIO::ERR_SLAVE_DIED:
00296       result = i18n( "The process for the %1 protocol died unexpectedly." ,  errorText );
00297       break;
00298     case  KIO::ERR_OUT_OF_MEMORY:
00299       result = i18n( "Error. Out of memory.\n%1" ,  errorText );
00300       break;
00301     case  KIO::ERR_UNKNOWN_PROXY_HOST:
00302       result = i18n( "Unknown proxy host\n%1" ,  errorText );
00303       break;
00304     case  KIO::ERR_COULD_NOT_AUTHENTICATE:
00305       result = i18n( "Authorization failed, %1 authentication not supported" ,  errorText );
00306       break;
00307     case  KIO::ERR_ABORTED:
00308       result = i18n( "User canceled action\n%1" ,  errorText );
00309       break;
00310     case  KIO::ERR_INTERNAL_SERVER:
00311       result = i18n( "Internal error in server\n%1" ,  errorText );
00312       break;
00313     case  KIO::ERR_SERVER_TIMEOUT:
00314       result = i18n( "Timeout on server\n%1" ,  errorText );
00315       break;
00316     case  KIO::ERR_UNKNOWN:
00317       result = i18n( "Unknown error\n%1" ,  errorText );
00318       break;
00319     case  KIO::ERR_UNKNOWN_INTERRUPT:
00320       result = i18n( "Unknown interrupt\n%1" ,  errorText );
00321       break;
00322 /*
00323     case  KIO::ERR_CHECKSUM_MISMATCH:
00324       if (errorText)
00325         result = i18n( "Warning: MD5 Checksum for %1 does not match checksum returned from server" ).arg(errorText);
00326       else
00327         result = i18n( "Warning: MD5 Checksum for %1 does not match checksum returned from server" ).arg("document");
00328       break;
00329 */
00330     case KIO::ERR_CANNOT_DELETE_ORIGINAL:
00331       result = i18n( "Could not delete original file %1.\nPlease check permissions." ,  errorText );
00332       break;
00333     case KIO::ERR_CANNOT_DELETE_PARTIAL:
00334       result = i18n( "Could not delete partial file %1.\nPlease check permissions." ,  errorText );
00335       break;
00336     case KIO::ERR_CANNOT_RENAME_ORIGINAL:
00337       result = i18n( "Could not rename original file %1.\nPlease check permissions." ,  errorText );
00338       break;
00339     case KIO::ERR_CANNOT_RENAME_PARTIAL:
00340       result = i18n( "Could not rename partial file %1.\nPlease check permissions." ,  errorText );
00341       break;
00342     case KIO::ERR_CANNOT_SYMLINK:
00343       result = i18n( "Could not create symlink %1.\nPlease check permissions." ,  errorText );
00344       break;
00345     case KIO::ERR_NO_CONTENT:
00346       result = errorText;
00347       break;
00348     case KIO::ERR_DISK_FULL:
00349       result = i18n( "Could not write file %1.\nDisk full." ,  errorText );
00350       break;
00351     case KIO::ERR_IDENTICAL_FILES:
00352       result = i18n( "The source and destination are the same file.\n%1" ,  errorText );
00353       break;
00354     case KIO::ERR_SLAVE_DEFINED:
00355       result = errorText;
00356       break;
00357     case KIO::ERR_UPGRADE_REQUIRED:
00358       result = i18n( "%1 is required by the server, but is not available." , errorText);
00359       break;
00360     case KIO::ERR_POST_DENIED:
00361       result = i18n( "Access to restricted port in POST denied.");
00362       break;
00363     default:
00364       result = i18n( "Unknown error code %1\n%2\nPlease send a full bug report at http://bugs.kde.org." ,  errorCode ,  errorText );
00365       break;
00366     }
00367 
00368   return result;
00369 }
00370 
00371 KIO_EXPORT QString KIO::unsupportedActionErrorString(const QString &protocol, int cmd) {
00372   switch (cmd) {
00373     case CMD_CONNECT:
00374       return i18n("Opening connections is not supported with the protocol %1." , protocol);
00375     case CMD_DISCONNECT:
00376       return i18n("Closing connections is not supported with the protocol %1." , protocol);
00377     case CMD_STAT:
00378       return i18n("Accessing files is not supported with the protocol %1.", protocol);
00379     case CMD_PUT:
00380       return i18n("Writing to %1 is not supported.", protocol);
00381     case CMD_SPECIAL:
00382       return i18n("There are no special actions available for protocol %1.", protocol);
00383     case CMD_LISTDIR:
00384       return i18n("Listing folders is not supported for protocol %1.", protocol);
00385     case CMD_GET:
00386       return i18n("Retrieving data from %1 is not supported.", protocol);
00387     case CMD_MIMETYPE:
00388       return i18n("Retrieving mime type information from %1 is not supported.", protocol);
00389     case CMD_RENAME:
00390       return i18n("Renaming or moving files within %1 is not supported.", protocol);
00391     case CMD_SYMLINK:
00392       return i18n("Creating symlinks is not supported with protocol %1.", protocol);
00393     case CMD_COPY:
00394       return i18n("Copying files within %1 is not supported.", protocol);
00395     case CMD_DEL:
00396       return i18n("Deleting files from %1 is not supported.", protocol);
00397     case CMD_MKDIR:
00398       return i18n("Creating folders is not supported with protocol %1.", protocol);
00399     case CMD_CHMOD:
00400       return i18n("Changing the attributes of files is not supported with protocol %1.", protocol);
00401     case CMD_CHOWN:
00402       return i18n("Changing the ownership of files is not supported with protocol %1.", protocol);
00403     case CMD_SUBURL:
00404       return i18n("Using sub-URLs with %1 is not supported.", protocol);
00405     case CMD_MULTI_GET:
00406       return i18n("Multiple get is not supported with protocol %1.", protocol);
00407     case CMD_OPEN:
00408       return i18n("Opening files is not supported with protocol %1.", protocol);
00409     default:
00410       return i18n("Protocol %1 does not support action %2.", protocol, cmd);
00411   }/*end switch*/
00412 }
00413 
00414 KIO_EXPORT QStringList KIO::Job::detailedErrorStrings( const KUrl *reqUrl /*= 0L*/,
00415                                             int method /*= -1*/ ) const
00416 {
00417   QString errorName, techName, description, ret2;
00418   QStringList causes, solutions, ret;
00419 
00420   QByteArray raw = rawErrorDetail( error(), errorText(), reqUrl, method );
00421   QDataStream stream(raw);
00422 
00423   stream >> errorName >> techName >> description >> causes >> solutions;
00424 
00425   QString url, protocol, datetime;
00426   if ( reqUrl ) {
00427     url = Qt::escape(reqUrl->prettyUrl());
00428     protocol = reqUrl->protocol();
00429   } else {
00430     url = i18nc("@info url", "(unknown)" );
00431   }
00432 
00433   datetime = KGlobal::locale()->formatDateTime( QDateTime::currentDateTime(),
00434                                                 KLocale::LongDate );
00435 
00436   ret << errorName;
00437   ret << i18nc( "@info %1 error name, %2 description",
00438                 "<qt><p><b>%1</b></p><p>%2</p></qt>", errorName, description);
00439 
00440   ret2 = QLatin1String( "<qt>" );
00441   if ( !techName.isEmpty() )
00442     ret2 += QLatin1String( "<p>" ) + i18n( "<b>Technical reason</b>: " ) +
00443             techName + QLatin1String( "</p>" );
00444   ret2 += QLatin1String( "<p>" ) + i18n( "<b>Details of the request</b>:" ) +
00445           QLatin1String( "</p><ul>" ) + i18n( "<li>URL: %1</li>", url );
00446   if ( !protocol.isEmpty() ) {
00447     ret2 += i18n( "<li>Protocol: %1</li>" , protocol );
00448   }
00449   ret2 += i18n( "<li>Date and time: %1</li>", datetime ) +
00450           i18n( "<li>Additional information: %1</li>" ,  errorText() ) +
00451           QLatin1String( "</ul>" );
00452   if ( !causes.isEmpty() ) {
00453     ret2 += QLatin1String( "<p>" ) + i18n( "<b>Possible causes</b>:" ) +
00454             QLatin1String( "</p><ul><li>" ) + causes.join( "</li><li>" ) +
00455             QLatin1String( "</li></ul>" );
00456   }
00457   if ( !solutions.isEmpty() ) {
00458     ret2 += QLatin1String( "<p>" ) + i18n( "<b>Possible solutions</b>:" ) +
00459             QLatin1String( "</p><ul><li>" ) + solutions.join( "</li><li>" ) +
00460             QLatin1String( "</li></ul>" );
00461   }
00462   ret2 += QLatin1String( "</qt>" );
00463   ret << ret2;
00464 
00465   return ret;
00466 }
00467 
00468 KIO_EXPORT QByteArray KIO::rawErrorDetail(int errorCode, const QString &errorText,
00469                                const KUrl *reqUrl /*= 0L*/, int /*method = -1*/ )
00470 {
00471   QString url, host, protocol, datetime, domain, path, filename;
00472   bool isSlaveNetwork = false;
00473   if ( reqUrl ) {
00474     url = reqUrl->prettyUrl();
00475     host = reqUrl->host();
00476     protocol = reqUrl->protocol();
00477 
00478     if ( host.startsWith( QLatin1String( "www." ) ) )
00479       domain = host.mid(4);
00480     else
00481       domain = host;
00482 
00483     filename = reqUrl->fileName();
00484     path = reqUrl->path();
00485 
00486     // detect if protocol is a network protocol...
00487     isSlaveNetwork = KProtocolInfo::protocolClass(protocol) == ":internet";
00488   } else {
00489     // assume that the errorText has the location we are interested in
00490     url = host = domain = path = filename = errorText;
00491     protocol = i18nc("@info protocol", "(unknown)" );
00492   }
00493 
00494   datetime = KGlobal::locale()->formatDateTime( QDateTime::currentDateTime(),
00495                                                 KLocale::LongDate );
00496 
00497   QString errorName, techName, description;
00498   QStringList causes, solutions;
00499 
00500   // c == cause, s == solution
00501   QString sSysadmin = i18n( "Contact your appropriate computer support system, "
00502     "whether the system administrator, or technical support group for further "
00503     "assistance." );
00504   QString sServeradmin = i18n( "Contact the administrator of the server "
00505     "for further assistance." );
00506   // FIXME active link to permissions dialog
00507   QString sAccess = i18n( "Check your access permissions on this resource." );
00508   QString cAccess = i18n( "Your access permissions may be inadequate to "
00509     "perform the requested operation on this resource." );
00510   QString cLocked = i18n( "The file may be in use (and thus locked) by "
00511     "another user or application." );
00512   QString sQuerylock = i18n( "Check to make sure that no other "
00513     "application or user is using the file or has locked the file." );
00514   QString cHardware = i18n( "Although unlikely, a hardware error may have "
00515     "occurred." );
00516   QString cBug = i18n( "You may have encountered a bug in the program." );
00517   QString cBuglikely = i18n( "This is most likely to be caused by a bug in the "
00518     "program. Please consider submitting a full bug report as detailed below." );
00519   QString sUpdate = i18n( "Update your software to the latest version. "
00520     "Your distribution should provide tools to update your software." );
00521   QString sBugreport = i18n( "When all else fails, please consider helping the "
00522     "KDE team or the third party maintainer of this software by submitting a "
00523     "high quality bug report. If the software is provided by a third party, "
00524     "please contact them directly. Otherwise, first look to see if "
00525     "the same bug has been submitted by someone else by searching at the "
00526     "<a href=\"http://bugs.kde.org/\">KDE bug reporting website</a>. If not, take "
00527     "note of the details given above, and include them in your bug report, along "
00528     "with as many other details as you think might help." );
00529   QString cNetwork = i18n( "There may have been a problem with your network "
00530     "connection." );
00531   // FIXME netconf kcontrol link
00532   QString cNetconf = i18n( "There may have been a problem with your network "
00533     "configuration. If you have been accessing the Internet with no problems "
00534     "recently, this is unlikely." );
00535   QString cNetpath = i18n( "There may have been a problem at some point along "
00536     "the network path between the server and this computer." );
00537   QString sTryagain = i18n( "Try again, either now or at a later time." );
00538   QString cProtocol = i18n( "A protocol error or incompatibility may have occurred." );
00539   QString sExists = i18n( "Ensure that the resource exists, and try again." );
00540   QString cExists = i18n( "The specified resource may not exist." );
00541   QString cTypo = i18n( "You may have incorrectly typed the location." );
00542   QString sTypo = i18n( "Double-check that you have entered the correct location "
00543     "and try again." );
00544   QString sNetwork = i18n( "Check your network connection status." );
00545 
00546   switch( errorCode ) {
00547     case  KIO::ERR_CANNOT_OPEN_FOR_READING:
00548       errorName = i18n( "Cannot Open Resource For Reading" );
00549       description = i18n( "This means that the contents of the requested file "
00550         "or folder <strong>%1</strong> could not be retrieved, as read "
00551         "access could not be obtained.", path );
00552       causes << i18n( "You may not have permissions to read the file or open "
00553         "the folder.") << cLocked << cHardware;
00554       solutions << sAccess << sQuerylock << sSysadmin;
00555       break;
00556 
00557     case  KIO::ERR_CANNOT_OPEN_FOR_WRITING:
00558       errorName = i18n( "Cannot Open Resource For Writing" );
00559       description = i18n( "This means that the file, <strong>%1</strong>, could "
00560         "not be written to as requested, because access with permission to "
00561         "write could not be obtained." ,  filename );
00562       causes << cAccess << cLocked << cHardware;
00563       solutions << sAccess << sQuerylock << sSysadmin;
00564       break;
00565 
00566     case  KIO::ERR_CANNOT_LAUNCH_PROCESS:
00567       errorName = i18n( "Cannot Initiate the %1 Protocol" ,  protocol );
00568       techName = i18n( "Unable to Launch Process" );
00569       description = i18n( "The program on your computer which provides access "
00570         "to the <strong>%1</strong> protocol could not be started. This is "
00571         "usually due to technical reasons." ,  protocol );
00572       causes << i18n( "The program which provides compatibility with this "
00573         "protocol may not have been updated with your last update of KDE. "
00574         "This can cause the program to be incompatible with the current version "
00575         "and thus not start." ) << cBug;
00576       solutions << sUpdate << sSysadmin;
00577       break;
00578 
00579     case  KIO::ERR_INTERNAL:
00580       errorName = i18n( "Internal Error" );
00581       description = i18n( "The program on your computer which provides access "
00582         "to the <strong>%1</strong> protocol has reported an internal error." ,
00583           protocol );
00584       causes << cBuglikely;
00585       solutions << sUpdate << sBugreport;
00586       break;
00587 
00588     case  KIO::ERR_MALFORMED_URL:
00589       errorName = i18n( "Improperly Formatted URL" );
00590       description = i18n( "The <strong>U</strong>niform <strong>R</strong>esource "
00591         "<strong>L</strong>ocator (URL) that you entered was not properly "
00592         "formatted. The format of a URL is generally as follows:"
00593         "<blockquote><strong>protocol://user:password@www.example.org:port/folder/"
00594         "filename.extension?query=value</strong></blockquote>" );
00595       solutions << sTypo;
00596       break;
00597 
00598     case  KIO::ERR_UNSUPPORTED_PROTOCOL:
00599       errorName = i18n( "Unsupported Protocol %1" ,  protocol );
00600       description = i18n( "The protocol <strong>%1</strong> is not supported "
00601         "by the KDE programs currently installed on this computer." ,
00602           protocol );
00603       causes << i18n( "The requested protocol may not be supported." )
00604         << i18n( "The versions of the %1 protocol supported by this computer and "
00605         "the server may be incompatible." ,  protocol );
00606       solutions << i18n( "You may perform a search on the Internet for a KDE "
00607         "program (called a kioslave or ioslave) which supports this protocol. "
00608         "Places to search include <a href=\"http://kde-apps.org/\">"
00609         "http://kde-apps.org/</a> and <a href=\"http://freshmeat.net/\">"
00610         "http://freshmeat.net/</a>." )
00611         << sUpdate << sSysadmin;
00612       break;
00613 
00614     case  KIO::ERR_NO_SOURCE_PROTOCOL:
00615       errorName = i18n( "URL Does Not Refer to a Resource." );
00616       techName = i18n( "Protocol is a Filter Protocol" );
00617       description = i18n( "The <strong>U</strong>niform <strong>R</strong>esource "
00618         "<strong>L</strong>ocator (URL) that you entered did not refer to a "
00619         "specific resource." );
00620       causes << i18n( "KDE is able to communicate through a protocol within a "
00621         "protocol; the protocol specified is only for use in such situations, "
00622         "however this is not one of these situations. This is a rare event, and "
00623         "is likely to indicate a programming error." );
00624       solutions << sTypo;
00625       break;
00626 
00627     case  KIO::ERR_UNSUPPORTED_ACTION:
00628       errorName = i18n( "Unsupported Action: %1" ,  errorText );
00629       description = i18n( "The requested action is not supported by the KDE "
00630         "program which is implementing the <strong>%1</strong> protocol." ,
00631           protocol );
00632       causes << i18n( "This error is very much dependent on the KDE program. The "
00633         "additional information should give you more information than is available "
00634         "to the KDE input/output architecture." );
00635       solutions << i18n( "Attempt to find another way to accomplish the same "
00636         "outcome." );
00637       break;
00638 
00639     case  KIO::ERR_IS_DIRECTORY:
00640       errorName = i18n( "File Expected" );
00641       description = i18n( "The request expected a file, however the "
00642         "folder <strong>%1</strong> was found instead." , path );
00643       causes << i18n( "This may be an error on the server side." ) << cBug;
00644       solutions << sUpdate << sSysadmin;
00645       break;
00646 
00647     case  KIO::ERR_IS_FILE:
00648       errorName = i18n( "Folder Expected" );
00649       description = i18n( "The request expected a folder, however "
00650         "the file <strong>%1</strong> was found instead." , filename );
00651       causes << cBug;
00652       solutions << sUpdate << sSysadmin;
00653       break;
00654 
00655     case  KIO::ERR_DOES_NOT_EXIST:
00656       errorName = i18n( "File or Folder Does Not Exist" );
00657       description = i18n( "The specified file or folder <strong>%1</strong> "
00658         "does not exist." , path );
00659       causes << cBug;
00660       solutions << sUpdate << sSysadmin;
00661       break;
00662 
00663     case  KIO::ERR_FILE_ALREADY_EXIST:
00664       errorName = i18n( "File Already Exists" );
00665       description = i18n( "The requested file could not be created because a "
00666         "file with the same name already exists." );
00667       solutions << i18n ( "Try moving the current file out of the way first, "
00668         "and then try again." )
00669         << i18n ( "Delete the current file and try again." )
00670         << i18n( "Choose an alternate filename for the new file." );
00671       break;
00672 
00673     case  KIO::ERR_DIR_ALREADY_EXIST:
00674       errorName = i18n( "Folder Already Exists" );
00675       description = i18n( "The requested folder could not be created because "
00676         "a folder with the same name already exists." );
00677       solutions << i18n( "Try moving the current folder out of the way first, "
00678         "and then try again." )
00679         << i18n( "Delete the current folder and try again." )
00680         << i18n( "Choose an alternate name for the new folder." );
00681       break;
00682 
00683     case  KIO::ERR_UNKNOWN_HOST:
00684       errorName = i18n( "Unknown Host" );
00685       description = i18n( "An unknown host error indicates that the server with "
00686         "the requested name, <strong>%1</strong>, could not be "
00687         "located on the Internet." ,  host );
00688       causes << i18n( "The name that you typed, %1, may not exist: it may be "
00689         "incorrectly typed." ,  host )
00690         << cNetwork << cNetconf;
00691       solutions << sNetwork << sSysadmin;
00692       break;
00693 
00694     case  KIO::ERR_ACCESS_DENIED:
00695       errorName = i18n( "Access Denied" );
00696       description = i18n( "Access was denied to the specified resource, "
00697         "<strong>%1</strong>." ,  url );
00698       causes << i18n( "You may have supplied incorrect authentication details or "
00699         "none at all." )
00700         << i18n( "Your account may not have permission to access the "
00701         "specified resource." );
00702       solutions << i18n( "Retry the request and ensure your authentication details "
00703         "are entered correctly." ) << sSysadmin;
00704       if ( !isSlaveNetwork ) solutions << sServeradmin;
00705       break;
00706 
00707     case  KIO::ERR_WRITE_ACCESS_DENIED:
00708       errorName = i18n( "Write Access Denied" );
00709       description = i18n( "This means that an attempt to write to the file "
00710         "<strong>%1</strong> was rejected." ,  filename );
00711       causes << cAccess << cLocked << cHardware;
00712       solutions << sAccess << sQuerylock << sSysadmin;
00713       break;
00714 
00715     case  KIO::ERR_CANNOT_ENTER_DIRECTORY:
00716       errorName = i18n( "Unable to Enter Folder" );
00717       description = i18n( "This means that an attempt to enter (in other words, "
00718         "to open) the requested folder <strong>%1</strong> was rejected." ,
00719           path );
00720       causes << cAccess << cLocked;
00721       solutions << sAccess << sQuerylock << sSysadmin;
00722       break;
00723 
00724     case  KIO::ERR_PROTOCOL_IS_NOT_A_FILESYSTEM:
00725       errorName = i18n( "Folder Listing Unavailable" );
00726       techName = i18n( "Protocol %1 is not a Filesystem" ,  protocol );
00727       description = i18n( "This means that a request was made which requires "
00728         "determining the contents of the folder, and the KDE program supporting "
00729         "this protocol is unable to do so." );
00730       causes << cBug;
00731       solutions << sUpdate << sBugreport;
00732       break;
00733 
00734     case  KIO::ERR_CYCLIC_LINK:
00735       errorName = i18n( "Cyclic Link Detected" );
00736       description = i18n( "UNIX environments are commonly able to link a file or "
00737         "folder to a separate name and/or location. KDE detected a link or "
00738         "series of links that results in an infinite loop - i.e. the file was "
00739         "(perhaps in a roundabout way) linked to itself." );
00740       solutions << i18n( "Delete one part of the loop in order that it does not "
00741         "cause an infinite loop, and try again." ) << sSysadmin;
00742       break;
00743 
00744     case  KIO::ERR_USER_CANCELED:
00745       // Do nothing in this case. The user doesn't need to be told what he just did.
00746       // rodda: However, if we have been called, an application is about to display
00747       // this information anyway. If we don't return sensible information, the
00748       // user sees a blank dialog (I have seen this myself)
00749       errorName = i18n( "Request Aborted By User" );
00750       description = i18n( "The request was not completed because it was "
00751         "aborted." );
00752       solutions << i18n( "Retry the request." );
00753       break;
00754 
00755     case  KIO::ERR_CYCLIC_COPY:
00756       errorName = i18n( "Cyclic Link Detected During Copy" );
00757       description = i18n( "UNIX environments are commonly able to link a file or "
00758         "folder to a separate name and/or location. During the requested copy "
00759         "operation, KDE detected a link or series of links that results in an "
00760         "infinite loop - i.e. the file was (perhaps in a roundabout way) linked "
00761         "to itself." );
00762       solutions << i18n( "Delete one part of the loop in order that it does not "
00763         "cause an infinite loop, and try again." ) << sSysadmin;
00764       break;
00765 
00766     case  KIO::ERR_COULD_NOT_CREATE_SOCKET:
00767       errorName = i18n( "Could Not Create Network Connection" );
00768       techName = i18n( "Could Not Create Socket" );
00769       description = i18n( "This is a fairly technical error in which a required "
00770         "device for network communications (a socket) could not be created." );
00771       causes << i18n( "The network connection may be incorrectly configured, or "
00772         "the network interface may not be enabled." );
00773       solutions << sNetwork << sSysadmin;
00774       break;
00775 
00776     case  KIO::ERR_COULD_NOT_CONNECT:
00777       errorName = i18n( "Connection to Server Refused" );
00778       description = i18n( "The server <strong>%1</strong> refused to allow this "
00779         "computer to make a connection." ,  host );
00780       causes << i18n( "The server, while currently connected to the Internet, "
00781         "may not be configured to allow requests." )
00782         << i18n( "The server, while currently connected to the Internet, "
00783         "may not be running the requested service (%1)." ,  protocol )
00784         << i18n( "A network firewall (a device which restricts Internet "
00785         "requests), either protecting your network or the network of the server, "
00786         "may have intervened, preventing this request." );
00787       solutions << sTryagain << sServeradmin << sSysadmin;
00788       break;
00789 
00790     case  KIO::ERR_CONNECTION_BROKEN:
00791       errorName = i18n( "Connection to Server Closed Unexpectedly" );
00792       description = i18n( "Although a connection was established to "
00793         "<strong>%1</strong>, the connection was closed at an unexpected point "
00794         "in the communication." ,  host );
00795       causes << cNetwork << cNetpath << i18n( "A protocol error may have occurred, "
00796         "causing the server to close the connection as a response to the error." );
00797       solutions << sTryagain << sServeradmin << sSysadmin;
00798       break;
00799 
00800     case  KIO::ERR_NOT_FILTER_PROTOCOL:
00801       errorName = i18n( "URL Resource Invalid" );
00802       techName = i18n( "Protocol %1 is not a Filter Protocol" ,  protocol );
00803       description = i18n( "The <strong>U</strong>niform <strong>R</strong>esource "
00804         "<strong>L</strong>ocator (URL) that you entered did not refer to "
00805         "a valid mechanism of accessing the specific resource, "
00806         "<strong>%1%2</strong>." ,
00807           !host.isNull() ? host + '/' : QString() , path );
00808       causes << i18n( "KDE is able to communicate through a protocol within a "
00809         "protocol. This request specified a protocol be used as such, however "
00810         "this protocol is not capable of such an action. This is a rare event, "
00811         "and is likely to indicate a programming error." );
00812       solutions << sTypo << sSysadmin;
00813       break;
00814 
00815     case  KIO::ERR_COULD_NOT_MOUNT:
00816       errorName = i18n( "Unable to Initialize Input/Output Device" );
00817       techName = i18n( "Could Not Mount Device" );
00818       description = i18n( "The requested device could not be initialized "
00819         "(\"mounted\"). The reported error was: <strong>%1</strong>" ,
00820           errorText );
00821       causes << i18n( "The device may not be ready, for example there may be "
00822         "no media in a removable media device (i.e. no CD-ROM in a CD drive), "
00823         "or in the case of a peripheral/portable device, the device may not "
00824         "be correctly connected." )
00825         << i18n( "You may not have permissions to initialize (\"mount\") the "
00826         "device. On UNIX systems, often system administrator privileges are "
00827         "required to initialize a device." )
00828         << cHardware;
00829       solutions << i18n( "Check that the device is ready; removable drives "
00830         "must contain media, and portable devices must be connected and powered "
00831         "on.; and try again." ) << sAccess << sSysadmin;
00832       break;
00833 
00834     case  KIO::ERR_COULD_NOT_UNMOUNT:
00835       errorName = i18n( "Unable to Uninitialize Input/Output Device" );
00836       techName = i18n( "Could Not Unmount Device" );
00837       description = i18n( "The requested device could not be uninitialized "
00838         "(\"unmounted\"). The reported error was: <strong>%1</strong>" ,
00839           errorText );
00840       causes << i18n( "The device may be busy, that is, still in use by "
00841         "another application or user. Even such things as having an open "
00842         "browser window on a location on this device may cause the device to "
00843         "remain in use." )
00844         << i18n( "You may not have permissions to uninitialize (\"unmount\") "
00845         "the device. On UNIX systems, system administrator privileges are "
00846         "often required to uninitialize a device." )
00847         << cHardware;
00848       solutions << i18n( "Check that no applications are accessing the device, "
00849         "and try again." ) << sAccess << sSysadmin;
00850       break;
00851 
00852     case  KIO::ERR_COULD_NOT_READ:
00853       errorName = i18n( "Cannot Read From Resource" );
00854       description = i18n( "This means that although the resource, "
00855         "<strong>%1</strong>, was able to be opened, an error occurred while "
00856         "reading the contents of the resource." ,  url );
00857       causes << i18n( "You may not have permissions to read from the resource." );
00858       if ( !isSlaveNetwork ) causes << cNetwork;
00859       causes << cHardware;
00860       solutions << sAccess;
00861       if ( !isSlaveNetwork ) solutions << sNetwork;
00862       solutions << sSysadmin;
00863       break;
00864 
00865     case  KIO::ERR_COULD_NOT_WRITE:
00866       errorName = i18n( "Cannot Write to Resource" );
00867       description = i18n( "This means that although the resource, <strong>%1</strong>"
00868         ", was able to be opened, an error occurred while writing to the resource." ,
00869           url );
00870       causes << i18n( "You may not have permissions to write to the resource." );
00871       if ( !isSlaveNetwork ) causes << cNetwork;
00872       causes << cHardware;
00873       solutions << sAccess;
00874       if ( !isSlaveNetwork ) solutions << sNetwork;
00875       solutions << sSysadmin;
00876       break;
00877 
00878     case  KIO::ERR_COULD_NOT_BIND:
00879       errorName = i18n( "Could Not Listen for Network Connections" );
00880       techName = i18n( "Could Not Bind" );
00881       description = i18n( "This is a fairly technical error in which a required "
00882         "device for network communications (a socket) could not be established "
00883         "to listen for incoming network connections." );
00884       causes << i18n( "The network connection may be incorrectly configured, or "
00885         "the network interface may not be enabled." );
00886       solutions << sNetwork << sSysadmin;
00887       break;
00888 
00889     case  KIO::ERR_COULD_NOT_LISTEN:
00890       errorName = i18n( "Could Not Listen for Network Connections" );
00891       techName = i18n( "Could Not Listen" );
00892       description = i18n( "This is a fairly technical error in which a required "
00893         "device for network communications (a socket) could not be established "
00894         "to listen for incoming network connections." );
00895       causes << i18n( "The network connection may be incorrectly configured, or "
00896         "the network interface may not be enabled." );
00897       solutions << sNetwork << sSysadmin;
00898       break;
00899 
00900     case  KIO::ERR_COULD_NOT_ACCEPT:
00901       errorName = i18n( "Could Not Accept Network Connection" );
00902       description = i18n( "This is a fairly technical error in which an error "
00903         "occurred while attempting to accept an incoming network connection." );
00904       causes << i18n( "The network connection may be incorrectly configured, or "
00905         "the network interface may not be enabled." )
00906         << i18n( "You may not have permissions to accept the connection." );
00907       solutions << sNetwork << sSysadmin;
00908       break;
00909 
00910     case  KIO::ERR_COULD_NOT_LOGIN:
00911       errorName = i18n( "Could Not Login: %1" ,  errorText );
00912       description = i18n( "An attempt to login to perform the requested "
00913         "operation was unsuccessful." );
00914       causes << i18n( "You may have supplied incorrect authentication details or "
00915         "none at all." )
00916         << i18n( "Your account may not have permission to access the "
00917         "specified resource." ) << cProtocol;
00918       solutions << i18n( "Retry the request and ensure your authentication details "
00919         "are entered correctly." ) << sServeradmin << sSysadmin;
00920       break;
00921 
00922     case  KIO::ERR_COULD_NOT_STAT:
00923       errorName = i18n( "Could Not Determine Resource Status" );
00924       techName = i18n( "Could Not Stat Resource" );
00925       description = i18n( "An attempt to determine information about the status "
00926         "of the resource <strong>%1</strong>, such as the resource name, type, "
00927         "size, etc., was unsuccessful." ,  url );
00928       causes << i18n( "The specified resource may not have existed or may "
00929         "not be accessible." ) << cProtocol << cHardware;
00930       solutions << i18n( "Retry the request and ensure your authentication details "
00931         "are entered correctly." ) << sSysadmin;
00932       break;
00933 
00934     case  KIO::ERR_COULD_NOT_CLOSEDIR:
00935       //result = i18n( "Could not terminate listing %1" ).arg( errorText );
00936       errorName = i18n( "Could Not Cancel Listing" );
00937       techName = i18n( "FIXME: Document this" );
00938       break;
00939 
00940     case  KIO::ERR_COULD_NOT_MKDIR:
00941       errorName = i18n( "Could Not Create Folder" );
00942       description = i18n( "An attempt to create the requested folder failed." );
00943       causes << cAccess << i18n( "The location where the folder was to be created "
00944         "may not exist." );
00945       if ( !isSlaveNetwork ) causes << cProtocol;
00946       solutions << i18n( "Retry the request." ) << sAccess;
00947       break;
00948 
00949     case  KIO::ERR_COULD_NOT_RMDIR:
00950       errorName = i18n( "Could Not Remove Folder" );
00951       description = i18n( "An attempt to remove the specified folder, "
00952         "<strong>%1</strong>, failed." , path );
00953       causes << i18n( "The specified folder may not exist." )
00954         << i18n( "The specified folder may not be empty." )
00955         << cAccess;
00956       if ( !isSlaveNetwork ) causes << cProtocol;
00957       solutions << i18n( "Ensure that the folder exists and is empty, and try "
00958         "again." ) << sAccess;
00959       break;
00960 
00961     case  KIO::ERR_CANNOT_RESUME:
00962       errorName = i18n( "Could Not Resume File Transfer" );
00963       description = i18n( "The specified request asked that the transfer of "
00964         "file <strong>%1</strong> be resumed at a certain point of the "
00965         "transfer. This was not possible." ,  filename );
00966       causes << i18n( "The protocol, or the server, may not support file "
00967         "resuming." );
00968       solutions << i18n( "Retry the request without attempting to resume "
00969         "transfer." );
00970       break;
00971 
00972     case  KIO::ERR_CANNOT_RENAME:
00973       errorName = i18n( "Could Not Rename Resource" );
00974       description = i18n( "An attempt to rename the specified resource "
00975         "<strong>%1</strong> failed." ,  url );
00976       causes << cAccess << cExists;
00977       if ( !isSlaveNetwork ) causes << cProtocol;
00978       solutions << sAccess << sExists;
00979       break;
00980 
00981     case  KIO::ERR_CANNOT_CHMOD:
00982       errorName = i18n( "Could Not Alter Permissions of Resource" );
00983       description = i18n( "An attempt to alter the permissions on the specified "
00984         "resource <strong>%1</strong> failed." ,  url );
00985       causes << cAccess << cExists;
00986       solutions << sAccess << sExists;
00987       break;
00988 
00989     case  KIO::ERR_CANNOT_CHOWN:
00990       errorName = i18n( "Could Not Change Ownership of Resource" );
00991       description = i18n( "An attempt to change the ownership of the specified "
00992         "resource <strong>%1</strong> failed." ,  url );
00993       causes << cAccess << cExists;
00994       solutions << sAccess << sExists;
00995       break;
00996 
00997     case  KIO::ERR_CANNOT_DELETE:
00998       errorName = i18n( "Could Not Delete Resource" );
00999       description = i18n( "An attempt to delete the specified resource "
01000         "<strong>%1</strong> failed." ,  url );
01001       causes << cAccess << cExists;
01002       solutions << sAccess << sExists;
01003       break;
01004 
01005     case  KIO::ERR_SLAVE_DIED:
01006       errorName = i18n( "Unexpected Program Termination" );
01007       description = i18n( "The program on your computer which provides access "
01008         "to the <strong>%1</strong> protocol has unexpectedly terminated." ,
01009           url );
01010       causes << cBuglikely;
01011       solutions << sUpdate << sBugreport;
01012       break;
01013 
01014     case  KIO::ERR_OUT_OF_MEMORY:
01015       errorName = i18n( "Out of Memory" );
01016       description = i18n( "The program on your computer which provides access "
01017         "to the <strong>%1</strong> protocol could not obtain the memory "
01018         "required to continue." ,  protocol );
01019       causes << cBuglikely;
01020       solutions << sUpdate << sBugreport;
01021       break;
01022 
01023     case  KIO::ERR_UNKNOWN_PROXY_HOST:
01024       errorName = i18n( "Unknown Proxy Host" );
01025       description = i18n( "While retrieving information about the specified "
01026         "proxy host, <strong>%1</strong>, an Unknown Host error was encountered. "
01027         "An unknown host error indicates that the requested name could not be "
01028         "located on the Internet." ,  errorText );
01029       causes << i18n( "There may have been a problem with your network "
01030         "configuration, specifically your proxy's hostname. If you have been "
01031         "accessing the Internet with no problems recently, this is unlikely." )
01032         << cNetwork;
01033       solutions << i18n( "Double-check your proxy settings and try again." )
01034         << sSysadmin;
01035       break;
01036 
01037     case  KIO::ERR_COULD_NOT_AUTHENTICATE:
01038       errorName = i18n( "Authentication Failed: Method %1 Not Supported" ,
01039            errorText );
01040       description = i18n( "Although you may have supplied the correct "
01041         "authentication details, the authentication failed because the "
01042         "method that the server is using is not supported by the KDE "
01043         "program implementing the protocol %1." ,  protocol );
01044       solutions << i18n( "Please file a bug at <a href=\"http://bugs.kde.org/\">"
01045         "http://bugs.kde.org/</a> to inform the KDE team of the unsupported "
01046         "authentication method." ) << sSysadmin;
01047       break;
01048 
01049     case  KIO::ERR_ABORTED:
01050       errorName = i18n( "Request Aborted" );
01051       description = i18n( "The request was not completed because it was "
01052         "aborted." );
01053       solutions << i18n( "Retry the request." );
01054       break;
01055 
01056     case  KIO::ERR_INTERNAL_SERVER:
01057       errorName = i18n( "Internal Error in Server" );
01058       description = i18n( "The program on the server which provides access "
01059         "to the <strong>%1</strong> protocol has reported an internal error: "
01060         "%2." ,  protocol, errorText );
01061       causes << i18n( "This is most likely to be caused by a bug in the "
01062         "server program. Please consider submitting a full bug report as "
01063         "detailed below." );
01064       solutions << i18n( "Contact the administrator of the server "
01065         "to advise them of the problem." )
01066         << i18n( "If you know who the authors of the server software are, "
01067         "submit the bug report directly to them." );
01068       break;
01069 
01070     case  KIO::ERR_SERVER_TIMEOUT:
01071       errorName = i18n( "Timeout Error" );
01072       description = i18n( "Although contact was made with the server, a "
01073         "response was not received within the amount of time allocated for "
01074         "the request as follows:<ul>"
01075         "<li>Timeout for establishing a connection: %1 seconds</li>"
01076         "<li>Timeout for receiving a response: %2 seconds</li>"
01077         "<li>Timeout for accessing proxy servers: %3 seconds</li></ul>"
01078         "Please note that you can alter these timeout settings in the KDE "
01079         "System Settings, by selecting Network Settings -> Connection Preferences." ,
01080           KProtocolManager::connectTimeout() ,
01081           KProtocolManager::responseTimeout() ,
01082           KProtocolManager::proxyConnectTimeout() );
01083       causes << cNetpath << i18n( "The server was too busy responding to other "
01084         "requests to respond." );
01085       solutions << sTryagain << sServeradmin;
01086       break;
01087 
01088     case  KIO::ERR_UNKNOWN:
01089       errorName = i18n( "Unknown Error" );
01090       description = i18n( "The program on your computer which provides access "
01091         "to the <strong>%1</strong> protocol has reported an unknown error: "
01092         "%2." ,  protocol ,  errorText );
01093       causes << cBug;
01094       solutions << sUpdate << sBugreport;
01095       break;
01096 
01097     case  KIO::ERR_UNKNOWN_INTERRUPT:
01098       errorName = i18n( "Unknown Interruption" );
01099       description = i18n( "The program on your computer which provides access "
01100         "to the <strong>%1</strong> protocol has reported an interruption of "
01101         "an unknown type: %2." ,  protocol ,  errorText );
01102       causes << cBug;
01103       solutions << sUpdate << sBugreport;
01104       break;
01105 
01106     case KIO::ERR_CANNOT_DELETE_ORIGINAL:
01107       errorName = i18n( "Could Not Delete Original File" );
01108       description = i18n( "The requested operation required the deleting of "
01109         "the original file, most likely at the end of a file move operation. "
01110         "The original file <strong>%1</strong> could not be deleted." ,
01111           errorText );
01112       causes << cAccess;
01113       solutions << sAccess;
01114       break;
01115 
01116     case KIO::ERR_CANNOT_DELETE_PARTIAL:
01117       errorName = i18n( "Could Not Delete Temporary File" );
01118       description = i18n( "The requested operation required the creation of "
01119         "a temporary file in which to save the new file while being "
01120         "downloaded. This temporary file <strong>%1</strong> could not be "
01121         "deleted." ,  errorText );
01122       causes << cAccess;
01123       solutions << sAccess;
01124       break;
01125 
01126     case KIO::ERR_CANNOT_RENAME_ORIGINAL:
01127       errorName = i18n( "Could Not Rename Original File" );
01128       description = i18n( "The requested operation required the renaming of "
01129         "the original file <strong>%1</strong>, however it could not be "
01130         "renamed." ,  errorText );
01131       causes << cAccess;
01132       solutions << sAccess;
01133       break;
01134 
01135     case KIO::ERR_CANNOT_RENAME_PARTIAL:
01136       errorName = i18n( "Could Not Rename Temporary File" );
01137       description = i18n( "The requested operation required the creation of "
01138         "a temporary file <strong>%1</strong>, however it could not be "
01139         "created." ,  errorText );
01140       causes << cAccess;
01141       solutions << sAccess;
01142       break;
01143 
01144     case KIO::ERR_CANNOT_SYMLINK:
01145       errorName = i18n( "Could Not Create Link" );
01146       techName = i18n( "Could Not Create Symbolic Link" );
01147       description = i18n( "The requested symbolic link %1 could not be created." ,
01148           errorText );
01149       causes << cAccess;
01150       solutions << sAccess;
01151       break;
01152 
01153     case KIO::ERR_NO_CONTENT:
01154       errorName = i18n( "No Content" );
01155       description = errorText;
01156       break;
01157 
01158     case KIO::ERR_DISK_FULL:
01159       errorName = i18n( "Disk Full" );
01160       description = i18n( "The requested file <strong>%1</strong> could not be "
01161         "written to as there is inadequate disk space." ,  errorText );
01162       solutions << i18n( "Free up enough disk space by 1) deleting unwanted and "
01163         "temporary files; 2) archiving files to removable media storage such as "
01164         "CD-Recordable discs; or 3) obtain more storage capacity." )
01165         << sSysadmin;
01166       break;
01167 
01168     case KIO::ERR_IDENTICAL_FILES:
01169       errorName = i18n( "Source and Destination Files Identical" );
01170       description = i18n( "The operation could not be completed because the "
01171         "source and destination files are the same file." );
01172       solutions << i18n( "Choose a different filename for the destination file." );
01173       break;
01174 
01175     // We assume that the slave has all the details
01176     case KIO::ERR_SLAVE_DEFINED:
01177       errorName.clear();
01178       description = errorText;
01179       break;
01180 
01181     default:
01182       // fall back to the plain error...
01183       errorName = i18n( "Undocumented Error" );
01184       description = buildErrorString( errorCode, errorText );
01185   }
01186 
01187   QByteArray ret;
01188   QDataStream stream(&ret, QIODevice::WriteOnly);
01189   stream << errorName << techName << description << causes << solutions;
01190   return ret;
01191 }
01192 
01193 /***************************************************************
01194  *
01195  * Utility functions
01196  *
01197  ***************************************************************/
01198 
01199 KIO::CacheControl KIO::parseCacheControl(const QString &cacheControl)
01200 {
01201   QString tmp = cacheControl.toLower();
01202 
01203   if (tmp == "cacheonly")
01204      return KIO::CC_CacheOnly;
01205   if (tmp == "cache")
01206      return KIO::CC_Cache;
01207   if (tmp == "verify")
01208      return KIO::CC_Verify;
01209   if (tmp == "refresh")
01210      return KIO::CC_Refresh;
01211   if (tmp == "reload")
01212      return KIO::CC_Reload;
01213 
01214   kDebug() << "unrecognized Cache control option:"<<cacheControl;
01215   return KIO::CC_Verify;
01216 }
01217 
01218 QString KIO::getCacheControlString(KIO::CacheControl cacheControl)
01219 {
01220     if (cacheControl == KIO::CC_CacheOnly)
01221     return "CacheOnly";
01222     if (cacheControl == KIO::CC_Cache)
01223     return "Cache";
01224     if (cacheControl == KIO::CC_Verify)
01225     return "Verify";
01226     if (cacheControl == KIO::CC_Refresh)
01227     return "Refresh";
01228     if (cacheControl == KIO::CC_Reload)
01229     return "Reload";
01230     kDebug() << "unrecognized Cache control enum value:"<<cacheControl;
01231     return QString();
01232 }
01233 
01234 QPixmap KIO::pixmapForUrl( const KUrl & _url, mode_t _mode, KIconLoader::Group _group,
01235                            int _force_size, int _state, QString * _path )
01236 {
01237     const QString iconName = KMimeType::iconNameForUrl( _url, _mode );
01238     return KIconLoader::global()->loadMimeTypeIcon( iconName, _group, _force_size, _state, QStringList(), _path );
01239 }
01240 
01241 KJobTrackerInterface *KIO::getJobTracker()
01242 {
01243     return globalJobTracker;
01244 }
01245 
01246 
01247 /***************************************************************
01248  *
01249  * KIO::MetaData
01250  *
01251  ***************************************************************/
01252 KIO::MetaData::MetaData(const QMap<QString,QVariant>& map)
01253 {
01254   *this = map;
01255 }
01256 
01257 KIO::MetaData & KIO::MetaData::operator += ( const QMap<QString,QVariant> &metaData )
01258 {
01259   QMap<QString,QVariant>::ConstIterator it;
01260   
01261   for(it = metaData.constBegin(); it !=  metaData.constEnd(); ++it)
01262      insert(it.key(), it.value().toString());
01263 
01264   return *this;
01265 }
01266 
01267 KIO::MetaData & KIO::MetaData::operator = ( const QMap<QString,QVariant> &metaData )
01268 {
01269   clear();
01270 
01271   QMap<QString,QVariant>::ConstIterator it;
01272   for(it = metaData.constBegin(); it !=  metaData.constEnd(); ++it)
01273      insert(it.key(), it.value().toString());
01274 
01275   return *this;
01276 }
01277 
01278 QVariant KIO::MetaData::toVariant() const
01279 {
01280  QMap<QString, QVariant> map;
01281  QMap<QString,QString>::ConstIterator it;
01282  QMap<QString,QString>::ConstIterator itEnd = constEnd();
01283 
01284  for(it = constBegin(); it != itEnd; ++it)
01285    map.insert(it.key(), it.value());
01286 
01287  return QVariant(map);
01288 }

KIO

Skip menu "KIO"
  • Main Page
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Namespace Members
  • Class Members
  • Related Pages

kdelibs

Skip menu "kdelibs"
  • DNSSD
  • Interfaces
  •   KHexEdit
  •   KMediaPlayer
  •   KSpeech
  •   KTextEditor
  • Kate
  • kconf_update
  • KDE3Support
  •   KUnitTest
  • KDECore
  • KDED
  • KDEsu
  • KDEUI
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • kio
  • KIOSlave
  • KJS
  •   KJS-API
  •   WTF
  • kjsembed
  • KNewStuff
  • KParts
  • KPty
  • Kross
  • KUtils
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver
Generated for kdelibs by doxygen 1.6.1
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal