21 #include <sys/types.h> 32 #include "tdeio/global.h" 33 #include "tdeio/job.h" 36 #include <tdelocale.h> 37 #include <tdeglobal.h> 38 #include <tdeprotocolmanager.h> 48 return convertSize( size ) +
" (" + i18n(
"%1 B" ).arg( TDEGlobal::locale()->formatNumber(size, 0) ) +
")";
58 if ( size >= 1073741824 )
60 fsize /= 1073741824.0;
62 s = i18n(
"%1 TB" ).arg( TDEGlobal::locale()->formatNumber(fsize / 1024.0, 1));
64 s = i18n(
"%1 GB" ).arg( TDEGlobal::locale()->formatNumber(fsize, 1));
67 else if ( size >= 1048576 )
70 s = i18n(
"%1 MB" ).arg( TDEGlobal::locale()->formatNumber(fsize, 1));
73 else if ( size >= 1024 )
76 s = i18n(
"%1 KB" ).arg( TDEGlobal::locale()->formatNumber(fsize, 1));
81 s = i18n(
"%1 B" ).arg( TDEGlobal::locale()->formatNumber(fsize, 0));
99 sprintf(charbuf,
"%lld", size);
100 return TQString::fromLatin1(charbuf);
106 if ( (speed != 0) && (totalSize != 0) )
107 return ( totalSize - processedSize ) / speed;
114 unsigned int days = seconds / 86400;
115 unsigned int hours = (seconds - (days * 86400)) / 3600;
116 unsigned int mins = (seconds - (days * 86400) - (hours * 3600)) / 60;
117 seconds = (seconds - (days * 86400) - (hours * 3600) - (mins * 60));
119 const TQTime time(hours, mins, seconds);
120 const TQString timeStr( TDEGlobal::locale()->formatTime(time,
true ,
true ) );
122 return i18n(
"1 day %1",
"%n days %1", days).arg(timeStr);
129 TQTime remainingTime;
133 if ( totalSize == 0 ) {
136 secs = ( totalSize - processedSize ) / speed;
138 if (secs >= (24*60*60))
140 int hr = secs / ( 60 * 60 );
141 int mn = ( secs - hr * 60 * 60 ) / 60;
142 int sc = ( secs - hr * 60 * 60 - mn * 60 );
144 remainingTime.setHMS( hr, mn, sc );
147 return remainingTime;
152 TQString text = items == 0 ? i18n(
"No Items" ) : i18n(
"One Item",
"%n Items", items );
154 text += files == 0 ? i18n(
"No Files" ) : i18n(
"One File",
"%n Files", files );
155 if ( showSize && files > 0 )
161 text += dirs == 0 ? i18n(
"No Folders" ) : i18n(
"One Folder",
"%n Folders", dirs);
167 TQString str( _str );
168 bool unicode_supported = (TQString::fromLocal8Bit(TQString(TQChar((uint)0x2215)).local8Bit())[0].unicode() != 0x3f);
171 while ( ( i = str.find(
"%", i ) ) != -1 ) {
172 str.replace( i, 1,
"%%");
175 while ( ( i = str.find(
"/" ) ) != -1 ) {
176 if (unicode_supported) {
180 str.replace( i, 1, TQChar((uint)0x2215));
185 str.replace( i, 1,
"%2f");
194 bool unicode_supported = (TQString::fromLocal8Bit(TQString(TQChar((uint)0x2215)).local8Bit())[0].unicode() != 0x3f);
197 for ( ; i < _str.length() ; ++i ) {
198 if ( _str[i]==
'%' ) {
199 if ( _str[i+1]==
'%' )
204 else if ((!unicode_supported) && ( _str[i+1]==
'2' && (i+2<_str.length()) && _str[i+2].lower()==
'f' ))
214 else if ( _str[i] == TQChar((uint)0x2215) ) {
236 case TDEIO::ERR_CANNOT_OPEN_FOR_READING:
237 result = i18n(
"Could not read %1." ).arg( errorText );
239 case TDEIO::ERR_CANNOT_OPEN_FOR_WRITING:
240 result = i18n(
"Could not write to %1." ).arg( errorText );
242 case TDEIO::ERR_CANNOT_LAUNCH_PROCESS:
243 result = i18n(
"Could not start process %1." ).arg( errorText );
245 case TDEIO::ERR_INTERNAL:
246 result = i18n(
"Internal Error\nPlease send a full bug report at http://bugs.trinitydesktop.org\n%1" ).arg( errorText );
248 case TDEIO::ERR_MALFORMED_URL:
249 result = i18n(
"Malformed URL %1." ).arg( errorText );
251 case TDEIO::ERR_UNSUPPORTED_PROTOCOL:
252 result = i18n(
"The protocol %1 is not supported." ).arg( errorText );
254 case TDEIO::ERR_NO_SOURCE_PROTOCOL:
255 result = i18n(
"The protocol %1 is only a filter protocol.").arg( errorText );
257 case TDEIO::ERR_UNSUPPORTED_ACTION:
261 case TDEIO::ERR_IS_DIRECTORY:
262 result = i18n(
"%1 is a folder, but a file was expected." ).arg( errorText );
264 case TDEIO::ERR_IS_FILE:
265 result = i18n(
"%1 is a file, but a folder was expected." ).arg( errorText );
267 case TDEIO::ERR_DOES_NOT_EXIST:
268 result = i18n(
"The file or folder %1 does not exist." ).arg( errorText );
270 case TDEIO::ERR_FILE_ALREADY_EXIST:
271 result = i18n(
"A file named %1 already exists." ).arg( errorText );
273 case TDEIO::ERR_DIR_ALREADY_EXIST:
274 result = i18n(
"A folder named %1 already exists." ).arg( errorText );
276 case TDEIO::ERR_UNKNOWN_HOST:
277 result = errorText.isEmpty() ? i18n(
"No hostname specified." ) : i18n(
"Unknown host %1" ).arg( errorText );
279 case TDEIO::ERR_ACCESS_DENIED:
280 result = i18n(
"Access denied to %1." ).arg( errorText );
282 case TDEIO::ERR_WRITE_ACCESS_DENIED:
283 result = i18n(
"Access denied.\nCould not write to %1." ).arg( errorText );
285 case TDEIO::ERR_CANNOT_ENTER_DIRECTORY:
286 result = i18n(
"Could not enter folder %1." ).arg( errorText );
288 case TDEIO::ERR_PROTOCOL_IS_NOT_A_FILESYSTEM:
289 result = i18n(
"The protocol %1 does not implement a folder service." ).arg( errorText );
291 case TDEIO::ERR_CYCLIC_LINK:
292 result = i18n(
"Found a cyclic link in %1." ).arg( errorText );
294 case TDEIO::ERR_USER_CANCELED:
297 case TDEIO::ERR_CYCLIC_COPY:
298 result = i18n(
"Found a cyclic link while copying %1." ).arg( errorText );
300 case TDEIO::ERR_COULD_NOT_CREATE_SOCKET:
301 result = i18n(
"Could not create socket for accessing %1." ).arg( errorText );
303 case TDEIO::ERR_COULD_NOT_CONNECT:
304 result = i18n(
"Could not connect to host %1." ).arg( errorText.isEmpty() ? TQString::fromLatin1(
"localhost") :
errorText );
306 case TDEIO::ERR_CONNECTION_BROKEN:
307 result = i18n(
"Connection to host %1 is broken." ).arg( errorText );
309 case TDEIO::ERR_NOT_FILTER_PROTOCOL:
310 result = i18n(
"The protocol %1 is not a filter protocol." ).arg( errorText );
312 case TDEIO::ERR_COULD_NOT_MOUNT:
313 result = i18n(
"Could not mount device.\nThe reported error was:\n%1" ).arg( errorText );
315 case TDEIO::ERR_COULD_NOT_UNMOUNT:
316 result = i18n(
"Could not unmount device.\nThe reported error was:\n%1" ).arg( errorText );
318 case TDEIO::ERR_COULD_NOT_READ:
319 result = i18n(
"Could not read file %1." ).arg( errorText );
321 case TDEIO::ERR_COULD_NOT_WRITE:
322 result = i18n(
"Could not write to file %1." ).arg( errorText );
324 case TDEIO::ERR_COULD_NOT_BIND:
325 result = i18n(
"Could not bind %1." ).arg( errorText );
327 case TDEIO::ERR_COULD_NOT_LISTEN:
328 result = i18n(
"Could not listen %1." ).arg( errorText );
330 case TDEIO::ERR_COULD_NOT_ACCEPT:
331 result = i18n(
"Could not accept %1." ).arg( errorText );
333 case TDEIO::ERR_COULD_NOT_LOGIN:
336 case TDEIO::ERR_COULD_NOT_STAT:
337 result = i18n(
"Could not access %1." ).arg( errorText );
339 case TDEIO::ERR_COULD_NOT_CLOSEDIR:
340 result = i18n(
"Could not terminate listing %1." ).arg( errorText );
342 case TDEIO::ERR_COULD_NOT_MKDIR:
343 result = i18n(
"Could not make folder %1." ).arg( errorText );
345 case TDEIO::ERR_COULD_NOT_RMDIR:
346 result = i18n(
"Could not remove folder %1." ).arg( errorText );
348 case TDEIO::ERR_CANNOT_RESUME:
349 result = i18n(
"Could not resume file %1." ).arg( errorText );
351 case TDEIO::ERR_CANNOT_RENAME:
352 result = i18n(
"Could not rename file %1." ).arg( errorText );
354 case TDEIO::ERR_CANNOT_CHMOD:
355 result = i18n(
"Could not change permissions for %1." ).arg( errorText );
357 case TDEIO::ERR_CANNOT_DELETE:
358 result = i18n(
"Could not delete file %1." ).arg( errorText );
360 case TDEIO::ERR_SLAVE_DIED:
361 result = i18n(
"The process for the %1 protocol died unexpectedly." ).arg( errorText );
363 case TDEIO::ERR_OUT_OF_MEMORY:
364 result = i18n(
"Error. Out of memory.\n%1" ).arg( errorText );
366 case TDEIO::ERR_UNKNOWN_PROXY_HOST:
367 result = i18n(
"Unknown proxy host\n%1" ).arg( errorText );
369 case TDEIO::ERR_COULD_NOT_AUTHENTICATE:
370 result = i18n(
"Authorization failed, %1 authentication not supported" ).arg( errorText );
372 case TDEIO::ERR_ABORTED:
373 result = i18n(
"User canceled action\n%1" ).arg( errorText );
375 case TDEIO::ERR_INTERNAL_SERVER:
376 result = i18n(
"Internal error in server\n%1" ).arg( errorText );
378 case TDEIO::ERR_SERVER_TIMEOUT:
379 result = i18n(
"Timeout on server\n%1" ).arg( errorText );
381 case TDEIO::ERR_UNKNOWN:
382 result = i18n(
"Unknown error\n%1" ).arg( errorText );
384 case TDEIO::ERR_UNKNOWN_INTERRUPT:
385 result = i18n(
"Unknown interrupt\n%1" ).arg( errorText );
395 case TDEIO::ERR_CANNOT_DELETE_ORIGINAL:
396 result = i18n(
"Could not delete original file %1.\nPlease check permissions." ).arg( errorText );
398 case TDEIO::ERR_CANNOT_DELETE_PARTIAL:
399 result = i18n(
"Could not delete partial file %1.\nPlease check permissions." ).arg( errorText );
401 case TDEIO::ERR_CANNOT_RENAME_ORIGINAL:
402 result = i18n(
"Could not rename original file %1.\nPlease check permissions." ).arg( errorText );
404 case TDEIO::ERR_CANNOT_RENAME_PARTIAL:
405 result = i18n(
"Could not rename partial file %1.\nPlease check permissions." ).arg( errorText );
407 case TDEIO::ERR_CANNOT_SYMLINK:
408 result = i18n(
"Could not create symlink %1.\nPlease check permissions." ).arg( errorText );
410 case TDEIO::ERR_NO_CONTENT:
413 case TDEIO::ERR_DISK_FULL:
414 result = i18n(
"Could not write file %1.\nDisk full." ).arg( errorText );
416 case TDEIO::ERR_IDENTICAL_FILES:
417 result = i18n(
"The source and destination are the same file.\n%1" ).arg( errorText );
419 case TDEIO::ERR_SLAVE_DEFINED:
422 case TDEIO::ERR_UPGRADE_REQUIRED:
423 result = i18n(
"%1 is required by the server, but is not available." ).arg(errorText);
425 case TDEIO::ERR_POST_DENIED:
426 result = i18n(
"Access to restricted port in POST denied.");
428 case TDEIO::ERR_OFFLINE_MODE:
429 result = i18n(
"Could not access %1.\nOffline mode active.").arg( errorText );
432 result = i18n(
"Unknown error code %1\n%2\nPlease send a full bug report at http://bugs.trinitydesktop.org." ).arg( errorCode ).arg( errorText );
442 return i18n(
"Opening connections is not supported with the protocol %1." ).arg(protocol);
444 return i18n(
"Closing connections is not supported with the protocol %1." ).arg(protocol);
446 return i18n(
"Accessing files is not supported with the protocol %1.").arg(protocol);
448 return i18n(
"Writing to %1 is not supported.").arg(protocol);
450 return i18n(
"There are no special actions available for protocol %1.").arg(protocol);
452 return i18n(
"Listing folders is not supported for protocol %1.").arg(protocol);
454 return i18n(
"Retrieving data from %1 is not supported.").arg(protocol);
456 return i18n(
"Retrieving mime type information from %1 is not supported.").arg(protocol);
458 return i18n(
"Renaming or moving files within %1 is not supported.").arg(protocol);
460 return i18n(
"Creating symlinks is not supported with protocol %1.").arg(protocol);
462 return i18n(
"Copying files within %1 is not supported.").arg(protocol);
464 return i18n(
"Deleting files from %1 is not supported.").arg(protocol);
466 return i18n(
"Creating folders is not supported with protocol %1.").arg(protocol);
468 return i18n(
"Changing the attributes of files is not supported with protocol %1.").arg(protocol);
470 return i18n(
"Using sub-URLs with %1 is not supported.").arg(protocol);
472 return i18n(
"Multiple get is not supported with protocol %1.").arg(protocol);
474 return i18n(
"Protocol %1 does not support action %2.").arg(protocol).arg(cmd);
481 TQString errorName, techName, description, ret2;
482 TQStringList causes, solutions, ret;
484 TQByteArray raw =
rawErrorDetail( m_error, m_errorText, reqUrl, method );
485 TQDataStream stream(raw, IO_ReadOnly);
487 stream >> errorName >> techName >> description >> causes >> solutions;
489 TQString url, protocol, datetime;
491 url = reqUrl->htmlURL();
492 protocol = reqUrl->protocol();
494 url = i18n(
"(unknown)" );
497 datetime = TDEGlobal::locale()->formatDateTime( TQDateTime::currentDateTime(),
501 ret << TQString::fromLatin1(
"<qt><p><b>" ) + errorName +
502 TQString::fromLatin1(
"</b></p><p>" ) + description +
503 TQString::fromLatin1(
"</p>" );
504 ret2 = TQString::fromLatin1(
"<qt><p>" );
505 if ( !techName.isEmpty() )
506 ret2 += i18n(
"<b>Technical reason</b>: " ) + techName + TQString::fromLatin1(
"</p>" );
507 ret2 += i18n(
"</p><p><b>Details of the request</b>:" );
508 ret2 += i18n(
"</p><ul><li>URL: %1</li>" ).arg( url );
509 if ( !protocol.isEmpty() ) {
510 ret2 += i18n(
"<li>Protocol: %1</li>" ).arg( protocol );
512 ret2 += i18n(
"<li>Date and time: %1</li>" ).arg( datetime );
513 ret2 += i18n(
"<li>Additional information: %1</li></ul>" ).arg( m_errorText );
514 if ( !causes.isEmpty() ) {
515 ret2 += i18n(
"<p><b>Possible causes</b>:</p><ul><li>" );
516 ret2 += causes.join(
"</li><li>" );
517 ret2 += TQString::fromLatin1(
"</li></ul>" );
519 if ( !solutions.isEmpty() ) {
520 ret2 += i18n(
"<p><b>Possible solutions</b>:</p><ul><li>" );
521 ret2 += solutions.join(
"</li><li>" );
522 ret2 += TQString::fromLatin1(
"</li></ul>" );
529 const KURL *reqUrl ,
int )
531 TQString url, host, protocol, datetime, domain, path, dir, filename;
532 bool isSlaveNetwork =
false;
534 url = reqUrl->prettyURL();
535 host = reqUrl->host();
536 protocol = reqUrl->protocol();
538 if ( host.left(4) ==
"www." )
539 domain = host.mid(4);
543 path = reqUrl->path(1);
544 filename = reqUrl->fileName();
545 dir = path + filename;
549 if ( protocol ==
"http" ||
550 protocol ==
"https" ||
552 protocol ==
"sftp" ||
553 protocol ==
"webdav" ||
554 protocol ==
"webdavs" ||
555 protocol ==
"finger" ||
556 protocol ==
"fish" ||
557 protocol ==
"gopher" ||
558 protocol ==
"imap" ||
559 protocol ==
"imaps" ||
561 protocol ==
"ldap" ||
562 protocol ==
"mailto" ||
563 protocol ==
"news" ||
564 protocol ==
"nntp" ||
565 protocol ==
"pop3" ||
566 protocol ==
"pop3s" ||
567 protocol ==
"smtp" ||
568 protocol ==
"smtps" ||
571 isSlaveNetwork =
false;
575 url = host = domain = path = filename = dir =
errorText;
576 protocol = i18n(
"(unknown)" );
579 datetime = TDEGlobal::locale()->formatDateTime( TQDateTime::currentDateTime(),
582 TQString errorName, techName, description;
583 TQStringList causes, solutions;
586 TQString sSysadmin = i18n(
"Contact your appropriate computer support system, " 587 "whether the system administrator, or technical support group for further " 589 TQString sServeradmin = i18n(
"Contact the administrator of the server " 590 "for further assistance." );
592 TQString sAccess = i18n(
"Check your access permissions on this resource." );
593 TQString cAccess = i18n(
"Your access permissions may be inadequate to " 594 "perform the requested operation on this resource." );
595 TQString cLocked = i18n(
"The file may be in use (and thus locked) by " 596 "another user or application." );
597 TQString sQuerylock = i18n(
"Check to make sure that no other " 598 "application or user is using the file or has locked the file." );
599 TQString cHardware = i18n(
"Although unlikely, a hardware error may have " 601 TQString cBug = i18n(
"You may have encountered a bug in the program." );
602 TQString cBuglikely = i18n(
"This is most likely to be caused by a bug in the " 603 "program. Please consider submitting a full bug report as detailed below." );
604 TQString sUpdate = i18n(
"Update your software to the latest version. " 605 "Your distribution should provide tools to update your software." );
606 TQString sBugreport = i18n(
"When all else fails, please consider helping the " 607 "TDE team or the third party maintainer of this software by submitting a " 608 "high quality bug report. If the software is provided by a third party, " 609 "please contact them directly. Otherwise, first look to see if " 610 "the same bug has been submitted by someone else by searching at the " 611 "<a href=\"http://bugs.trinitydesktop.org/\">TDE bug reporting website</a>. If not, take " 612 "note of the details given above, and include them in your bug report, along " 613 "with as many other details as you think might help." );
614 TQString cNetwork = i18n(
"There may have been a problem with your network " 617 TQString cNetconf = i18n(
"There may have been a problem with your network " 618 "configuration. If you have been accessing the Internet with no problems " 619 "recently, this is unlikely." );
620 TQString cNetpath = i18n(
"There may have been a problem at some point along " 621 "the network path between the server and this computer." );
622 TQString sTryagain = i18n(
"Try again, either now or at a later time." );
623 TQString cProtocol = i18n(
"A protocol error or incompatibility may have occurred." );
624 TQString sExists = i18n(
"Ensure that the resource exists, and try again." );
625 TQString cExists = i18n(
"The specified resource may not exist." );
626 TQString cTypo = i18n(
"You may have incorrectly typed the location." );
627 TQString sTypo = i18n(
"Double-check that you have entered the correct location " 629 TQString sNetwork = i18n(
"Check your network connection status." );
631 switch( errorCode ) {
632 case TDEIO::ERR_CANNOT_OPEN_FOR_READING:
633 errorName = i18n(
"Cannot Open Resource For Reading" );
634 description = i18n(
"This means that the contents of the requested file " 635 "or folder <strong>%1</strong> could not be retrieved, as read " 636 "access could not be obtained." ).arg( dir );
637 causes << i18n(
"You may not have permissions to read the file or open " 638 "the folder.") << cLocked << cHardware;
639 solutions << sAccess << sQuerylock << sSysadmin;
642 case TDEIO::ERR_CANNOT_OPEN_FOR_WRITING:
643 errorName = i18n(
"Cannot Open Resource For Writing" );
644 description = i18n(
"This means that the file, <strong>%1</strong>, could " 645 "not be written to as requested, because access with permission to " 646 "write could not be obtained." ).arg( filename );
647 causes << cAccess << cLocked << cHardware;
648 solutions << sAccess << sQuerylock << sSysadmin;
651 case TDEIO::ERR_CANNOT_LAUNCH_PROCESS:
652 errorName = i18n(
"Cannot Initiate the %1 Protocol" ).arg( protocol );
653 techName = i18n(
"Unable to Launch Process" );
654 description = i18n(
"The program on your computer which provides access " 655 "to the <strong>%1</strong> protocol could not be started. This is " 656 "usually due to technical reasons." ).arg( protocol );
657 causes << i18n(
"The program which provides compatibility with this " 658 "protocol may not have been updated with your last update of TDE. " 659 "This can cause the program to be incompatible with the current version " 660 "and thus not start." ) << cBug;
661 solutions << sUpdate << sSysadmin;
664 case TDEIO::ERR_INTERNAL:
665 errorName = i18n(
"Internal Error" );
666 description = i18n(
"The program on your computer which provides access " 667 "to the <strong>%1</strong> protocol has reported an internal error." )
669 causes << cBuglikely;
670 solutions << sUpdate << sBugreport;
673 case TDEIO::ERR_MALFORMED_URL:
674 errorName = i18n(
"Improperly Formatted URL" );
675 description = i18n(
"The <strong>U</strong>niform <strong>R</strong>esource " 676 "<strong>L</strong>ocator (URL) that you entered was not properly " 677 "formatted. The format of a URL is generally as follows:" 678 "<blockquote><strong>protocol://user:password@www.example.org:port/folder/" 679 "filename.extension?query=value</strong></blockquote>" );
683 case TDEIO::ERR_UNSUPPORTED_PROTOCOL:
684 errorName = i18n(
"Unsupported Protocol %1" ).arg( protocol );
685 description = i18n(
"The protocol <strong>%1</strong> is not supported " 686 "by the TDE programs currently installed on this computer." )
688 causes << i18n(
"The requested protocol may not be supported." )
689 << i18n(
"The versions of the %1 protocol supported by this computer and " 690 "the server may be incompatible." ).arg( protocol );
691 solutions << i18n(
"You may perform a search on the Internet for a TDE " 692 "program (called a tdeioslave or ioslave) which supports this protocol. " 693 "Places to search include <a href=\"http://kde-apps.org/\">" 694 "http://kde-apps.org/</a> and <a href=\"http://freshmeat.net/\">" 695 "http://freshmeat.net/</a>." )
696 << sUpdate << sSysadmin;
699 case TDEIO::ERR_NO_SOURCE_PROTOCOL:
700 errorName = i18n(
"URL Does Not Refer to a Resource." );
701 techName = i18n(
"Protocol is a Filter Protocol" );
702 description = i18n(
"The <strong>U</strong>niform <strong>R</strong>esource " 703 "<strong>L</strong>ocator (URL) that you entered did not refer to a " 704 "specific resource." );
705 causes << i18n(
"TDE is able to communicate through a protocol within a " 706 "protocol; the protocol specified is only for use in such situations, " 707 "however this is not one of these situations. This is a rare event, and " 708 "is likely to indicate a programming error." );
712 case TDEIO::ERR_UNSUPPORTED_ACTION:
713 errorName = i18n(
"Unsupported Action: %1" ).arg( errorText );
714 description = i18n(
"The requested action is not supported by the TDE " 715 "program which is implementing the <strong>%1</strong> protocol." )
717 causes << i18n(
"This error is very much dependent on the TDE program. The " 718 "additional information should give you more information than is available " 719 "to the TDE input/output architecture." );
720 solutions << i18n(
"Attempt to find another way to accomplish the same " 724 case TDEIO::ERR_IS_DIRECTORY:
725 errorName = i18n(
"File Expected" );
726 description = i18n(
"The request expected a file, however the " 727 "folder <strong>%1</strong> was found instead." ).arg( dir );
728 causes << i18n(
"This may be an error on the server side." ) << cBug;
729 solutions << sUpdate << sSysadmin;
732 case TDEIO::ERR_IS_FILE:
733 errorName = i18n(
"Folder Expected" );
734 description = i18n(
"The request expected a folder, however " 735 "the file <strong>%1</strong> was found instead." ).arg( filename );
737 solutions << sUpdate << sSysadmin;
740 case TDEIO::ERR_DOES_NOT_EXIST:
741 errorName = i18n(
"File or Folder Does Not Exist" );
742 description = i18n(
"The specified file or folder <strong>%1</strong> " 743 "does not exist." ).arg( dir );
745 solutions << sUpdate << sSysadmin;
748 case TDEIO::ERR_FILE_ALREADY_EXIST:
749 errorName = i18n(
"File Already Exists" );
750 description = i18n(
"The requested file could not be created because a " 751 "file with the same name already exists." );
752 solutions << i18n (
"Try moving the current file out of the way first, " 753 "and then try again." )
754 << i18n (
"Delete the current file and try again." )
755 << i18n(
"Choose an alternate filename for the new file." );
758 case TDEIO::ERR_DIR_ALREADY_EXIST:
759 errorName = i18n(
"Folder Already Exists" );
760 description = i18n(
"The requested folder could not be created because " 761 "a folder with the same name already exists." );
762 solutions << i18n(
"Try moving the current folder out of the way first, " 763 "and then try again." )
764 << i18n(
"Delete the current folder and try again." )
765 << i18n(
"Choose an alternate name for the new folder." );
768 case TDEIO::ERR_UNKNOWN_HOST:
769 errorName = i18n(
"Unknown Host" );
770 description = i18n(
"An unknown host error indicates that the server with " 771 "the requested name, <strong>%1</strong>, could not be " 772 "located on the Internet." ).arg( host );
773 causes << i18n(
"The name that you typed, %1, may not exist: it may be " 774 "incorrectly typed." ).arg( host )
775 << cNetwork << cNetconf;
776 solutions << sNetwork << sSysadmin;
779 case TDEIO::ERR_ACCESS_DENIED:
780 errorName = i18n(
"Access Denied" );
781 description = i18n(
"Access was denied to the specified resource, " 782 "<strong>%1</strong>." ).arg( url );
783 causes << i18n(
"You may have supplied incorrect authentication details or " 785 << i18n(
"Your account may not have permission to access the " 786 "specified resource." );
787 solutions << i18n(
"Retry the request and ensure your authentication details " 788 "are entered correctly." ) << sSysadmin;
789 if ( !isSlaveNetwork ) solutions << sServeradmin;
792 case TDEIO::ERR_WRITE_ACCESS_DENIED:
793 errorName = i18n(
"Write Access Denied" );
794 description = i18n(
"This means that an attempt to write to the file " 795 "<strong>%1</strong> was rejected." ).arg( filename );
796 causes << cAccess << cLocked << cHardware;
797 solutions << sAccess << sQuerylock << sSysadmin;
800 case TDEIO::ERR_CANNOT_ENTER_DIRECTORY:
801 errorName = i18n(
"Unable to Enter Folder" );
802 description = i18n(
"This means that an attempt to enter (in other words, " 803 "to open) the requested folder <strong>%1</strong> was rejected." )
805 causes << cAccess << cLocked;
806 solutions << sAccess << sQuerylock << sSysadmin;
809 case TDEIO::ERR_PROTOCOL_IS_NOT_A_FILESYSTEM:
810 errorName = i18n(
"Folder Listing Unavailable" );
811 techName = i18n(
"Protocol %1 is not a Filesystem" ).arg( protocol );
812 description = i18n(
"This means that a request was made which requires " 813 "determining the contents of the folder, and the TDE program supporting " 814 "this protocol is unable to do so." );
816 solutions << sUpdate << sBugreport;
819 case TDEIO::ERR_CYCLIC_LINK:
820 errorName = i18n(
"Cyclic Link Detected" );
821 description = i18n(
"UNIX environments are commonly able to link a file or " 822 "folder to a separate name and/or location. TDE detected a link or " 823 "series of links that results in an infinite loop - i.e. the file was " 824 "(perhaps in a roundabout way) linked to itself." );
825 solutions << i18n(
"Delete one part of the loop in order that it does not " 826 "cause an infinite loop, and try again." ) << sSysadmin;
829 case TDEIO::ERR_USER_CANCELED:
834 errorName = i18n(
"Request Aborted By User" );
835 description = i18n(
"The request was not completed because it was " 837 solutions << i18n(
"Retry the request." );
840 case TDEIO::ERR_CYCLIC_COPY:
841 errorName = i18n(
"Cyclic Link Detected During Copy" );
842 description = i18n(
"UNIX environments are commonly able to link a file or " 843 "folder to a separate name and/or location. During the requested copy " 844 "operation, TDE detected a link or series of links that results in an " 845 "infinite loop - i.e. the file was (perhaps in a roundabout way) linked " 847 solutions << i18n(
"Delete one part of the loop in order that it does not " 848 "cause an infinite loop, and try again." ) << sSysadmin;
851 case TDEIO::ERR_COULD_NOT_CREATE_SOCKET:
852 errorName = i18n(
"Could Not Create Network Connection" );
853 techName = i18n(
"Could Not Create Socket" );
854 description = i18n(
"This is a fairly technical error in which a required " 855 "device for network communications (a socket) could not be created." );
856 causes << i18n(
"The network connection may be incorrectly configured, or " 857 "the network interface may not be enabled." );
858 solutions << sNetwork << sSysadmin;
861 case TDEIO::ERR_COULD_NOT_CONNECT:
862 errorName = i18n(
"Connection to Server Refused" );
863 description = i18n(
"The server <strong>%1</strong> refused to allow this " 864 "computer to make a connection." ).arg( host );
865 causes << i18n(
"The server, while currently connected to the Internet, " 866 "may not be configured to allow requests." )
867 << i18n(
"The server, while currently connected to the Internet, " 868 "may not be running the requested service (%1)." ).arg( protocol )
869 << i18n(
"A network firewall (a device which restricts Internet " 870 "requests), either protecting your network or the network of the server, " 871 "may have intervened, preventing this request." );
872 solutions << sTryagain << sServeradmin << sSysadmin;
875 case TDEIO::ERR_CONNECTION_BROKEN:
876 errorName = i18n(
"Connection to Server Closed Unexpectedly" );
877 description = i18n(
"Although a connection was established to " 878 "<strong>%1</strong>, the connection was closed at an unexpected point " 879 "in the communication." ).arg( host );
880 causes << cNetwork << cNetpath << i18n(
"A protocol error may have occurred, " 881 "causing the server to close the connection as a response to the error." );
882 solutions << sTryagain << sServeradmin << sSysadmin;
885 case TDEIO::ERR_NOT_FILTER_PROTOCOL:
886 errorName = i18n(
"URL Resource Invalid" );
887 techName = i18n(
"Protocol %1 is not a Filter Protocol" ).arg( protocol );
888 description = i18n(
"The <strong>U</strong>niform <strong>R</strong>esource " 889 "<strong>L</strong>ocator (URL) that you entered did not refer to " 890 "a valid mechanism of accessing the specific resource, " 891 "<strong>%1%2</strong>." )
892 .arg( !host.isNull() ? host +
'/' : TQString::null ).arg( dir );
893 causes << i18n(
"TDE is able to communicate through a protocol within a " 894 "protocol. This request specified a protocol be used as such, however " 895 "this protocol is not capable of such an action. This is a rare event, " 896 "and is likely to indicate a programming error." );
897 solutions << sTypo << sSysadmin;
900 case TDEIO::ERR_COULD_NOT_MOUNT:
901 errorName = i18n(
"Unable to Initialize Input/Output Device" );
902 techName = i18n(
"Could Not Mount Device" );
903 description = i18n(
"The requested device could not be initialized " 904 "(\"mounted\"). The reported error was: <strong>%1</strong>" )
906 causes << i18n(
"The device may not be ready, for example there may be " 907 "no media in a removable media device (i.e. no CD-ROM in a CD drive), " 908 "or in the case of a peripheral/portable device, the device may not " 909 "be correctly connected." )
910 << i18n(
"You may not have permissions to initialize (\"mount\") the " 911 "device. On UNIX systems, often system administrator privileges are " 912 "required to initialize a device." )
914 solutions << i18n(
"Check that the device is ready; removable drives " 915 "must contain media, and portable devices must be connected and powered " 916 "on.; and try again." ) << sAccess << sSysadmin;
919 case TDEIO::ERR_COULD_NOT_UNMOUNT:
920 errorName = i18n(
"Unable to Uninitialize Input/Output Device" );
921 techName = i18n(
"Could Not Unmount Device" );
922 description = i18n(
"The requested device could not be uninitialized " 923 "(\"unmounted\"). The reported error was: <strong>%1</strong>" )
925 causes << i18n(
"The device may be busy, that is, still in use by " 926 "another application or user. Even such things as having an open " 927 "browser window on a location on this device may cause the device to " 929 << i18n(
"You may not have permissions to uninitialize (\"unmount\") " 930 "the device. On UNIX systems, system administrator privileges are " 931 "often required to uninitialize a device." )
933 solutions << i18n(
"Check that no applications are accessing the device, " 934 "and try again." ) << sAccess << sSysadmin;
937 case TDEIO::ERR_COULD_NOT_READ:
938 errorName = i18n(
"Cannot Read From Resource" );
939 description = i18n(
"This means that although the resource, " 940 "<strong>%1</strong>, was able to be opened, an error occurred while " 941 "reading the contents of the resource." ).arg( url );
942 causes << i18n(
"You may not have permissions to read from the resource." );
943 if ( !isSlaveNetwork ) causes << cNetwork;
945 solutions << sAccess;
946 if ( !isSlaveNetwork ) solutions << sNetwork;
947 solutions << sSysadmin;
950 case TDEIO::ERR_COULD_NOT_WRITE:
951 errorName = i18n(
"Cannot Write to Resource" );
952 description = i18n(
"This means that although the resource, <strong>%1</strong>" 953 ", was able to be opened, an error occurred while writing to the resource." )
955 causes << i18n(
"You may not have permissions to write to the resource." );
956 if ( !isSlaveNetwork ) causes << cNetwork;
958 solutions << sAccess;
959 if ( !isSlaveNetwork ) solutions << sNetwork;
960 solutions << sSysadmin;
963 case TDEIO::ERR_COULD_NOT_BIND:
964 errorName = i18n(
"Could Not Listen for Network Connections" );
965 techName = i18n(
"Could Not Bind" );
966 description = i18n(
"This is a fairly technical error in which a required " 967 "device for network communications (a socket) could not be established " 968 "to listen for incoming network connections." );
969 causes << i18n(
"The network connection may be incorrectly configured, or " 970 "the network interface may not be enabled." );
971 solutions << sNetwork << sSysadmin;
974 case TDEIO::ERR_COULD_NOT_LISTEN:
975 errorName = i18n(
"Could Not Listen for Network Connections" );
976 techName = i18n(
"Could Not Listen" );
977 description = i18n(
"This is a fairly technical error in which a required " 978 "device for network communications (a socket) could not be established " 979 "to listen for incoming network connections." );
980 causes << i18n(
"The network connection may be incorrectly configured, or " 981 "the network interface may not be enabled." );
982 solutions << sNetwork << sSysadmin;
985 case TDEIO::ERR_COULD_NOT_ACCEPT:
986 errorName = i18n(
"Could Not Accept Network Connection" );
987 description = i18n(
"This is a fairly technical error in which an error " 988 "occurred while attempting to accept an incoming network connection." );
989 causes << i18n(
"The network connection may be incorrectly configured, or " 990 "the network interface may not be enabled." )
991 << i18n(
"You may not have permissions to accept the connection." );
992 solutions << sNetwork << sSysadmin;
995 case TDEIO::ERR_COULD_NOT_LOGIN:
996 errorName = i18n(
"Could Not Login: %1" ).arg( errorText );
997 description = i18n(
"An attempt to login to perform the requested " 998 "operation was unsuccessful." );
999 causes << i18n(
"You may have supplied incorrect authentication details or " 1001 << i18n(
"Your account may not have permission to access the " 1002 "specified resource." ) << cProtocol;
1003 solutions << i18n(
"Retry the request and ensure your authentication details " 1004 "are entered correctly." ) << sServeradmin << sSysadmin;
1007 case TDEIO::ERR_COULD_NOT_STAT:
1008 errorName = i18n(
"Could Not Determine Resource Status" );
1009 techName = i18n(
"Could Not Stat Resource" );
1010 description = i18n(
"An attempt to determine information about the status " 1011 "of the resource <strong>%1</strong>, such as the resource name, type, " 1012 "size, etc., was unsuccessful." ).arg( url );
1013 causes << i18n(
"The specified resource may not have existed or may " 1014 "not be accessible." ) << cProtocol << cHardware;
1015 solutions << i18n(
"Retry the request and ensure your authentication details " 1016 "are entered correctly." ) << sSysadmin;
1019 case TDEIO::ERR_COULD_NOT_CLOSEDIR:
1021 errorName = i18n(
"Could Not Cancel Listing" );
1022 techName = i18n(
"FIXME: Document this" );
1025 case TDEIO::ERR_COULD_NOT_MKDIR:
1026 errorName = i18n(
"Could Not Create Folder" );
1027 description = i18n(
"An attempt to create the requested folder failed." );
1028 causes << cAccess << i18n(
"The location where the folder was to be created " 1030 if ( !isSlaveNetwork ) causes << cProtocol;
1031 solutions << i18n(
"Retry the request." ) << sAccess;
1034 case TDEIO::ERR_COULD_NOT_RMDIR:
1035 errorName = i18n(
"Could Not Remove Folder" );
1036 description = i18n(
"An attempt to remove the specified folder, " 1037 "<strong>%1</strong>, failed." ).arg( dir );
1038 causes << i18n(
"The specified folder may not exist." )
1039 << i18n(
"The specified folder may not be empty." )
1041 if ( !isSlaveNetwork ) causes << cProtocol;
1042 solutions << i18n(
"Ensure that the folder exists and is empty, and try " 1043 "again." ) << sAccess;
1046 case TDEIO::ERR_CANNOT_RESUME:
1047 errorName = i18n(
"Could Not Resume File Transfer" );
1048 description = i18n(
"The specified request asked that the transfer of " 1049 "file <strong>%1</strong> be resumed at a certain point of the " 1050 "transfer. This was not possible." ).arg( filename );
1051 causes << i18n(
"The protocol, or the server, may not support file " 1053 solutions << i18n(
"Retry the request without attempting to resume " 1057 case TDEIO::ERR_CANNOT_RENAME:
1058 errorName = i18n(
"Could Not Rename Resource" );
1059 description = i18n(
"An attempt to rename the specified resource " 1060 "<strong>%1</strong> failed." ).arg( url );
1061 causes << cAccess << cExists;
1062 if ( !isSlaveNetwork ) causes << cProtocol;
1063 solutions << sAccess << sExists;
1066 case TDEIO::ERR_CANNOT_CHMOD:
1067 errorName = i18n(
"Could Not Alter Permissions of Resource" );
1068 description = i18n(
"An attempt to alter the permissions on the specified " 1069 "resource <strong>%1</strong> failed." ).arg( url );
1070 causes << cAccess << cExists;
1071 solutions << sAccess << sExists;
1074 case TDEIO::ERR_CANNOT_DELETE:
1075 errorName = i18n(
"Could Not Delete Resource" );
1076 description = i18n(
"An attempt to delete the specified resource " 1077 "<strong>%1</strong> failed." ).arg( url );
1078 causes << cAccess << cExists;
1079 solutions << sAccess << sExists;
1082 case TDEIO::ERR_SLAVE_DIED:
1083 errorName = i18n(
"Unexpected Program Termination" );
1084 description = i18n(
"The program on your computer which provides access " 1085 "to the <strong>%1</strong> protocol has unexpectedly terminated." )
1087 causes << cBuglikely;
1088 solutions << sUpdate << sBugreport;
1091 case TDEIO::ERR_OUT_OF_MEMORY:
1092 errorName = i18n(
"Out of Memory" );
1093 description = i18n(
"The program on your computer which provides access " 1094 "to the <strong>%1</strong> protocol could not obtain the memory " 1095 "required to continue." ).arg( protocol );
1096 causes << cBuglikely;
1097 solutions << sUpdate << sBugreport;
1100 case TDEIO::ERR_UNKNOWN_PROXY_HOST:
1101 errorName = i18n(
"Unknown Proxy Host" );
1102 description = i18n(
"While retrieving information about the specified " 1103 "proxy host, <strong>%1</strong>, an Unknown Host error was encountered. " 1104 "An unknown host error indicates that the requested name could not be " 1105 "located on the Internet." ).arg( errorText );
1106 causes << i18n(
"There may have been a problem with your network " 1107 "configuration, specifically your proxy's hostname. If you have been " 1108 "accessing the Internet with no problems recently, this is unlikely." )
1110 solutions << i18n(
"Double-check your proxy settings and try again." )
1114 case TDEIO::ERR_COULD_NOT_AUTHENTICATE:
1115 errorName = i18n(
"Authentication Failed: Method %1 Not Supported" )
1117 description = i18n(
"Although you may have supplied the correct " 1118 "authentication details, the authentication failed because the " 1119 "method that the server is using is not supported by the TDE " 1120 "program implementing the protocol %1." ).arg( protocol );
1121 solutions << i18n(
"Please file a bug at <a href=\"http://bugs.trinitydesktop.org/\">" 1122 "http://bugs.trinitydesktop.org/</a> to inform the TDE team of the unsupported " 1123 "authentication method." ) << sSysadmin;
1126 case TDEIO::ERR_ABORTED:
1127 errorName = i18n(
"Request Aborted" );
1128 description = i18n(
"The request was not completed because it was " 1130 solutions << i18n(
"Retry the request." );
1133 case TDEIO::ERR_INTERNAL_SERVER:
1134 errorName = i18n(
"Internal Error in Server" );
1135 description = i18n(
"The program on the server which provides access " 1136 "to the <strong>%1</strong> protocol has reported an internal error: " 1137 "%0." ).arg( protocol );
1138 causes << i18n(
"This is most likely to be caused by a bug in the " 1139 "server program. Please consider submitting a full bug report as " 1140 "detailed below." );
1141 solutions << i18n(
"Contact the administrator of the server " 1142 "to advise them of the problem." )
1143 << i18n(
"If you know who the authors of the server software are, " 1144 "submit the bug report directly to them." );
1147 case TDEIO::ERR_SERVER_TIMEOUT:
1148 errorName = i18n(
"Timeout Error" );
1149 description = i18n(
"Although contact was made with the server, a " 1150 "response was not received within the amount of time allocated for " 1151 "the request as follows:<ul>" 1152 "<li>Timeout for establishing a connection: %1 seconds</li>" 1153 "<li>Timeout for receiving a response: %2 seconds</li>" 1154 "<li>Timeout for accessing proxy servers: %3 seconds</li></ul>" 1155 "Please note that you can alter these timeout settings in the TDE " 1156 "Control Center, by selecting Network -> Preferences." )
1160 causes << cNetpath << i18n(
"The server was too busy responding to other " 1161 "requests to respond." );
1162 solutions << sTryagain << sServeradmin;
1165 case TDEIO::ERR_UNKNOWN:
1166 errorName = i18n(
"Unknown Error" );
1167 description = i18n(
"The program on your computer which provides access " 1168 "to the <strong>%1</strong> protocol has reported an unknown error: " 1169 "%2." ).arg( protocol ).arg( errorText );
1171 solutions << sUpdate << sBugreport;
1174 case TDEIO::ERR_UNKNOWN_INTERRUPT:
1175 errorName = i18n(
"Unknown Interruption" );
1176 description = i18n(
"The program on your computer which provides access " 1177 "to the <strong>%1</strong> protocol has reported an interruption of " 1178 "an unknown type: %2." ).arg( protocol ).arg( errorText );
1180 solutions << sUpdate << sBugreport;
1183 case TDEIO::ERR_CANNOT_DELETE_ORIGINAL:
1184 errorName = i18n(
"Could Not Delete Original File" );
1185 description = i18n(
"The requested operation required the deleting of " 1186 "the original file, most likely at the end of a file move operation. " 1187 "The original file <strong>%1</strong> could not be deleted." )
1190 solutions << sAccess;
1193 case TDEIO::ERR_CANNOT_DELETE_PARTIAL:
1194 errorName = i18n(
"Could Not Delete Temporary File" );
1195 description = i18n(
"The requested operation required the creation of " 1196 "a temporary file in which to save the new file while being " 1197 "downloaded. This temporary file <strong>%1</strong> could not be " 1198 "deleted." ).arg( errorText );
1200 solutions << sAccess;
1203 case TDEIO::ERR_CANNOT_RENAME_ORIGINAL:
1204 errorName = i18n(
"Could Not Rename Original File" );
1205 description = i18n(
"The requested operation required the renaming of " 1206 "the original file <strong>%1</strong>, however it could not be " 1207 "renamed." ).arg( errorText );
1209 solutions << sAccess;
1212 case TDEIO::ERR_CANNOT_RENAME_PARTIAL:
1213 errorName = i18n(
"Could Not Rename Temporary File" );
1214 description = i18n(
"The requested operation required the creation of " 1215 "a temporary file <strong>%1</strong>, however it could not be " 1216 "created." ).arg( errorText );
1218 solutions << sAccess;
1221 case TDEIO::ERR_CANNOT_SYMLINK:
1222 errorName = i18n(
"Could Not Create Link" );
1223 techName = i18n(
"Could Not Create Symbolic Link" );
1224 description = i18n(
"The requested symbolic link %1 could not be created." )
1227 solutions << sAccess;
1230 case TDEIO::ERR_NO_CONTENT:
1231 errorName = i18n(
"No Content" );
1235 case TDEIO::ERR_DISK_FULL:
1236 errorName = i18n(
"Disk Full" );
1237 description = i18n(
"The requested file <strong>%1</strong> could not be " 1238 "written to as there is inadequate disk space." ).arg( errorText );
1239 solutions << i18n(
"Free up enough disk space by 1) deleting unwanted and " 1240 "temporary files; 2) archiving files to removable media storage such as " 1241 "CD-Recordable discs; or 3) obtain more storage capacity." )
1245 case TDEIO::ERR_IDENTICAL_FILES:
1246 errorName = i18n(
"Source and Destination Files Identical" );
1247 description = i18n(
"The operation could not be completed because the " 1248 "source and destination files are the same file." );
1249 solutions << i18n(
"Choose a different filename for the destination file." );
1253 case TDEIO::ERR_SLAVE_DEFINED:
1254 errorName = TQString::null;
1260 errorName = i18n(
"Undocumented Error" );
1265 TQDataStream stream(ret, IO_WriteOnly);
1266 stream << errorName << techName << description << causes << solutions;
1282 #ifdef HAVE_SYS_STAT_H 1283 #include <sys/stat.h> 1285 #include <sys/param.h> 1286 #ifdef HAVE_LIMITS_H 1289 #ifdef HAVE_SYS_MNTTAB_H 1290 #include <sys/mnttab.h> 1292 #ifdef HAVE_MNTENT_H 1294 #elif defined(HAVE_SYS_MNTENT_H) 1295 #include <sys/mntent.h> 1297 #ifdef HAVE_SYS_UCRED_H 1298 #include <sys/ucred.h> 1300 #ifdef HAVE_SYS_MOUNT_H 1301 #include <sys/mount.h> 1307 #include <sys/mntctl.h> 1308 #include <sys/vmount.h> 1309 #include <sys/vfs.h> 1314 int mntctl(
int command,
int size,
void* buffer);
1317 extern "C" struct vfs_ent *getvfsbytype(
int vfsType);
1318 extern "C" void endvfsent( );
1327 #ifndef HAVE_GETMNTINFO 1329 #ifdef _PATH_MOUNTED 1332 # define MNTTAB _PATH_MOUNTED 1336 # define MNTTAB MTAB_FILE 1338 # define MNTTAB "/etc/mnttab" 1345 # define FSTAB _PATH_FSTAB 1347 # define FSTAB "/etc/fstab" 1352 #define hasmntopt(var,opt) (0) 1362 #ifdef HAVE_SETMNTENT 1363 #define SETMNTENT setmntent 1364 #define ENDMNTENT endmntent 1365 #define STRUCT_MNTENT struct mntent * 1366 #define STRUCT_SETMNTENT FILE * 1367 #define GETMNTENT(file, var) ((var = getmntent(file)) != 0) 1368 #define MOUNTPOINT(var) var->mnt_dir 1369 #define MOUNTTYPE(var) var->mnt_type 1370 #define HASMNTOPT(var, opt) hasmntopt(var, opt) 1371 #define FSNAME(var) var->mnt_fsname 1375 #define SETMNTENT fopen 1376 #define ENDMNTENT fclose 1377 #define STRUCT_MNTENT struct mnttab 1378 #define STRUCT_SETMNTENT FILE * 1379 #define GETMNTENT(file, var) (getmntent(file, &var) == 0) 1380 #define MOUNTPOINT(var) var.mnt_mountp 1381 #define MOUNTTYPE(var) var.mnt_fstype 1382 #define HASMNTOPT(var, opt) hasmntopt(&var, opt) 1383 #define FSNAME(var) var.mnt_special 1396 const char *volpath;
1402 if( (volpath = volmgt_root()) == NULL ) {
1403 kdDebug( 7007 ) <<
"findDeviceMountPoint: " 1404 <<
"VOLMGT: can't find volmgt root dir" << endl;
1405 return TQString::null;
1408 if( (mnttab = fopen( MNTTAB,
"r" )) == NULL ) {
1409 kdDebug( 7007 ) <<
"findDeviceMountPoint: " 1410 <<
"VOLMGT: can't open mnttab" << endl;
1411 return TQString::null;
1415 devname += TQFile::encodeName( filename );
1417 len = devname.length();
1430 result = TQString::null;
1431 while( getmntent( mnttab, &mnt ) == 0 ) {
1436 if( strncmp( devname.data(), mnt.mnt_special, len ) == 0
1437 || (strncmp( devname.data(), mnt.mnt_special, len - 3 ) == 0
1438 && mnt.mnt_special[len - 3] ==
'/' )
1439 || (strcmp(TQFile::encodeName(filename).data()
1440 , mnt.mnt_special)==0)) {
1441 result = mnt.mnt_mountp;
1448 char realpath_buffer[MAXPATHLEN];
1451 realname = TQFile::encodeName(filename);
1453 if (realpath(realname, realpath_buffer) != 0)
1455 realname = realpath_buffer;
1459 #ifdef HAVE_GETMNTINFO 1461 #ifdef GETMNTINFO_USES_STATVFS 1462 struct statvfs *mounted;
1464 struct statfs *mounted;
1467 int num_fs = getmntinfo(&mounted, MNT_NOWAIT);
1469 for (
int i=0;i<num_fs;i++) {
1471 TQCString device_name = mounted[i].f_mntfromname;
1475 if (realpath(device_name, realpath_buffer) != 0)
1477 device_name = realpath_buffer;
1479 if (realname == device_name) {
1480 result = mounted[i].f_mntonname;
1487 struct vmount *mntctl_buffer;
1491 int fsname_len, num;
1504 mntctl_buffer = (
struct vmount*)malloc(buf_sz);
1505 num = mntctl(MCTL_QUERY, buf_sz, mntctl_buffer);
1508 buf_sz = *(
int*)mntctl_buffer;
1509 free(mntctl_buffer);
1510 mntctl_buffer = (
struct vmount*)malloc(buf_sz);
1511 num = mntctl(MCTL_QUERY, buf_sz, mntctl_buffer);
1518 for ( ; num > 0; num-- )
1521 fsname_len = vmt2datasize(vm, VMT_STUB);
1522 mountedto = (
char*)malloc(fsname_len + 1);
1523 mountedto[fsname_len] =
'\0';
1524 strncpy(mountedto, (
char *)vmt2dataptr(vm, VMT_STUB), fsname_len);
1527 fsname_len = vmt2datasize(vm, VMT_OBJECT);
1528 mountedfrom = (
char*)malloc(fsname_len + 1);
1529 mountedfrom[fsname_len] =
'\0';
1530 strncpy(mountedfrom, (
char *)vmt2dataptr(vm, VMT_OBJECT), fsname_len);
1532 TQCString device_name = mountedfrom;
1534 if (realpath(device_name, realpath_buffer) != 0)
1536 device_name = realpath_buffer;
1540 if (realname == device_name) {
1549 vm = (
struct vmount *)((
char *)vm + vm->vmt_length);
1553 free( mntctl_buffer );
1557 STRUCT_SETMNTENT mtab;
1561 if ((mtab = SETMNTENT(MNTTAB,
"r")) == 0) {
1562 perror(
"setmntent");
1563 return TQString::null;
1578 while (GETMNTENT(mtab, me))
1582 TQCString device_name = FSNAME(me);
1583 if (device_name.isEmpty() || (device_name ==
"none"))
1590 if (realpath(device_name, realpath_buffer) != 0)
1592 device_name = realpath_buffer;
1596 if (realname == device_name)
1598 result = MOUNTPOINT(me);
1613 static bool is_my_mountpoint(
const char *mountpoint,
const char *realname,
int &max )
1615 int length = strlen(mountpoint);
1617 if (!strncmp(mountpoint, realname, length)
1620 if (length == 1 || realname[length] ==
'/' || realname[length] ==
'\0')
1626 typedef enum { Unseen, Right, Wrong } MountState;
1631 static void check_mount_point(
const char *mounttype,
1633 MountState &isslow, MountState &isautofs)
1635 bool nfs = !strcmp(mounttype,
"nfs");
1636 bool autofs = !strcmp(mounttype,
"autofs") || !strcmp(mounttype,
"subfs");
1637 bool pid = (strstr(fsname,
":(pid") != 0);
1641 else if (isslow == Right)
1645 if (autofs || (nfs && pid)) {
1653 static TQString get_mount_info(
const TQString& filename,
1654 MountState& isautofs, MountState& isslow, MountState& ismanual,
1657 static bool gotRoot =
false;
1658 static dev_t rootDevice;
1660 struct cachedDevice_t
1663 TQString mountPoint;
1664 MountState isautofs;
1666 MountState ismanual;
1669 static struct cachedDevice_t *cachedDevice = 0;
1673 KDE_struct_stat stat_buf;
1674 KDE_stat(
"/", &stat_buf);
1676 rootDevice = stat_buf.st_dev;
1679 bool gotDevice =
false;
1680 KDE_struct_stat stat_buf;
1681 if (KDE_stat(TQFile::encodeName(filename), &stat_buf) == 0)
1684 if (stat_buf.st_dev == rootDevice)
1686 static const TQString &root = TDEGlobal::staticQString(
"/");
1690 fstype = TQString::null;
1693 if (cachedDevice && (stat_buf.st_dev == cachedDevice->device))
1695 bool interestedInIsManual = ismanual != Wrong;
1696 isautofs = cachedDevice->isautofs;
1697 isslow = cachedDevice->isslow;
1698 ismanual = cachedDevice->ismanual;
1699 fstype = cachedDevice->fstype;
1701 if ( !interestedInIsManual || ismanual != Unseen )
1702 return cachedDevice->mountPoint;
1706 char realname[MAXPATHLEN];
1708 memset(realname, 0, MAXPATHLEN);
1711 if (realpath(TQFile::encodeName(filename), realname) == 0) {
1712 if( strlcpy(realname, TQFile::encodeName(filename), MAXPATHLEN)>=MAXPATHLEN)
1713 return TQString::null;
1717 TQString mountPoint;
1729 #ifdef HAVE_GETMNTINFO 1731 #ifdef GETMNTINFO_USES_STATVFS 1732 struct statvfs *mounted;
1734 struct statfs *mounted;
1737 char realpath_buffer[MAXPATHLEN];
1739 int num_fs = getmntinfo(&mounted, MNT_NOWAIT);
1741 for (
int i=0;i<num_fs;i++) {
1743 TQCString device_name = mounted[i].f_mntfromname;
1747 if (realpath(device_name, realpath_buffer) != 0)
1749 device_name = realpath_buffer;
1751 char * mounttype = mnt_names[mounted[i].f_type];
1753 char * mounttype = mounted[i].f_fstypename;
1755 if ( is_my_mountpoint( mounted[i].f_mntonname, realname, max ) )
1757 mountPoint = TQFile::decodeName(mounted[i].f_mntonname);
1758 fstype = TQString::fromLatin1(mounttype);
1759 check_mount_point( mounttype, mounted[i].f_mntfromname,
1763 if (ismanual == Unseen)
1765 struct fstab *ft = getfsfile(mounted[i].f_mntonname);
1766 if (!ft || strstr(ft->fs_mntops,
"noauto"))
1774 struct vmount *mntctl_buffer;
1778 int fsname_len, num;
1779 char realpath_buffer[MAXPATHLEN];
1782 mntctl_buffer = (
struct vmount*)malloc(buf_sz);
1783 num = mntctl(MCTL_QUERY, buf_sz, mntctl_buffer);
1786 buf_sz = *(
int*)mntctl_buffer;
1787 free(mntctl_buffer);
1788 mntctl_buffer = (
struct vmount*)malloc(buf_sz);
1789 num = mntctl(MCTL_QUERY, buf_sz, mntctl_buffer);
1795 vm = (
struct vmount *)mntctl_buffer;
1796 for ( ; num > 0; num-- )
1799 fsname_len = vmt2datasize(vm, VMT_STUB);
1800 mountedto = (
char*)malloc(fsname_len + 1);
1801 mountedto[fsname_len] =
'\0';
1802 strncpy(mountedto, (
char *)vmt2dataptr(vm, VMT_STUB), fsname_len);
1804 fsname_len = vmt2datasize(vm, VMT_OBJECT);
1805 mountedfrom = (
char*)malloc(fsname_len + 1);
1806 mountedfrom[fsname_len] =
'\0';
1807 strncpy(mountedfrom, (
char *)vmt2dataptr(vm, VMT_OBJECT), fsname_len);
1810 TQCString device_name = mountedfrom;
1812 if (realpath(device_name, realpath_buffer) != 0)
1814 device_name = realpath_buffer;
1820 struct vfs_ent* ent = getvfsbytype(vm->vmt_gfstype);
1822 if ( is_my_mountpoint( mountedto, realname, max ) )
1824 mountPoint = TQFile::decodeName(mountedto);
1825 fstype = TQString::fromLatin1(ent->vfsent_name);
1826 check_mount_point(ent->vfsent_name, device_name, isautofs, isslow);
1828 if (ismanual == Unseen)
1840 vm = (
struct vmount *)((
char *)vm + vm->vmt_length);
1846 free( mntctl_buffer );
1850 STRUCT_SETMNTENT mtab;
1853 if ((mtab = SETMNTENT(MNTTAB,
"r")) == 0) {
1854 perror(
"setmntent");
1855 return TQString::null;
1861 if (!GETMNTENT(mtab, me))
1864 if ( is_my_mountpoint( MOUNTPOINT(me), realname, max ) )
1866 mountPoint = TQFile::decodeName( MOUNTPOINT(me) );
1867 fstype = MOUNTTYPE(me);
1868 check_mount_point(MOUNTTYPE(me), FSNAME(me), isautofs, isslow);
1871 if (ismanual == Unseen)
1875 TQCString fsname_me = FSNAME(me);
1876 TQCString mounttype_me = MOUNTTYPE(me);
1878 STRUCT_SETMNTENT fstab;
1879 if ((fstab = SETMNTENT(FSTAB,
"r")) == 0) {
1885 while (GETMNTENT(fstab, fe))
1887 if (fsname_me == FSNAME(fe))
1890 if (HASMNTOPT(fe,
"noauto") ||
1891 !strcmp(MOUNTTYPE(fe),
"supermount"))
1896 if (!found || (mounttype_me ==
"supermount"))
1908 if (isautofs == Right && isslow == Unseen)
1914 cachedDevice =
new cachedDevice_t;
1916 cachedDevice->device = stat_buf.st_dev;
1917 cachedDevice->mountPoint = mountPoint;
1918 cachedDevice->isautofs = isautofs;
1919 cachedDevice->isslow = isslow;
1920 cachedDevice->ismanual = ismanual;
1921 cachedDevice->fstype = fstype;
1931 return TQString::null;
1938 MountState isautofs = Unseen, isslow = Unseen, ismanual = Wrong;
1940 return get_mount_info(filename, isautofs, isslow, ismanual, fstype);
1942 return TQString::null; 1949 MountState isautofs = Unseen, isslow = Unseen, ismanual = Unseen;
1951 TQString mountPoint = get_mount_info(filename, isautofs, isslow, ismanual, fstype);
1952 return !mountPoint.isNull() && (ismanual == Right);
1961 MountState isautofs = Unseen, isslow = Unseen, ismanual = Wrong;
1963 TQString mountPoint = get_mount_info(filename, isautofs, isslow, ismanual, fstype);
1964 return !mountPoint.isNull() && (isslow == Right);
1973 MountState isautofs = Unseen, isslow = Unseen, ismanual = Wrong;
1975 TQString mountPoint = get_mount_info(filename, isautofs, isslow, ismanual, fstype);
1976 kdDebug() <<
"testFileSystemFlag: fstype=" << fstype << endl;
1977 if (mountPoint.isNull())
1979 bool isMsDos = ( fstype ==
"msdos" || fstype ==
"fat" || fstype ==
"vfat" );
1984 case SupportsSymlinks:
1986 case CaseInsensitive:
1995 TQString tmp = cacheControl.lower();
1997 if (tmp ==
"cacheonly")
2001 if (tmp ==
"verify")
2003 if (tmp ==
"refresh")
2005 if (tmp ==
"reload")
2008 kdDebug() <<
"unrecognized Cache control option:"<<cacheControl<<endl;
2024 kdDebug() <<
"unrecognized Cache control enum value:"<<cacheControl<<endl;
2025 return TQString::null;
TDEIO_EXPORT TQString convertSize(TDEIO::filesize_t size)
Converts size from bytes to the string representation.
TDEIO_EXPORT unsigned int calculateRemainingSeconds(TDEIO::filesize_t totalSize, TDEIO::filesize_t processedSize, TDEIO::filesize_t speed)
Calculates remaining time in seconds from total size, processed size and speed.
CacheControl
Specifies how to use the cache.
TQ_ULLONG filesize_t
64-bit file size
TQStringList 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 ...
TDEIO_EXPORT TQString convertSizeWithBytes(TDEIO::filesize_t size)
Converts size from bytes to a string representation with includes the size in bytes.
TDEIO_EXPORT TQByteArray rawErrorDetail(int errorCode, const TQString &errorText, const KURL *reqUrl=0L, int method=-1)
Returns translated error details for errorCode using the additional error information provided by err...
TDEIO_EXPORT TQString encodeFileName(const TQString &str)
Encodes (from the text displayed to the real filename) This translates % into %% and / into ∕ (U+221...
TDEIO_EXPORT TQString getCacheControlString(TDEIO::CacheControl cacheControl)
Returns a string representation of the given cache control method.
TQString errorString() const
Converts an error code and a non-i18n error message into an error message in the current language...
TDEIO_EXPORT TQString decodeFileName(const TQString &str)
Decodes (from the filename to the text displayed) This translates %2[fF] into /, %% into %...
const TQString & errorText() const
Returns the error text if there has been an error.
static int responseTimeout()
Returns the preferred response timeout value for remote connecting in seconds.
Validate cached entry with remote site if expired.
TDEIO_EXPORT TQTime calculateRemaining(TDEIO::filesize_t totalSize, TDEIO::filesize_t processedSize, TDEIO::filesize_t speed) KDE_DEPRECATED
Calculates remaining time from total size, processed size and speed.
Always validate cached entry with remote site.
TDEIO_EXPORT bool testFileSystemFlag(const TQString &filename, FileSystemFlag flag)
Checks the capabilities of the filesystem to which a given file belongs.
TDEIO_EXPORT TQString number(TDEIO::filesize_t size)
Converts a size to a string representation Not unlike TQString::number(...)
Always fetch from remote site.
static int connectTimeout()
Returns the preferred timeout value for remote connections in seconds.
TDEIO_EXPORT TQString findPathMountPoint(const TQString &filename)
Returns the mount point on which resides filename.
Fail request if not in cache.
Use cached entry if available.
TDEIO_EXPORT TDEIO::CacheControl parseCacheControl(const TQString &cacheControl)
Parses the string representation of the cache control option.
TDEIO_EXPORT TQString unsupportedActionErrorString(const TQString &protocol, int cmd)
Returns an appropriate error message if the given command cmd is an unsupported action (ERR_UNSUPPORT...
void result(TDEIO::Job *job)
Emitted when the job is finished, in any case (completed, canceled, failed...).
TDEIO_EXPORT bool manually_mounted(const TQString &filename)
Checks if the path belongs to a filesystem that is manually mounted.
TDEIO_EXPORT TQString itemsSummaryString(uint items, uint files, uint dirs, TDEIO::filesize_t size, bool showSize)
Helper for showing information about a set of files and directories.
TDEIO_EXPORT TQString convertSeconds(unsigned int seconds)
Convert seconds to a string representing number of days, hours, minutes and seconds.
TDEIO_EXPORT bool probably_slow_mounted(const TQString &filename)
Checks if the path belongs to a filesystem that is probably slow.
static int proxyConnectTimeout()
Returns the preferred timeout value for proxy connections in seconds.
TDEIO_EXPORT TQString findDeviceMountPoint(const TQString &device)
Returns the mount point where device is mounted right now.
TDEIO_EXPORT TQString buildErrorString(int errorCode, const TQString &errorText)
Returns a translated error message for errorCode using the additional error information provided by e...
TDEIO_EXPORT TQString convertSizeFromKB(TDEIO::filesize_t kbSize)
Converts size from kilo-bytes to the string representation.