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

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
  • Solid
  • Sonnet
  • ThreadWeaver
Generated for kdelibs by doxygen 1.5.4
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