• Skip to content
  • Skip to link menu
KDE 4.6 API Reference
  • KDE API Reference
  • kdelibs
  • KDE Home
  • Contact Us
 

KIO

global.cpp

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

KIO

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

kdelibs

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