File indexing completed on 2024-04-28 07:43:48

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