File indexing completed on 2024-04-28 11:40:57

0001 /*
0002     This file is part of the KDE libraries
0003     SPDX-FileCopyrightText: 2000 David Faure <faure@kde.org>
0004 
0005     SPDX-License-Identifier: LGPL-2.0-only
0006 */
0007 
0008 #include "job.h"
0009 #include "kioglobal_p.h"
0010 #include <KLocalizedString>
0011 #include <KStringHandler>
0012 #include <kprotocolmanager.h>
0013 
0014 #include <QDataStream>
0015 #include <QDateTime>
0016 #include <QLocale>
0017 #include <QUrl>
0018 #include <sys/stat.h> // S_IRUSR etc
0019 
0020 static const int s_maxFilePathLength = 80;
0021 
0022 QString KIO::Job::errorString() const
0023 {
0024     return KIO::buildErrorString(error(), errorText());
0025 }
0026 
0027 KIOCORE_EXPORT QString KIO::buildErrorString(int errorCode, const QString &errorText)
0028 {
0029     QString result;
0030 
0031     switch (errorCode) {
0032     case KIO::ERR_CANNOT_OPEN_FOR_READING:
0033         result = i18n("Could not read %1.", errorText);
0034         break;
0035     case KIO::ERR_CANNOT_OPEN_FOR_WRITING:
0036         result = i18n("Could not write to %1.", KStringHandler::csqueeze(errorText, s_maxFilePathLength));
0037         break;
0038     case KIO::ERR_CANNOT_LAUNCH_PROCESS:
0039         result = i18n("Could not start process %1.", errorText);
0040         break;
0041     case KIO::ERR_INTERNAL:
0042         result = i18n("Internal Error\nPlease send a full bug report at https://bugs.kde.org\n%1", errorText);
0043         break;
0044     case KIO::ERR_MALFORMED_URL:
0045         result = i18n("Malformed URL %1.", errorText);
0046         break;
0047     case KIO::ERR_UNSUPPORTED_PROTOCOL:
0048         result = i18n("The protocol %1 is not supported.", errorText);
0049         break;
0050     case KIO::ERR_NO_SOURCE_PROTOCOL:
0051         result = i18n("The protocol %1 is only a filter protocol.", errorText);
0052         break;
0053     case KIO::ERR_UNSUPPORTED_ACTION:
0054         result = errorText;
0055         //       result = i18n( "Unsupported action %1" ).arg( errorText );
0056         break;
0057     case KIO::ERR_IS_DIRECTORY:
0058         result = i18n("%1 is a folder, but a file was expected.", errorText);
0059         break;
0060     case KIO::ERR_IS_FILE:
0061         result = i18n("%1 is a file, but a folder was expected.", errorText);
0062         break;
0063     case KIO::ERR_DOES_NOT_EXIST:
0064         result = i18n("The file or folder %1 does not exist.", errorText);
0065         break;
0066     case KIO::ERR_FILE_ALREADY_EXIST:
0067         result = i18n("A file named %1 already exists.", errorText);
0068         break;
0069     case KIO::ERR_DIR_ALREADY_EXIST:
0070         result = i18n("A folder named %1 already exists.", errorText);
0071         break;
0072     case KIO::ERR_UNKNOWN_HOST:
0073         result = errorText.isEmpty() ? i18n("No hostname specified.") : i18n("Unknown host %1", errorText);
0074         break;
0075     case KIO::ERR_ACCESS_DENIED:
0076         result = i18n("Access denied to %1.", errorText);
0077         break;
0078     case KIO::ERR_WRITE_ACCESS_DENIED:
0079         result = i18n("Access denied.\nCould not write to %1.", errorText);
0080         break;
0081     case KIO::ERR_CANNOT_ENTER_DIRECTORY:
0082         result = i18n("Could not enter folder %1.", errorText);
0083         break;
0084     case KIO::ERR_PROTOCOL_IS_NOT_A_FILESYSTEM:
0085         result = i18n("The protocol %1 does not implement a folder service.", errorText);
0086         break;
0087     case KIO::ERR_CYCLIC_LINK:
0088         result = i18n("Found a cyclic link in %1.", errorText);
0089         break;
0090     case KIO::ERR_CYCLIC_COPY:
0091         result = i18n("Found a cyclic link while copying %1.", errorText);
0092         break;
0093     case KIO::ERR_CANNOT_CREATE_SOCKET:
0094         result = i18n("Could not create socket for accessing %1.", errorText);
0095         break;
0096     case KIO::ERR_CANNOT_CONNECT:
0097         result = i18n("Could not connect to host %1.", errorText.isEmpty() ? QStringLiteral("localhost") : errorText);
0098         break;
0099     case KIO::ERR_CONNECTION_BROKEN:
0100         result = i18n("Connection to host %1 is broken.", errorText);
0101         break;
0102     case KIO::ERR_NOT_FILTER_PROTOCOL:
0103         result = i18n("The protocol %1 is not a filter protocol.", errorText);
0104         break;
0105     case KIO::ERR_CANNOT_MOUNT:
0106         result = i18n("Could not mount device.\nThe reported error was:\n%1", errorText);
0107         break;
0108     case KIO::ERR_CANNOT_UNMOUNT:
0109         result = i18n("Could not unmount device.\nThe reported error was:\n%1", errorText);
0110         break;
0111     case KIO::ERR_CANNOT_READ:
0112         result = i18n("Could not read file %1.", errorText);
0113         break;
0114     case KIO::ERR_CANNOT_WRITE:
0115         result = i18n("Could not write to file %1.", errorText);
0116         break;
0117     case KIO::ERR_CANNOT_BIND:
0118         result = i18n("Could not bind %1.", errorText);
0119         break;
0120     case KIO::ERR_CANNOT_LISTEN:
0121         result = i18n("Could not listen %1.", errorText);
0122         break;
0123     case KIO::ERR_CANNOT_ACCEPT:
0124         result = i18n("Could not accept %1.", errorText);
0125         break;
0126     case KIO::ERR_CANNOT_LOGIN:
0127         result = errorText;
0128         break;
0129     case KIO::ERR_CANNOT_STAT:
0130         result = i18n("Could not access %1.", errorText);
0131         break;
0132     case KIO::ERR_CANNOT_CLOSEDIR:
0133         result = i18n("Could not terminate listing %1.", errorText);
0134         break;
0135     case KIO::ERR_CANNOT_MKDIR:
0136         result = i18n("Could not make folder %1.", KStringHandler::csqueeze(errorText, s_maxFilePathLength));
0137         break;
0138     case KIO::ERR_CANNOT_RMDIR:
0139         result = i18n("Could not remove folder %1.", errorText);
0140         break;
0141     case KIO::ERR_CANNOT_RESUME:
0142         result = i18n("Could not resume file %1.", errorText);
0143         break;
0144     case KIO::ERR_CANNOT_RENAME:
0145         result = i18n("Could not rename file %1.", KStringHandler::csqueeze(errorText, s_maxFilePathLength));
0146         break;
0147     case KIO::ERR_CANNOT_CHMOD:
0148         result = i18n("Could not change permissions for %1.", errorText);
0149         break;
0150     case KIO::ERR_CANNOT_CHOWN:
0151         result = i18n("Could not change ownership for %1.", errorText);
0152         break;
0153     case KIO::ERR_CANNOT_DELETE:
0154         result = i18n("Could not delete file %1.", errorText);
0155         break;
0156     case KIO::ERR_WORKER_DIED:
0157         result = i18n("The process for the %1 protocol died unexpectedly.", errorText);
0158         break;
0159     case KIO::ERR_OUT_OF_MEMORY:
0160         result = i18n("Error. Out of memory.\n%1", errorText);
0161         break;
0162     case KIO::ERR_UNKNOWN_PROXY_HOST:
0163         result = i18n("Unknown proxy host\n%1", errorText);
0164         break;
0165     case KIO::ERR_CANNOT_AUTHENTICATE:
0166         result = i18n("Authorization failed, %1 authentication not supported", errorText);
0167         break;
0168     case KIO::ERR_USER_CANCELED:
0169         // Typically no message should be shown to the user in this case;
0170         // however the text is set here only for debugging purposes.
0171     case KIO::ERR_ABORTED:
0172         result = i18n("User canceled action\n%1", errorText);
0173         break;
0174     case KIO::ERR_INTERNAL_SERVER:
0175         result = i18n("Internal error in server\n%1", errorText);
0176         break;
0177     case KIO::ERR_SERVER_TIMEOUT:
0178         result = i18n("Timeout on server\n%1", errorText);
0179         break;
0180     case KIO::ERR_UNKNOWN:
0181         result = i18n("Unknown error\n%1", errorText);
0182         break;
0183     case KIO::ERR_UNKNOWN_INTERRUPT:
0184         result = i18n("Unknown interrupt\n%1", errorText);
0185         break;
0186     /*
0187         case  KIO::ERR_CHECKSUM_MISMATCH:
0188           if (errorText)
0189             result = i18n( "Warning: MD5 Checksum for %1 does not match checksum returned from server" ).arg(errorText);
0190           else
0191             result = i18n( "Warning: MD5 Checksum for %1 does not match checksum returned from server" ).arg("document");
0192           break;
0193     */
0194     case KIO::ERR_CANNOT_DELETE_ORIGINAL:
0195         result = i18n("Could not delete original file %1.\nPlease check permissions.", errorText);
0196         break;
0197     case KIO::ERR_CANNOT_DELETE_PARTIAL:
0198         result = i18n("Could not delete partial file %1.\nPlease check permissions.", errorText);
0199         break;
0200     case KIO::ERR_CANNOT_RENAME_ORIGINAL:
0201         result = i18n("Could not rename original file %1.\nPlease check permissions.", errorText);
0202         break;
0203     case KIO::ERR_CANNOT_RENAME_PARTIAL:
0204         result = i18n("Could not rename partial file %1.\nPlease check permissions.", errorText);
0205         break;
0206     case KIO::ERR_CANNOT_SYMLINK:
0207         result = i18n("Could not create symlink %1.\nPlease check permissions.", errorText);
0208         break;
0209     case KIO::ERR_SYMLINKS_NOT_SUPPORTED:
0210         result = i18n("Cannot create symlinks at %1.\nThe destination filesystem doesn't support symlinks.", errorText);
0211         break;
0212     case KIO::ERR_NO_CONTENT:
0213         result = errorText;
0214         break;
0215     case KIO::ERR_DISK_FULL:
0216         result = i18n("There is not enough space on the disk to write %1.", errorText);
0217         break;
0218     case KIO::ERR_IDENTICAL_FILES:
0219         result = i18n("The source and destination are the same file.\n%1", errorText);
0220         break;
0221     case KIO::ERR_WORKER_DEFINED:
0222         Q_FALLTHROUGH();
0223     case KJob::UserDefinedError:
0224         result = errorText;
0225         break;
0226     case KIO::ERR_UPGRADE_REQUIRED:
0227         result = i18n("%1 is required by the server, but is not available.", errorText);
0228         break;
0229     case KIO::ERR_POST_DENIED:
0230         result = i18n("Access to restricted port in POST denied.");
0231         break;
0232     case KIO::ERR_POST_NO_SIZE:
0233         result = i18n("The required content size information was not provided for a POST operation.");
0234         break;
0235     case KIO::ERR_DROP_ON_ITSELF:
0236         result = i18n("A file or folder cannot be dropped onto itself");
0237         break;
0238     case KIO::ERR_CANNOT_MOVE_INTO_ITSELF:
0239         result = i18n("A folder cannot be moved into itself");
0240         break;
0241     case KIO::ERR_PASSWD_SERVER:
0242         result = i18n("Communication with the local password server failed");
0243         break;
0244     case KIO::ERR_CANNOT_CREATE_WORKER:
0245         result = i18n("Unable to create KIO worker. %1", errorText);
0246         break;
0247     case KIO::ERR_FILE_TOO_LARGE_FOR_FAT32:
0248         result = xi18nc("@info",
0249                         "Cannot transfer <filename>%1</filename> because it is too large. The destination filesystem only supports files up to 4GiB",
0250                         errorText);
0251         break;
0252     case KIO::ERR_PRIVILEGE_NOT_REQUIRED:
0253         result =
0254             i18n("Privilege escalation is not necessary because \n'%1' is owned by the current user.\nPlease retry after changing permissions.", errorText);
0255         break;
0256     case KIO::ERR_TRASH_FILE_TOO_LARGE:
0257         result = i18n("File is too large to be trashed.");
0258         break;
0259     default:
0260         result = i18n("Unknown error code %1\n%2\nPlease send a full bug report at https://bugs.kde.org.", errorCode, errorText);
0261         break;
0262     }
0263 
0264     return result;
0265 }
0266 
0267 QStringList KIO::Job::detailedErrorStrings(const QUrl *reqUrl /*= 0*/, int method /*= -1*/) const
0268 {
0269     QString errorName;
0270     QString techName;
0271     QString description;
0272     QString ret2;
0273     QStringList causes;
0274     QStringList solutions;
0275     QStringList ret;
0276 
0277     QByteArray raw = rawErrorDetail(error(), errorText(), reqUrl, method);
0278     QDataStream stream(raw);
0279 
0280     stream >> errorName >> techName >> description >> causes >> solutions;
0281 
0282     QString url;
0283     QString protocol;
0284     QString datetime;
0285     if (reqUrl) {
0286         QString prettyUrl;
0287         prettyUrl = reqUrl->toDisplayString();
0288         url = prettyUrl.toHtmlEscaped();
0289         protocol = reqUrl->scheme();
0290     } else {
0291         url = i18nc("@info url", "(unknown)");
0292     }
0293 
0294     datetime = QLocale().toString(QDateTime::currentDateTime(), QLocale::LongFormat);
0295 
0296     ret << errorName;
0297     ret << i18nc("@info %1 error name, %2 description", "<qt><p><b>%1</b></p><p>%2</p></qt>", errorName, description);
0298 
0299     ret2 = QStringLiteral("<qt>");
0300     if (!techName.isEmpty()) {
0301         ret2 += QLatin1String("<p>") + i18n("<b>Technical reason</b>: ") + techName + QLatin1String("</p>");
0302     }
0303     ret2 += QLatin1String("<p>") + i18n("<b>Details of the request</b>:") + QLatin1String("</p><ul>") + i18n("<li>URL: %1</li>", url);
0304     if (!protocol.isEmpty()) {
0305         ret2 += i18n("<li>Protocol: %1</li>", protocol);
0306     }
0307     ret2 += i18n("<li>Date and time: %1</li>", datetime) + i18n("<li>Additional information: %1</li>", errorText()) + QLatin1String("</ul>");
0308     if (!causes.isEmpty()) {
0309         ret2 += QLatin1String("<p>") + i18n("<b>Possible causes</b>:") + QLatin1String("</p><ul><li>") + causes.join(QLatin1String("</li><li>"))
0310             + QLatin1String("</li></ul>");
0311     }
0312     if (!solutions.isEmpty()) {
0313         ret2 += QLatin1String("<p>") + i18n("<b>Possible solutions</b>:") + QLatin1String("</p><ul><li>") + solutions.join(QLatin1String("</li><li>"))
0314             + QLatin1String("</li></ul>");
0315     }
0316     ret2 += QLatin1String("</qt>");
0317     ret << ret2;
0318 
0319     return ret;
0320 }
0321 
0322 KIOCORE_EXPORT QByteArray KIO::rawErrorDetail(int errorCode, const QString &errorText, const QUrl *reqUrl /*= 0*/, int /*method = -1*/)
0323 {
0324     QString url;
0325     QString host;
0326     QString protocol;
0327     QString datetime;
0328     QString domain;
0329     QString path;
0330     QString filename;
0331     bool isWorkerNetwork = false;
0332     if (reqUrl) {
0333         url = reqUrl->toDisplayString();
0334         host = reqUrl->host();
0335         protocol = reqUrl->scheme();
0336 
0337         const QLatin1String web("www.");
0338         if (host.startsWith(web)) {
0339             domain = host.mid(web.size());
0340         } else {
0341             domain = host;
0342         }
0343 
0344         filename = reqUrl->fileName();
0345         path = reqUrl->path();
0346 
0347         // detect if protocol is a network protocol...
0348         if (!protocol.isEmpty()) {
0349             isWorkerNetwork = KProtocolInfo::protocolClass(protocol) == QLatin1String(":internet");
0350         }
0351     } else {
0352         // assume that the errorText has the location we are interested in
0353         url = host = domain = path = filename = errorText;
0354     }
0355 
0356     if (protocol.isEmpty()) {
0357         protocol = i18nc("@info protocol", "(unknown)");
0358     }
0359 
0360     datetime = QLocale().toString(QDateTime::currentDateTime(), QLocale::LongFormat);
0361 
0362     QString errorName;
0363     QString techName;
0364     QString description;
0365     QStringList causes;
0366     QStringList solutions;
0367 
0368     // c == cause, s == solution
0369     QString sSysadmin = i18n(
0370         "Contact your appropriate computer support system, "
0371         "whether the system administrator, or technical support group for further "
0372         "assistance.");
0373     QString sServeradmin = i18n(
0374         "Contact the administrator of the server "
0375         "for further assistance.");
0376     // FIXME active link to permissions dialog
0377     QString sAccess = i18n("Check your access permissions on this resource.");
0378     QString cAccess = i18n(
0379         "Your access permissions may be inadequate to "
0380         "perform the requested operation on this resource.");
0381     QString cLocked = i18n(
0382         "The file may be in use (and thus locked) by "
0383         "another user or application.");
0384     QString sQuerylock = i18n(
0385         "Check to make sure that no other "
0386         "application or user is using the file or has locked the file.");
0387     QString cHardware = i18n(
0388         "Although unlikely, a hardware error may have "
0389         "occurred.");
0390     QString cBug = i18n("You may have encountered a bug in the program.");
0391     QString cBuglikely = i18n(
0392         "This is most likely to be caused by a bug in the "
0393         "program. Please consider submitting a full bug report as detailed below.");
0394     QString sUpdate = i18n(
0395         "Update your software to the latest version. "
0396         "Your distribution should provide tools to update your software.");
0397     QString sBugreport = i18n(
0398         "When all else fails, please consider helping the "
0399         "KDE team or the third party maintainer of this software by submitting a "
0400         "high quality bug report. If the software is provided by a third party, "
0401         "please contact them directly. Otherwise, first look to see if "
0402         "the same bug has been submitted by someone else by searching at the "
0403         "<a href=\"https://bugs.kde.org/\">KDE bug reporting website</a>. If not, take "
0404         "note of the details given above, and include them in your bug report, along "
0405         "with as many other details as you think might help.");
0406     QString cNetwork = i18n(
0407         "There may have been a problem with your network "
0408         "connection.");
0409     // FIXME netconf kcontrol link
0410     QString cNetconf = i18n(
0411         "There may have been a problem with your network "
0412         "configuration. If you have been accessing the Internet with no problems "
0413         "recently, this is unlikely.");
0414     QString cNetpath = i18n(
0415         "There may have been a problem at some point along "
0416         "the network path between the server and this computer.");
0417     QString sTryagain = i18n("Try again, either now or at a later time.");
0418     QString cProtocol = i18n("A protocol error or incompatibility may have occurred.");
0419     QString sExists = i18n("Ensure that the resource exists, and try again.");
0420     QString cExists = i18n("The specified resource may not exist.");
0421     QString sTypo = i18n(
0422         "Double-check that you have entered the correct location "
0423         "and try again.");
0424     QString sNetwork = i18n("Check your network connection status.");
0425 
0426     switch (errorCode) {
0427     case KIO::ERR_CANNOT_OPEN_FOR_READING:
0428         errorName = i18n("Cannot Open Resource For Reading");
0429         description = i18n(
0430             "This means that the contents of the requested file "
0431             "or folder <strong>%1</strong> could not be retrieved, as read "
0432             "access could not be obtained.",
0433             path);
0434         causes << i18n(
0435             "You may not have permissions to read the file or open "
0436             "the folder.")
0437                << cLocked << cHardware;
0438         solutions << sAccess << sQuerylock << sSysadmin;
0439         break;
0440 
0441     case KIO::ERR_CANNOT_OPEN_FOR_WRITING:
0442         errorName = i18n("Cannot Open Resource For Writing");
0443         description = i18n(
0444             "This means that the file, <strong>%1</strong>, could "
0445             "not be written to as requested, because access with permission to "
0446             "write could not be obtained.",
0447             KStringHandler::csqueeze(filename, s_maxFilePathLength));
0448         causes << cAccess << cLocked << cHardware;
0449         solutions << sAccess << sQuerylock << sSysadmin;
0450         break;
0451 
0452     case KIO::ERR_CANNOT_LAUNCH_PROCESS:
0453         errorName = i18n("Cannot Launch Process required by the %1 Protocol", protocol);
0454         techName = i18n("Unable to Launch Process");
0455         description = i18n(
0456             "The program on your computer which provides access "
0457             "to the <strong>%1</strong> protocol could not be found or started. This is "
0458             "usually due to technical reasons.",
0459             protocol);
0460         causes << i18n(
0461             "The program which provides compatibility with this "
0462             "protocol may not have been updated with your last update of KDE. "
0463             "This can cause the program to be incompatible with the current version "
0464             "and thus not start.")
0465                << cBug;
0466         solutions << sUpdate << sSysadmin;
0467         break;
0468 
0469     case KIO::ERR_INTERNAL:
0470         errorName = i18n("Internal Error");
0471         description = i18n(
0472             "The program on your computer which provides access "
0473             "to the <strong>%1</strong> protocol has reported an internal error.",
0474             protocol);
0475         causes << cBuglikely;
0476         solutions << sUpdate << sBugreport;
0477         break;
0478 
0479     case KIO::ERR_MALFORMED_URL:
0480         errorName = i18n("Improperly Formatted URL");
0481         description = i18n(
0482             "The <strong>U</strong>niform <strong>R</strong>esource "
0483             "<strong>L</strong>ocator (URL) that you entered was not properly "
0484             "formatted. The format of a URL is generally as follows:"
0485             "<blockquote><strong>protocol://user:password@www.example.org:port/folder/"
0486             "filename.extension?query=value</strong></blockquote>");
0487         solutions << sTypo;
0488         break;
0489 
0490     case KIO::ERR_UNSUPPORTED_PROTOCOL:
0491         errorName = i18n("Unsupported Protocol %1", protocol);
0492         description = i18n(
0493             "The protocol <strong>%1</strong> is not supported "
0494             "by the KDE programs currently installed on this computer.",
0495             protocol);
0496         causes << i18n("The requested protocol may not be supported.")
0497                << i18n(
0498                       "The versions of the %1 protocol supported by this computer and "
0499                       "the server may be incompatible.",
0500                       protocol);
0501         solutions << i18n(
0502             "You may perform a search on the Internet for a software "
0503             "plugin (called a \"KIO worker\") which supports this protocol. "
0504             "Places to search include <a href=\"https://store.kde.org/\">"
0505             "https://store.kde.org</a>.")
0506                   << sUpdate << sSysadmin;
0507         break;
0508 
0509     case KIO::ERR_NO_SOURCE_PROTOCOL:
0510         errorName = i18n("URL Does Not Refer to a Resource.");
0511         techName = i18n("Protocol is a Filter Protocol");
0512         description = i18n(
0513             "The <strong>U</strong>niform <strong>R</strong>esource "
0514             "<strong>L</strong>ocator (URL) that you entered did not refer to a "
0515             "specific resource.");
0516         causes << i18n(
0517             "KDE is able to communicate through a protocol within a "
0518             "protocol; the protocol specified is only for use in such situations, "
0519             "however this is not one of these situations. This is a rare event, and "
0520             "is likely to indicate a programming error.");
0521         solutions << sTypo;
0522         break;
0523 
0524     case KIO::ERR_UNSUPPORTED_ACTION:
0525         errorName = i18n("Unsupported Action: %1", errorText);
0526         description = i18n(
0527             "The requested action is not supported by the KDE "
0528             "program which is implementing the <strong>%1</strong> protocol.",
0529             protocol);
0530         causes << i18n(
0531             "This error is very much dependent on the KDE program. The "
0532             "additional information should give you more information than is available "
0533             "to the KDE input/output architecture.");
0534         solutions << i18n(
0535             "Attempt to find another way to accomplish the same "
0536             "outcome.");
0537         break;
0538 
0539     case KIO::ERR_IS_DIRECTORY:
0540         errorName = i18n("File Expected");
0541         description = i18n(
0542             "The request expected a file, however the "
0543             "folder <strong>%1</strong> was found instead.",
0544             path);
0545         causes << i18n("This may be an error on the server side.") << cBug;
0546         solutions << sUpdate << sSysadmin;
0547         break;
0548 
0549     case KIO::ERR_IS_FILE:
0550         errorName = i18n("Folder Expected");
0551         description = i18n(
0552             "The request expected a folder, however "
0553             "the file <strong>%1</strong> was found instead.",
0554             filename);
0555         causes << cBug;
0556         solutions << sUpdate << sSysadmin;
0557         break;
0558 
0559     case KIO::ERR_DOES_NOT_EXIST:
0560         errorName = i18n("File or Folder Does Not Exist");
0561         description = i18n(
0562             "The specified file or folder <strong>%1</strong> "
0563             "does not exist.",
0564             path);
0565         causes << cExists;
0566         solutions << sExists;
0567         break;
0568 
0569     case KIO::ERR_FILE_ALREADY_EXIST:
0570         errorName = i18n("File Already Exists");
0571         description = i18n(
0572             "The requested file could not be created because a "
0573             "file with the same name already exists.");
0574         solutions << i18n(
0575             "Try moving the current file out of the way first, "
0576             "and then try again.")
0577                   << i18n("Delete the current file and try again.") << i18n("Choose an alternate filename for the new file.");
0578         break;
0579 
0580     case KIO::ERR_DIR_ALREADY_EXIST:
0581         errorName = i18n("Folder Already Exists");
0582         description = i18n(
0583             "The requested folder could not be created because "
0584             "a folder with the same name already exists.");
0585         solutions << i18n(
0586             "Try moving the current folder out of the way first, "
0587             "and then try again.")
0588                   << i18n("Delete the current folder and try again.") << i18n("Choose an alternate name for the new folder.");
0589         break;
0590 
0591     case KIO::ERR_UNKNOWN_HOST:
0592         errorName = i18n("Unknown Host");
0593         description = i18n(
0594             "An unknown host error indicates that the server with "
0595             "the requested name, <strong>%1</strong>, could not be "
0596             "located on the Internet.",
0597             host);
0598         causes << i18n(
0599             "The name that you typed, %1, may not exist: it may be "
0600             "incorrectly typed.",
0601             host)
0602                << cNetwork << cNetconf;
0603         solutions << sNetwork << sSysadmin;
0604         break;
0605 
0606     case KIO::ERR_ACCESS_DENIED:
0607         errorName = i18n("Access Denied");
0608         description = i18n(
0609             "Access was denied to the specified resource, "
0610             "<strong>%1</strong>.",
0611             url);
0612         causes << i18n(
0613             "You may have supplied incorrect authentication details or "
0614             "none at all.")
0615                << i18n(
0616                       "Your account may not have permission to access the "
0617                       "specified resource.");
0618         solutions << i18n(
0619             "Retry the request and ensure your authentication details "
0620             "are entered correctly.")
0621                   << sSysadmin;
0622         if (!isWorkerNetwork) {
0623             solutions << sServeradmin;
0624         }
0625         break;
0626 
0627     case KIO::ERR_WRITE_ACCESS_DENIED:
0628         errorName = i18n("Write Access Denied");
0629         description = i18n(
0630             "This means that an attempt to write to the file "
0631             "<strong>%1</strong> was rejected.",
0632             filename);
0633         causes << cAccess << cLocked << cHardware;
0634         solutions << sAccess << sQuerylock << sSysadmin;
0635         break;
0636 
0637     case KIO::ERR_CANNOT_ENTER_DIRECTORY:
0638         errorName = i18n("Unable to Enter Folder");
0639         description = i18n(
0640             "This means that an attempt to enter (in other words, "
0641             "to open) the requested folder <strong>%1</strong> was rejected.",
0642             path);
0643         causes << cAccess << cLocked;
0644         solutions << sAccess << sQuerylock << sSysadmin;
0645         break;
0646 
0647     case KIO::ERR_PROTOCOL_IS_NOT_A_FILESYSTEM:
0648         errorName = i18n("Folder Listing Unavailable");
0649         techName = i18n("Protocol %1 is not a Filesystem", protocol);
0650         description = i18n(
0651             "This means that a request was made which requires "
0652             "determining the contents of the folder, and the KDE program supporting "
0653             "this protocol is unable to do so.");
0654         causes << cBug;
0655         solutions << sUpdate << sBugreport;
0656         break;
0657 
0658     case KIO::ERR_CYCLIC_LINK:
0659         errorName = i18n("Cyclic Link Detected");
0660         description = i18n(
0661             "UNIX environments are commonly able to link a file or "
0662             "folder to a separate name and/or location. KDE detected a link or "
0663             "series of links that results in an infinite loop - i.e. the file was "
0664             "(perhaps in a roundabout way) linked to itself.");
0665         solutions << i18n(
0666             "Delete one part of the loop in order that it does not "
0667             "cause an infinite loop, and try again.")
0668                   << sSysadmin;
0669         break;
0670 
0671     case KIO::ERR_USER_CANCELED:
0672         // Do nothing in this case. The user doesn't need to be told what he just did.
0673         // rodda: However, if we have been called, an application is about to display
0674         // this information anyway. If we don't return sensible information, the
0675         // user sees a blank dialog (I have seen this myself)
0676         errorName = i18n("Request Aborted By User");
0677         description = i18n(
0678             "The request was not completed because it was "
0679             "aborted.");
0680         solutions << i18n("Retry the request.");
0681         break;
0682 
0683     case KIO::ERR_CYCLIC_COPY:
0684         errorName = i18n("Cyclic Link Detected During Copy");
0685         description = i18n(
0686             "UNIX environments are commonly able to link a file or "
0687             "folder to a separate name and/or location. During the requested copy "
0688             "operation, KDE detected a link or series of links that results in an "
0689             "infinite loop - i.e. the file was (perhaps in a roundabout way) linked "
0690             "to itself.");
0691         solutions << i18n(
0692             "Delete one part of the loop in order that it does not "
0693             "cause an infinite loop, and try again.")
0694                   << sSysadmin;
0695         break;
0696 
0697     case KIO::ERR_CANNOT_CREATE_SOCKET:
0698         errorName = i18n("Could Not Create Network Connection");
0699         techName = i18n("Could Not Create Socket");
0700         description = i18n(
0701             "This is a fairly technical error in which a required "
0702             "device for network communications (a socket) could not be created.");
0703         causes << i18n(
0704             "The network connection may be incorrectly configured, or "
0705             "the network interface may not be enabled.");
0706         solutions << sNetwork << sSysadmin;
0707         break;
0708 
0709     case KIO::ERR_CANNOT_CONNECT:
0710         errorName = i18n("Connection to Server Refused");
0711         description = i18n(
0712             "The server <strong>%1</strong> refused to allow this "
0713             "computer to make a connection.",
0714             host);
0715         causes << i18n(
0716             "The server, while currently connected to the Internet, "
0717             "may not be configured to allow requests.")
0718                << i18n(
0719                       "The server, while currently connected to the Internet, "
0720                       "may not be running the requested service (%1).",
0721                       protocol)
0722                << i18n(
0723                       "A network firewall (a device which restricts Internet "
0724                       "requests), either protecting your network or the network of the server, "
0725                       "may have intervened, preventing this request.");
0726         solutions << sTryagain << sServeradmin << sSysadmin;
0727         break;
0728 
0729     case KIO::ERR_CONNECTION_BROKEN:
0730         errorName = i18n("Connection to Server Closed Unexpectedly");
0731         description = i18n(
0732             "Although a connection was established to "
0733             "<strong>%1</strong>, the connection was closed at an unexpected point "
0734             "in the communication.",
0735             host);
0736         causes << cNetwork << cNetpath
0737                << i18n(
0738                       "A protocol error may have occurred, "
0739                       "causing the server to close the connection as a response to the error.");
0740         solutions << sTryagain << sServeradmin << sSysadmin;
0741         break;
0742 
0743     case KIO::ERR_NOT_FILTER_PROTOCOL:
0744         errorName = i18n("URL Resource Invalid");
0745         techName = i18n("Protocol %1 is not a Filter Protocol", protocol);
0746         description = i18n(
0747             "The <strong>U</strong>niform <strong>R</strong>esource "
0748             "<strong>L</strong>ocator (URL) that you entered did not refer to "
0749             "a valid mechanism of accessing the specific resource, "
0750             "<strong>%1%2</strong>.",
0751             !host.isNull() ? host + QLatin1Char('/') : QString(),
0752             path);
0753         causes << i18n(
0754             "KDE is able to communicate through a protocol within a "
0755             "protocol. This request specified a protocol be used as such, however "
0756             "this protocol is not capable of such an action. This is a rare event, "
0757             "and is likely to indicate a programming error.");
0758         solutions << sTypo << sSysadmin;
0759         break;
0760 
0761     case KIO::ERR_CANNOT_MOUNT:
0762         errorName = i18n("Unable to Initialize Input/Output Device");
0763         techName = i18n("Could Not Mount Device");
0764         description = i18n(
0765             "The requested device could not be initialized "
0766             "(\"mounted\"). The reported error was: <strong>%1</strong>",
0767             errorText);
0768         causes << i18n(
0769             "The device may not be ready, for example there may be "
0770             "no media in a removable media device (i.e. no CD-ROM in a CD drive), "
0771             "or in the case of a peripheral/portable device, the device may not "
0772             "be correctly connected.")
0773                << i18n(
0774                       "You may not have permissions to initialize (\"mount\") the "
0775                       "device. On UNIX systems, often system administrator privileges are "
0776                       "required to initialize a device.")
0777                << cHardware;
0778         solutions << i18n(
0779             "Check that the device is ready; removable drives "
0780             "must contain media, and portable devices must be connected and powered "
0781             "on.; and try again.")
0782                   << sAccess << sSysadmin;
0783         break;
0784 
0785     case KIO::ERR_CANNOT_UNMOUNT:
0786         errorName = i18n("Unable to Uninitialize Input/Output Device");
0787         techName = i18n("Could Not Unmount Device");
0788         description = i18n(
0789             "The requested device could not be uninitialized "
0790             "(\"unmounted\"). The reported error was: <strong>%1</strong>",
0791             errorText);
0792         causes << i18n(
0793             "The device may be busy, that is, still in use by "
0794             "another application or user. Even such things as having an open "
0795             "browser window on a location on this device may cause the device to "
0796             "remain in use.")
0797                << i18n(
0798                       "You may not have permissions to uninitialize (\"unmount\") "
0799                       "the device. On UNIX systems, system administrator privileges are "
0800                       "often required to uninitialize a device.")
0801                << cHardware;
0802         solutions << i18n(
0803             "Check that no applications are accessing the device, "
0804             "and try again.")
0805                   << sAccess << sSysadmin;
0806         break;
0807 
0808     case KIO::ERR_CANNOT_READ:
0809         errorName = i18n("Cannot Read From Resource");
0810         description = i18n(
0811             "This means that although the resource, "
0812             "<strong>%1</strong>, was able to be opened, an error occurred while "
0813             "reading the contents of the resource.",
0814             url);
0815         causes << i18n("You may not have permissions to read from the resource.");
0816         if (!isWorkerNetwork) {
0817             causes << cNetwork;
0818         }
0819         causes << cHardware;
0820         solutions << sAccess;
0821         if (!isWorkerNetwork) {
0822             solutions << sNetwork;
0823         }
0824         solutions << sSysadmin;
0825         break;
0826 
0827     case KIO::ERR_CANNOT_WRITE:
0828         errorName = i18n("Cannot Write to Resource");
0829         description = i18n(
0830             "This means that although the resource, <strong>%1</strong>"
0831             ", was able to be opened, an error occurred while writing to the resource.",
0832             url);
0833         causes << i18n("You may not have permissions to write to the resource.");
0834         if (!isWorkerNetwork) {
0835             causes << cNetwork;
0836         }
0837         causes << cHardware;
0838         solutions << sAccess;
0839         if (!isWorkerNetwork) {
0840             solutions << sNetwork;
0841         }
0842         solutions << sSysadmin;
0843         break;
0844 
0845     case KIO::ERR_CANNOT_BIND:
0846         errorName = i18n("Could Not Listen for Network Connections");
0847         techName = i18n("Could Not Bind");
0848         description = i18n(
0849             "This is a fairly technical error in which a required "
0850             "device for network communications (a socket) could not be established "
0851             "to listen for incoming network connections.");
0852         causes << i18n(
0853             "The network connection may be incorrectly configured, or "
0854             "the network interface may not be enabled.");
0855         solutions << sNetwork << sSysadmin;
0856         break;
0857 
0858     case KIO::ERR_CANNOT_LISTEN:
0859         errorName = i18n("Could Not Listen for Network Connections");
0860         techName = i18n("Could Not Listen");
0861         description = i18n(
0862             "This is a fairly technical error in which a required "
0863             "device for network communications (a socket) could not be established "
0864             "to listen for incoming network connections.");
0865         causes << i18n(
0866             "The network connection may be incorrectly configured, or "
0867             "the network interface may not be enabled.");
0868         solutions << sNetwork << sSysadmin;
0869         break;
0870 
0871     case KIO::ERR_CANNOT_ACCEPT:
0872         errorName = i18n("Could Not Accept Network Connection");
0873         description = i18n(
0874             "This is a fairly technical error in which an error "
0875             "occurred while attempting to accept an incoming network connection.");
0876         causes << i18n(
0877             "The network connection may be incorrectly configured, or "
0878             "the network interface may not be enabled.")
0879                << i18n("You may not have permissions to accept the connection.");
0880         solutions << sNetwork << sSysadmin;
0881         break;
0882 
0883     case KIO::ERR_CANNOT_LOGIN:
0884         errorName = i18n("Could Not Login: %1", errorText);
0885         description = i18n(
0886             "An attempt to login to perform the requested "
0887             "operation was unsuccessful.");
0888         causes << i18n(
0889             "You may have supplied incorrect authentication details or "
0890             "none at all.")
0891                << i18n(
0892                       "Your account may not have permission to access the "
0893                       "specified resource.")
0894                << cProtocol;
0895         solutions << i18n(
0896             "Retry the request and ensure your authentication details "
0897             "are entered correctly.")
0898                   << sServeradmin << sSysadmin;
0899         break;
0900 
0901     case KIO::ERR_CANNOT_STAT:
0902         errorName = i18n("Could Not Determine Resource Status");
0903         techName = i18n("Could Not Stat Resource");
0904         description = i18n(
0905             "An attempt to determine information about the status "
0906             "of the resource <strong>%1</strong>, such as the resource name, type, "
0907             "size, etc., was unsuccessful.",
0908             url);
0909         causes << i18n(
0910             "The specified resource may not have existed or may "
0911             "not be accessible.")
0912                << cProtocol << cHardware;
0913         solutions << i18n(
0914             "Retry the request and ensure your authentication details "
0915             "are entered correctly.")
0916                   << sSysadmin;
0917         break;
0918 
0919     case KIO::ERR_CANNOT_CLOSEDIR:
0920         // result = i18n( "Could not terminate listing %1" ).arg( errorText );
0921         errorName = i18n("Could Not Cancel Listing");
0922         techName = i18n("FIXME: Document this");
0923         break;
0924 
0925     case KIO::ERR_CANNOT_MKDIR:
0926         errorName = i18n("Could Not Create Folder");
0927         description = i18n("An attempt to create the requested folder failed.");
0928         causes << cAccess
0929                << i18n(
0930                       "The location where the folder was to be created "
0931                       "may not exist.");
0932         if (!isWorkerNetwork) {
0933             causes << cProtocol;
0934         }
0935         solutions << i18n("Retry the request.") << sAccess;
0936         break;
0937 
0938     case KIO::ERR_CANNOT_RMDIR:
0939         errorName = i18n("Could Not Remove Folder");
0940         description = i18n(
0941             "An attempt to remove the specified folder, "
0942             "<strong>%1</strong>, failed.",
0943             path);
0944         causes << i18n("The specified folder may not exist.") << i18n("The specified folder may not be empty.") << cAccess;
0945         if (!isWorkerNetwork) {
0946             causes << cProtocol;
0947         }
0948         solutions << i18n(
0949             "Ensure that the folder exists and is empty, and try "
0950             "again.")
0951                   << sAccess;
0952         break;
0953 
0954     case KIO::ERR_CANNOT_RESUME:
0955         errorName = i18n("Could Not Resume File Transfer");
0956         description = i18n(
0957             "The specified request asked that the transfer of "
0958             "file <strong>%1</strong> be resumed at a certain point of the "
0959             "transfer. This was not possible.",
0960             filename);
0961         causes << i18n(
0962             "The protocol, or the server, may not support file "
0963             "resuming.");
0964         solutions << i18n(
0965             "Retry the request without attempting to resume "
0966             "transfer.");
0967         break;
0968 
0969     case KIO::ERR_CANNOT_RENAME:
0970         errorName = i18n("Could Not Rename Resource");
0971         description = i18n(
0972             "An attempt to rename the specified resource "
0973             "<strong>%1</strong> failed.",
0974             KStringHandler::csqueeze(url, s_maxFilePathLength));
0975         causes << cAccess << cExists;
0976         if (!isWorkerNetwork) {
0977             causes << cProtocol;
0978         }
0979         solutions << sAccess << sExists;
0980         break;
0981 
0982     case KIO::ERR_CANNOT_CHMOD:
0983         errorName = i18n("Could Not Alter Permissions of Resource");
0984         description = i18n(
0985             "An attempt to alter the permissions on the specified "
0986             "resource <strong>%1</strong> failed.",
0987             url);
0988         causes << cAccess << cExists;
0989         solutions << sAccess << sExists;
0990         break;
0991 
0992     case KIO::ERR_CANNOT_CHOWN:
0993         errorName = i18n("Could Not Change Ownership of Resource");
0994         description = i18n(
0995             "An attempt to change the ownership of the specified "
0996             "resource <strong>%1</strong> failed.",
0997             url);
0998         causes << cAccess << cExists;
0999         solutions << sAccess << sExists;
1000         break;
1001 
1002     case KIO::ERR_CANNOT_DELETE:
1003         errorName = i18n("Could Not Delete Resource");
1004         description = i18n(
1005             "An attempt to delete the specified resource "
1006             "<strong>%1</strong> failed.",
1007             url);
1008         causes << cAccess << cExists;
1009         solutions << sAccess << sExists;
1010         break;
1011 
1012     case KIO::ERR_WORKER_DIED:
1013         errorName = i18n("Unexpected Program Termination");
1014         description = i18n(
1015             "The program on your computer which provides access "
1016             "to the <strong>%1</strong> protocol has unexpectedly terminated.",
1017             url);
1018         causes << cBuglikely;
1019         solutions << sUpdate << sBugreport;
1020         break;
1021 
1022     case KIO::ERR_OUT_OF_MEMORY:
1023         errorName = i18n("Out of Memory");
1024         description = i18n(
1025             "The program on your computer which provides access "
1026             "to the <strong>%1</strong> protocol could not obtain the memory "
1027             "required to continue.",
1028             protocol);
1029         causes << cBuglikely;
1030         solutions << sUpdate << sBugreport;
1031         break;
1032 
1033     case KIO::ERR_UNKNOWN_PROXY_HOST:
1034         errorName = i18n("Unknown Proxy Host");
1035         description = i18n(
1036             "While retrieving information about the specified "
1037             "proxy host, <strong>%1</strong>, an Unknown Host error was encountered. "
1038             "An unknown host error indicates that the requested name could not be "
1039             "located on the Internet.",
1040             errorText);
1041         causes << i18n(
1042             "There may have been a problem with your network "
1043             "configuration, specifically your proxy's hostname. If you have been "
1044             "accessing the Internet with no problems recently, this is unlikely.")
1045                << cNetwork;
1046         solutions << i18n("Double-check your proxy settings and try again.") << sSysadmin;
1047         break;
1048 
1049     case KIO::ERR_CANNOT_AUTHENTICATE:
1050         errorName = i18n("Authentication Failed: Method %1 Not Supported", errorText);
1051         description = i18n(
1052             "Although you may have supplied the correct "
1053             "authentication details, the authentication failed because the "
1054             "method that the server is using is not supported by the KDE "
1055             "program implementing the protocol %1.",
1056             protocol);
1057         solutions << i18n(
1058             "Please file a bug at <a href=\"https://bugs.kde.org/\">"
1059             "https://bugs.kde.org/</a> to inform the KDE team of the unsupported "
1060             "authentication method.")
1061                   << sSysadmin;
1062         break;
1063 
1064     case KIO::ERR_ABORTED:
1065         errorName = i18n("Request Aborted");
1066         description = i18n(
1067             "The request was not completed because it was "
1068             "aborted.");
1069         solutions << i18n("Retry the request.");
1070         break;
1071 
1072     case KIO::ERR_INTERNAL_SERVER:
1073         errorName = i18n("Internal Error in Server");
1074         description = i18n(
1075             "The program on the server which provides access "
1076             "to the <strong>%1</strong> protocol has reported an internal error: "
1077             "%2.",
1078             protocol,
1079             errorText);
1080         causes << i18n(
1081             "This is most likely to be caused by a bug in the "
1082             "server program. Please consider submitting a full bug report as "
1083             "detailed below.");
1084         solutions << i18n(
1085             "Contact the administrator of the server "
1086             "to advise them of the problem.")
1087                   << i18n(
1088                          "If you know who the authors of the server software are, "
1089                          "submit the bug report directly to them.");
1090         break;
1091 
1092     case KIO::ERR_SERVER_TIMEOUT:
1093         errorName = i18n("Timeout Error");
1094         description = i18n(
1095             "Although contact was made with the server, a "
1096             "response was not received within the amount of time allocated for "
1097             "the request as follows:<ul>"
1098             "<li>Timeout for establishing a connection: %1 seconds</li>"
1099             "<li>Timeout for receiving a response: %2 seconds</li>"
1100             "<li>Timeout for accessing proxy servers: %3 seconds</li></ul>"
1101             "Please note that you can alter these timeout settings in the KDE "
1102             "System Settings, by selecting Network Settings -> Connection Preferences.",
1103             KProtocolManager::connectTimeout(),
1104             KProtocolManager::responseTimeout(),
1105             KProtocolManager::proxyConnectTimeout());
1106         causes << cNetpath
1107                << i18n(
1108                       "The server was too busy responding to other "
1109                       "requests to respond.");
1110         solutions << sTryagain << sServeradmin;
1111         break;
1112 
1113     case KIO::ERR_UNKNOWN:
1114         errorName = i18n("Unknown Error");
1115         description = i18n(
1116             "The program on your computer which provides access "
1117             "to the <strong>%1</strong> protocol has reported an unknown error: "
1118             "%2.",
1119             protocol,
1120             errorText);
1121         causes << cBug;
1122         solutions << sUpdate << sBugreport;
1123         break;
1124 
1125     case KIO::ERR_UNKNOWN_INTERRUPT:
1126         errorName = i18n("Unknown Interruption");
1127         description = i18n(
1128             "The program on your computer which provides access "
1129             "to the <strong>%1</strong> protocol has reported an interruption of "
1130             "an unknown type: %2.",
1131             protocol,
1132             errorText);
1133         causes << cBug;
1134         solutions << sUpdate << sBugreport;
1135         break;
1136 
1137     case KIO::ERR_CANNOT_DELETE_ORIGINAL:
1138         errorName = i18n("Could Not Delete Original File");
1139         description = i18n(
1140             "The requested operation required the deleting of "
1141             "the original file, most likely at the end of a file move operation. "
1142             "The original file <strong>%1</strong> could not be deleted.",
1143             errorText);
1144         causes << cAccess;
1145         solutions << sAccess;
1146         break;
1147 
1148     case KIO::ERR_CANNOT_DELETE_PARTIAL:
1149         errorName = i18n("Could Not Delete Temporary File");
1150         description = i18n(
1151             "The requested operation required the creation of "
1152             "a temporary file in which to save the new file while being "
1153             "downloaded. This temporary file <strong>%1</strong> could not be "
1154             "deleted.",
1155             errorText);
1156         causes << cAccess;
1157         solutions << sAccess;
1158         break;
1159 
1160     case KIO::ERR_CANNOT_RENAME_ORIGINAL:
1161         errorName = i18n("Could Not Rename Original File");
1162         description = i18n(
1163             "The requested operation required the renaming of "
1164             "the original file <strong>%1</strong>, however it could not be "
1165             "renamed.",
1166             errorText);
1167         causes << cAccess;
1168         solutions << sAccess;
1169         break;
1170 
1171     case KIO::ERR_CANNOT_RENAME_PARTIAL:
1172         errorName = i18n("Could Not Rename Temporary File");
1173         description = i18n(
1174             "The requested operation required the creation of "
1175             "a temporary file <strong>%1</strong>, however it could not be "
1176             "created.",
1177             errorText);
1178         causes << cAccess;
1179         solutions << sAccess;
1180         break;
1181 
1182     case KIO::ERR_CANNOT_SYMLINK:
1183         errorName = i18n("Could Not Create Link");
1184         techName = i18n("Could Not Create Symbolic Link");
1185         description = i18n("The requested symbolic link %1 could not be created.", errorText);
1186         causes << cAccess;
1187         solutions << sAccess;
1188         break;
1189 
1190     case KIO::ERR_NO_CONTENT:
1191         errorName = i18n("No Content");
1192         description = errorText;
1193         break;
1194 
1195     case KIO::ERR_DISK_FULL:
1196         errorName = i18n("Disk Full");
1197         description = i18n(
1198             "The requested file <strong>%1</strong> could not be "
1199             "written to as there is inadequate disk space.",
1200             errorText);
1201         solutions << i18n(
1202             "Free up enough disk space by 1) deleting unwanted and "
1203             "temporary files; 2) archiving files to removable media storage such as "
1204             "CD-Recordable discs; or 3) obtain more storage capacity.")
1205                   << sSysadmin;
1206         break;
1207 
1208     case KIO::ERR_IDENTICAL_FILES:
1209         errorName = i18n("Source and Destination Files Identical");
1210         description = i18n(
1211             "The operation could not be completed because the "
1212             "source and destination files are the same file.");
1213         solutions << i18n("Choose a different filename for the destination file.");
1214         break;
1215 
1216     case KIO::ERR_DROP_ON_ITSELF:
1217         errorName = i18n("File or Folder dropped onto itself");
1218         description = i18n(
1219             "The operation could not be completed because the "
1220             "source and destination file or folder are the same.");
1221         solutions << i18n("Drop the item into a different file or folder.");
1222         break;
1223 
1224     // We assume that the worker has all the details
1225     case KIO::ERR_WORKER_DEFINED:
1226         errorName.clear();
1227         description = errorText;
1228         break;
1229 
1230     case KIO::ERR_CANNOT_MOVE_INTO_ITSELF:
1231         errorName = i18n("Folder moved into itself");
1232         description = i18n(
1233             "The operation could not be completed because the "
1234             "source can not be moved into itself.");
1235         solutions << i18n("Move the item into a different folder.");
1236         break;
1237 
1238     case KIO::ERR_PASSWD_SERVER:
1239         errorName = i18n("Could not communicate with password server");
1240         description = i18n(
1241             "The operation could not be completed because the "
1242             "service for requesting passwords (kpasswdserver) couldn't be contacted");
1243         solutions << i18n("Try restarting your session, or look in the logs for errors from kiod.");
1244         break;
1245 
1246     case KIO::ERR_CANNOT_CREATE_WORKER:
1247         errorName = i18n("Cannot Initiate the %1 Protocol", protocol);
1248         techName = i18n("Unable to Create KIO Worker");
1249         description = i18n(
1250             "The KIO worker which provides access "
1251             "to the <strong>%1</strong> protocol could not be started. This is "
1252             "usually due to technical reasons.",
1253             protocol);
1254         causes << i18n(
1255             "klauncher could not find or start the plugin which provides the protocol. "
1256             "This means you may have an outdated version of the plugin.");
1257         solutions << sUpdate << sSysadmin;
1258         break;
1259 
1260     case KIO::ERR_FILE_TOO_LARGE_FOR_FAT32:
1261         errorName = xi18nc("@info", "Cannot transfer <filename>%1</filename>", errorText);
1262         description = xi18nc("@info",
1263                              "The file <filename>%1</filename> cannot be transferred,"
1264                              " because the destination filesystem does not support files that large",
1265                              errorText);
1266         solutions << i18n("Reformat the destination drive to use a filesystem that supports files that large.");
1267         break;
1268 
1269     default:
1270         // fall back to the plain error...
1271         errorName = i18n("Undocumented Error");
1272         description = buildErrorString(errorCode, errorText);
1273     }
1274 
1275     QByteArray ret;
1276     QDataStream stream(&ret, QIODevice::WriteOnly);
1277     stream << errorName << techName << description << causes << solutions;
1278     return ret;
1279 }
1280 
1281 QFile::Permissions KIO::convertPermissions(int permissions)
1282 {
1283     QFile::Permissions qPermissions;
1284 
1285     if (permissions > 0) {
1286         if (permissions & S_IRUSR) {
1287             qPermissions |= QFile::ReadOwner;
1288         }
1289         if (permissions & S_IWUSR) {
1290             qPermissions |= QFile::WriteOwner;
1291         }
1292         if (permissions & S_IXUSR) {
1293             qPermissions |= QFile::ExeOwner;
1294         }
1295 
1296         if (permissions & S_IRGRP) {
1297             qPermissions |= QFile::ReadGroup;
1298         }
1299         if (permissions & S_IWGRP) {
1300             qPermissions |= QFile::WriteGroup;
1301         }
1302         if (permissions & S_IXGRP) {
1303             qPermissions |= QFile::ExeGroup;
1304         }
1305 
1306         if (permissions & S_IROTH) {
1307             qPermissions |= QFile::ReadOther;
1308         }
1309         if (permissions & S_IWOTH) {
1310             qPermissions |= QFile::WriteOther;
1311         }
1312         if (permissions & S_IXOTH) {
1313             qPermissions |= QFile::ExeOther;
1314         }
1315     }
1316 
1317     return qPermissions;
1318 }