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.

netaccesstest.cpp 1.6KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. /*
  2. * Copyright (C) 2004 David Faure <faure@kde.org>
  3. *
  4. * This library is free software; you can redistribute it and/or
  5. * modify it under the terms of the GNU Library General Public
  6. * License version 2 as published by the Free Software Foundation;
  7. *
  8. * This library is distributed in the hope that it will be useful,
  9. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  11. * Library General Public License for more details.
  12. *
  13. * You should have received a copy of the GNU Library General Public License
  14. * along with this library; see the file COPYING.LIB. If not, write to
  15. * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
  16. * Boston, MA 02110-1301, USA.
  17. */
  18. #include <tdeapplication.h>
  19. #include <kdebug.h>
  20. #include <kurl.h>
  21. #include <tdeio/netaccess.h>
  22. #include <tqfile.h>
  23. int main(int argc, char **argv)
  24. {
  25. TDEApplication app( argc, argv, "netaccesstest", true /*styles*/, true /* it _has_ a GUI ! */);
  26. KURL srcURL( "ftp://ftp.kde.org/pub/kde/README" );
  27. KURL tmpURL( "file:/tmp/netaccesstest_README" );
  28. for ( uint i = 0; i < 4 ; ++i ) {
  29. kdDebug() << "file_copy" << endl;
  30. if ( !TDEIO::NetAccess::file_copy(srcURL, tmpURL, -1, true, false, 0) )
  31. kdError() << "file_copy failed: " << TDEIO::NetAccess::lastErrorString() << endl;
  32. else {
  33. TQFile f( tmpURL.path() );
  34. if (!f.open(IO_ReadOnly))
  35. kdFatal() << "Cannot open: " << f.name() << ". The error was: " << f.errorString() << endl;
  36. else {
  37. f.close();
  38. }
  39. }
  40. }
  41. return 0;
  42. }