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

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
  • Kross
  • KUtils
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver
Generated for kdelibs by doxygen 1.5.7
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