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 Trinity website for a TDE " 692 "program (called a tdeioslave, ioslave or tdeio) which supports this protocol. " 693 "Places to search include <a href=\"https://mirror.git.trinitydesktop.org/cgit/\">" 694 "https://mirror.git.trinitydesktop.org/cgit/</a> or the repos for your distribution." )
695 << sUpdate << sSysadmin;
698 case TDEIO::ERR_NO_SOURCE_PROTOCOL:
699 errorName = i18n(
"URL Does Not Refer to a Resource." );
700 techName = i18n(
"Protocol is a Filter Protocol" );
701 description = i18n(
"The <strong>U</strong>niform <strong>R</strong>esource " 702 "<strong>L</strong>ocator (URL) that you entered did not refer to a " 703 "specific resource." );
704 causes << i18n(
"TDE is able to communicate through a protocol within a " 705 "protocol; the protocol specified is only for use in such situations, " 706 "however this is not one of these situations. This is a rare event, and " 707 "is likely to indicate a programming error." );
711 case TDEIO::ERR_UNSUPPORTED_ACTION:
712 errorName = i18n(
"Unsupported Action: %1" ).arg( errorText );
713 description = i18n(
"The requested action is not supported by the TDE " 714 "program which is implementing the <strong>%1</strong> protocol." )
716 causes << i18n(
"This error is very much dependent on the TDE program. The " 717 "additional information should give you more information than is available " 718 "to the TDE input/output architecture." );
719 solutions << i18n(
"Attempt to find another way to accomplish the same " 723 case TDEIO::ERR_IS_DIRECTORY:
724 errorName = i18n(
"File Expected" );
725 description = i18n(
"The request expected a file, however the " 726 "folder <strong>%1</strong> was found instead." ).arg( dir );
727 causes << i18n(
"This may be an error on the server side." ) << cBug;
728 solutions << sUpdate << sSysadmin;
731 case TDEIO::ERR_IS_FILE:
732 errorName = i18n(
"Folder Expected" );
733 description = i18n(
"The request expected a folder, however " 734 "the file <strong>%1</strong> was found instead." ).arg( filename );
736 solutions << sUpdate << sSysadmin;
739 case TDEIO::ERR_DOES_NOT_EXIST:
740 errorName = i18n(
"File or Folder Does Not Exist" );
741 description = i18n(
"The specified file or folder <strong>%1</strong> " 742 "does not exist." ).arg( dir );
744 solutions << sUpdate << sSysadmin;
747 case TDEIO::ERR_FILE_ALREADY_EXIST:
748 errorName = i18n(
"File Already Exists" );
749 description = i18n(
"The requested file could not be created because a " 750 "file with the same name already exists." );
751 solutions << i18n (
"Try moving the current file out of the way first, " 752 "and then try again." )
753 << i18n (
"Delete the current file and try again." )
754 << i18n(
"Choose an alternate filename for the new file." );
757 case TDEIO::ERR_DIR_ALREADY_EXIST:
758 errorName = i18n(
"Folder Already Exists" );
759 description = i18n(
"The requested folder could not be created because " 760 "a folder with the same name already exists." );
761 solutions << i18n(
"Try moving the current folder out of the way first, " 762 "and then try again." )
763 << i18n(
"Delete the current folder and try again." )
764 << i18n(
"Choose an alternate name for the new folder." );
767 case TDEIO::ERR_UNKNOWN_HOST:
768 errorName = i18n(
"Unknown Host" );
769 description = i18n(
"An unknown host error indicates that the server with " 770 "the requested name, <strong>%1</strong>, could not be " 771 "located on the Internet." ).arg( host );
772 causes << i18n(
"The name that you typed, %1, may not exist: it may be " 773 "incorrectly typed." ).arg( host )
774 << cNetwork << cNetconf;
775 solutions << sNetwork << sSysadmin;
778 case TDEIO::ERR_ACCESS_DENIED:
779 errorName = i18n(
"Access Denied" );
780 description = i18n(
"Access was denied to the specified resource, " 781 "<strong>%1</strong>." ).arg( url );
782 causes << i18n(
"You may have supplied incorrect authentication details or " 784 << i18n(
"Your account may not have permission to access the " 785 "specified resource." );
786 solutions << i18n(
"Retry the request and ensure your authentication details " 787 "are entered correctly." ) << sSysadmin;
788 if ( !isSlaveNetwork ) solutions << sServeradmin;
791 case TDEIO::ERR_WRITE_ACCESS_DENIED:
792 errorName = i18n(
"Write Access Denied" );
793 description = i18n(
"This means that an attempt to write to the file " 794 "<strong>%1</strong> was rejected." ).arg( filename );
795 causes << cAccess << cLocked << cHardware;
796 solutions << sAccess << sQuerylock << sSysadmin;
799 case TDEIO::ERR_CANNOT_ENTER_DIRECTORY:
800 errorName = i18n(
"Unable to Enter Folder" );
801 description = i18n(
"This means that an attempt to enter (in other words, " 802 "to open) the requested folder <strong>%1</strong> was rejected." )
804 causes << cAccess << cLocked;
805 solutions << sAccess << sQuerylock << sSysadmin;
808 case TDEIO::ERR_PROTOCOL_IS_NOT_A_FILESYSTEM:
809 errorName = i18n(
"Folder Listing Unavailable" );
810 techName = i18n(
"Protocol %1 is not a Filesystem" ).arg( protocol );
811 description = i18n(
"This means that a request was made which requires " 812 "determining the contents of the folder, and the TDE program supporting " 813 "this protocol is unable to do so." );
815 solutions << sUpdate << sBugreport;
818 case TDEIO::ERR_CYCLIC_LINK:
819 errorName = i18n(
"Cyclic Link Detected" );
820 description = i18n(
"UNIX environments are commonly able to link a file or " 821 "folder to a separate name and/or location. TDE detected a link or " 822 "series of links that results in an infinite loop - i.e. the file was " 823 "(perhaps in a roundabout way) linked to itself." );
824 solutions << i18n(
"Delete one part of the loop in order that it does not " 825 "cause an infinite loop, and try again." ) << sSysadmin;
828 case TDEIO::ERR_USER_CANCELED:
833 errorName = i18n(
"Request Aborted By User" );
834 description = i18n(
"The request was not completed because it was " 836 solutions << i18n(
"Retry the request." );
839 case TDEIO::ERR_CYCLIC_COPY:
840 errorName = i18n(
"Cyclic Link Detected During Copy" );
841 description = i18n(
"UNIX environments are commonly able to link a file or " 842 "folder to a separate name and/or location. During the requested copy " 843 "operation, TDE detected a link or series of links that results in an " 844 "infinite loop - i.e. the file was (perhaps in a roundabout way) linked " 846 solutions << i18n(
"Delete one part of the loop in order that it does not " 847 "cause an infinite loop, and try again." ) << sSysadmin;
850 case TDEIO::ERR_COULD_NOT_CREATE_SOCKET:
851 errorName = i18n(
"Could Not Create Network Connection" );
852 techName = i18n(
"Could Not Create Socket" );
853 description = i18n(
"This is a fairly technical error in which a required " 854 "device for network communications (a socket) could not be created." );
855 causes << i18n(
"The network connection may be incorrectly configured, or " 856 "the network interface may not be enabled." );
857 solutions << sNetwork << sSysadmin;
860 case TDEIO::ERR_COULD_NOT_CONNECT:
861 errorName = i18n(
"Connection to Server Refused" );
862 description = i18n(
"The server <strong>%1</strong> refused to allow this " 863 "computer to make a connection." ).arg( host );
864 causes << i18n(
"The server, while currently connected to the Internet, " 865 "may not be configured to allow requests." )
866 << i18n(
"The server, while currently connected to the Internet, " 867 "may not be running the requested service (%1)." ).arg( protocol )
868 << i18n(
"A network firewall (a device which restricts Internet " 869 "requests), either protecting your network or the network of the server, " 870 "may have intervened, preventing this request." );
871 solutions << sTryagain << sServeradmin << sSysadmin;
874 case TDEIO::ERR_CONNECTION_BROKEN:
875 errorName = i18n(
"Connection to Server Closed Unexpectedly" );
876 description = i18n(
"Although a connection was established to " 877 "<strong>%1</strong>, the connection was closed at an unexpected point " 878 "in the communication." ).arg( host );
879 causes << cNetwork << cNetpath << i18n(
"A protocol error may have occurred, " 880 "causing the server to close the connection as a response to the error." );
881 solutions << sTryagain << sServeradmin << sSysadmin;
884 case TDEIO::ERR_NOT_FILTER_PROTOCOL:
885 errorName = i18n(
"URL Resource Invalid" );
886 techName = i18n(
"Protocol %1 is not a Filter Protocol" ).arg( protocol );
887 description = i18n(
"The <strong>U</strong>niform <strong>R</strong>esource " 888 "<strong>L</strong>ocator (URL) that you entered did not refer to " 889 "a valid mechanism of accessing the specific resource, " 890 "<strong>%1%2</strong>." )
891 .arg( !host.isNull() ? host +
'/' : TQString::null ).arg( dir );
892 causes << i18n(
"TDE is able to communicate through a protocol within a " 893 "protocol. This request specified a protocol be used as such, however " 894 "this protocol is not capable of such an action. This is a rare event, " 895 "and is likely to indicate a programming error." );
896 solutions << sTypo << sSysadmin;
899 case TDEIO::ERR_COULD_NOT_MOUNT:
900 errorName = i18n(
"Unable to Initialize Input/Output Device" );
901 techName = i18n(
"Could Not Mount Device" );
902 description = i18n(
"The requested device could not be initialized " 903 "(\"mounted\"). The reported error was: <strong>%1</strong>" )
905 causes << i18n(
"The device may not be ready, for example there may be " 906 "no media in a removable media device (i.e. no CD-ROM in a CD drive), " 907 "or in the case of a peripheral/portable device, the device may not " 908 "be correctly connected." )
909 << i18n(
"You may not have permissions to initialize (\"mount\") the " 910 "device. On UNIX systems, often system administrator privileges are " 911 "required to initialize a device." )
913 solutions << i18n(
"Check that the device is ready; removable drives " 914 "must contain media, and portable devices must be connected and powered " 915 "on.; and try again." ) << sAccess << sSysadmin;
918 case TDEIO::ERR_COULD_NOT_UNMOUNT:
919 errorName = i18n(
"Unable to Uninitialize Input/Output Device" );
920 techName = i18n(
"Could Not Unmount Device" );
921 description = i18n(
"The requested device could not be uninitialized " 922 "(\"unmounted\"). The reported error was: <strong>%1</strong>" )
924 causes << i18n(
"The device may be busy, that is, still in use by " 925 "another application or user. Even such things as having an open " 926 "browser window on a location on this device may cause the device to " 928 << i18n(
"You may not have permissions to uninitialize (\"unmount\") " 929 "the device. On UNIX systems, system administrator privileges are " 930 "often required to uninitialize a device." )
932 solutions << i18n(
"Check that no applications are accessing the device, " 933 "and try again." ) << sAccess << sSysadmin;
936 case TDEIO::ERR_COULD_NOT_READ:
937 errorName = i18n(
"Cannot Read From Resource" );
938 description = i18n(
"This means that although the resource, " 939 "<strong>%1</strong>, was able to be opened, an error occurred while " 940 "reading the contents of the resource." ).arg( url );
941 causes << i18n(
"You may not have permissions to read from the resource." );
942 if ( !isSlaveNetwork ) causes << cNetwork;
944 solutions << sAccess;
945 if ( !isSlaveNetwork ) solutions << sNetwork;
946 solutions << sSysadmin;
949 case TDEIO::ERR_COULD_NOT_WRITE:
950 errorName = i18n(
"Cannot Write to Resource" );
951 description = i18n(
"This means that although the resource, <strong>%1</strong>" 952 ", was able to be opened, an error occurred while writing to the resource." )
954 causes << i18n(
"You may not have permissions to write to the resource." );
955 if ( !isSlaveNetwork ) causes << cNetwork;
957 solutions << sAccess;
958 if ( !isSlaveNetwork ) solutions << sNetwork;
959 solutions << sSysadmin;
962 case TDEIO::ERR_COULD_NOT_BIND:
963 errorName = i18n(
"Could Not Listen for Network Connections" );
964 techName = i18n(
"Could Not Bind" );
965 description = i18n(
"This is a fairly technical error in which a required " 966 "device for network communications (a socket) could not be established " 967 "to listen for incoming network connections." );
968 causes << i18n(
"The network connection may be incorrectly configured, or " 969 "the network interface may not be enabled." );
970 solutions << sNetwork << sSysadmin;
973 case TDEIO::ERR_COULD_NOT_LISTEN:
974 errorName = i18n(
"Could Not Listen for Network Connections" );
975 techName = i18n(
"Could Not Listen" );
976 description = i18n(
"This is a fairly technical error in which a required " 977 "device for network communications (a socket) could not be established " 978 "to listen for incoming network connections." );
979 causes << i18n(
"The network connection may be incorrectly configured, or " 980 "the network interface may not be enabled." );
981 solutions << sNetwork << sSysadmin;
984 case TDEIO::ERR_COULD_NOT_ACCEPT:
985 errorName = i18n(
"Could Not Accept Network Connection" );
986 description = i18n(
"This is a fairly technical error in which an error " 987 "occurred while attempting to accept an incoming network connection." );
988 causes << i18n(
"The network connection may be incorrectly configured, or " 989 "the network interface may not be enabled." )
990 << i18n(
"You may not have permissions to accept the connection." );
991 solutions << sNetwork << sSysadmin;
994 case TDEIO::ERR_COULD_NOT_LOGIN:
995 errorName = i18n(
"Could Not Login: %1" ).arg( errorText );
996 description = i18n(
"An attempt to login to perform the requested " 997 "operation was unsuccessful." );
998 causes << i18n(
"You may have supplied incorrect authentication details or " 1000 << i18n(
"Your account may not have permission to access the " 1001 "specified resource." ) << cProtocol;
1002 solutions << i18n(
"Retry the request and ensure your authentication details " 1003 "are entered correctly." ) << sServeradmin << sSysadmin;
1006 case TDEIO::ERR_COULD_NOT_STAT:
1007 errorName = i18n(
"Could Not Determine Resource Status" );
1008 techName = i18n(
"Could Not Stat Resource" );
1009 description = i18n(
"An attempt to determine information about the status " 1010 "of the resource <strong>%1</strong>, such as the resource name, type, " 1011 "size, etc., was unsuccessful." ).arg( url );
1012 causes << i18n(
"The specified resource may not have existed or may " 1013 "not be accessible." ) << cProtocol << cHardware;
1014 solutions << i18n(
"Retry the request and ensure your authentication details " 1015 "are entered correctly." ) << sSysadmin;
1018 case TDEIO::ERR_COULD_NOT_CLOSEDIR:
1020 errorName = i18n(
"Could Not Cancel Listing" );
1021 techName = i18n(
"FIXME: Document this" );
1024 case TDEIO::ERR_COULD_NOT_MKDIR:
1025 errorName = i18n(
"Could Not Create Folder" );
1026 description = i18n(
"An attempt to create the requested folder failed." );
1027 causes << cAccess << i18n(
"The location where the folder was to be created " 1029 if ( !isSlaveNetwork ) causes << cProtocol;
1030 solutions << i18n(
"Retry the request." ) << sAccess;
1033 case TDEIO::ERR_COULD_NOT_RMDIR:
1034 errorName = i18n(
"Could Not Remove Folder" );
1035 description = i18n(
"An attempt to remove the specified folder, " 1036 "<strong>%1</strong>, failed." ).arg( dir );
1037 causes << i18n(
"The specified folder may not exist." )
1038 << i18n(
"The specified folder may not be empty." )
1040 if ( !isSlaveNetwork ) causes << cProtocol;
1041 solutions << i18n(
"Ensure that the folder exists and is empty, and try " 1042 "again." ) << sAccess;
1045 case TDEIO::ERR_CANNOT_RESUME:
1046 errorName = i18n(
"Could Not Resume File Transfer" );
1047 description = i18n(
"The specified request asked that the transfer of " 1048 "file <strong>%1</strong> be resumed at a certain point of the " 1049 "transfer. This was not possible." ).arg( filename );
1050 causes << i18n(
"The protocol, or the server, may not support file " 1052 solutions << i18n(
"Retry the request without attempting to resume " 1056 case TDEIO::ERR_CANNOT_RENAME:
1057 errorName = i18n(
"Could Not Rename Resource" );
1058 description = i18n(
"An attempt to rename the specified resource " 1059 "<strong>%1</strong> failed." ).arg( url );
1060 causes << cAccess << cExists;
1061 if ( !isSlaveNetwork ) causes << cProtocol;
1062 solutions << sAccess << sExists;
1065 case TDEIO::ERR_CANNOT_CHMOD:
1066 errorName = i18n(
"Could Not Alter Permissions of Resource" );
1067 description = i18n(
"An attempt to alter the permissions on the specified " 1068 "resource <strong>%1</strong> failed." ).arg( url );
1069 causes << cAccess << cExists;
1070 solutions << sAccess << sExists;
1073 case TDEIO::ERR_CANNOT_DELETE:
1074 errorName = i18n(
"Could Not Delete Resource" );
1075 description = i18n(
"An attempt to delete the specified resource " 1076 "<strong>%1</strong> failed." ).arg( url );
1077 causes << cAccess << cExists;
1078 solutions << sAccess << sExists;
1081 case TDEIO::ERR_SLAVE_DIED:
1082 errorName = i18n(
"Unexpected Program Termination" );
1083 description = i18n(
"The program on your computer which provides access " 1084 "to the <strong>%1</strong> protocol has unexpectedly terminated." )
1086 causes << cBuglikely;
1087 solutions << sUpdate << sBugreport;
1090 case TDEIO::ERR_OUT_OF_MEMORY:
1091 errorName = i18n(
"Out of Memory" );
1092 description = i18n(
"The program on your computer which provides access " 1093 "to the <strong>%1</strong> protocol could not obtain the memory " 1094 "required to continue." ).arg( protocol );
1095 causes << cBuglikely;
1096 solutions << sUpdate << sBugreport;
1099 case TDEIO::ERR_UNKNOWN_PROXY_HOST:
1100 errorName = i18n(
"Unknown Proxy Host" );
1101 description = i18n(
"While retrieving information about the specified " 1102 "proxy host, <strong>%1</strong>, an Unknown Host error was encountered. " 1103 "An unknown host error indicates that the requested name could not be " 1104 "located on the Internet." ).arg( errorText );
1105 causes << i18n(
"There may have been a problem with your network " 1106 "configuration, specifically your proxy's hostname. If you have been " 1107 "accessing the Internet with no problems recently, this is unlikely." )
1109 solutions << i18n(
"Double-check your proxy settings and try again." )
1113 case TDEIO::ERR_COULD_NOT_AUTHENTICATE:
1114 errorName = i18n(
"Authentication Failed: Method %1 Not Supported" )
1116 description = i18n(
"Although you may have supplied the correct " 1117 "authentication details, the authentication failed because the " 1118 "method that the server is using is not supported by the TDE " 1119 "program implementing the protocol %1." ).arg( protocol );
1120 solutions << i18n(
"Please file a bug at <a href=\"http://bugs.trinitydesktop.org/\">" 1121 "http://bugs.trinitydesktop.org/</a> to inform the TDE team of the unsupported " 1122 "authentication method." ) << sSysadmin;
1125 case TDEIO::ERR_ABORTED:
1126 errorName = i18n(
"Request Aborted" );
1127 description = i18n(
"The request was not completed because it was " 1129 solutions << i18n(
"Retry the request." );
1132 case TDEIO::ERR_INTERNAL_SERVER:
1133 errorName = i18n(
"Internal Error in Server" );
1134 description = i18n(
"The program on the server which provides access " 1135 "to the <strong>%1</strong> protocol has reported an internal error: " 1136 "%0." ).arg( protocol );
1137 causes << i18n(
"This is most likely to be caused by a bug in the " 1138 "server program. Please consider submitting a full bug report as " 1139 "detailed below." );
1140 solutions << i18n(
"Contact the administrator of the server " 1141 "to advise them of the problem." )
1142 << i18n(
"If you know who the authors of the server software are, " 1143 "submit the bug report directly to them." );
1146 case TDEIO::ERR_SERVER_TIMEOUT:
1147 errorName = i18n(
"Timeout Error" );
1148 description = i18n(
"Although contact was made with the server, a " 1149 "response was not received within the amount of time allocated for " 1150 "the request as follows:<ul>" 1151 "<li>Timeout for establishing a connection: %1 seconds</li>" 1152 "<li>Timeout for receiving a response: %2 seconds</li>" 1153 "<li>Timeout for accessing proxy servers: %3 seconds</li></ul>" 1154 "Please note that you can alter these timeout settings in the TDE " 1155 "Control Center, by selecting Network -> Preferences." )
1159 causes << cNetpath << i18n(
"The server was too busy responding to other " 1160 "requests to respond." );
1161 solutions << sTryagain << sServeradmin;
1164 case TDEIO::ERR_UNKNOWN:
1165 errorName = i18n(
"Unknown Error" );
1166 description = i18n(
"The program on your computer which provides access " 1167 "to the <strong>%1</strong> protocol has reported an unknown error: " 1168 "%2." ).arg( protocol ).arg( errorText );
1170 solutions << sUpdate << sBugreport;
1173 case TDEIO::ERR_UNKNOWN_INTERRUPT:
1174 errorName = i18n(
"Unknown Interruption" );
1175 description = i18n(
"The program on your computer which provides access " 1176 "to the <strong>%1</strong> protocol has reported an interruption of " 1177 "an unknown type: %2." ).arg( protocol ).arg( errorText );
1179 solutions << sUpdate << sBugreport;
1182 case TDEIO::ERR_CANNOT_DELETE_ORIGINAL:
1183 errorName = i18n(
"Could Not Delete Original File" );
1184 description = i18n(
"The requested operation required the deleting of " 1185 "the original file, most likely at the end of a file move operation. " 1186 "The original file <strong>%1</strong> could not be deleted." )
1189 solutions << sAccess;
1192 case TDEIO::ERR_CANNOT_DELETE_PARTIAL:
1193 errorName = i18n(
"Could Not Delete Temporary File" );
1194 description = i18n(
"The requested operation required the creation of " 1195 "a temporary file in which to save the new file while being " 1196 "downloaded. This temporary file <strong>%1</strong> could not be " 1197 "deleted." ).arg( errorText );
1199 solutions << sAccess;
1202 case TDEIO::ERR_CANNOT_RENAME_ORIGINAL:
1203 errorName = i18n(
"Could Not Rename Original File" );
1204 description = i18n(
"The requested operation required the renaming of " 1205 "the original file <strong>%1</strong>, however it could not be " 1206 "renamed." ).arg( errorText );
1208 solutions << sAccess;
1211 case TDEIO::ERR_CANNOT_RENAME_PARTIAL:
1212 errorName = i18n(
"Could Not Rename Temporary File" );
1213 description = i18n(
"The requested operation required the creation of " 1214 "a temporary file <strong>%1</strong>, however it could not be " 1215 "created." ).arg( errorText );
1217 solutions << sAccess;
1220 case TDEIO::ERR_CANNOT_SYMLINK:
1221 errorName = i18n(
"Could Not Create Link" );
1222 techName = i18n(
"Could Not Create Symbolic Link" );
1223 description = i18n(
"The requested symbolic link %1 could not be created." )
1226 solutions << sAccess;
1229 case TDEIO::ERR_NO_CONTENT:
1230 errorName = i18n(
"No Content" );
1234 case TDEIO::ERR_DISK_FULL:
1235 errorName = i18n(
"Disk Full" );
1236 description = i18n(
"The requested file <strong>%1</strong> could not be " 1237 "written to as there is inadequate disk space." ).arg( errorText );
1238 solutions << i18n(
"Free up enough disk space by 1) deleting unwanted and " 1239 "temporary files; 2) archiving files to removable media storage such as " 1240 "CD-Recordable discs; or 3) obtain more storage capacity." )
1244 case TDEIO::ERR_IDENTICAL_FILES:
1245 errorName = i18n(
"Source and Destination Files Identical" );
1246 description = i18n(
"The operation could not be completed because the " 1247 "source and destination files are the same file." );
1248 solutions << i18n(
"Choose a different filename for the destination file." );
1252 case TDEIO::ERR_SLAVE_DEFINED:
1253 errorName = TQString::null;
1259 errorName = i18n(
"Undocumented Error" );
1264 TQDataStream stream(ret, IO_WriteOnly);
1265 stream << errorName << techName << description << causes << solutions;
1281 #ifdef HAVE_SYS_STAT_H 1282 #include <sys/stat.h> 1284 #include <sys/param.h> 1285 #ifdef HAVE_LIMITS_H 1288 #ifdef HAVE_SYS_MNTTAB_H 1289 #include <sys/mnttab.h> 1291 #ifdef HAVE_MNTENT_H 1293 #elif defined(HAVE_SYS_MNTENT_H) 1294 #include <sys/mntent.h> 1296 #ifdef HAVE_SYS_UCRED_H 1297 #include <sys/ucred.h> 1299 #ifdef HAVE_SYS_MOUNT_H 1300 #include <sys/mount.h> 1306 #include <sys/mntctl.h> 1307 #include <sys/vmount.h> 1308 #include <sys/vfs.h> 1313 int mntctl(
int command,
int size,
void* buffer);
1316 extern "C" struct vfs_ent *getvfsbytype(
int vfsType);
1317 extern "C" void endvfsent( );
1326 #ifndef HAVE_GETMNTINFO 1328 #ifdef _PATH_MOUNTED 1331 # define MNTTAB _PATH_MOUNTED 1335 # define MNTTAB MTAB_FILE 1337 # define MNTTAB "/etc/mnttab" 1344 # define FSTAB _PATH_FSTAB 1346 # define FSTAB "/etc/fstab" 1351 #define hasmntopt(var,opt) (0) 1361 #ifdef HAVE_SETMNTENT 1362 #define SETMNTENT setmntent 1363 #define ENDMNTENT endmntent 1364 #define STRUCT_MNTENT struct mntent * 1365 #define STRUCT_SETMNTENT FILE * 1366 #define GETMNTENT(file, var) ((var = getmntent(file)) != 0) 1367 #define MOUNTPOINT(var) var->mnt_dir 1368 #define MOUNTTYPE(var) var->mnt_type 1369 #define HASMNTOPT(var, opt) hasmntopt(var, opt) 1370 #define FSNAME(var) var->mnt_fsname 1374 #define SETMNTENT fopen 1375 #define ENDMNTENT fclose 1376 #define STRUCT_MNTENT struct mnttab 1377 #define STRUCT_SETMNTENT FILE * 1378 #define GETMNTENT(file, var) (getmntent(file, &var) == 0) 1379 #define MOUNTPOINT(var) var.mnt_mountp 1380 #define MOUNTTYPE(var) var.mnt_fstype 1381 #define HASMNTOPT(var, opt) hasmntopt(&var, opt) 1382 #define FSNAME(var) var.mnt_special 1395 const char *volpath;
1401 if( (volpath = volmgt_root()) == NULL ) {
1402 kdDebug( 7007 ) <<
"findDeviceMountPoint: " 1403 <<
"VOLMGT: can't find volmgt root dir" << endl;
1404 return TQString::null;
1407 if( (mnttab = fopen( MNTTAB,
"r" )) == NULL ) {
1408 kdDebug( 7007 ) <<
"findDeviceMountPoint: " 1409 <<
"VOLMGT: can't open mnttab" << endl;
1410 return TQString::null;
1414 devname += TQFile::encodeName( filename );
1416 len = devname.length();
1429 result = TQString::null;
1430 while( getmntent( mnttab, &mnt ) == 0 ) {
1435 if( strncmp( devname.data(), mnt.mnt_special, len ) == 0
1436 || (strncmp( devname.data(), mnt.mnt_special, len - 3 ) == 0
1437 && mnt.mnt_special[len - 3] ==
'/' )
1438 || (strcmp(TQFile::encodeName(filename).data()
1439 , mnt.mnt_special)==0)) {
1440 result = mnt.mnt_mountp;
1447 char realpath_buffer[MAXPATHLEN];
1450 realname = TQFile::encodeName(filename);
1452 if (realpath(realname, realpath_buffer) != 0)
1454 realname = realpath_buffer;
1458 #ifdef HAVE_GETMNTINFO 1460 #ifdef GETMNTINFO_USES_STATVFS 1461 struct statvfs *mounted;
1463 struct statfs *mounted;
1466 int num_fs = getmntinfo(&mounted, MNT_NOWAIT);
1468 for (
int i=0;i<num_fs;i++) {
1470 TQCString device_name = mounted[i].f_mntfromname;
1474 if (realpath(device_name, realpath_buffer) != 0)
1476 device_name = realpath_buffer;
1478 if (realname == device_name) {
1479 result = mounted[i].f_mntonname;
1486 struct vmount *mntctl_buffer;
1490 int fsname_len, num;
1503 mntctl_buffer = (
struct vmount*)malloc(buf_sz);
1504 num = mntctl(MCTL_QUERY, buf_sz, mntctl_buffer);
1507 buf_sz = *(
int*)mntctl_buffer;
1508 free(mntctl_buffer);
1509 mntctl_buffer = (
struct vmount*)malloc(buf_sz);
1510 num = mntctl(MCTL_QUERY, buf_sz, mntctl_buffer);
1517 for ( ; num > 0; num-- )
1520 fsname_len = vmt2datasize(vm, VMT_STUB);
1521 mountedto = (
char*)malloc(fsname_len + 1);
1522 mountedto[fsname_len] =
'\0';
1523 strncpy(mountedto, (
char *)vmt2dataptr(vm, VMT_STUB), fsname_len);
1526 fsname_len = vmt2datasize(vm, VMT_OBJECT);
1527 mountedfrom = (
char*)malloc(fsname_len + 1);
1528 mountedfrom[fsname_len] =
'\0';
1529 strncpy(mountedfrom, (
char *)vmt2dataptr(vm, VMT_OBJECT), fsname_len);
1531 TQCString device_name = mountedfrom;
1533 if (realpath(device_name, realpath_buffer) != 0)
1535 device_name = realpath_buffer;
1539 if (realname == device_name) {
1548 vm = (
struct vmount *)((
char *)vm + vm->vmt_length);
1552 free( mntctl_buffer );
1556 STRUCT_SETMNTENT mtab;
1560 if ((mtab = SETMNTENT(MNTTAB,
"r")) == 0) {
1561 perror(
"setmntent");
1562 return TQString::null;
1577 while (GETMNTENT(mtab, me))
1581 TQCString device_name = FSNAME(me);
1582 if (device_name.isEmpty() || (device_name ==
"none"))
1589 if (realpath(device_name, realpath_buffer) != 0)
1591 device_name = realpath_buffer;
1595 if (realname == device_name)
1597 result = MOUNTPOINT(me);
1612 static bool is_my_mountpoint(
const char *mountpoint,
const char *realname,
int &max )
1614 int length = strlen(mountpoint);
1616 if (!strncmp(mountpoint, realname, length)
1619 if (length == 1 || realname[length] ==
'/' || realname[length] ==
'\0')
1625 typedef enum { Unseen, Right, Wrong } MountState;
1630 static void check_mount_point(
const char *mounttype,
1632 MountState &isslow, MountState &isautofs)
1634 bool nfs = !strcmp(mounttype,
"nfs");
1635 bool autofs = !strcmp(mounttype,
"autofs") || !strcmp(mounttype,
"subfs");
1636 bool pid = (strstr(fsname,
":(pid") != 0);
1640 else if (isslow == Right)
1644 if (autofs || (nfs && pid)) {
1652 static TQString get_mount_info(
const TQString& filename,
1653 MountState& isautofs, MountState& isslow, MountState& ismanual,
1656 static bool gotRoot =
false;
1657 static dev_t rootDevice;
1659 struct cachedDevice_t
1662 TQString mountPoint;
1663 MountState isautofs;
1665 MountState ismanual;
1668 static struct cachedDevice_t *cachedDevice = 0;
1672 KDE_struct_stat stat_buf;
1673 KDE_stat(
"/", &stat_buf);
1675 rootDevice = stat_buf.st_dev;
1678 bool gotDevice =
false;
1679 KDE_struct_stat stat_buf;
1680 if (KDE_stat(TQFile::encodeName(filename), &stat_buf) == 0)
1683 if (stat_buf.st_dev == rootDevice)
1685 static const TQString &root = TDEGlobal::staticQString(
"/");
1689 fstype = TQString::null;
1692 if (cachedDevice && (stat_buf.st_dev == cachedDevice->device))
1694 bool interestedInIsManual = ismanual != Wrong;
1695 isautofs = cachedDevice->isautofs;
1696 isslow = cachedDevice->isslow;
1697 ismanual = cachedDevice->ismanual;
1698 fstype = cachedDevice->fstype;
1700 if ( !interestedInIsManual || ismanual != Unseen )
1701 return cachedDevice->mountPoint;
1705 char realname[MAXPATHLEN];
1707 memset(realname, 0, MAXPATHLEN);
1710 if (realpath(TQFile::encodeName(filename), realname) == 0) {
1711 if( strlcpy(realname, TQFile::encodeName(filename), MAXPATHLEN)>=MAXPATHLEN)
1712 return TQString::null;
1716 TQString mountPoint;
1728 #ifdef HAVE_GETMNTINFO 1730 #ifdef GETMNTINFO_USES_STATVFS 1731 struct statvfs *mounted;
1733 struct statfs *mounted;
1736 char realpath_buffer[MAXPATHLEN];
1738 int num_fs = getmntinfo(&mounted, MNT_NOWAIT);
1740 for (
int i=0;i<num_fs;i++) {
1742 TQCString device_name = mounted[i].f_mntfromname;
1746 if (realpath(device_name, realpath_buffer) != 0)
1748 device_name = realpath_buffer;
1750 char * mounttype = mnt_names[mounted[i].f_type];
1752 char * mounttype = mounted[i].f_fstypename;
1754 if ( is_my_mountpoint( mounted[i].f_mntonname, realname, max ) )
1756 mountPoint = TQFile::decodeName(mounted[i].f_mntonname);
1757 fstype = TQString::fromLatin1(mounttype);
1758 check_mount_point( mounttype, mounted[i].f_mntfromname,
1762 if (ismanual == Unseen)
1764 struct fstab *ft = getfsfile(mounted[i].f_mntonname);
1765 if (!ft || strstr(ft->fs_mntops,
"noauto"))
1773 struct vmount *mntctl_buffer;
1777 int fsname_len, num;
1778 char realpath_buffer[MAXPATHLEN];
1781 mntctl_buffer = (
struct vmount*)malloc(buf_sz);
1782 num = mntctl(MCTL_QUERY, buf_sz, mntctl_buffer);
1785 buf_sz = *(
int*)mntctl_buffer;
1786 free(mntctl_buffer);
1787 mntctl_buffer = (
struct vmount*)malloc(buf_sz);
1788 num = mntctl(MCTL_QUERY, buf_sz, mntctl_buffer);
1794 vm = (
struct vmount *)mntctl_buffer;
1795 for ( ; num > 0; num-- )
1798 fsname_len = vmt2datasize(vm, VMT_STUB);
1799 mountedto = (
char*)malloc(fsname_len + 1);
1800 mountedto[fsname_len] =
'\0';
1801 strncpy(mountedto, (
char *)vmt2dataptr(vm, VMT_STUB), fsname_len);
1803 fsname_len = vmt2datasize(vm, VMT_OBJECT);
1804 mountedfrom = (
char*)malloc(fsname_len + 1);
1805 mountedfrom[fsname_len] =
'\0';
1806 strncpy(mountedfrom, (
char *)vmt2dataptr(vm, VMT_OBJECT), fsname_len);
1809 TQCString device_name = mountedfrom;
1811 if (realpath(device_name, realpath_buffer) != 0)
1813 device_name = realpath_buffer;
1819 struct vfs_ent* ent = getvfsbytype(vm->vmt_gfstype);
1821 if ( is_my_mountpoint( mountedto, realname, max ) )
1823 mountPoint = TQFile::decodeName(mountedto);
1824 fstype = TQString::fromLatin1(ent->vfsent_name);
1825 check_mount_point(ent->vfsent_name, device_name, isautofs, isslow);
1827 if (ismanual == Unseen)
1839 vm = (
struct vmount *)((
char *)vm + vm->vmt_length);
1845 free( mntctl_buffer );
1849 STRUCT_SETMNTENT mtab;
1852 if ((mtab = SETMNTENT(MNTTAB,
"r")) == 0) {
1853 perror(
"setmntent");
1854 return TQString::null;
1860 if (!GETMNTENT(mtab, me))
1863 if ( is_my_mountpoint( MOUNTPOINT(me), realname, max ) )
1865 mountPoint = TQFile::decodeName( MOUNTPOINT(me) );
1866 fstype = MOUNTTYPE(me);
1867 check_mount_point(MOUNTTYPE(me), FSNAME(me), isautofs, isslow);
1870 if (ismanual == Unseen)
1874 TQCString fsname_me = FSNAME(me);
1875 TQCString mounttype_me = MOUNTTYPE(me);
1877 STRUCT_SETMNTENT fstab;
1878 if ((fstab = SETMNTENT(FSTAB,
"r")) == 0) {
1884 while (GETMNTENT(fstab, fe))
1886 if (fsname_me == FSNAME(fe))
1889 if (HASMNTOPT(fe,
"noauto") ||
1890 !strcmp(MOUNTTYPE(fe),
"supermount"))
1895 if (!found || (mounttype_me ==
"supermount"))
1907 if (isautofs == Right && isslow == Unseen)
1913 cachedDevice =
new cachedDevice_t;
1915 cachedDevice->device = stat_buf.st_dev;
1916 cachedDevice->mountPoint = mountPoint;
1917 cachedDevice->isautofs = isautofs;
1918 cachedDevice->isslow = isslow;
1919 cachedDevice->ismanual = ismanual;
1920 cachedDevice->fstype = fstype;
1930 return TQString::null;
1937 MountState isautofs = Unseen, isslow = Unseen, ismanual = Wrong;
1939 return get_mount_info(filename, isautofs, isslow, ismanual, fstype);
1941 return TQString::null; 1948 MountState isautofs = Unseen, isslow = Unseen, ismanual = Unseen;
1950 TQString mountPoint = get_mount_info(filename, isautofs, isslow, ismanual, fstype);
1951 return !mountPoint.isNull() && (ismanual == Right);
1960 MountState isautofs = Unseen, isslow = Unseen, ismanual = Wrong;
1962 TQString mountPoint = get_mount_info(filename, isautofs, isslow, ismanual, fstype);
1963 return !mountPoint.isNull() && (isslow == Right);
1972 MountState isautofs = Unseen, isslow = Unseen, ismanual = Wrong;
1974 TQString mountPoint = get_mount_info(filename, isautofs, isslow, ismanual, fstype);
1975 kdDebug() <<
"testFileSystemFlag: fstype=" << fstype << endl;
1976 if (mountPoint.isNull())
1978 bool isMsDos = ( fstype ==
"msdos" || fstype ==
"fat" || fstype ==
"vfat" );
1983 case SupportsSymlinks:
1985 case CaseInsensitive:
1994 TQString tmp = cacheControl.lower();
1996 if (tmp ==
"cacheonly")
2000 if (tmp ==
"verify")
2002 if (tmp ==
"refresh")
2004 if (tmp ==
"reload")
2007 kdDebug() <<
"unrecognized Cache control option:"<<cacheControl<<endl;
2023 kdDebug() <<
"unrecognized Cache control enum value:"<<cacheControl<<endl;
2024 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.