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

KIO

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

kdelibs

Skip menu "kdelibs"
  • DNSSD
  • Interfaces
  •   KHexEdit
  •   KMediaPlayer
  •   KSpeech
  •   KTextEditor
  • kconf_update
  • KDE3Support
  •   KUnitTest
  • KDECore
  • KDED
  • KDEsu
  • KDEUI
  • KDEWebKit
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • kio
  • KIOSlave
  • KJS
  •   KJS-API
  •   WTF
  • kjsembed
  • KNewStuff
  • KParts
  • KPty
  • Kross
  • KUnitConversion
  • KUtils
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver
Generated for kdelibs by doxygen 1.7.5
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