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

KIO

  • sources
  • kde-4.14
  • kdelibs
  • kio
  • kio
global.cpp
Go to the documentation of this file.
1 /* This file is part of the KDE libraries
2  Copyright (C) 2000 David Faure <faure@kde.org>
3 
4  This library is free software; you can redistribute it and/or
5  modify it under the terms of the GNU Library General Public
6  License version 2 as published by the Free Software Foundation.
7 
8  This library is distributed in the hope that it will be useful,
9  but WITHOUT ANY WARRANTY; without even the implied warranty of
10  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11  Library General Public License for more details.
12 
13  You should have received a copy of the GNU Library General Public License
14  along with this library; see the file COPYING.LIB. If not, write to
15  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
16  Boston, MA 02110-1301, USA.
17 */
18 
19 #include "global.h"
20 #include "job.h"
21 
22 #include <config.h>
23 
24 #include <kdebug.h>
25 #include <klocale.h>
26 #include <kglobal.h>
27 #include <kiconloader.h>
28 #include <kprotocolmanager.h>
29 #include <kmimetype.h>
30 #include <kdynamicjobtracker_p.h>
31 
32 #include <QtCore/QByteArray>
33 #include <QtCore/QDate>
34 #include <QtGui/QTextDocument>
35 
36 #include <sys/types.h>
37 #include <sys/wait.h>
38 #include <sys/uio.h>
39 
40 #include <assert.h>
41 #include <signal.h>
42 #include <stdlib.h>
43 #include <string.h>
44 #include <unistd.h>
45 #include <stdio.h>
46 
47 K_GLOBAL_STATIC(KDynamicJobTracker, globalJobTracker)
48 
49 // If someone wants the SI-standard prefixes kB/MB/GB/TB, I would recommend
50 // a hidden kconfig option and getting the code from #57240 into the same
51 // method, so that all KDE apps use the same unit, instead of letting each app decide.
52 
53 KIO_EXPORT QString KIO::convertSize( KIO::filesize_t size )
54 {
55  return KGlobal::locale()->formatByteSize(size);
56 }
57 
58 KIO_EXPORT QString KIO::convertSizeFromKiB( KIO::filesize_t kibSize )
59 {
60  return KGlobal::locale()->formatByteSize(kibSize * 1024);
61 }
62 
63 KIO_EXPORT QString KIO::number( KIO::filesize_t size )
64 {
65  char charbuf[256];
66  sprintf(charbuf, "%lld", size);
67  return QLatin1String(charbuf);
68 }
69 
70 KIO_EXPORT unsigned int KIO::calculateRemainingSeconds( KIO::filesize_t totalSize,
71  KIO::filesize_t processedSize, KIO::filesize_t speed )
72 {
73  if ( (speed != 0) && (totalSize != 0) )
74  return ( totalSize - processedSize ) / speed;
75  else
76  return 0;
77 }
78 
79 KIO_EXPORT QString KIO::convertSeconds( unsigned int seconds )
80 {
81  unsigned int days = seconds / 86400;
82  unsigned int hours = (seconds - (days * 86400)) / 3600;
83  unsigned int mins = (seconds - (days * 86400) - (hours * 3600)) / 60;
84  seconds = (seconds - (days * 86400) - (hours * 3600) - (mins * 60));
85 
86  const QTime time(hours, mins, seconds);
87  const QString timeStr( KGlobal::locale()->formatTime(time, true /*with seconds*/, true /*duration*/) );
88  if ( days > 0 )
89  return i18np("1 day %2", "%1 days %2", days, timeStr);
90  else
91  return timeStr;
92 }
93 
94 #ifndef KDE_NO_DEPRECATED
95 KIO_EXPORT QTime KIO::calculateRemaining( KIO::filesize_t totalSize, KIO::filesize_t processedSize, KIO::filesize_t speed )
96 {
97  QTime remainingTime;
98 
99  if ( speed != 0 ) {
100  KIO::filesize_t secs;
101  if ( totalSize == 0 ) {
102  secs = 0;
103  } else {
104  secs = ( totalSize - processedSize ) / speed;
105  }
106  if (secs >= (24*60*60)) // Limit to 23:59:59
107  secs = (24*60*60)-1;
108  int hr = secs / ( 60 * 60 );
109  int mn = ( secs - hr * 60 * 60 ) / 60;
110  int sc = ( secs - hr * 60 * 60 - mn * 60 );
111 
112  remainingTime.setHMS( hr, mn, sc );
113  }
114 
115  return remainingTime;
116 }
117 #endif
118 
119 KIO_EXPORT QString KIO::itemsSummaryString(uint items, uint files, uint dirs, KIO::filesize_t size, bool showSize)
120 {
121  if ( files == 0 && dirs == 0 && items == 0 ) {
122  return i18np( "%1 Item", "%1 Items", 0 );
123  }
124 
125  QString summary;
126  const QString foldersText = i18np( "1 Folder", "%1 Folders", dirs );
127  const QString filesText = i18np( "1 File", "%1 Files", files );
128  if ( files > 0 && dirs > 0 ) {
129  summary = showSize ?
130  i18nc( "folders, files (size)", "%1, %2 (%3)", foldersText, filesText, KIO::convertSize( size ) ) :
131  i18nc( "folders, files", "%1, %2", foldersText, filesText );
132  } else if ( files > 0 ) {
133  summary = showSize ? i18nc( "files (size)", "%1 (%2)", filesText, KIO::convertSize( size ) ) : filesText;
134  } else if ( dirs > 0 ) {
135  summary = foldersText;
136  }
137 
138  if ( items > dirs + files ) {
139  const QString itemsText = i18np( "%1 Item", "%1 Items", items );
140  summary = summary.isEmpty() ? itemsText : i18nc( "items: folders, files (size)", "%1: %2", itemsText, summary );
141  }
142 
143  return summary;
144 }
145 
146 KIO_EXPORT QString KIO::encodeFileName( const QString & _str )
147 {
148  QString str( _str );
149  str.replace('/', QChar(0x2044)); // "Fraction slash"
150  return str;
151 }
152 
153 KIO_EXPORT QString KIO::decodeFileName( const QString & _str )
154 {
155  // Nothing to decode. "Fraction slash" is fine in filenames.
156  return _str;
157 }
158 
159 KIO_EXPORT QString KIO::Job::errorString() const
160 {
161  return KIO::buildErrorString(error(), errorText());
162 }
163 
164 KIO_EXPORT QString KIO::buildErrorString(int errorCode, const QString &errorText)
165 {
166  QString result;
167 
168  switch( errorCode )
169  {
170  case KIO::ERR_CANNOT_OPEN_FOR_READING:
171  result = i18n( "Could not read %1." , errorText );
172  break;
173  case KIO::ERR_CANNOT_OPEN_FOR_WRITING:
174  result = i18n( "Could not write to %1." , errorText );
175  break;
176  case KIO::ERR_CANNOT_LAUNCH_PROCESS:
177  result = i18n( "Could not start process %1." , errorText );
178  break;
179  case KIO::ERR_INTERNAL:
180  result = i18n( "Internal Error\nPlease send a full bug report at http://bugs.kde.org\n%1" , errorText );
181  break;
182  case KIO::ERR_MALFORMED_URL:
183  result = i18n( "Malformed URL %1." , errorText );
184  break;
185  case KIO::ERR_UNSUPPORTED_PROTOCOL:
186  result = i18n( "The protocol %1 is not supported." , errorText );
187  break;
188  case KIO::ERR_NO_SOURCE_PROTOCOL:
189  result = i18n( "The protocol %1 is only a filter protocol.", errorText );
190  break;
191  case KIO::ERR_UNSUPPORTED_ACTION:
192  result = errorText;
193 // result = i18n( "Unsupported action %1" ).arg( errorText );
194  break;
195  case KIO::ERR_IS_DIRECTORY:
196  result = i18n( "%1 is a folder, but a file was expected." , errorText );
197  break;
198  case KIO::ERR_IS_FILE:
199  result = i18n( "%1 is a file, but a folder was expected." , errorText );
200  break;
201  case KIO::ERR_DOES_NOT_EXIST:
202  result = i18n( "The file or folder %1 does not exist." , errorText );
203  break;
204  case KIO::ERR_FILE_ALREADY_EXIST:
205  result = i18n( "A file named %1 already exists." , errorText );
206  break;
207  case KIO::ERR_DIR_ALREADY_EXIST:
208  result = i18n( "A folder named %1 already exists." , errorText );
209  break;
210  case KIO::ERR_UNKNOWN_HOST:
211  result = errorText.isEmpty() ? i18n( "No hostname specified." ) : i18n( "Unknown host %1" , errorText );
212  break;
213  case KIO::ERR_ACCESS_DENIED:
214  result = i18n( "Access denied to %1." , errorText );
215  break;
216  case KIO::ERR_WRITE_ACCESS_DENIED:
217  result = i18n( "Access denied.\nCould not write to %1." , errorText );
218  break;
219  case KIO::ERR_CANNOT_ENTER_DIRECTORY:
220  result = i18n( "Could not enter folder %1." , errorText );
221  break;
222  case KIO::ERR_PROTOCOL_IS_NOT_A_FILESYSTEM:
223  result = i18n( "The protocol %1 does not implement a folder service." , errorText );
224  break;
225  case KIO::ERR_CYCLIC_LINK:
226  result = i18n( "Found a cyclic link in %1." , errorText );
227  break;
228  case KIO::ERR_USER_CANCELED:
229  // Do nothing in this case. The user doesn't need to be told what he just did.
230  break;
231  case KIO::ERR_CYCLIC_COPY:
232  result = i18n( "Found a cyclic link while copying %1." , errorText );
233  break;
234  case KIO::ERR_COULD_NOT_CREATE_SOCKET:
235  result = i18n( "Could not create socket for accessing %1." , errorText );
236  break;
237  case KIO::ERR_COULD_NOT_CONNECT:
238  result = i18n( "Could not connect to host %1." , errorText.isEmpty() ? QLatin1String("localhost") : errorText );
239  break;
240  case KIO::ERR_CONNECTION_BROKEN:
241  result = i18n( "Connection to host %1 is broken." , errorText );
242  break;
243  case KIO::ERR_NOT_FILTER_PROTOCOL:
244  result = i18n( "The protocol %1 is not a filter protocol." , errorText );
245  break;
246  case KIO::ERR_COULD_NOT_MOUNT:
247  result = i18n( "Could not mount device.\nThe reported error was:\n%1" , errorText );
248  break;
249  case KIO::ERR_COULD_NOT_UNMOUNT:
250  result = i18n( "Could not unmount device.\nThe reported error was:\n%1" , errorText );
251  break;
252  case KIO::ERR_COULD_NOT_READ:
253  result = i18n( "Could not read file %1." , errorText );
254  break;
255  case KIO::ERR_COULD_NOT_WRITE:
256  result = i18n( "Could not write to file %1." , errorText );
257  break;
258  case KIO::ERR_COULD_NOT_BIND:
259  result = i18n( "Could not bind %1." , errorText );
260  break;
261  case KIO::ERR_COULD_NOT_LISTEN:
262  result = i18n( "Could not listen %1." , errorText );
263  break;
264  case KIO::ERR_COULD_NOT_ACCEPT:
265  result = i18n( "Could not accept %1." , errorText );
266  break;
267  case KIO::ERR_COULD_NOT_LOGIN:
268  result = errorText;
269  break;
270  case KIO::ERR_COULD_NOT_STAT:
271  result = i18n( "Could not access %1." , errorText );
272  break;
273  case KIO::ERR_COULD_NOT_CLOSEDIR:
274  result = i18n( "Could not terminate listing %1." , errorText );
275  break;
276  case KIO::ERR_COULD_NOT_MKDIR:
277  result = i18n( "Could not make folder %1." , errorText );
278  break;
279  case KIO::ERR_COULD_NOT_RMDIR:
280  result = i18n( "Could not remove folder %1." , errorText );
281  break;
282  case KIO::ERR_CANNOT_RESUME:
283  result = i18n( "Could not resume file %1." , errorText );
284  break;
285  case KIO::ERR_CANNOT_RENAME:
286  result = i18n( "Could not rename file %1." , errorText );
287  break;
288  case KIO::ERR_CANNOT_CHMOD:
289  result = i18n( "Could not change permissions for %1." , errorText );
290  break;
291  case KIO::ERR_CANNOT_CHOWN:
292  result = i18n( "Could not change ownership for %1." , errorText );
293  break;
294  case KIO::ERR_CANNOT_DELETE:
295  result = i18n( "Could not delete file %1." , errorText );
296  break;
297  case KIO::ERR_SLAVE_DIED:
298  result = i18n( "The process for the %1 protocol died unexpectedly." , errorText );
299  break;
300  case KIO::ERR_OUT_OF_MEMORY:
301  result = i18n( "Error. Out of memory.\n%1" , errorText );
302  break;
303  case KIO::ERR_UNKNOWN_PROXY_HOST:
304  result = i18n( "Unknown proxy host\n%1" , errorText );
305  break;
306  case KIO::ERR_COULD_NOT_AUTHENTICATE:
307  result = i18n( "Authorization failed, %1 authentication not supported" , errorText );
308  break;
309  case KIO::ERR_ABORTED:
310  result = i18n( "User canceled action\n%1" , errorText );
311  break;
312  case KIO::ERR_INTERNAL_SERVER:
313  result = i18n( "Internal error in server\n%1" , errorText );
314  break;
315  case KIO::ERR_SERVER_TIMEOUT:
316  result = i18n( "Timeout on server\n%1" , errorText );
317  break;
318  case KIO::ERR_UNKNOWN:
319  result = i18n( "Unknown error\n%1" , errorText );
320  break;
321  case KIO::ERR_UNKNOWN_INTERRUPT:
322  result = i18n( "Unknown interrupt\n%1" , errorText );
323  break;
324 /*
325  case KIO::ERR_CHECKSUM_MISMATCH:
326  if (errorText)
327  result = i18n( "Warning: MD5 Checksum for %1 does not match checksum returned from server" ).arg(errorText);
328  else
329  result = i18n( "Warning: MD5 Checksum for %1 does not match checksum returned from server" ).arg("document");
330  break;
331 */
332  case KIO::ERR_CANNOT_DELETE_ORIGINAL:
333  result = i18n( "Could not delete original file %1.\nPlease check permissions." , errorText );
334  break;
335  case KIO::ERR_CANNOT_DELETE_PARTIAL:
336  result = i18n( "Could not delete partial file %1.\nPlease check permissions." , errorText );
337  break;
338  case KIO::ERR_CANNOT_RENAME_ORIGINAL:
339  result = i18n( "Could not rename original file %1.\nPlease check permissions." , errorText );
340  break;
341  case KIO::ERR_CANNOT_RENAME_PARTIAL:
342  result = i18n( "Could not rename partial file %1.\nPlease check permissions." , errorText );
343  break;
344  case KIO::ERR_CANNOT_SYMLINK:
345  result = i18n( "Could not create symlink %1.\nPlease check permissions." , errorText );
346  break;
347  case KIO::ERR_NO_CONTENT:
348  result = errorText;
349  break;
350  case KIO::ERR_DISK_FULL:
351  result = i18n( "Could not write file %1.\nDisk full." , errorText );
352  break;
353  case KIO::ERR_IDENTICAL_FILES:
354  result = i18n( "The source and destination are the same file.\n%1" , errorText );
355  break;
356  case KIO::ERR_SLAVE_DEFINED:
357  result = errorText;
358  break;
359  case KIO::ERR_UPGRADE_REQUIRED:
360  result = i18n( "%1 is required by the server, but is not available." , errorText);
361  break;
362  case KIO::ERR_POST_DENIED:
363  result = i18n( "Access to restricted port in POST denied.");
364  break;
365  case KIO::ERR_POST_NO_SIZE:
366  result = i18n( "The required content size information was not provided for a POST operation.");
367  break;
368  default:
369  result = i18n( "Unknown error code %1\n%2\nPlease send a full bug report at http://bugs.kde.org." , errorCode , errorText );
370  break;
371  }
372 
373  return result;
374 }
375 
376 KIO_EXPORT QString KIO::unsupportedActionErrorString(const QString &protocol, int cmd) {
377  switch (cmd) {
378  case CMD_CONNECT:
379  return i18n("Opening connections is not supported with the protocol %1." , protocol);
380  case CMD_DISCONNECT:
381  return i18n("Closing connections is not supported with the protocol %1." , protocol);
382  case CMD_STAT:
383  return i18n("Accessing files is not supported with the protocol %1.", protocol);
384  case CMD_PUT:
385  return i18n("Writing to %1 is not supported.", protocol);
386  case CMD_SPECIAL:
387  return i18n("There are no special actions available for protocol %1.", protocol);
388  case CMD_LISTDIR:
389  return i18n("Listing folders is not supported for protocol %1.", protocol);
390  case CMD_GET:
391  return i18n("Retrieving data from %1 is not supported.", protocol);
392  case CMD_MIMETYPE:
393  return i18n("Retrieving mime type information from %1 is not supported.", protocol);
394  case CMD_RENAME:
395  return i18n("Renaming or moving files within %1 is not supported.", protocol);
396  case CMD_SYMLINK:
397  return i18n("Creating symlinks is not supported with protocol %1.", protocol);
398  case CMD_COPY:
399  return i18n("Copying files within %1 is not supported.", protocol);
400  case CMD_DEL:
401  return i18n("Deleting files from %1 is not supported.", protocol);
402  case CMD_MKDIR:
403  return i18n("Creating folders is not supported with protocol %1.", protocol);
404  case CMD_CHMOD:
405  return i18n("Changing the attributes of files is not supported with protocol %1.", protocol);
406  case CMD_CHOWN:
407  return i18n("Changing the ownership of files is not supported with protocol %1.", protocol);
408  case CMD_SUBURL:
409  return i18n("Using sub-URLs with %1 is not supported.", protocol);
410  case CMD_MULTI_GET:
411  return i18n("Multiple get is not supported with protocol %1.", protocol);
412  case CMD_OPEN:
413  return i18n("Opening files is not supported with protocol %1.", protocol);
414  default:
415  return i18n("Protocol %1 does not support action %2.", protocol, cmd);
416  }/*end switch*/
417 }
418 
419 KIO_EXPORT QStringList KIO::Job::detailedErrorStrings( const KUrl *reqUrl /*= 0L*/,
420  int method /*= -1*/ ) const
421 {
422  QString errorName, techName, description, ret2;
423  QStringList causes, solutions, ret;
424 
425  QByteArray raw = rawErrorDetail( error(), errorText(), reqUrl, method );
426  QDataStream stream(raw);
427 
428  stream >> errorName >> techName >> description >> causes >> solutions;
429 
430  QString url, protocol, datetime;
431  if ( reqUrl ) {
432  url = Qt::escape(reqUrl->prettyUrl());
433  protocol = reqUrl->protocol();
434  } else {
435  url = i18nc("@info url", "(unknown)" );
436  }
437 
438  datetime = KGlobal::locale()->formatDateTime( QDateTime::currentDateTime(),
439  KLocale::LongDate );
440 
441  ret << errorName;
442  ret << i18nc( "@info %1 error name, %2 description",
443  "<qt><p><b>%1</b></p><p>%2</p></qt>", errorName, description);
444 
445  ret2 = QLatin1String( "<qt>" );
446  if ( !techName.isEmpty() )
447  ret2 += QLatin1String( "<p>" ) + i18n( "<b>Technical reason</b>: " ) +
448  techName + QLatin1String( "</p>" );
449  ret2 += QLatin1String( "<p>" ) + i18n( "<b>Details of the request</b>:" ) +
450  QLatin1String( "</p><ul>" ) + i18n( "<li>URL: %1</li>", url );
451  if ( !protocol.isEmpty() ) {
452  ret2 += i18n( "<li>Protocol: %1</li>" , protocol );
453  }
454  ret2 += i18n( "<li>Date and time: %1</li>", datetime ) +
455  i18n( "<li>Additional information: %1</li>" , errorText() ) +
456  QLatin1String( "</ul>" );
457  if ( !causes.isEmpty() ) {
458  ret2 += QLatin1String( "<p>" ) + i18n( "<b>Possible causes</b>:" ) +
459  QLatin1String( "</p><ul><li>" ) + causes.join( "</li><li>" ) +
460  QLatin1String( "</li></ul>" );
461  }
462  if ( !solutions.isEmpty() ) {
463  ret2 += QLatin1String( "<p>" ) + i18n( "<b>Possible solutions</b>:" ) +
464  QLatin1String( "</p><ul><li>" ) + solutions.join( "</li><li>" ) +
465  QLatin1String( "</li></ul>" );
466  }
467  ret2 += QLatin1String( "</qt>" );
468  ret << ret2;
469 
470  return ret;
471 }
472 
473 KIO_EXPORT QByteArray KIO::rawErrorDetail(int errorCode, const QString &errorText,
474  const KUrl *reqUrl /*= 0L*/, int /*method = -1*/ )
475 {
476  QString url, host, protocol, datetime, domain, path, filename;
477  bool isSlaveNetwork = false;
478  if ( reqUrl ) {
479  url = reqUrl->prettyUrl();
480  host = reqUrl->host();
481  protocol = reqUrl->protocol();
482 
483  if ( host.startsWith( QLatin1String( "www." ) ) )
484  domain = host.mid(4);
485  else
486  domain = host;
487 
488  filename = reqUrl->fileName();
489  path = reqUrl->path();
490 
491  // detect if protocol is a network protocol...
492  isSlaveNetwork = KProtocolInfo::protocolClass(protocol) == ":internet";
493  } else {
494  // assume that the errorText has the location we are interested in
495  url = host = domain = path = filename = errorText;
496  protocol = i18nc("@info protocol", "(unknown)" );
497  }
498 
499  datetime = KGlobal::locale()->formatDateTime( QDateTime::currentDateTime(),
500  KLocale::LongDate );
501 
502  QString errorName, techName, description;
503  QStringList causes, solutions;
504 
505  // c == cause, s == solution
506  QString sSysadmin = i18n( "Contact your appropriate computer support system, "
507  "whether the system administrator, or technical support group for further "
508  "assistance." );
509  QString sServeradmin = i18n( "Contact the administrator of the server "
510  "for further assistance." );
511  // FIXME active link to permissions dialog
512  QString sAccess = i18n( "Check your access permissions on this resource." );
513  QString cAccess = i18n( "Your access permissions may be inadequate to "
514  "perform the requested operation on this resource." );
515  QString cLocked = i18n( "The file may be in use (and thus locked) by "
516  "another user or application." );
517  QString sQuerylock = i18n( "Check to make sure that no other "
518  "application or user is using the file or has locked the file." );
519  QString cHardware = i18n( "Although unlikely, a hardware error may have "
520  "occurred." );
521  QString cBug = i18n( "You may have encountered a bug in the program." );
522  QString cBuglikely = i18n( "This is most likely to be caused by a bug in the "
523  "program. Please consider submitting a full bug report as detailed below." );
524  QString sUpdate = i18n( "Update your software to the latest version. "
525  "Your distribution should provide tools to update your software." );
526  QString sBugreport = i18n( "When all else fails, please consider helping the "
527  "KDE team or the third party maintainer of this software by submitting a "
528  "high quality bug report. If the software is provided by a third party, "
529  "please contact them directly. Otherwise, first look to see if "
530  "the same bug has been submitted by someone else by searching at the "
531  "<a href=\"http://bugs.kde.org/\">KDE bug reporting website</a>. If not, take "
532  "note of the details given above, and include them in your bug report, along "
533  "with as many other details as you think might help." );
534  QString cNetwork = i18n( "There may have been a problem with your network "
535  "connection." );
536  // FIXME netconf kcontrol link
537  QString cNetconf = i18n( "There may have been a problem with your network "
538  "configuration. If you have been accessing the Internet with no problems "
539  "recently, this is unlikely." );
540  QString cNetpath = i18n( "There may have been a problem at some point along "
541  "the network path between the server and this computer." );
542  QString sTryagain = i18n( "Try again, either now or at a later time." );
543  QString cProtocol = i18n( "A protocol error or incompatibility may have occurred." );
544  QString sExists = i18n( "Ensure that the resource exists, and try again." );
545  QString cExists = i18n( "The specified resource may not exist." );
546  QString cTypo = i18n( "You may have incorrectly typed the location." );
547  QString sTypo = i18n( "Double-check that you have entered the correct location "
548  "and try again." );
549  QString sNetwork = i18n( "Check your network connection status." );
550 
551  switch( errorCode ) {
552  case KIO::ERR_CANNOT_OPEN_FOR_READING:
553  errorName = i18n( "Cannot Open Resource For Reading" );
554  description = i18n( "This means that the contents of the requested file "
555  "or folder <strong>%1</strong> could not be retrieved, as read "
556  "access could not be obtained.", path );
557  causes << i18n( "You may not have permissions to read the file or open "
558  "the folder.") << cLocked << cHardware;
559  solutions << sAccess << sQuerylock << sSysadmin;
560  break;
561 
562  case KIO::ERR_CANNOT_OPEN_FOR_WRITING:
563  errorName = i18n( "Cannot Open Resource For Writing" );
564  description = i18n( "This means that the file, <strong>%1</strong>, could "
565  "not be written to as requested, because access with permission to "
566  "write could not be obtained." , filename );
567  causes << cAccess << cLocked << cHardware;
568  solutions << sAccess << sQuerylock << sSysadmin;
569  break;
570 
571  case KIO::ERR_CANNOT_LAUNCH_PROCESS:
572  errorName = i18n( "Cannot Initiate the %1 Protocol" , protocol );
573  techName = i18n( "Unable to Launch Process" );
574  description = i18n( "The program on your computer which provides access "
575  "to the <strong>%1</strong> protocol could not be started. This is "
576  "usually due to technical reasons." , protocol );
577  causes << i18n( "The program which provides compatibility with this "
578  "protocol may not have been updated with your last update of KDE. "
579  "This can cause the program to be incompatible with the current version "
580  "and thus not start." ) << cBug;
581  solutions << sUpdate << sSysadmin;
582  break;
583 
584  case KIO::ERR_INTERNAL:
585  errorName = i18n( "Internal Error" );
586  description = i18n( "The program on your computer which provides access "
587  "to the <strong>%1</strong> protocol has reported an internal error." ,
588  protocol );
589  causes << cBuglikely;
590  solutions << sUpdate << sBugreport;
591  break;
592 
593  case KIO::ERR_MALFORMED_URL:
594  errorName = i18n( "Improperly Formatted URL" );
595  description = i18n( "The <strong>U</strong>niform <strong>R</strong>esource "
596  "<strong>L</strong>ocator (URL) that you entered was not properly "
597  "formatted. The format of a URL is generally as follows:"
598  "<blockquote><strong>protocol://user:password@www.example.org:port/folder/"
599  "filename.extension?query=value</strong></blockquote>" );
600  solutions << sTypo;
601  break;
602 
603  case KIO::ERR_UNSUPPORTED_PROTOCOL:
604  errorName = i18n( "Unsupported Protocol %1" , protocol );
605  description = i18n( "The protocol <strong>%1</strong> is not supported "
606  "by the KDE programs currently installed on this computer." ,
607  protocol );
608  causes << i18n( "The requested protocol may not be supported." )
609  << i18n( "The versions of the %1 protocol supported by this computer and "
610  "the server may be incompatible." , protocol );
611  solutions << i18n( "You may perform a search on the Internet for a KDE "
612  "program (called a kioslave or ioslave) which supports this protocol. "
613  "Places to search include <a href=\"http://kde-apps.org/\">"
614  "http://kde-apps.org/</a> and <a href=\"http://freshmeat.net/\">"
615  "http://freshmeat.net/</a>." )
616  << sUpdate << sSysadmin;
617  break;
618 
619  case KIO::ERR_NO_SOURCE_PROTOCOL:
620  errorName = i18n( "URL Does Not Refer to a Resource." );
621  techName = i18n( "Protocol is a Filter Protocol" );
622  description = i18n( "The <strong>U</strong>niform <strong>R</strong>esource "
623  "<strong>L</strong>ocator (URL) that you entered did not refer to a "
624  "specific resource." );
625  causes << i18n( "KDE is able to communicate through a protocol within a "
626  "protocol; the protocol specified is only for use in such situations, "
627  "however this is not one of these situations. This is a rare event, and "
628  "is likely to indicate a programming error." );
629  solutions << sTypo;
630  break;
631 
632  case KIO::ERR_UNSUPPORTED_ACTION:
633  errorName = i18n( "Unsupported Action: %1" , errorText );
634  description = i18n( "The requested action is not supported by the KDE "
635  "program which is implementing the <strong>%1</strong> protocol." ,
636  protocol );
637  causes << i18n( "This error is very much dependent on the KDE program. The "
638  "additional information should give you more information than is available "
639  "to the KDE input/output architecture." );
640  solutions << i18n( "Attempt to find another way to accomplish the same "
641  "outcome." );
642  break;
643 
644  case KIO::ERR_IS_DIRECTORY:
645  errorName = i18n( "File Expected" );
646  description = i18n( "The request expected a file, however the "
647  "folder <strong>%1</strong> was found instead." , path );
648  causes << i18n( "This may be an error on the server side." ) << cBug;
649  solutions << sUpdate << sSysadmin;
650  break;
651 
652  case KIO::ERR_IS_FILE:
653  errorName = i18n( "Folder Expected" );
654  description = i18n( "The request expected a folder, however "
655  "the file <strong>%1</strong> was found instead." , filename );
656  causes << cBug;
657  solutions << sUpdate << sSysadmin;
658  break;
659 
660  case KIO::ERR_DOES_NOT_EXIST:
661  errorName = i18n( "File or Folder Does Not Exist" );
662  description = i18n( "The specified file or folder <strong>%1</strong> "
663  "does not exist." , path );
664  causes << cExists;
665  solutions << sExists;
666  break;
667 
668  case KIO::ERR_FILE_ALREADY_EXIST:
669  errorName = i18n( "File Already Exists" );
670  description = i18n( "The requested file could not be created because a "
671  "file with the same name already exists." );
672  solutions << i18n ( "Try moving the current file out of the way first, "
673  "and then try again." )
674  << i18n ( "Delete the current file and try again." )
675  << i18n( "Choose an alternate filename for the new file." );
676  break;
677 
678  case KIO::ERR_DIR_ALREADY_EXIST:
679  errorName = i18n( "Folder Already Exists" );
680  description = i18n( "The requested folder could not be created because "
681  "a folder with the same name already exists." );
682  solutions << i18n( "Try moving the current folder out of the way first, "
683  "and then try again." )
684  << i18n( "Delete the current folder and try again." )
685  << i18n( "Choose an alternate name for the new folder." );
686  break;
687 
688  case KIO::ERR_UNKNOWN_HOST:
689  errorName = i18n( "Unknown Host" );
690  description = i18n( "An unknown host error indicates that the server with "
691  "the requested name, <strong>%1</strong>, could not be "
692  "located on the Internet." , host );
693  causes << i18n( "The name that you typed, %1, may not exist: it may be "
694  "incorrectly typed." , host )
695  << cNetwork << cNetconf;
696  solutions << sNetwork << sSysadmin;
697  break;
698 
699  case KIO::ERR_ACCESS_DENIED:
700  errorName = i18n( "Access Denied" );
701  description = i18n( "Access was denied to the specified resource, "
702  "<strong>%1</strong>." , url );
703  causes << i18n( "You may have supplied incorrect authentication details or "
704  "none at all." )
705  << i18n( "Your account may not have permission to access the "
706  "specified resource." );
707  solutions << i18n( "Retry the request and ensure your authentication details "
708  "are entered correctly." ) << sSysadmin;
709  if ( !isSlaveNetwork ) solutions << sServeradmin;
710  break;
711 
712  case KIO::ERR_WRITE_ACCESS_DENIED:
713  errorName = i18n( "Write Access Denied" );
714  description = i18n( "This means that an attempt to write to the file "
715  "<strong>%1</strong> was rejected." , filename );
716  causes << cAccess << cLocked << cHardware;
717  solutions << sAccess << sQuerylock << sSysadmin;
718  break;
719 
720  case KIO::ERR_CANNOT_ENTER_DIRECTORY:
721  errorName = i18n( "Unable to Enter Folder" );
722  description = i18n( "This means that an attempt to enter (in other words, "
723  "to open) the requested folder <strong>%1</strong> was rejected." ,
724  path );
725  causes << cAccess << cLocked;
726  solutions << sAccess << sQuerylock << sSysadmin;
727  break;
728 
729  case KIO::ERR_PROTOCOL_IS_NOT_A_FILESYSTEM:
730  errorName = i18n( "Folder Listing Unavailable" );
731  techName = i18n( "Protocol %1 is not a Filesystem" , protocol );
732  description = i18n( "This means that a request was made which requires "
733  "determining the contents of the folder, and the KDE program supporting "
734  "this protocol is unable to do so." );
735  causes << cBug;
736  solutions << sUpdate << sBugreport;
737  break;
738 
739  case KIO::ERR_CYCLIC_LINK:
740  errorName = i18n( "Cyclic Link Detected" );
741  description = i18n( "UNIX environments are commonly able to link a file or "
742  "folder to a separate name and/or location. KDE detected a link or "
743  "series of links that results in an infinite loop - i.e. the file was "
744  "(perhaps in a roundabout way) linked to itself." );
745  solutions << i18n( "Delete one part of the loop in order that it does not "
746  "cause an infinite loop, and try again." ) << sSysadmin;
747  break;
748 
749  case KIO::ERR_USER_CANCELED:
750  // Do nothing in this case. The user doesn't need to be told what he just did.
751  // rodda: However, if we have been called, an application is about to display
752  // this information anyway. If we don't return sensible information, the
753  // user sees a blank dialog (I have seen this myself)
754  errorName = i18n( "Request Aborted By User" );
755  description = i18n( "The request was not completed because it was "
756  "aborted." );
757  solutions << i18n( "Retry the request." );
758  break;
759 
760  case KIO::ERR_CYCLIC_COPY:
761  errorName = i18n( "Cyclic Link Detected During Copy" );
762  description = i18n( "UNIX environments are commonly able to link a file or "
763  "folder to a separate name and/or location. During the requested copy "
764  "operation, KDE detected a link or series of links that results in an "
765  "infinite loop - i.e. the file was (perhaps in a roundabout way) linked "
766  "to itself." );
767  solutions << i18n( "Delete one part of the loop in order that it does not "
768  "cause an infinite loop, and try again." ) << sSysadmin;
769  break;
770 
771  case KIO::ERR_COULD_NOT_CREATE_SOCKET:
772  errorName = i18n( "Could Not Create Network Connection" );
773  techName = i18n( "Could Not Create Socket" );
774  description = i18n( "This is a fairly technical error in which a required "
775  "device for network communications (a socket) could not be created." );
776  causes << i18n( "The network connection may be incorrectly configured, or "
777  "the network interface may not be enabled." );
778  solutions << sNetwork << sSysadmin;
779  break;
780 
781  case KIO::ERR_COULD_NOT_CONNECT:
782  errorName = i18n( "Connection to Server Refused" );
783  description = i18n( "The server <strong>%1</strong> refused to allow this "
784  "computer to make a connection." , host );
785  causes << i18n( "The server, while currently connected to the Internet, "
786  "may not be configured to allow requests." )
787  << i18n( "The server, while currently connected to the Internet, "
788  "may not be running the requested service (%1)." , protocol )
789  << i18n( "A network firewall (a device which restricts Internet "
790  "requests), either protecting your network or the network of the server, "
791  "may have intervened, preventing this request." );
792  solutions << sTryagain << sServeradmin << sSysadmin;
793  break;
794 
795  case KIO::ERR_CONNECTION_BROKEN:
796  errorName = i18n( "Connection to Server Closed Unexpectedly" );
797  description = i18n( "Although a connection was established to "
798  "<strong>%1</strong>, the connection was closed at an unexpected point "
799  "in the communication." , host );
800  causes << cNetwork << cNetpath << i18n( "A protocol error may have occurred, "
801  "causing the server to close the connection as a response to the error." );
802  solutions << sTryagain << sServeradmin << sSysadmin;
803  break;
804 
805  case KIO::ERR_NOT_FILTER_PROTOCOL:
806  errorName = i18n( "URL Resource Invalid" );
807  techName = i18n( "Protocol %1 is not a Filter Protocol" , protocol );
808  description = i18n( "The <strong>U</strong>niform <strong>R</strong>esource "
809  "<strong>L</strong>ocator (URL) that you entered did not refer to "
810  "a valid mechanism of accessing the specific resource, "
811  "<strong>%1%2</strong>." ,
812  !host.isNull() ? host + '/' : QString() , path );
813  causes << i18n( "KDE is able to communicate through a protocol within a "
814  "protocol. This request specified a protocol be used as such, however "
815  "this protocol is not capable of such an action. This is a rare event, "
816  "and is likely to indicate a programming error." );
817  solutions << sTypo << sSysadmin;
818  break;
819 
820  case KIO::ERR_COULD_NOT_MOUNT:
821  errorName = i18n( "Unable to Initialize Input/Output Device" );
822  techName = i18n( "Could Not Mount Device" );
823  description = i18n( "The requested device could not be initialized "
824  "(\"mounted\"). The reported error was: <strong>%1</strong>" ,
825  errorText );
826  causes << i18n( "The device may not be ready, for example there may be "
827  "no media in a removable media device (i.e. no CD-ROM in a CD drive), "
828  "or in the case of a peripheral/portable device, the device may not "
829  "be correctly connected." )
830  << i18n( "You may not have permissions to initialize (\"mount\") the "
831  "device. On UNIX systems, often system administrator privileges are "
832  "required to initialize a device." )
833  << cHardware;
834  solutions << i18n( "Check that the device is ready; removable drives "
835  "must contain media, and portable devices must be connected and powered "
836  "on.; and try again." ) << sAccess << sSysadmin;
837  break;
838 
839  case KIO::ERR_COULD_NOT_UNMOUNT:
840  errorName = i18n( "Unable to Uninitialize Input/Output Device" );
841  techName = i18n( "Could Not Unmount Device" );
842  description = i18n( "The requested device could not be uninitialized "
843  "(\"unmounted\"). The reported error was: <strong>%1</strong>" ,
844  errorText );
845  causes << i18n( "The device may be busy, that is, still in use by "
846  "another application or user. Even such things as having an open "
847  "browser window on a location on this device may cause the device to "
848  "remain in use." )
849  << i18n( "You may not have permissions to uninitialize (\"unmount\") "
850  "the device. On UNIX systems, system administrator privileges are "
851  "often required to uninitialize a device." )
852  << cHardware;
853  solutions << i18n( "Check that no applications are accessing the device, "
854  "and try again." ) << sAccess << sSysadmin;
855  break;
856 
857  case KIO::ERR_COULD_NOT_READ:
858  errorName = i18n( "Cannot Read From Resource" );
859  description = i18n( "This means that although the resource, "
860  "<strong>%1</strong>, was able to be opened, an error occurred while "
861  "reading the contents of the resource." , url );
862  causes << i18n( "You may not have permissions to read from the resource." );
863  if ( !isSlaveNetwork ) causes << cNetwork;
864  causes << cHardware;
865  solutions << sAccess;
866  if ( !isSlaveNetwork ) solutions << sNetwork;
867  solutions << sSysadmin;
868  break;
869 
870  case KIO::ERR_COULD_NOT_WRITE:
871  errorName = i18n( "Cannot Write to Resource" );
872  description = i18n( "This means that although the resource, <strong>%1</strong>"
873  ", was able to be opened, an error occurred while writing to the resource." ,
874  url );
875  causes << i18n( "You may not have permissions to write to the resource." );
876  if ( !isSlaveNetwork ) causes << cNetwork;
877  causes << cHardware;
878  solutions << sAccess;
879  if ( !isSlaveNetwork ) solutions << sNetwork;
880  solutions << sSysadmin;
881  break;
882 
883  case KIO::ERR_COULD_NOT_BIND:
884  errorName = i18n( "Could Not Listen for Network Connections" );
885  techName = i18n( "Could Not Bind" );
886  description = i18n( "This is a fairly technical error in which a required "
887  "device for network communications (a socket) could not be established "
888  "to listen for incoming network connections." );
889  causes << i18n( "The network connection may be incorrectly configured, or "
890  "the network interface may not be enabled." );
891  solutions << sNetwork << sSysadmin;
892  break;
893 
894  case KIO::ERR_COULD_NOT_LISTEN:
895  errorName = i18n( "Could Not Listen for Network Connections" );
896  techName = i18n( "Could Not Listen" );
897  description = i18n( "This is a fairly technical error in which a required "
898  "device for network communications (a socket) could not be established "
899  "to listen for incoming network connections." );
900  causes << i18n( "The network connection may be incorrectly configured, or "
901  "the network interface may not be enabled." );
902  solutions << sNetwork << sSysadmin;
903  break;
904 
905  case KIO::ERR_COULD_NOT_ACCEPT:
906  errorName = i18n( "Could Not Accept Network Connection" );
907  description = i18n( "This is a fairly technical error in which an error "
908  "occurred while attempting to accept an incoming network connection." );
909  causes << i18n( "The network connection may be incorrectly configured, or "
910  "the network interface may not be enabled." )
911  << i18n( "You may not have permissions to accept the connection." );
912  solutions << sNetwork << sSysadmin;
913  break;
914 
915  case KIO::ERR_COULD_NOT_LOGIN:
916  errorName = i18n( "Could Not Login: %1" , errorText );
917  description = i18n( "An attempt to login to perform the requested "
918  "operation was unsuccessful." );
919  causes << i18n( "You may have supplied incorrect authentication details or "
920  "none at all." )
921  << i18n( "Your account may not have permission to access the "
922  "specified resource." ) << cProtocol;
923  solutions << i18n( "Retry the request and ensure your authentication details "
924  "are entered correctly." ) << sServeradmin << sSysadmin;
925  break;
926 
927  case KIO::ERR_COULD_NOT_STAT:
928  errorName = i18n( "Could Not Determine Resource Status" );
929  techName = i18n( "Could Not Stat Resource" );
930  description = i18n( "An attempt to determine information about the status "
931  "of the resource <strong>%1</strong>, such as the resource name, type, "
932  "size, etc., was unsuccessful." , url );
933  causes << i18n( "The specified resource may not have existed or may "
934  "not be accessible." ) << cProtocol << cHardware;
935  solutions << i18n( "Retry the request and ensure your authentication details "
936  "are entered correctly." ) << sSysadmin;
937  break;
938 
939  case KIO::ERR_COULD_NOT_CLOSEDIR:
940  //result = i18n( "Could not terminate listing %1" ).arg( errorText );
941  errorName = i18n( "Could Not Cancel Listing" );
942  techName = i18n( "FIXME: Document this" );
943  break;
944 
945  case KIO::ERR_COULD_NOT_MKDIR:
946  errorName = i18n( "Could Not Create Folder" );
947  description = i18n( "An attempt to create the requested folder failed." );
948  causes << cAccess << i18n( "The location where the folder was to be created "
949  "may not exist." );
950  if ( !isSlaveNetwork ) causes << cProtocol;
951  solutions << i18n( "Retry the request." ) << sAccess;
952  break;
953 
954  case KIO::ERR_COULD_NOT_RMDIR:
955  errorName = i18n( "Could Not Remove Folder" );
956  description = i18n( "An attempt to remove the specified folder, "
957  "<strong>%1</strong>, failed." , path );
958  causes << i18n( "The specified folder may not exist." )
959  << i18n( "The specified folder may not be empty." )
960  << cAccess;
961  if ( !isSlaveNetwork ) causes << cProtocol;
962  solutions << i18n( "Ensure that the folder exists and is empty, and try "
963  "again." ) << sAccess;
964  break;
965 
966  case KIO::ERR_CANNOT_RESUME:
967  errorName = i18n( "Could Not Resume File Transfer" );
968  description = i18n( "The specified request asked that the transfer of "
969  "file <strong>%1</strong> be resumed at a certain point of the "
970  "transfer. This was not possible." , filename );
971  causes << i18n( "The protocol, or the server, may not support file "
972  "resuming." );
973  solutions << i18n( "Retry the request without attempting to resume "
974  "transfer." );
975  break;
976 
977  case KIO::ERR_CANNOT_RENAME:
978  errorName = i18n( "Could Not Rename Resource" );
979  description = i18n( "An attempt to rename the specified resource "
980  "<strong>%1</strong> failed." , url );
981  causes << cAccess << cExists;
982  if ( !isSlaveNetwork ) causes << cProtocol;
983  solutions << sAccess << sExists;
984  break;
985 
986  case KIO::ERR_CANNOT_CHMOD:
987  errorName = i18n( "Could Not Alter Permissions of Resource" );
988  description = i18n( "An attempt to alter the permissions on the specified "
989  "resource <strong>%1</strong> failed." , url );
990  causes << cAccess << cExists;
991  solutions << sAccess << sExists;
992  break;
993 
994  case KIO::ERR_CANNOT_CHOWN:
995  errorName = i18n( "Could Not Change Ownership of Resource" );
996  description = i18n( "An attempt to change the ownership of the specified "
997  "resource <strong>%1</strong> failed." , url );
998  causes << cAccess << cExists;
999  solutions << sAccess << sExists;
1000  break;
1001 
1002  case KIO::ERR_CANNOT_DELETE:
1003  errorName = i18n( "Could Not Delete Resource" );
1004  description = i18n( "An attempt to delete the specified resource "
1005  "<strong>%1</strong> failed." , url );
1006  causes << cAccess << cExists;
1007  solutions << sAccess << sExists;
1008  break;
1009 
1010  case KIO::ERR_SLAVE_DIED:
1011  errorName = i18n( "Unexpected Program Termination" );
1012  description = i18n( "The program on your computer which provides access "
1013  "to the <strong>%1</strong> protocol has unexpectedly terminated." ,
1014  url );
1015  causes << cBuglikely;
1016  solutions << sUpdate << sBugreport;
1017  break;
1018 
1019  case KIO::ERR_OUT_OF_MEMORY:
1020  errorName = i18n( "Out of Memory" );
1021  description = i18n( "The program on your computer which provides access "
1022  "to the <strong>%1</strong> protocol could not obtain the memory "
1023  "required to continue." , protocol );
1024  causes << cBuglikely;
1025  solutions << sUpdate << sBugreport;
1026  break;
1027 
1028  case KIO::ERR_UNKNOWN_PROXY_HOST:
1029  errorName = i18n( "Unknown Proxy Host" );
1030  description = i18n( "While retrieving information about the specified "
1031  "proxy host, <strong>%1</strong>, an Unknown Host error was encountered. "
1032  "An unknown host error indicates that the requested name could not be "
1033  "located on the Internet." , errorText );
1034  causes << i18n( "There may have been a problem with your network "
1035  "configuration, specifically your proxy's hostname. If you have been "
1036  "accessing the Internet with no problems recently, this is unlikely." )
1037  << cNetwork;
1038  solutions << i18n( "Double-check your proxy settings and try again." )
1039  << sSysadmin;
1040  break;
1041 
1042  case KIO::ERR_COULD_NOT_AUTHENTICATE:
1043  errorName = i18n( "Authentication Failed: Method %1 Not Supported" ,
1044  errorText );
1045  description = i18n( "Although you may have supplied the correct "
1046  "authentication details, the authentication failed because the "
1047  "method that the server is using is not supported by the KDE "
1048  "program implementing the protocol %1." , protocol );
1049  solutions << i18n( "Please file a bug at <a href=\"http://bugs.kde.org/\">"
1050  "http://bugs.kde.org/</a> to inform the KDE team of the unsupported "
1051  "authentication method." ) << sSysadmin;
1052  break;
1053 
1054  case KIO::ERR_ABORTED:
1055  errorName = i18n( "Request Aborted" );
1056  description = i18n( "The request was not completed because it was "
1057  "aborted." );
1058  solutions << i18n( "Retry the request." );
1059  break;
1060 
1061  case KIO::ERR_INTERNAL_SERVER:
1062  errorName = i18n( "Internal Error in Server" );
1063  description = i18n( "The program on the server which provides access "
1064  "to the <strong>%1</strong> protocol has reported an internal error: "
1065  "%2." , protocol, errorText );
1066  causes << i18n( "This is most likely to be caused by a bug in the "
1067  "server program. Please consider submitting a full bug report as "
1068  "detailed below." );
1069  solutions << i18n( "Contact the administrator of the server "
1070  "to advise them of the problem." )
1071  << i18n( "If you know who the authors of the server software are, "
1072  "submit the bug report directly to them." );
1073  break;
1074 
1075  case KIO::ERR_SERVER_TIMEOUT:
1076  errorName = i18n( "Timeout Error" );
1077  description = i18n( "Although contact was made with the server, a "
1078  "response was not received within the amount of time allocated for "
1079  "the request as follows:<ul>"
1080  "<li>Timeout for establishing a connection: %1 seconds</li>"
1081  "<li>Timeout for receiving a response: %2 seconds</li>"
1082  "<li>Timeout for accessing proxy servers: %3 seconds</li></ul>"
1083  "Please note that you can alter these timeout settings in the KDE "
1084  "System Settings, by selecting Network Settings -> Connection Preferences." ,
1085  KProtocolManager::connectTimeout() ,
1086  KProtocolManager::responseTimeout() ,
1087  KProtocolManager::proxyConnectTimeout() );
1088  causes << cNetpath << i18n( "The server was too busy responding to other "
1089  "requests to respond." );
1090  solutions << sTryagain << sServeradmin;
1091  break;
1092 
1093  case KIO::ERR_UNKNOWN:
1094  errorName = i18n( "Unknown Error" );
1095  description = i18n( "The program on your computer which provides access "
1096  "to the <strong>%1</strong> protocol has reported an unknown error: "
1097  "%2." , protocol , errorText );
1098  causes << cBug;
1099  solutions << sUpdate << sBugreport;
1100  break;
1101 
1102  case KIO::ERR_UNKNOWN_INTERRUPT:
1103  errorName = i18n( "Unknown Interruption" );
1104  description = i18n( "The program on your computer which provides access "
1105  "to the <strong>%1</strong> protocol has reported an interruption of "
1106  "an unknown type: %2." , protocol , errorText );
1107  causes << cBug;
1108  solutions << sUpdate << sBugreport;
1109  break;
1110 
1111  case KIO::ERR_CANNOT_DELETE_ORIGINAL:
1112  errorName = i18n( "Could Not Delete Original File" );
1113  description = i18n( "The requested operation required the deleting of "
1114  "the original file, most likely at the end of a file move operation. "
1115  "The original file <strong>%1</strong> could not be deleted." ,
1116  errorText );
1117  causes << cAccess;
1118  solutions << sAccess;
1119  break;
1120 
1121  case KIO::ERR_CANNOT_DELETE_PARTIAL:
1122  errorName = i18n( "Could Not Delete Temporary File" );
1123  description = i18n( "The requested operation required the creation of "
1124  "a temporary file in which to save the new file while being "
1125  "downloaded. This temporary file <strong>%1</strong> could not be "
1126  "deleted." , errorText );
1127  causes << cAccess;
1128  solutions << sAccess;
1129  break;
1130 
1131  case KIO::ERR_CANNOT_RENAME_ORIGINAL:
1132  errorName = i18n( "Could Not Rename Original File" );
1133  description = i18n( "The requested operation required the renaming of "
1134  "the original file <strong>%1</strong>, however it could not be "
1135  "renamed." , errorText );
1136  causes << cAccess;
1137  solutions << sAccess;
1138  break;
1139 
1140  case KIO::ERR_CANNOT_RENAME_PARTIAL:
1141  errorName = i18n( "Could Not Rename Temporary File" );
1142  description = i18n( "The requested operation required the creation of "
1143  "a temporary file <strong>%1</strong>, however it could not be "
1144  "created." , errorText );
1145  causes << cAccess;
1146  solutions << sAccess;
1147  break;
1148 
1149  case KIO::ERR_CANNOT_SYMLINK:
1150  errorName = i18n( "Could Not Create Link" );
1151  techName = i18n( "Could Not Create Symbolic Link" );
1152  description = i18n( "The requested symbolic link %1 could not be created." ,
1153  errorText );
1154  causes << cAccess;
1155  solutions << sAccess;
1156  break;
1157 
1158  case KIO::ERR_NO_CONTENT:
1159  errorName = i18n( "No Content" );
1160  description = errorText;
1161  break;
1162 
1163  case KIO::ERR_DISK_FULL:
1164  errorName = i18n( "Disk Full" );
1165  description = i18n( "The requested file <strong>%1</strong> could not be "
1166  "written to as there is inadequate disk space." , errorText );
1167  solutions << i18n( "Free up enough disk space by 1) deleting unwanted and "
1168  "temporary files; 2) archiving files to removable media storage such as "
1169  "CD-Recordable discs; or 3) obtain more storage capacity." )
1170  << sSysadmin;
1171  break;
1172 
1173  case KIO::ERR_IDENTICAL_FILES:
1174  errorName = i18n( "Source and Destination Files Identical" );
1175  description = i18n( "The operation could not be completed because the "
1176  "source and destination files are the same file." );
1177  solutions << i18n( "Choose a different filename for the destination file." );
1178  break;
1179 
1180  // We assume that the slave has all the details
1181  case KIO::ERR_SLAVE_DEFINED:
1182  errorName.clear();
1183  description = errorText;
1184  break;
1185 
1186  default:
1187  // fall back to the plain error...
1188  errorName = i18n( "Undocumented Error" );
1189  description = buildErrorString( errorCode, errorText );
1190  }
1191 
1192  QByteArray ret;
1193  QDataStream stream(&ret, QIODevice::WriteOnly);
1194  stream << errorName << techName << description << causes << solutions;
1195  return ret;
1196 }
1197 
1198 /***************************************************************
1199  *
1200  * Utility functions
1201  *
1202  ***************************************************************/
1203 
1204 KIO::CacheControl KIO::parseCacheControl(const QString &cacheControl)
1205 {
1206  QString tmp = cacheControl.toLower();
1207 
1208  if (tmp == QLatin1String("cacheonly"))
1209  return KIO::CC_CacheOnly;
1210  if (tmp == QLatin1String("cache"))
1211  return KIO::CC_Cache;
1212  if (tmp == QLatin1String("verify"))
1213  return KIO::CC_Verify;
1214  if (tmp == QLatin1String("refresh"))
1215  return KIO::CC_Refresh;
1216  if (tmp == QLatin1String("reload"))
1217  return KIO::CC_Reload;
1218 
1219  kDebug() << "unrecognized Cache control option:"<<cacheControl;
1220  return KIO::CC_Verify;
1221 }
1222 
1223 QString KIO::getCacheControlString(KIO::CacheControl cacheControl)
1224 {
1225  if (cacheControl == KIO::CC_CacheOnly)
1226  return "CacheOnly";
1227  if (cacheControl == KIO::CC_Cache)
1228  return "Cache";
1229  if (cacheControl == KIO::CC_Verify)
1230  return "Verify";
1231  if (cacheControl == KIO::CC_Refresh)
1232  return "Refresh";
1233  if (cacheControl == KIO::CC_Reload)
1234  return "Reload";
1235  kDebug() << "unrecognized Cache control enum value:"<<cacheControl;
1236  return QString();
1237 }
1238 
1239 QPixmap KIO::pixmapForUrl( const KUrl & _url, mode_t _mode, KIconLoader::Group _group,
1240  int _force_size, int _state, QString * _path )
1241 {
1242  const QString iconName = KMimeType::iconNameForUrl( _url, _mode );
1243  return KIconLoader::global()->loadMimeTypeIcon( iconName, _group, _force_size, _state, QStringList(), _path );
1244 }
1245 
1246 KJobTrackerInterface *KIO::getJobTracker()
1247 {
1248  return globalJobTracker;
1249 }
1250 
1251 QFile::Permissions KIO::convertPermissions(int permissions)
1252 {
1253  QFile::Permissions qPermissions(0);
1254 
1255  if (permissions > 0) {
1256  if (permissions & S_IRUSR) {
1257  qPermissions |= QFile::ReadOwner;
1258  }
1259  if (permissions & S_IWUSR) {
1260  qPermissions |= QFile::WriteOwner;
1261  }
1262  if (permissions & S_IXUSR) {
1263  qPermissions |= QFile::ExeOwner;
1264  }
1265 
1266  if (permissions & S_IRGRP) {
1267  qPermissions |= QFile::ReadGroup;
1268  }
1269  if (permissions & S_IWGRP) {
1270  qPermissions |= QFile::WriteGroup;
1271  }
1272  if (permissions & S_IXGRP) {
1273  qPermissions |= QFile::ExeGroup;
1274  }
1275 
1276  if (permissions & S_IROTH) {
1277  qPermissions |= QFile::ReadOther;
1278  }
1279  if (permissions & S_IWOTH) {
1280  qPermissions |= QFile::WriteOther;
1281  }
1282  if (permissions & S_IXOTH) {
1283  qPermissions |= QFile::ExeOther;
1284  }
1285  }
1286 
1287  return qPermissions;
1288 }
1289 
1290 
1291 
1292 /***************************************************************
1293  *
1294  * KIO::MetaData
1295  *
1296  ***************************************************************/
1297 KIO::MetaData::MetaData(const QMap<QString,QVariant>& map)
1298 {
1299  *this = map;
1300 }
1301 
1302 KIO::MetaData & KIO::MetaData::operator += ( const QMap<QString,QVariant> &metaData )
1303 {
1304  QMapIterator<QString,QVariant> it (metaData);
1305 
1306  while(it.hasNext()) {
1307  it.next();
1308  insert(it.key(), it.value().toString());
1309  }
1310 
1311  return *this;
1312 }
1313 
1314 KIO::MetaData & KIO::MetaData::operator = ( const QMap<QString,QVariant> &metaData )
1315 {
1316  clear();
1317  return (*this += metaData);
1318 }
1319 
1320 QVariant KIO::MetaData::toVariant() const
1321 {
1322  QMap<QString, QVariant> map;
1323  QMapIterator <QString,QString> it (*this);
1324 
1325  while (it.hasNext()) {
1326  it.next();
1327  map.insert(it.key(), it.value());
1328  }
1329 
1330  return QVariant(map);
1331 }
KIO::unsupportedActionErrorString
QString unsupportedActionErrorString(const QString &protocol, int cmd)
Returns an appropriate error message if the given command cmd is an unsupported action (ERR_UNSUPPORT...
Definition: global.cpp:376
i18n
QString i18n(const char *text)
KIO::CC_CacheOnly
Fail request if not in cache.
Definition: global.h:332
KIO::getCacheControlString
QString getCacheControlString(KIO::CacheControl cacheControl)
Returns a string representation of the given cache control method.
Definition: global.cpp:1223
KIO::filesize_t
qulonglong filesize_t
64-bit file size
Definition: global.h:57
KIO::ERR_DISK_FULL
Definition: global.h:256
kdebug.h
KIO::ERR_UNKNOWN_INTERRUPT
Definition: global.h:248
KIO::ERR_SLAVE_DEFINED
Definition: global.h:258
kmimetype.h
KIO::CMD_CHOWN
Definition: global.h:181
KIO::MetaData::MetaData
MetaData()
Creates an empty meta data map.
Definition: global.h:402
KIO::ERR_UPGRADE_REQUIRED
Definition: global.h:264
QTime::setHMS
bool setHMS(int h, int m, int s, int ms)
KIO::ERR_UNKNOWN_PROXY_HOST
Definition: global.h:240
KIO::ERR_CANNOT_RENAME_ORIGINAL
Definition: global.h:251
QByteArray
KIconLoader::global
static KIconLoader * global()
QDataStream
QChar
i18np
QString i18np(const char *sing, const char *plur, const A1 &a1)
KIO::ERR_MALFORMED_URL
Definition: global.h:199
KIO::MetaData::operator+=
MetaData & operator+=(const QMap< QString, QString > &metaData)
Adds the given meta data map to this map.
Definition: global.h:420
KIO::ERR_POST_NO_SIZE
Definition: global.h:272
KIO::ERR_CYCLIC_COPY
Definition: global.h:215
K_GLOBAL_STATIC
#define K_GLOBAL_STATIC(TYPE, NAME)
KIO::ERR_COULD_NOT_CLOSEDIR
Definition: global.h:229
KIO::CMD_SUBURL
Definition: global.h:174
KIO::ERR_CANNOT_DELETE
Definition: global.h:235
QMap< QString, QVariant >
KIO::decodeFileName
QString decodeFileName(const QString &str)
Decodes (from the filename to the text displayed) This doesn't do anything anymore, it used to do the opposite of encodeFileName when encodeFileName was using %2F for '/'.
Definition: global.cpp:153
QUrl::host
QString host() const
KIO::ERR_COULD_NOT_MKDIR
Definition: global.h:230
KIO::ERR_FILE_ALREADY_EXIST
Definition: global.h:206
KIO::CMD_STAT
Definition: global.h:161
KIO::ERR_OUT_OF_MEMORY
Definition: global.h:239
KIO::ERR_USER_CANCELED
Definition: global.h:214
KIO::ERR_COULD_NOT_BIND
Definition: global.h:224
KIO::CMD_OPEN
Definition: global.h:180
KIO::CMD_MIMETYPE
Definition: global.h:162
KIO::CC_Reload
Always fetch from remote site.
Definition: global.h:336
kiconloader.h
KIO::ERR_CANNOT_LAUNCH_PROCESS
Definition: global.h:197
KIO::ERR_CANNOT_RENAME_PARTIAL
Definition: global.h:252
KIO::pixmapForUrl
QPixmap pixmapForUrl(const KUrl &_url, mode_t _mode=0, KIconLoader::Group _group=KIconLoader::Desktop, int _force_size=0, int _state=0, QString *_path=0)
Convenience method to find the pixmap for a URL.
Definition: global.cpp:1239
QStringList::join
QString join(const QString &separator) const
KIO::convertSeconds
QString convertSeconds(unsigned int seconds)
Convert seconds to a string representing number of days, hours, minutes and seconds.
Definition: global.cpp:79
KIO::ERR_SLAVE_DIED
Definition: global.h:238
KIO::CMD_CONNECT
Definition: global.h:152
KIO::CMD_SPECIAL
Definition: global.h:169
kDebug
static QDebug kDebug(bool cond, int area=KDE_DEFAULT_DEBUG_AREA)
klocale.h
global.h
QTime
KIO::ERR_WRITE_ACCESS_DENIED
Definition: global.h:210
KIO::MetaData
MetaData is a simple map of key/value strings.
Definition: global.h:396
insert
KGuiItem insert()
KIO::Job::detailedErrorStrings
QStringList detailedErrorStrings(const KUrl *reqUrl=0L, int method=-1) const
Converts an error code and a non-i18n error message into i18n strings suitable for presentation in a ...
Definition: global.cpp:419
KUrl
KIO::ERR_COULD_NOT_LISTEN
Definition: global.h:225
i18nc
QString i18nc(const char *ctxt, const char *text)
kprotocolmanager.h
QString::isNull
bool isNull() const
KIO::CMD_LISTDIR
Definition: global.h:163
KIO::ERR_COULD_NOT_CONNECT
Definition: global.h:217
kdynamicjobtracker_p.h
QString::clear
void clear()
KDynamicJobTracker
This class implements a simple job tracker which registers any job to the KWidgetJobTracker if a kuis...
Definition: kdynamicjobtracker_p.h:31
KIO::ERR_UNKNOWN_HOST
Definition: global.h:208
KIO::CMD_COPY
Definition: global.h:166
kglobal.h
KIO::ERR_NOT_FILTER_PROTOCOL
Definition: global.h:219
KIO::ERR_COULD_NOT_UNMOUNT
Definition: global.h:221
QMapIterator
KProtocolManager::responseTimeout
static int responseTimeout()
Returns the preferred response timeout value for remote connecting in seconds.
Definition: kprotocolmanager.cpp:292
KIO::ERR_SERVER_TIMEOUT
Definition: global.h:244
KIO::ERR_INTERNAL
Definition: global.h:198
KIO::ERR_CANNOT_OPEN_FOR_WRITING
Definition: global.h:196
KIO::ERR_CANNOT_DELETE_ORIGINAL
Definition: global.h:249
KIO::ERR_COULD_NOT_READ
Definition: global.h:222
KIO::ERR_COULD_NOT_AUTHENTICATE
Definition: global.h:241
QMapIterator::next
Item next()
KIO::encodeFileName
QString encodeFileName(const QString &str)
Encodes (from the text displayed to the real filename) This translates '/' into a "unicode fraction s...
Definition: global.cpp:146
KIO::MetaData::toVariant
QVariant toVariant() const
Returns the contents of the map as a QVariant.
Definition: global.cpp:1320
KUrl::protocol
QString protocol() const
QList::isEmpty
bool isEmpty() const
KIO::buildErrorString
QString buildErrorString(int errorCode, const QString &errorText)
Returns a translated error message for errorCode using the additional error information provided by e...
Definition: global.cpp:164
QString::isEmpty
bool isEmpty() const
KIO::ERR_INTERNAL_SERVER
Definition: global.h:243
KIO::ERR_IS_DIRECTORY
Definition: global.h:203
KIO::ERR_CANNOT_RENAME
Definition: global.h:233
QString::startsWith
bool startsWith(const QString &s, Qt::CaseSensitivity cs) const
KIO::itemsSummaryString
QString itemsSummaryString(uint items, uint files, uint dirs, KIO::filesize_t size, bool showSize)
Helper for showing information about a set of files and directories.
Definition: global.cpp:119
KIconLoader::loadMimeTypeIcon
QPixmap loadMimeTypeIcon(const QString &iconName, KIconLoader::Group group, int size=0, int state=KIconLoader::DefaultState, const QStringList &overlays=QStringList(), QString *path_store=0) const
KIO::CacheControl
CacheControl
Specifies how to use the cache.
Definition: global.h:330
KIO::ERR_UNSUPPORTED_PROTOCOL
Definition: global.h:200
KLocale::formatByteSize
QString formatByteSize(double size) const
clear
KAction * clear(const QObject *recvr, const char *slot, QObject *parent)
KIO::getJobTracker
KJobTrackerInterface * getJobTracker()
Definition: global.cpp:1246
QString
KProtocolInfo::protocolClass
static QString protocolClass(const QString &protocol)
QMapIterator::key
const Key & key() const
KIO::CMD_PUT
Definition: global.h:160
KUrl::path
QString path(AdjustPathOption trailing=LeaveTrailingSlash) const
KIO::ERR_IDENTICAL_FILES
Definition: global.h:257
KProtocolManager::connectTimeout
static int connectTimeout()
Returns the preferred timeout value for remote connections in seconds.
Definition: kprotocolmanager.cpp:278
QMapIterator::value
const T & value() const
KIO::CMD_RENAME
Definition: global.h:165
QFile::Permissions
typedef Permissions
KIO::ERR_DIR_ALREADY_EXIST
Definition: global.h:207
QStringList
KIO::ERR_COULD_NOT_STAT
Definition: global.h:228
QPixmap
KIO::parseCacheControl
KIO::CacheControl parseCacheControl(const QString &cacheControl)
Parses the string representation of the cache control option.
Definition: global.cpp:1204
KIO::ERR_CONNECTION_BROKEN
Definition: global.h:218
QString::toLower
QString toLower() const
KIO::CMD_DEL
Definition: global.h:167
KIO::CMD_MKDIR
Definition: global.h:164
KJobTrackerInterface
KIO::ERR_COULD_NOT_ACCEPT
Definition: global.h:226
KIO::convertSizeFromKiB
QString convertSizeFromKiB(KIO::filesize_t kibSize)
Converts size from kibi-bytes (2^10) to the string representation.
Definition: global.cpp:58
KLocale::formatDateTime
QString formatDateTime(const QDateTime &dateTime, DateFormat format=ShortDate, bool includeSecs=false) const
KIO::ERR_NO_SOURCE_PROTOCOL
Definition: global.h:201
KIO::ERR_ACCESS_DENIED
Definition: global.h:209
KGlobal::locale
KLocale * locale()
job.h
KIO::ERR_COULD_NOT_LOGIN
Definition: global.h:227
KIO::ERR_IS_FILE
Definition: global.h:204
QString::replace
QString & replace(int position, int n, QChar after)
KIO::CMD_DISCONNECT
Definition: global.h:153
KIO::ERR_COULD_NOT_CREATE_SOCKET
Definition: global.h:216
QDateTime::currentDateTime
QDateTime currentDateTime()
KIO::ERR_CANNOT_CHOWN
Definition: global.h:271
QString::mid
QString mid(int position, int n) const
KIO::CMD_CHMOD
Definition: global.h:168
KIO::CC_Cache
Use cached entry if available.
Definition: global.h:333
KIO::CC_Refresh
Always validate cached entry with remote site.
Definition: global.h:335
KIO::ERR_CANNOT_DELETE_PARTIAL
Definition: global.h:250
KIO::Job::errorString
QString errorString() const
Converts an error code and a non-i18n error message into an error message in the current language...
Definition: global.cpp:159
QLatin1String
KUrl::fileName
QString fileName(const DirectoryOptions &options=IgnoreTrailingSlash) const
Qt::escape
QString escape(const QString &plain)
KIO::MetaData::operator=
MetaData & operator=(const QMap< QString, QVariant > &metaData)
Sets the given meta data map to this map.
Definition: global.cpp:1314
KIO::CC_Verify
Validate cached entry with remote site if expired.
Definition: global.h:334
KIO::ERR_UNSUPPORTED_ACTION
Definition: global.h:202
KIconLoader::Group
Group
KIO::ERR_CANNOT_RESUME
Definition: global.h:232
KIO::ERR_NO_CONTENT
Definition: global.h:255
KIO::calculateRemaining
QTime calculateRemaining(KIO::filesize_t totalSize, KIO::filesize_t processedSize, KIO::filesize_t speed)
Calculates remaining time from total size, processed size and speed.
Definition: global.cpp:95
KIO::ERR_CYCLIC_LINK
Definition: global.h:213
KProtocolManager::proxyConnectTimeout
static int proxyConnectTimeout()
Returns the preferred timeout value for proxy connections in seconds.
Definition: kprotocolmanager.cpp:285
KIO::calculateRemainingSeconds
unsigned int calculateRemainingSeconds(KIO::filesize_t totalSize, KIO::filesize_t processedSize, KIO::filesize_t speed)
Calculates remaining time in seconds from total size, processed size and speed.
Definition: global.cpp:70
KIO::ERR_COULD_NOT_RMDIR
Definition: global.h:231
KIO::ERR_CANNOT_SYMLINK
Definition: global.h:254
KIO::ERR_ABORTED
Definition: global.h:242
KIO::ERR_CANNOT_OPEN_FOR_READING
Definition: global.h:195
KIO::ERR_POST_DENIED
Definition: global.h:267
KLocale::LongDate
QMap::insert
iterator insert(const Key &key, const T &value)
KIO::ERR_PROTOCOL_IS_NOT_A_FILESYSTEM
Definition: global.h:212
KIO::ERR_UNKNOWN
Definition: global.h:246
KIO::rawErrorDetail
QByteArray rawErrorDetail(int errorCode, const QString &errorText, const KUrl *reqUrl=0L, int method=-1)
Returns translated error details for errorCode using the additional error information provided by err...
Definition: global.cpp:473
KIO::ERR_DOES_NOT_EXIST
Definition: global.h:205
KIO::ERR_COULD_NOT_MOUNT
Definition: global.h:220
KIO::ERR_CANNOT_ENTER_DIRECTORY
Definition: global.h:211
KIO::CMD_MULTI_GET
Definition: global.h:178
KIO::convertSize
QString convertSize(KIO::filesize_t size)
Converts size from bytes to the string representation.
Definition: global.cpp:53
KIO::CMD_SYMLINK
Definition: global.h:173
KUrl::prettyUrl
QString prettyUrl(AdjustPathOption trailing=LeaveTrailingSlash) const
KIO::ERR_COULD_NOT_WRITE
Definition: global.h:223
KIO::ERR_CANNOT_CHMOD
Definition: global.h:234
QMapIterator::hasNext
bool hasNext() const
KCompositeJob::errorText
QString errorText() const
KIO::convertPermissions
QFile::Permissions convertPermissions(int permissions)
Converts KIO file permissions from mode_t to QFile::Permissions format.
Definition: global.cpp:1251
KIO::number
QString number(KIO::filesize_t size)
Converts a size to a string representation Not unlike QString::number(...)
Definition: global.cpp:63
KCompositeJob::error
int error() const
QVariant
KIO::CMD_GET
Definition: global.h:159
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:24:52 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

KIO

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

kdelibs API Reference

Skip menu "kdelibs API Reference"
  • DNSSD
  • Interfaces
  •   KHexEdit
  •   KMediaPlayer
  •   KSpeech
  •   KTextEditor
  • kconf_update
  • KDE3Support
  •   KUnitTest
  • KDECore
  • KDED
  • KDEsu
  • KDEUI
  • KDEWebKit
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • kio
  • KIOSlave
  • KJS
  •   KJS-API
  •   WTF
  • kjsembed
  • KNewStuff
  • KParts
  • KPty
  • Kross
  • KUnitConversion
  • KUtils
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal