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:
1151 errorName = i18n(
"Timeout Error" );
1152 description = i18n(
"Although contact was made with the server, a "
1153 "response was not received within the amount of time allocated for "
1154 "the request as follows:")
1155 .append(TQString::fromLatin1(
"<ul><li>"))
1156 .append(i18n(
"Timeout for establishing a connection: %n second",
1157 "Timeout for establishing a connection: %n seconds",
1159 .append(TQString::fromLatin1(
"</li><li>"))
1160 .append(i18n(
"Timeout for receiving a response: %n second",
1161 "Timeout for receiving a response: %n seconds",
1163 .append(TQString::fromLatin1(
"</li><li>"))
1164 .append(i18n(
"Timeout for accessing proxy servers: %n second",
1165 "Timeout for accessing proxy servers: %n seconds",
1167 .append(TQString::fromLatin1(
"</li></ul>"))
1168 .append(i18n(
"Please note that you can alter these timeout settings in the TDE "
1169 "Control Center, by selecting Network -> Preferences." ));
1170 causes << cNetpath << i18n(
"The server was too busy responding to other "
1171 "requests to respond." );
1172 solutions << sTryagain << sServeradmin;
1176 case TDEIO::ERR_UNKNOWN:
1177 errorName = i18n(
"Unknown Error" );
1178 description = i18n(
"The program on your computer which provides access "
1179 "to the <strong>%1</strong> protocol has reported an unknown error: "
1180 "%2." ).arg( protocol ).arg( errorText );
1182 solutions << sUpdate << sBugreport;
1185 case TDEIO::ERR_UNKNOWN_INTERRUPT:
1186 errorName = i18n(
"Unknown Interruption" );
1187 description = i18n(
"The program on your computer which provides access "
1188 "to the <strong>%1</strong> protocol has reported an interruption of "
1189 "an unknown type: %2." ).arg( protocol ).arg( errorText );
1191 solutions << sUpdate << sBugreport;
1194 case TDEIO::ERR_CANNOT_DELETE_ORIGINAL:
1195 errorName = i18n(
"Could Not Delete Original File" );
1196 description = i18n(
"The requested operation required the deleting of "
1197 "the original file, most likely at the end of a file move operation. "
1198 "The original file <strong>%1</strong> could not be deleted." )
1201 solutions << sAccess;
1204 case TDEIO::ERR_CANNOT_DELETE_PARTIAL:
1205 errorName = i18n(
"Could Not Delete Temporary File" );
1206 description = i18n(
"The requested operation required the creation of "
1207 "a temporary file in which to save the new file while being "
1208 "downloaded. This temporary file <strong>%1</strong> could not be "
1209 "deleted." ).arg( errorText );
1211 solutions << sAccess;
1214 case TDEIO::ERR_CANNOT_RENAME_ORIGINAL:
1215 errorName = i18n(
"Could Not Rename Original File" );
1216 description = i18n(
"The requested operation required the renaming of "
1217 "the original file <strong>%1</strong>, however it could not be "
1218 "renamed." ).arg( errorText );
1220 solutions << sAccess;
1223 case TDEIO::ERR_CANNOT_RENAME_PARTIAL:
1224 errorName = i18n(
"Could Not Rename Temporary File" );
1225 description = i18n(
"The requested operation required the creation of "
1226 "a temporary file <strong>%1</strong>, however it could not be "
1227 "created." ).arg( errorText );
1229 solutions << sAccess;
1232 case TDEIO::ERR_CANNOT_SYMLINK:
1233 errorName = i18n(
"Could Not Create Link" );
1234 techName = i18n(
"Could Not Create Symbolic Link" );
1235 description = i18n(
"The requested symbolic link %1 could not be created." )
1238 solutions << sAccess;
1241 case TDEIO::ERR_NO_CONTENT:
1242 errorName = i18n(
"No Content" );
1243 description = errorText;
1246 case TDEIO::ERR_DISK_FULL:
1247 errorName = i18n(
"Disk Full" );
1248 description = i18n(
"The requested file <strong>%1</strong> could not be "
1249 "written to as there is inadequate disk space." ).arg( errorText );
1250 solutions << i18n(
"Free up enough disk space by 1) deleting unwanted and "
1251 "temporary files; 2) archiving files to removable media storage such as "
1252 "CD-Recordable discs; or 3) obtain more storage capacity." )
1256 case TDEIO::ERR_IDENTICAL_FILES:
1257 errorName = i18n(
"Source and Destination Files Identical" );
1258 description = i18n(
"The operation could not be completed because the "
1259 "source and destination files are the same file." );
1260 solutions << i18n(
"Choose a different filename for the destination file." );
1264 case TDEIO::ERR_SLAVE_DEFINED:
1265 errorName = TQString::null;
1266 description = errorText;
1271 errorName = i18n(
"Undocumented Error" );
1276 TQDataStream stream(ret, IO_WriteOnly);
1277 stream << errorName << techName << description << causes << solutions;
1293 #ifdef HAVE_SYS_STAT_H
1294 #include <sys/stat.h>
1296 #include <sys/param.h>
1297 #ifdef HAVE_LIMITS_H
1300 #ifdef HAVE_SYS_MNTTAB_H
1301 #include <sys/mnttab.h>
1303 #ifdef HAVE_MNTENT_H
1305 #elif defined(HAVE_SYS_MNTENT_H)
1306 #include <sys/mntent.h>
1308 #ifdef HAVE_SYS_UCRED_H
1309 #include <sys/ucred.h>
1311 #ifdef HAVE_SYS_MOUNT_H
1312 #include <sys/mount.h>
1318 #include <sys/mntctl.h>
1319 #include <sys/vmount.h>
1320 #include <sys/vfs.h>
1325 int mntctl(
int command,
int size,
void* buffer);
1328 extern "C" struct vfs_ent *getvfsbytype(
int vfsType);
1329 extern "C" void endvfsent( );
1338 #ifndef HAVE_GETMNTINFO
1340 #ifdef _PATH_MOUNTED
1343 # define MNTTAB _PATH_MOUNTED
1347 # define MNTTAB MTAB_FILE
1349 # define MNTTAB "/etc/mnttab"
1356 # define FSTAB _PATH_FSTAB
1358 # define FSTAB "/etc/fstab"
1363 #define hasmntopt(var,opt) (0)
1373 #ifdef HAVE_SETMNTENT
1374 #define SETMNTENT setmntent
1375 #define ENDMNTENT endmntent
1376 #define STRUCT_MNTENT struct mntent *
1377 #define STRUCT_SETMNTENT FILE *
1378 #define GETMNTENT(file, var) ((var = getmntent(file)) != 0)
1379 #define MOUNTPOINT(var) var->mnt_dir
1380 #define MOUNTTYPE(var) var->mnt_type
1381 #define HASMNTOPT(var, opt) hasmntopt(var, opt)
1382 #define FSNAME(var) var->mnt_fsname
1386 #define SETMNTENT fopen
1387 #define ENDMNTENT fclose
1388 #define STRUCT_MNTENT struct mnttab
1389 #define STRUCT_SETMNTENT FILE *
1390 #define GETMNTENT(file, var) (getmntent(file, &var) == 0)
1391 #define MOUNTPOINT(var) var.mnt_mountp
1392 #define MOUNTTYPE(var) var.mnt_fstype
1393 #define HASMNTOPT(var, opt) hasmntopt(&var, opt)
1394 #define FSNAME(var) var.mnt_special
1407 const char *volpath;
1413 if( (volpath = volmgt_root()) == NULL ) {
1414 kdDebug( 7007 ) <<
"findDeviceMountPoint: "
1415 <<
"VOLMGT: can't find volmgt root dir" << endl;
1416 return TQString::null;
1419 if( (mnttab = fopen( MNTTAB,
"r" )) == NULL ) {
1420 kdDebug( 7007 ) <<
"findDeviceMountPoint: "
1421 <<
"VOLMGT: can't open mnttab" << endl;
1422 return TQString::null;
1426 devname += TQFile::encodeName( filename );
1428 len = devname.length();
1441 result = TQString::null;
1442 while( getmntent( mnttab, &mnt ) == 0 ) {
1447 if( strncmp( devname.data(), mnt.mnt_special, len ) == 0
1448 || (strncmp( devname.data(), mnt.mnt_special, len - 3 ) == 0
1449 && mnt.mnt_special[len - 3] ==
'/' )
1450 || (strcmp(TQFile::encodeName(filename).data()
1451 , mnt.mnt_special)==0)) {
1452 result = mnt.mnt_mountp;
1459 char realpath_buffer[MAXPATHLEN];
1462 realname = TQFile::encodeName(filename);
1464 if (realpath(realname, realpath_buffer) != 0)
1466 realname = realpath_buffer;
1470 #ifdef HAVE_GETMNTINFO
1472 #ifdef GETMNTINFO_USES_STATVFS
1473 struct statvfs *mounted;
1475 struct statfs *mounted;
1478 int num_fs = getmntinfo(&mounted, MNT_NOWAIT);
1480 for (
int i=0;i<num_fs;i++) {
1482 TQCString device_name = mounted[i].f_mntfromname;
1486 if (realpath(device_name, realpath_buffer) != 0)
1488 device_name = realpath_buffer;
1490 if (realname == device_name) {
1491 result = mounted[i].f_mntonname;
1498 struct vmount *mntctl_buffer;
1502 int fsname_len, num;
1515 mntctl_buffer = (
struct vmount*)malloc(buf_sz);
1516 num = mntctl(MCTL_QUERY, buf_sz, mntctl_buffer);
1519 buf_sz = *(
int*)mntctl_buffer;
1520 free(mntctl_buffer);
1521 mntctl_buffer = (
struct vmount*)malloc(buf_sz);
1522 num = mntctl(MCTL_QUERY, buf_sz, mntctl_buffer);
1529 for ( ; num > 0; num-- )
1532 fsname_len = vmt2datasize(vm, VMT_STUB);
1533 mountedto = (
char*)malloc(fsname_len + 1);
1534 mountedto[fsname_len] =
'\0';
1535 strncpy(mountedto, (
char *)vmt2dataptr(vm, VMT_STUB), fsname_len);
1538 fsname_len = vmt2datasize(vm, VMT_OBJECT);
1539 mountedfrom = (
char*)malloc(fsname_len + 1);
1540 mountedfrom[fsname_len] =
'\0';
1541 strncpy(mountedfrom, (
char *)vmt2dataptr(vm, VMT_OBJECT), fsname_len);
1543 TQCString device_name = mountedfrom;
1545 if (realpath(device_name, realpath_buffer) != 0)
1547 device_name = realpath_buffer;
1551 if (realname == device_name) {
1560 vm = (
struct vmount *)((
char *)vm + vm->vmt_length);
1564 free( mntctl_buffer );
1568 STRUCT_SETMNTENT mtab;
1572 if ((mtab = SETMNTENT(MNTTAB,
"r")) == 0) {
1573 perror(
"setmntent");
1574 return TQString::null;
1589 while (GETMNTENT(mtab, me))
1593 TQCString device_name = FSNAME(me);
1594 if (device_name.isEmpty() || (device_name ==
"none"))
1601 if (realpath(device_name, realpath_buffer) != 0)
1603 device_name = realpath_buffer;
1607 if (realname == device_name)
1609 result = MOUNTPOINT(me);
1624 static bool is_my_mountpoint(
const char *mountpoint,
const char *realname,
int &max )
1626 int length = strlen(mountpoint);
1628 if (!strncmp(mountpoint, realname, length)
1631 if (length == 1 || realname[length] ==
'/' || realname[length] ==
'\0')
1637 typedef enum { Unseen, Right, Wrong } MountState;
1642 static void check_mount_point(
const char *mounttype,
1644 MountState &isslow, MountState &isautofs)
1646 bool nfs = !strcmp(mounttype,
"nfs");
1647 bool autofs = !strcmp(mounttype,
"autofs") || !strcmp(mounttype,
"subfs");
1648 bool pid = (strstr(fsname,
":(pid") != 0);
1652 else if (isslow == Right)
1656 if (autofs || (nfs && pid)) {
1664 static TQString get_mount_info(
const TQString& filename,
1665 MountState& isautofs, MountState& isslow, MountState& ismanual,
1668 static bool gotRoot =
false;
1669 static dev_t rootDevice;
1671 struct cachedDevice_t
1674 TQString mountPoint;
1675 MountState isautofs;
1677 MountState ismanual;
1680 static struct cachedDevice_t *cachedDevice = 0;
1684 KDE_struct_stat stat_buf;
1685 KDE_stat(
"/", &stat_buf);
1687 rootDevice = stat_buf.st_dev;
1690 bool gotDevice =
false;
1691 KDE_struct_stat stat_buf;
1692 if (KDE_stat(TQFile::encodeName(filename), &stat_buf) == 0)
1695 if (stat_buf.st_dev == rootDevice)
1697 static const TQString &root = TDEGlobal::staticQString(
"/");
1701 fstype = TQString::null;
1704 if (cachedDevice && (stat_buf.st_dev == cachedDevice->device))
1706 bool interestedInIsManual = ismanual != Wrong;
1707 isautofs = cachedDevice->isautofs;
1708 isslow = cachedDevice->isslow;
1709 ismanual = cachedDevice->ismanual;
1710 fstype = cachedDevice->fstype;
1712 if ( !interestedInIsManual || ismanual != Unseen )
1713 return cachedDevice->mountPoint;
1717 char realname[MAXPATHLEN];
1719 memset(realname, 0, MAXPATHLEN);
1722 if (realpath(TQFile::encodeName(filename), realname) == 0) {
1723 if( strlcpy(realname, TQFile::encodeName(filename), MAXPATHLEN)>=MAXPATHLEN)
1724 return TQString::null;
1728 TQString mountPoint;
1740 #ifdef HAVE_GETMNTINFO
1742 #ifdef GETMNTINFO_USES_STATVFS
1743 struct statvfs *mounted;
1745 struct statfs *mounted;
1748 char realpath_buffer[MAXPATHLEN];
1750 int num_fs = getmntinfo(&mounted, MNT_NOWAIT);
1752 for (
int i=0;i<num_fs;i++) {
1754 TQCString device_name = mounted[i].f_mntfromname;
1758 if (realpath(device_name, realpath_buffer) != 0)
1760 device_name = realpath_buffer;
1762 char * mounttype = mnt_names[mounted[i].f_type];
1764 char * mounttype = mounted[i].f_fstypename;
1766 if ( is_my_mountpoint( mounted[i].f_mntonname, realname, max ) )
1768 mountPoint = TQFile::decodeName(mounted[i].f_mntonname);
1769 fstype = TQString::fromLatin1(mounttype);
1770 check_mount_point( mounttype, mounted[i].f_mntfromname,
1774 if (ismanual == Unseen)
1776 struct fstab *ft = getfsfile(mounted[i].f_mntonname);
1777 if (!ft || strstr(ft->fs_mntops,
"noauto"))
1785 struct vmount *mntctl_buffer;
1789 int fsname_len, num;
1790 char realpath_buffer[MAXPATHLEN];
1793 mntctl_buffer = (
struct vmount*)malloc(buf_sz);
1794 num = mntctl(MCTL_QUERY, buf_sz, mntctl_buffer);
1797 buf_sz = *(
int*)mntctl_buffer;
1798 free(mntctl_buffer);
1799 mntctl_buffer = (
struct vmount*)malloc(buf_sz);
1800 num = mntctl(MCTL_QUERY, buf_sz, mntctl_buffer);
1806 vm = (
struct vmount *)mntctl_buffer;
1807 for ( ; num > 0; num-- )
1810 fsname_len = vmt2datasize(vm, VMT_STUB);
1811 mountedto = (
char*)malloc(fsname_len + 1);
1812 mountedto[fsname_len] =
'\0';
1813 strncpy(mountedto, (
char *)vmt2dataptr(vm, VMT_STUB), fsname_len);
1815 fsname_len = vmt2datasize(vm, VMT_OBJECT);
1816 mountedfrom = (
char*)malloc(fsname_len + 1);
1817 mountedfrom[fsname_len] =
'\0';
1818 strncpy(mountedfrom, (
char *)vmt2dataptr(vm, VMT_OBJECT), fsname_len);
1821 TQCString device_name = mountedfrom;
1823 if (realpath(device_name, realpath_buffer) != 0)
1825 device_name = realpath_buffer;
1831 struct vfs_ent* ent = getvfsbytype(vm->vmt_gfstype);
1833 if ( is_my_mountpoint( mountedto, realname, max ) )
1835 mountPoint = TQFile::decodeName(mountedto);
1836 fstype = TQString::fromLatin1(ent->vfsent_name);
1837 check_mount_point(ent->vfsent_name, device_name, isautofs, isslow);
1839 if (ismanual == Unseen)
1851 vm = (
struct vmount *)((
char *)vm + vm->vmt_length);
1857 free( mntctl_buffer );
1861 STRUCT_SETMNTENT mtab;
1864 if ((mtab = SETMNTENT(MNTTAB,
"r")) == 0) {
1865 perror(
"setmntent");
1866 return TQString::null;
1872 if (!GETMNTENT(mtab, me))
1875 if ( is_my_mountpoint( MOUNTPOINT(me), realname, max ) )
1877 mountPoint = TQFile::decodeName( MOUNTPOINT(me) );
1878 fstype = MOUNTTYPE(me);
1879 check_mount_point(MOUNTTYPE(me), FSNAME(me), isautofs, isslow);
1882 if (ismanual == Unseen)
1886 TQCString fsname_me = FSNAME(me);
1887 TQCString mounttype_me = MOUNTTYPE(me);
1889 STRUCT_SETMNTENT fstab;
1890 if ((fstab = SETMNTENT(FSTAB,
"r")) == 0) {
1896 while (GETMNTENT(fstab, fe))
1898 if (fsname_me == FSNAME(fe))
1901 if (HASMNTOPT(fe,
"noauto") ||
1902 !strcmp(MOUNTTYPE(fe),
"supermount"))
1907 if (!found || (mounttype_me ==
"supermount"))
1919 if (isautofs == Right && isslow == Unseen)
1925 cachedDevice =
new cachedDevice_t;
1927 cachedDevice->device = stat_buf.st_dev;
1928 cachedDevice->mountPoint = mountPoint;
1929 cachedDevice->isautofs = isautofs;
1930 cachedDevice->isslow = isslow;
1931 cachedDevice->ismanual = ismanual;
1932 cachedDevice->fstype = fstype;
1942 return TQString::null;
1949 MountState isautofs = Unseen, isslow = Unseen, ismanual = Wrong;
1951 return get_mount_info(filename, isautofs, isslow, ismanual, fstype);
1953 return TQString::null;
1960 MountState isautofs = Unseen, isslow = Unseen, ismanual = Unseen;
1962 TQString mountPoint = get_mount_info(filename, isautofs, isslow, ismanual, fstype);
1963 return !mountPoint.isNull() && (ismanual == Right);
1972 MountState isautofs = Unseen, isslow = Unseen, ismanual = Wrong;
1974 TQString mountPoint = get_mount_info(filename, isautofs, isslow, ismanual, fstype);
1975 return !mountPoint.isNull() && (isslow == Right);
1984 MountState isautofs = Unseen, isslow = Unseen, ismanual = Wrong;
1986 TQString mountPoint = get_mount_info(filename, isautofs, isslow, ismanual, fstype);
1987 kdDebug() <<
"testFileSystemFlag: fstype=" << fstype << endl;
1988 if (mountPoint.isNull())
1990 bool isMsDos = ( fstype ==
"msdos" || fstype ==
"fat" || fstype ==
"vfat" );
1995 case SupportsSymlinks:
1997 case CaseInsensitive:
2006 TQString tmp = cacheControl.lower();
2008 if (tmp ==
"cacheonly")
2012 if (tmp ==
"verify")
2014 if (tmp ==
"refresh")
2016 if (tmp ==
"reload")
2019 kdDebug() <<
"unrecognized Cache control option:"<<cacheControl<<endl;
2035 kdDebug() <<
"unrecognized Cache control enum value:"<<cacheControl<<endl;
2036 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
TQString errorString() const
Converts an error code and a non-i18n error message into an error message in the current language...
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.
TDEIO_EXPORT TQString decodeFileName(const TQString &str)
Decodes (from the filename to the text displayed) This translates %2[fF] into /, %% into %...
static int responseTimeout()
Returns the preferred response timeout value for remote connecting in seconds.
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 ...
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...
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.