• 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, 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     filename = reqUrl->fileName();
00473     path = reqUrl->path();
00474 
00475     // detect if protocol is a network protocol...
00476     isSlaveNetwork = KProtocolInfo::protocolClass(protocol) == ":internet";
00477   } else {
00478     // assume that the errorText has the location we are interested in
00479     url = host = domain = path = filename = errorText;
00480     protocol = i18nc("@info protocol", "(unknown)" );
00481   }
00482 
00483   datetime = KGlobal::locale()->formatDateTime( QDateTime::currentDateTime(),
00484                                                 KLocale::LongDate );
00485 
00486   QString errorName, techName, description;
00487   QStringList causes, solutions;
00488 
00489   // c == cause, s == solution
00490   QString sSysadmin = i18n( "Contact your appropriate computer support system, "
00491     "whether the system administrator, or technical support group for further "
00492     "assistance." );
00493   QString sServeradmin = i18n( "Contact the administrator of the server "
00494     "for further assistance." );
00495   // FIXME active link to permissions dialog
00496   QString sAccess = i18n( "Check your access permissions on this resource." );
00497   QString cAccess = i18n( "Your access permissions may be inadequate to "
00498     "perform the requested operation on this resource." );
00499   QString cLocked = i18n( "The file may be in use (and thus locked) by "
00500     "another user or application." );
00501   QString sQuerylock = i18n( "Check to make sure that no other "
00502     "application or user is using the file or has locked the file." );
00503   QString cHardware = i18n( "Although unlikely, a hardware error may have "
00504     "occurred." );
00505   QString cBug = i18n( "You may have encountered a bug in the program." );
00506   QString cBuglikely = i18n( "This is most likely to be caused by a bug in the "
00507     "program. Please consider submitting a full bug report as detailed below." );
00508   QString sUpdate = i18n( "Update your software to the latest version. "
00509     "Your distribution should provide tools to update your software." );
00510   QString sBugreport = i18n( "When all else fails, please consider helping the "
00511     "KDE team or the third party maintainer of this software by submitting a "
00512     "high quality bug report. If the software is provided by a third party, "
00513     "please contact them directly. Otherwise, first look to see if "
00514     "the same bug has been submitted by someone else by searching at the "
00515     "<a href=\"http://bugs.kde.org/\">KDE bug reporting website</a>. If not, take "
00516     "note of the details given above, and include them in your bug report, along "
00517     "with as many other details as you think might help." );
00518   QString cNetwork = i18n( "There may have been a problem with your network "
00519     "connection." );
00520   // FIXME netconf kcontrol link
00521   QString cNetconf = i18n( "There may have been a problem with your network "
00522     "configuration. If you have been accessing the Internet with no problems "
00523     "recently, this is unlikely." );
00524   QString cNetpath = i18n( "There may have been a problem at some point along "
00525     "the network path between the server and this computer." );
00526   QString sTryagain = i18n( "Try again, either now or at a later time." );
00527   QString cProtocol = i18n( "A protocol error or incompatibility may have occurred." );
00528   QString sExists = i18n( "Ensure that the resource exists, and try again." );
00529   QString cExists = i18n( "The specified resource may not exist." );
00530   QString cTypo = i18n( "You may have incorrectly typed the location." );
00531   QString sTypo = i18n( "Double-check that you have entered the correct location "
00532     "and try again." );
00533   QString sNetwork = i18n( "Check your network connection status." );
00534 
00535   switch( errorCode ) {
00536     case  KIO::ERR_CANNOT_OPEN_FOR_READING:
00537       errorName = i18n( "Cannot Open Resource For Reading" );
00538       description = i18n( "This means that the contents of the requested file "
00539         "or folder <strong>%1</strong> could not be retrieved, as read "
00540         "access could not be obtained.", path );
00541       causes << i18n( "You may not have permissions to read the file or open "
00542         "the folder.") << cLocked << cHardware;
00543       solutions << sAccess << sQuerylock << sSysadmin;
00544       break;
00545 
00546     case  KIO::ERR_CANNOT_OPEN_FOR_WRITING:
00547       errorName = i18n( "Cannot Open Resource For Writing" );
00548       description = i18n( "This means that the file, <strong>%1</strong>, could "
00549         "not be written to as requested, because access with permission to "
00550         "write could not be obtained." ,  filename );
00551       causes << cAccess << cLocked << cHardware;
00552       solutions << sAccess << sQuerylock << sSysadmin;
00553       break;
00554 
00555     case  KIO::ERR_CANNOT_LAUNCH_PROCESS:
00556       errorName = i18n( "Cannot Initiate the %1 Protocol" ,  protocol );
00557       techName = i18n( "Unable to Launch Process" );
00558       description = i18n( "The program on your computer which provides access "
00559         "to the <strong>%1</strong> protocol could not be started. This is "
00560         "usually due to technical reasons." ,  protocol );
00561       causes << i18n( "The program which provides compatibility with this "
00562         "protocol may not have been updated with your last update of KDE. "
00563         "This can cause the program to be incompatible with the current version "
00564         "and thus not start." ) << cBug;
00565       solutions << sUpdate << sSysadmin;
00566       break;
00567 
00568     case  KIO::ERR_INTERNAL:
00569       errorName = i18n( "Internal Error" );
00570       description = i18n( "The program on your computer which provides access "
00571         "to the <strong>%1</strong> protocol has reported an internal error." ,
00572           protocol );
00573       causes << cBuglikely;
00574       solutions << sUpdate << sBugreport;
00575       break;
00576 
00577     case  KIO::ERR_MALFORMED_URL:
00578       errorName = i18n( "Improperly Formatted URL" );
00579       description = i18n( "The <strong>U</strong>niform <strong>R</strong>esource "
00580         "<strong>L</strong>ocator (URL) that you entered was not properly "
00581         "formatted. The format of a URL is generally as follows:"
00582         "<blockquote><strong>protocol://user:password@www.example.org:port/folder/"
00583         "filename.extension?query=value</strong></blockquote>" );
00584       solutions << sTypo;
00585       break;
00586 
00587     case  KIO::ERR_UNSUPPORTED_PROTOCOL:
00588       errorName = i18n( "Unsupported Protocol %1" ,  protocol );
00589       description = i18n( "The protocol <strong>%1</strong> is not supported "
00590         "by the KDE programs currently installed on this computer." ,
00591           protocol );
00592       causes << i18n( "The requested protocol may not be supported." )
00593         << i18n( "The versions of the %1 protocol supported by this computer and "
00594         "the server may be incompatible." ,  protocol );
00595       solutions << i18n( "You may perform a search on the Internet for a KDE "
00596         "program (called a kioslave or ioslave) which supports this protocol. "
00597         "Places to search include <a href=\"http://kde-apps.org/\">"
00598         "http://kde-apps.org/</a> and <a href=\"http://freshmeat.net/\">"
00599         "http://freshmeat.net/</a>." )
00600         << sUpdate << sSysadmin;
00601       break;
00602 
00603     case  KIO::ERR_NO_SOURCE_PROTOCOL:
00604       errorName = i18n( "URL Does Not Refer to a Resource." );
00605       techName = i18n( "Protocol is a Filter Protocol" );
00606       description = i18n( "The <strong>U</strong>niform <strong>R</strong>esource "
00607         "<strong>L</strong>ocator (URL) that you entered did not refer to a "
00608         "specific resource." );
00609       causes << i18n( "KDE is able to communicate through a protocol within a "
00610         "protocol; the protocol specified is only for use in such situations, "
00611         "however this is not one of these situations. This is a rare event, and "
00612         "is likely to indicate a programming error." );
00613       solutions << sTypo;
00614       break;
00615 
00616     case  KIO::ERR_UNSUPPORTED_ACTION:
00617       errorName = i18n( "Unsupported Action: %1" ,  errorText );
00618       description = i18n( "The requested action is not supported by the KDE "
00619         "program which is implementing the <strong>%1</strong> protocol." ,
00620           protocol );
00621       causes << i18n( "This error is very much dependent on the KDE program. The "
00622         "additional information should give you more information than is available "
00623         "to the KDE input/output architecture." );
00624       solutions << i18n( "Attempt to find another way to accomplish the same "
00625         "outcome." );
00626       break;
00627 
00628     case  KIO::ERR_IS_DIRECTORY:
00629       errorName = i18n( "File Expected" );
00630       description = i18n( "The request expected a file, however the "
00631         "folder <strong>%1</strong> was found instead." , path );
00632       causes << i18n( "This may be an error on the server side." ) << cBug;
00633       solutions << sUpdate << sSysadmin;
00634       break;
00635 
00636     case  KIO::ERR_IS_FILE:
00637       errorName = i18n( "Folder Expected" );
00638       description = i18n( "The request expected a folder, however "
00639         "the file <strong>%1</strong> was found instead." , filename );
00640       causes << cBug;
00641       solutions << sUpdate << sSysadmin;
00642       break;
00643 
00644     case  KIO::ERR_DOES_NOT_EXIST:
00645       errorName = i18n( "File or Folder Does Not Exist" );
00646       description = i18n( "The specified file or folder <strong>%1</strong> "
00647         "does not exist." , path );
00648       causes << cBug;
00649       solutions << sUpdate << sSysadmin;
00650       break;
00651 
00652     case  KIO::ERR_FILE_ALREADY_EXIST:
00653       errorName = i18n( "File Already Exists" );
00654       description = i18n( "The requested file could not be created because a "
00655         "file with the same name already exists." );
00656       solutions << i18n ( "Try moving the current file out of the way first, "
00657         "and then try again." )
00658         << i18n ( "Delete the current file and try again." )
00659         << i18n( "Choose an alternate filename for the new file." );
00660       break;
00661 
00662     case  KIO::ERR_DIR_ALREADY_EXIST:
00663       errorName = i18n( "Folder Already Exists" );
00664       description = i18n( "The requested folder could not be created because "
00665         "a folder with the same name already exists." );
00666       solutions << i18n( "Try moving the current folder out of the way first, "
00667         "and then try again." )
00668         << i18n( "Delete the current folder and try again." )
00669         << i18n( "Choose an alternate name for the new folder." );
00670       break;
00671 
00672     case  KIO::ERR_UNKNOWN_HOST:
00673       errorName = i18n( "Unknown Host" );
00674       description = i18n( "An unknown host error indicates that the server with "
00675         "the requested name, <strong>%1</strong>, could not be "
00676         "located on the Internet." ,  host );
00677       causes << i18n( "The name that you typed, %1, may not exist: it may be "
00678         "incorrectly typed." ,  host )
00679         << cNetwork << cNetconf;
00680       solutions << sNetwork << sSysadmin;
00681       break;
00682 
00683     case  KIO::ERR_ACCESS_DENIED:
00684       errorName = i18n( "Access Denied" );
00685       description = i18n( "Access was denied to the specified resource, "
00686         "<strong>%1</strong>." ,  url );
00687       causes << i18n( "You may have supplied incorrect authentication details or "
00688         "none at all." )
00689         << i18n( "Your account may not have permission to access the "
00690         "specified resource." );
00691       solutions << i18n( "Retry the request and ensure your authentication details "
00692         "are entered correctly." ) << sSysadmin;
00693       if ( !isSlaveNetwork ) solutions << sServeradmin;
00694       break;
00695 
00696     case  KIO::ERR_WRITE_ACCESS_DENIED:
00697       errorName = i18n( "Write Access Denied" );
00698       description = i18n( "This means that an attempt to write to the file "
00699         "<strong>%1</strong> was rejected." ,  filename );
00700       causes << cAccess << cLocked << cHardware;
00701       solutions << sAccess << sQuerylock << sSysadmin;
00702       break;
00703 
00704     case  KIO::ERR_CANNOT_ENTER_DIRECTORY:
00705       errorName = i18n( "Unable to Enter Folder" );
00706       description = i18n( "This means that an attempt to enter (in other words, "
00707         "to open) the requested folder <strong>%1</strong> was rejected." ,
00708           path );
00709       causes << cAccess << cLocked;
00710       solutions << sAccess << sQuerylock << sSysadmin;
00711       break;
00712 
00713     case  KIO::ERR_PROTOCOL_IS_NOT_A_FILESYSTEM:
00714       errorName = i18n( "Folder Listing Unavailable" );
00715       techName = i18n( "Protocol %1 is not a Filesystem" ,  protocol );
00716       description = i18n( "This means that a request was made which requires "
00717         "determining the contents of the folder, and the KDE program supporting "
00718         "this protocol is unable to do so." );
00719       causes << cBug;
00720       solutions << sUpdate << sBugreport;
00721       break;
00722 
00723     case  KIO::ERR_CYCLIC_LINK:
00724       errorName = i18n( "Cyclic Link Detected" );
00725       description = i18n( "UNIX environments are commonly able to link a file or "
00726         "folder to a separate name and/or location. KDE detected a link or "
00727         "series of links that results in an infinite loop - i.e. the file was "
00728         "(perhaps in a roundabout way) linked to itself." );
00729       solutions << i18n( "Delete one part of the loop in order that it does not "
00730         "cause an infinite loop, and try again." ) << sSysadmin;
00731       break;
00732 
00733     case  KIO::ERR_USER_CANCELED:
00734       // Do nothing in this case. The user doesn't need to be told what he just did.
00735       // rodda: However, if we have been called, an application is about to display
00736       // this information anyway. If we don't return sensible information, the
00737       // user sees a blank dialog (I have seen this myself)
00738       errorName = i18n( "Request Aborted By User" );
00739       description = i18n( "The request was not completed because it was "
00740         "aborted." );
00741       solutions << i18n( "Retry the request." );
00742       break;
00743 
00744     case  KIO::ERR_CYCLIC_COPY:
00745       errorName = i18n( "Cyclic Link Detected During Copy" );
00746       description = i18n( "UNIX environments are commonly able to link a file or "
00747         "folder to a separate name and/or location. During the requested copy "
00748         "operation, KDE detected a link or series of links that results in an "
00749         "infinite loop - i.e. the file was (perhaps in a roundabout way) linked "
00750         "to itself." );
00751       solutions << i18n( "Delete one part of the loop in order that it does not "
00752         "cause an infinite loop, and try again." ) << sSysadmin;
00753       break;
00754 
00755     case  KIO::ERR_COULD_NOT_CREATE_SOCKET:
00756       errorName = i18n( "Could Not Create Network Connection" );
00757       techName = i18n( "Could Not Create Socket" );
00758       description = i18n( "This is a fairly technical error in which a required "
00759         "device for network communications (a socket) could not be created." );
00760       causes << i18n( "The network connection may be incorrectly configured, or "
00761         "the network interface may not be enabled." );
00762       solutions << sNetwork << sSysadmin;
00763       break;
00764 
00765     case  KIO::ERR_COULD_NOT_CONNECT:
00766       errorName = i18n( "Connection to Server Refused" );
00767       description = i18n( "The server <strong>%1</strong> refused to allow this "
00768         "computer to make a connection." ,  host );
00769       causes << i18n( "The server, while currently connected to the Internet, "
00770         "may not be configured to allow requests." )
00771         << i18n( "The server, while currently connected to the Internet, "
00772         "may not be running the requested service (%1)." ,  protocol )
00773         << i18n( "A network firewall (a device which restricts Internet "
00774         "requests), either protecting your network or the network of the server, "
00775         "may have intervened, preventing this request." );
00776       solutions << sTryagain << sServeradmin << sSysadmin;
00777       break;
00778 
00779     case  KIO::ERR_CONNECTION_BROKEN:
00780       errorName = i18n( "Connection to Server Closed Unexpectedly" );
00781       description = i18n( "Although a connection was established to "
00782         "<strong>%1</strong>, the connection was closed at an unexpected point "
00783         "in the communication." ,  host );
00784       causes << cNetwork << cNetpath << i18n( "A protocol error may have occurred, "
00785         "causing the server to close the connection as a response to the error." );
00786       solutions << sTryagain << sServeradmin << sSysadmin;
00787       break;
00788 
00789     case  KIO::ERR_NOT_FILTER_PROTOCOL:
00790       errorName = i18n( "URL Resource Invalid" );
00791       techName = i18n( "Protocol %1 is not a Filter Protocol" ,  protocol );
00792       description = i18n( "The <strong>U</strong>niform <strong>R</strong>esource "
00793         "<strong>L</strong>ocator (URL) that you entered did not refer to "
00794         "a valid mechanism of accessing the specific resource, "
00795         "<strong>%1%2</strong>." ,
00796           !host.isNull() ? host + '/' : QString() , path );
00797       causes << i18n( "KDE is able to communicate through a protocol within a "
00798         "protocol. This request specified a protocol be used as such, however "
00799         "this protocol is not capable of such an action. This is a rare event, "
00800         "and is likely to indicate a programming error." );
00801       solutions << sTypo << sSysadmin;
00802       break;
00803 
00804     case  KIO::ERR_COULD_NOT_MOUNT:
00805       errorName = i18n( "Unable to Initialize Input/Output Device" );
00806       techName = i18n( "Could Not Mount Device" );
00807       description = i18n( "The requested device could not be initialized "
00808         "(\"mounted\"). The reported error was: <strong>%1</strong>" ,
00809           errorText );
00810       causes << i18n( "The device may not be ready, for example there may be "
00811         "no media in a removable media device (i.e. no CD-ROM in a CD drive), "
00812         "or in the case of a peripheral/portable device, the device may not "
00813         "be correctly connected." )
00814         << i18n( "You may not have permissions to initialize (\"mount\") the "
00815         "device. On UNIX systems, often system administrator privileges are "
00816         "required to initialize a device." )
00817         << cHardware;
00818       solutions << i18n( "Check that the device is ready; removable drives "
00819         "must contain media, and portable devices must be connected and powered "
00820         "on.; and try again." ) << sAccess << sSysadmin;
00821       break;
00822 
00823     case  KIO::ERR_COULD_NOT_UNMOUNT:
00824       errorName = i18n( "Unable to Uninitialize Input/Output Device" );
00825       techName = i18n( "Could Not Unmount Device" );
00826       description = i18n( "The requested device could not be uninitialized "
00827         "(\"unmounted\"). The reported error was: <strong>%1</strong>" ,
00828           errorText );
00829       causes << i18n( "The device may be busy, that is, still in use by "
00830         "another application or user. Even such things as having an open "
00831         "browser window on a location on this device may cause the device to "
00832         "remain in use." )
00833         << i18n( "You may not have permissions to uninitialize (\"unmount\") "
00834         "the device. On UNIX systems, system administrator privileges are "
00835         "often required to uninitialize a device." )
00836         << cHardware;
00837       solutions << i18n( "Check that no applications are accessing the device, "
00838         "and try again." ) << sAccess << sSysadmin;
00839       break;
00840 
00841     case  KIO::ERR_COULD_NOT_READ:
00842       errorName = i18n( "Cannot Read From Resource" );
00843       description = i18n( "This means that although the resource, "
00844         "<strong>%1</strong>, was able to be opened, an error occurred while "
00845         "reading the contents of the resource." ,  url );
00846       causes << i18n( "You may not have permissions to read from the resource." );
00847       if ( !isSlaveNetwork ) causes << cNetwork;
00848       causes << cHardware;
00849       solutions << sAccess;
00850       if ( !isSlaveNetwork ) solutions << sNetwork;
00851       solutions << sSysadmin;
00852       break;
00853 
00854     case  KIO::ERR_COULD_NOT_WRITE:
00855       errorName = i18n( "Cannot Write to Resource" );
00856       description = i18n( "This means that although the resource, <strong>%1</strong>"
00857         ", was able to be opened, an error occurred while writing to the resource." ,
00858           url );
00859       causes << i18n( "You may not have permissions to write to the resource." );
00860       if ( !isSlaveNetwork ) causes << cNetwork;
00861       causes << cHardware;
00862       solutions << sAccess;
00863       if ( !isSlaveNetwork ) solutions << sNetwork;
00864       solutions << sSysadmin;
00865       break;
00866 
00867     case  KIO::ERR_COULD_NOT_BIND:
00868       errorName = i18n( "Could Not Listen for Network Connections" );
00869       techName = i18n( "Could Not Bind" );
00870       description = i18n( "This is a fairly technical error in which a required "
00871         "device for network communications (a socket) could not be established "
00872         "to listen for incoming network connections." );
00873       causes << i18n( "The network connection may be incorrectly configured, or "
00874         "the network interface may not be enabled." );
00875       solutions << sNetwork << sSysadmin;
00876       break;
00877 
00878     case  KIO::ERR_COULD_NOT_LISTEN:
00879       errorName = i18n( "Could Not Listen for Network Connections" );
00880       techName = i18n( "Could Not Listen" );
00881       description = i18n( "This is a fairly technical error in which a required "
00882         "device for network communications (a socket) could not be established "
00883         "to listen for incoming network connections." );
00884       causes << i18n( "The network connection may be incorrectly configured, or "
00885         "the network interface may not be enabled." );
00886       solutions << sNetwork << sSysadmin;
00887       break;
00888 
00889     case  KIO::ERR_COULD_NOT_ACCEPT:
00890       errorName = i18n( "Could Not Accept Network Connection" );
00891       description = i18n( "This is a fairly technical error in which an error "
00892         "occurred while attempting to accept an incoming network connection." );
00893       causes << i18n( "The network connection may be incorrectly configured, or "
00894         "the network interface may not be enabled." )
00895         << i18n( "You may not have permissions to accept the connection." );
00896       solutions << sNetwork << sSysadmin;
00897       break;
00898 
00899     case  KIO::ERR_COULD_NOT_LOGIN:
00900       errorName = i18n( "Could Not Login: %1" ,  errorText );
00901       description = i18n( "An attempt to login to perform the requested "
00902         "operation was unsuccessful." );
00903       causes << i18n( "You may have supplied incorrect authentication details or "
00904         "none at all." )
00905         << i18n( "Your account may not have permission to access the "
00906         "specified resource." ) << cProtocol;
00907       solutions << i18n( "Retry the request and ensure your authentication details "
00908         "are entered correctly." ) << sServeradmin << sSysadmin;
00909       break;
00910 
00911     case  KIO::ERR_COULD_NOT_STAT:
00912       errorName = i18n( "Could Not Determine Resource Status" );
00913       techName = i18n( "Could Not Stat Resource" );
00914       description = i18n( "An attempt to determine information about the status "
00915         "of the resource <strong>%1</strong>, such as the resource name, type, "
00916         "size, etc., was unsuccessful." ,  url );
00917       causes << i18n( "The specified resource may not have existed or may "
00918         "not be accessible." ) << cProtocol << cHardware;
00919       solutions << i18n( "Retry the request and ensure your authentication details "
00920         "are entered correctly." ) << sSysadmin;
00921       break;
00922 
00923     case  KIO::ERR_COULD_NOT_CLOSEDIR:
00924       //result = i18n( "Could not terminate listing %1" ).arg( errorText );
00925       errorName = i18n( "Could Not Cancel Listing" );
00926       techName = i18n( "FIXME: Document this" );
00927       break;
00928 
00929     case  KIO::ERR_COULD_NOT_MKDIR:
00930       errorName = i18n( "Could Not Create Folder" );
00931       description = i18n( "An attempt to create the requested folder failed." );
00932       causes << cAccess << i18n( "The location where the folder was to be created "
00933         "may not exist." );
00934       if ( !isSlaveNetwork ) causes << cProtocol;
00935       solutions << i18n( "Retry the request." ) << sAccess;
00936       break;
00937 
00938     case  KIO::ERR_COULD_NOT_RMDIR:
00939       errorName = i18n( "Could Not Remove Folder" );
00940       description = i18n( "An attempt to remove the specified folder, "
00941         "<strong>%1</strong>, failed." , path );
00942       causes << i18n( "The specified folder may not exist." )
00943         << i18n( "The specified folder may not be empty." )
00944         << cAccess;
00945       if ( !isSlaveNetwork ) causes << cProtocol;
00946       solutions << i18n( "Ensure that the folder exists and is empty, and try "
00947         "again." ) << sAccess;
00948       break;
00949 
00950     case  KIO::ERR_CANNOT_RESUME:
00951       errorName = i18n( "Could Not Resume File Transfer" );
00952       description = i18n( "The specified request asked that the transfer of "
00953         "file <strong>%1</strong> be resumed at a certain point of the "
00954         "transfer. This was not possible." ,  filename );
00955       causes << i18n( "The protocol, or the server, may not support file "
00956         "resuming." );
00957       solutions << i18n( "Retry the request without attempting to resume "
00958         "transfer." );
00959       break;
00960 
00961     case  KIO::ERR_CANNOT_RENAME:
00962       errorName = i18n( "Could Not Rename Resource" );
00963       description = i18n( "An attempt to rename the specified resource "
00964         "<strong>%1</strong> failed." ,  url );
00965       causes << cAccess << cExists;
00966       if ( !isSlaveNetwork ) causes << cProtocol;
00967       solutions << sAccess << sExists;
00968       break;
00969 
00970     case  KIO::ERR_CANNOT_CHMOD:
00971       errorName = i18n( "Could Not Alter Permissions of Resource" );
00972       description = i18n( "An attempt to alter the permissions on the specified "
00973         "resource <strong>%1</strong> failed." ,  url );
00974       causes << cAccess << cExists;
00975       solutions << sAccess << sExists;
00976       break;
00977 
00978     case  KIO::ERR_CANNOT_CHOWN:
00979       errorName = i18n( "Could Not Change Ownership of Resource" );
00980       description = i18n( "An attempt to change the ownership of the specified "
00981         "resource <strong>%1</strong> failed." ,  url );
00982       causes << cAccess << cExists;
00983       solutions << sAccess << sExists;
00984       break;
00985 
00986     case  KIO::ERR_CANNOT_DELETE:
00987       errorName = i18n( "Could Not Delete Resource" );
00988       description = i18n( "An attempt to delete the specified resource "
00989         "<strong>%1</strong> failed." ,  url );
00990       causes << cAccess << cExists;
00991       solutions << sAccess << sExists;
00992       break;
00993 
00994     case  KIO::ERR_SLAVE_DIED:
00995       errorName = i18n( "Unexpected Program Termination" );
00996       description = i18n( "The program on your computer which provides access "
00997         "to the <strong>%1</strong> protocol has unexpectedly terminated." ,
00998           url );
00999       causes << cBuglikely;
01000       solutions << sUpdate << sBugreport;
01001       break;
01002 
01003     case  KIO::ERR_OUT_OF_MEMORY:
01004       errorName = i18n( "Out of Memory" );
01005       description = i18n( "The program on your computer which provides access "
01006         "to the <strong>%1</strong> protocol could not obtain the memory "
01007         "required to continue." ,  protocol );
01008       causes << cBuglikely;
01009       solutions << sUpdate << sBugreport;
01010       break;
01011 
01012     case  KIO::ERR_UNKNOWN_PROXY_HOST:
01013       errorName = i18n( "Unknown Proxy Host" );
01014       description = i18n( "While retrieving information about the specified "
01015         "proxy host, <strong>%1</strong>, an Unknown Host error was encountered. "
01016         "An unknown host error indicates that the requested name could not be "
01017         "located on the Internet." ,  errorText );
01018       causes << i18n( "There may have been a problem with your network "
01019         "configuration, specifically your proxy's hostname. If you have been "
01020         "accessing the Internet with no problems recently, this is unlikely." )
01021         << cNetwork;
01022       solutions << i18n( "Double-check your proxy settings and try again." )
01023         << sSysadmin;
01024       break;
01025 
01026     case  KIO::ERR_COULD_NOT_AUTHENTICATE:
01027       errorName = i18n( "Authentication Failed: Method %1 Not Supported" ,
01028            errorText );
01029       description = i18n( "Although you may have supplied the correct "
01030         "authentication details, the authentication failed because the "
01031         "method that the server is using is not supported by the KDE "
01032         "program implementing the protocol %1." ,  protocol );
01033       solutions << i18n( "Please file a bug at <a href=\"http://bugs.kde.org/\">"
01034         "http://bugs.kde.org/</a> to inform the KDE team of the unsupported "
01035         "authentication method." ) << sSysadmin;
01036       break;
01037 
01038     case  KIO::ERR_ABORTED:
01039       errorName = i18n( "Request Aborted" );
01040       description = i18n( "The request was not completed because it was "
01041         "aborted." );
01042       solutions << i18n( "Retry the request." );
01043       break;
01044 
01045     case  KIO::ERR_INTERNAL_SERVER:
01046       errorName = i18n( "Internal Error in Server" );
01047       description = i18n( "The program on the server which provides access "
01048         "to the <strong>%1</strong> protocol has reported an internal error: "
01049         "%2." ,  protocol, errorText );
01050       causes << i18n( "This is most likely to be caused by a bug in the "
01051         "server program. Please consider submitting a full bug report as "
01052         "detailed below." );
01053       solutions << i18n( "Contact the administrator of the server "
01054         "to advise them of the problem." )
01055         << i18n( "If you know who the authors of the server software are, "
01056         "submit the bug report directly to them." );
01057       break;
01058 
01059     case  KIO::ERR_SERVER_TIMEOUT:
01060       errorName = i18n( "Timeout Error" );
01061       description = i18n( "Although contact was made with the server, a "
01062         "response was not received within the amount of time allocated for "
01063         "the request as follows:<ul>"
01064         "<li>Timeout for establishing a connection: %1 seconds</li>"
01065         "<li>Timeout for receiving a response: %2 seconds</li>"
01066         "<li>Timeout for accessing proxy servers: %3 seconds</li></ul>"
01067         "Please note that you can alter these timeout settings in the KDE "
01068         "Control Center, by selecting Network -> Preferences." ,
01069           KProtocolManager::connectTimeout() ,
01070           KProtocolManager::responseTimeout() ,
01071           KProtocolManager::proxyConnectTimeout() );
01072       causes << cNetpath << i18n( "The server was too busy responding to other "
01073         "requests to respond." );
01074       solutions << sTryagain << sServeradmin;
01075       break;
01076 
01077     case  KIO::ERR_UNKNOWN:
01078       errorName = i18n( "Unknown Error" );
01079       description = i18n( "The program on your computer which provides access "
01080         "to the <strong>%1</strong> protocol has reported an unknown error: "
01081         "%2." ,  protocol ,  errorText );
01082       causes << cBug;
01083       solutions << sUpdate << sBugreport;
01084       break;
01085 
01086     case  KIO::ERR_UNKNOWN_INTERRUPT:
01087       errorName = i18n( "Unknown Interruption" );
01088       description = i18n( "The program on your computer which provides access "
01089         "to the <strong>%1</strong> protocol has reported an interruption of "
01090         "an unknown type: %2." ,  protocol ,  errorText );
01091       causes << cBug;
01092       solutions << sUpdate << sBugreport;
01093       break;
01094 
01095     case KIO::ERR_CANNOT_DELETE_ORIGINAL:
01096       errorName = i18n( "Could Not Delete Original File" );
01097       description = i18n( "The requested operation required the deleting of "
01098         "the original file, most likely at the end of a file move operation. "
01099         "The original file <strong>%1</strong> could not be deleted." ,
01100           errorText );
01101       causes << cAccess;
01102       solutions << sAccess;
01103       break;
01104 
01105     case KIO::ERR_CANNOT_DELETE_PARTIAL:
01106       errorName = i18n( "Could Not Delete Temporary File" );
01107       description = i18n( "The requested operation required the creation of "
01108         "a temporary file in which to save the new file while being "
01109         "downloaded. This temporary file <strong>%1</strong> could not be "
01110         "deleted." ,  errorText );
01111       causes << cAccess;
01112       solutions << sAccess;
01113       break;
01114 
01115     case KIO::ERR_CANNOT_RENAME_ORIGINAL:
01116       errorName = i18n( "Could Not Rename Original File" );
01117       description = i18n( "The requested operation required the renaming of "
01118         "the original file <strong>%1</strong>, however it could not be "
01119         "renamed." ,  errorText );
01120       causes << cAccess;
01121       solutions << sAccess;
01122       break;
01123 
01124     case KIO::ERR_CANNOT_RENAME_PARTIAL:
01125       errorName = i18n( "Could Not Rename Temporary File" );
01126       description = i18n( "The requested operation required the creation of "
01127         "a temporary file <strong>%1</strong>, however it could not be "
01128         "created." ,  errorText );
01129       causes << cAccess;
01130       solutions << sAccess;
01131       break;
01132 
01133     case KIO::ERR_CANNOT_SYMLINK:
01134       errorName = i18n( "Could Not Create Link" );
01135       techName = i18n( "Could Not Create Symbolic Link" );
01136       description = i18n( "The requested symbolic link %1 could not be created." ,
01137           errorText );
01138       causes << cAccess;
01139       solutions << sAccess;
01140       break;
01141 
01142     case KIO::ERR_NO_CONTENT:
01143       errorName = i18n( "No Content" );
01144       description = errorText;
01145       break;
01146 
01147     case KIO::ERR_DISK_FULL:
01148       errorName = i18n( "Disk Full" );
01149       description = i18n( "The requested file <strong>%1</strong> could not be "
01150         "written to as there is inadequate disk space." ,  errorText );
01151       solutions << i18n( "Free up enough disk space by 1) deleting unwanted and "
01152         "temporary files; 2) archiving files to removable media storage such as "
01153         "CD-Recordable discs; or 3) obtain more storage capacity." )
01154         << sSysadmin;
01155       break;
01156 
01157     case KIO::ERR_IDENTICAL_FILES:
01158       errorName = i18n( "Source and Destination Files Identical" );
01159       description = i18n( "The operation could not be completed because the "
01160         "source and destination files are the same file." );
01161       solutions << i18n( "Choose a different filename for the destination file." );
01162       break;
01163 
01164     // We assume that the slave has all the details
01165     case KIO::ERR_SLAVE_DEFINED:
01166       errorName.clear();
01167       description = errorText;
01168       break;
01169 
01170     default:
01171       // fall back to the plain error...
01172       errorName = i18n( "Undocumented Error" );
01173       description = buildErrorString( errorCode, errorText );
01174   }
01175 
01176   QByteArray ret;
01177   QDataStream stream(&ret, QIODevice::WriteOnly);
01178   stream << errorName << techName << description << causes << solutions;
01179   return ret;
01180 }
01181 
01182 /***************************************************************
01183  *
01184  * Utility functions
01185  *
01186  ***************************************************************/
01187 
01188 KIO::CacheControl KIO::parseCacheControl(const QString &cacheControl)
01189 {
01190   QString tmp = cacheControl.toLower();
01191 
01192   if (tmp == "cacheonly")
01193      return KIO::CC_CacheOnly;
01194   if (tmp == "cache")
01195      return KIO::CC_Cache;
01196   if (tmp == "verify")
01197      return KIO::CC_Verify;
01198   if (tmp == "refresh")
01199      return KIO::CC_Refresh;
01200   if (tmp == "reload")
01201      return KIO::CC_Reload;
01202 
01203   kDebug() << "unrecognized Cache control option:"<<cacheControl;
01204   return KIO::CC_Verify;
01205 }
01206 
01207 QString KIO::getCacheControlString(KIO::CacheControl cacheControl)
01208 {
01209     if (cacheControl == KIO::CC_CacheOnly)
01210     return "CacheOnly";
01211     if (cacheControl == KIO::CC_Cache)
01212     return "Cache";
01213     if (cacheControl == KIO::CC_Verify)
01214     return "Verify";
01215     if (cacheControl == KIO::CC_Refresh)
01216     return "Refresh";
01217     if (cacheControl == KIO::CC_Reload)
01218     return "Reload";
01219     kDebug() << "unrecognized Cache control enum value:"<<cacheControl;
01220     return QString();
01221 }
01222 
01223 QPixmap KIO::pixmapForUrl( const KUrl & _url, mode_t _mode, KIconLoader::Group _group,
01224                            int _force_size, int _state, QString * _path )
01225 {
01226     const QString iconName = KMimeType::iconNameForUrl( _url, _mode );
01227     return KIconLoader::global()->loadMimeTypeIcon( iconName, _group, _force_size, _state, QStringList(), _path );
01228 }
01229 
01230 KJobTrackerInterface *KIO::getJobTracker()
01231 {
01232     return globalJobTracker;
01233 }
01234 
01235 
01236 
01237 
01238 
01239 

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.6
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