TDE core libraries
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

140 lines
4.5KB

  1. /*
  2. * Copyright (C) 2002, 2003 Stephan Kulow <coolo@kde.org>
  3. * Copyright (C) 2003 David Faure <faure@kde.org>
  4. *
  5. * This library is free software; you can redistribute it and/or
  6. * modify it under the terms of the GNU Library General Public
  7. * License version 2 as published by the Free Software Foundation;
  8. *
  9. * This library is distributed in the hope that it will be useful,
  10. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  12. * Library General Public License for more details.
  13. *
  14. * You should have received a copy of the GNU Library General Public License
  15. * along with this library; see the file COPYING.LIB. If not, write to
  16. * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
  17. * Boston, MA 02110-1301, USA.
  18. */
  19. #include <kdebug.h>
  20. #include <tdeapplication.h>
  21. #include <time.h>
  22. #include "speed.h"
  23. #include <tdeio/job.h>
  24. #include <tdecmdlineargs.h>
  25. #include <tqdir.h>
  26. #include <tdeio/global.h>
  27. using namespace TDEIO;
  28. SpeedTest::SpeedTest( const KURL & url )
  29. : TQObject(0, "speed")
  30. {
  31. Job *job = listRecursive( url );
  32. //Job *job = del( KURL("file:" + TQDir::currentDirPath()) ); DANGEROUS !
  33. connect(job, TQT_SIGNAL( result( TDEIO::Job*)),
  34. TQT_SLOT( finished( TDEIO::Job* ) ));
  35. /*connect(job, TQT_SIGNAL( entries( TDEIO::Job*, const TDEIO::UDSEntryList&)),
  36. TQT_SLOT( entries( TDEIO::Job*, const TDEIO::UDSEntryList&)));
  37. */
  38. }
  39. void SpeedTest::entries(TDEIO::Job*, const UDSEntryList& list) {
  40. UDSEntryListConstIterator it=list.begin();
  41. for (; it != list.end(); ++it) {
  42. UDSEntry::ConstIterator it2 = (*it).begin();
  43. for( ; it2 != (*it).end(); it2++ ) {
  44. if ((*it2).m_uds == UDS_NAME)
  45. kdDebug() << ( *it2 ).m_str << endl;
  46. }
  47. }
  48. }
  49. void SpeedTest::finished(Job*) {
  50. kdDebug() << "job finished" << endl;
  51. kapp->quit();
  52. }
  53. static TDECmdLineOptions options[] =
  54. {
  55. { "+[URL]", "the URL to list", 0 },
  56. TDECmdLineLastOption
  57. };
  58. int main(int argc, char **argv) {
  59. TDECmdLineArgs::init( argc, argv, "speedapp", "A TDEIO::listRecursive testing tool", "0.0" );
  60. TDECmdLineArgs::addCmdLineOptions( options );
  61. TDEApplication app;
  62. TDECmdLineArgs *args = TDECmdLineArgs::parsedArgs();
  63. KURL url;
  64. if ( args->count() == 1 )
  65. url = args->url(0);
  66. else
  67. url = "file:" + TQDir::currentDirPath();
  68. kdDebug() << url.url() << " is probably " << (TDEIO::probably_slow_mounted(url.path()) ? "slow" : "normal") << " mounted\n";
  69. kdDebug() << url.url() << " is " << (TDEIO::manually_mounted(url.path()) ? "manually" : "system") << " mounted\n";
  70. TQString mp = TDEIO::findDeviceMountPoint(url.path());
  71. if (mp.isEmpty()) {
  72. kdDebug() << "no mount point for device " << url.url() << " found\n";
  73. } else
  74. kdDebug() << mp << " is the mount point for device " << url.url() << endl;
  75. mp = TDEIO::findPathMountPoint(url.path());
  76. if (mp.isEmpty()) {
  77. kdDebug() << "no mount point for path " << url.url() << " found\n";
  78. } else
  79. kdDebug() << mp << " is the mount point for path " << url.url() << endl;
  80. // SpeedTest test( url );
  81. // app.exec();
  82. mp = TDEIO::findPathMountPoint(url.path());
  83. if (mp.isEmpty()) {
  84. kdDebug() << "no mount point for path " << url.url() << " found\n";
  85. } else
  86. kdDebug() << mp << " is the mount point for path " << url.url() << endl;
  87. // SpeedTest test( url );
  88. // app.exec();
  89. url.setPath(TQDir::homeDirPath());
  90. mp = TDEIO::findPathMountPoint(url.path());
  91. if (mp.isEmpty()) {
  92. kdDebug() << "no mount point for path " << url.url() << " found\n";
  93. } else
  94. kdDebug() << mp << " is the mount point for path " << url.url() << endl;
  95. // SpeedTest test( url );
  96. // app.exec();
  97. mp = TDEIO::findPathMountPoint(url.path());
  98. if (mp.isEmpty()) {
  99. kdDebug() << "no mount point for path " << url.url() << " found\n";
  100. } else
  101. kdDebug() << mp << " is the mount point for path " << url.url() << endl;
  102. // SpeedTest test( url );
  103. // app.exec();
  104. if ( args->count() == 1 )
  105. url = args->url(0);
  106. else
  107. url = "file:" + TQDir::currentDirPath();
  108. mp = TDEIO::findPathMountPoint(url.path());
  109. if (mp.isEmpty()) {
  110. kdDebug() << "no mount point for path " << url.url() << " found\n";
  111. } else
  112. kdDebug() << mp << " is the mount point for path " << url.url() << endl;
  113. // SpeedTest test( url );
  114. // app.exec();
  115. }
  116. #include "speed.moc"