TDE graphics utilities
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.

74 lines
1.7KB

  1. /* This file is part of the KDE project
  2. Copyright (C) 2001 Carsten Pfeiffer <pfeiffer@kde.org>
  3. This program is free software; you can redistribute it and/or
  4. modify it under the terms of the GNU General Public
  5. License as published by the Free Software Foundation, version 2.
  6. This program is distributed in the hope that it will be useful,
  7. but WITHOUT ANY WARRANTY; without even the implied warranty of
  8. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  9. General Public License for more details.
  10. You should have received a copy of the GNU General Public License
  11. along with this program; see the file COPYING. If not, write to
  12. the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
  13. Boston, MA 02110-1301, USA.
  14. */
  15. #ifndef LOADER_H
  16. #define LOADER_H
  17. #include <tqbuffer.h>
  18. #include <tqcstring.h>
  19. #include <tqmap.h>
  20. #include <tqobject.h>
  21. #include <tdeio/job.h>
  22. #include <kurl.h>
  23. class Download
  24. {
  25. public:
  26. ~Download() {
  27. if ( m_buffer.isOpen() )
  28. m_buffer.close();
  29. }
  30. TQBuffer m_buffer;
  31. // add context of MrmlPart for progress?
  32. };
  33. class Loader : public TQObject
  34. {
  35. friend class gcc_sucks;
  36. Q_OBJECT
  37. public:
  38. static Loader *self();
  39. ~Loader();
  40. void requestDownload( const KURL& url );
  41. void removeDownload( const KURL& url );
  42. signals:
  43. void finished( const KURL& url, const TQByteArray& );
  44. private slots:
  45. void slotData( TDEIO::Job *, const TQByteArray& );
  46. void slotResult( TDEIO::Job * );
  47. private:
  48. Loader();
  49. TQMap<TDEIO::TransferJob*,Download*> m_downloads;
  50. typedef TQMapIterator<TDEIO::TransferJob*,Download*> DownloadIterator;
  51. static Loader *s_self;
  52. };
  53. #endif // LOADER_H