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.

metainfojob.h 3.7KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  1. // -*- c++ -*-
  2. // vim: ts=4 sw=4 et
  3. /* This file is part of the KDE libraries
  4. Copyright (C) 2001 Rolf Magnus <ramagnus@kde.org>
  5. parts of this taken from previewjob.h
  6. This library is free software; you can redistribute it and/or
  7. modify it under the terms of the GNU Library General Public
  8. License as published by the Free Software Foundation version 2.0.
  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. 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. #ifndef __tdeio_metainfojob_h__
  19. #define __tdeio_metainfojob_h__
  20. #include <tdeio/job.h>
  21. #include <tdefileitem.h>
  22. namespace TDEIO {
  23. /**
  24. * MetaInfoJob is a KIO Job to retrieve meta information from files.
  25. *
  26. * @short KIO Job to retrieve meta information from files.
  27. * @since 3.1
  28. */
  29. class TDEIO_EXPORT MetaInfoJob : public TDEIO::Job
  30. {
  31. Q_OBJECT
  32. public:
  33. /**
  34. * Creates a new MetaInfoJob.
  35. * @param items A list of KFileItems to get the metainfo for
  36. * @param deleteItems If true, the finished KFileItems are deleted
  37. */
  38. MetaInfoJob(const KFileItemList &items, bool deleteItems = false);
  39. virtual ~MetaInfoJob();
  40. /**
  41. * Removes an item from metainfo extraction.
  42. *
  43. * @param item the item that should be removed from the queue
  44. */
  45. void removeItem( const KFileItem *item );
  46. /**
  47. * Returns a list of all available metainfo plugins. The list
  48. * contains the basenames of the plugins' .desktop files (no path,
  49. * no .desktop).
  50. * @return the list of available meta info plugins
  51. */
  52. static TQStringList availablePlugins();
  53. /**
  54. * Returns a list of all supported MIME types. The list can
  55. * contain entries like text/ * (without the space).
  56. * @return the list of MIME types that are supported
  57. */
  58. static TQStringList supportedMimeTypes();
  59. signals:
  60. /**
  61. * Emitted when the meta info for @p item has been successfully
  62. * retrieved.
  63. * @param item the KFileItem describing the fetched item
  64. */
  65. void gotMetaInfo( const KFileItem *item );
  66. /**
  67. * Emitted when metainfo for @p item could not be extracted,
  68. * either because a plugin for its MIME type does not
  69. * exist, or because something went wrong.
  70. * @param item the KFileItem of the file that failed
  71. */
  72. void failed( const KFileItem *item );
  73. protected:
  74. void getMetaInfo();
  75. protected slots:
  76. virtual void slotResult( TDEIO::Job *job );
  77. private slots:
  78. void start();
  79. void slotMetaInfo(TDEIO::Job *, const TQByteArray &);
  80. private:
  81. void determineNextFile();
  82. // void saveMetaInfo(const TQByteArray info);
  83. private:
  84. struct MetaInfoJobPrivate *d;
  85. };
  86. /**
  87. * Retrieves meta information for the given items.
  88. *
  89. * @param items files to get metainfo for
  90. * @return the MetaInfoJob to retrieve the items
  91. */
  92. TDEIO_EXPORT MetaInfoJob* fileMetaInfo(const KFileItemList& items);
  93. /**
  94. * Retrieves meta information for the given items.
  95. *
  96. * @param items files to get metainfo for
  97. * @return the MetaInfoJob to retrieve the items
  98. */
  99. TDEIO_EXPORT MetaInfoJob* fileMetaInfo(const KURL::List& items);
  100. }
  101. #endif