home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2009 February / PCWFEB09.iso / Software / Linux / SLAX 6.0.8 / slax-6.0.8.iso / slax / base / 006-devel.lzm / usr / include / kio / metainfojob.h < prev    next >
Encoding:
C/C++ Source or Header  |  2005-10-10  |  3.7 KB  |  120 lines

  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.  
  7.     This library is free software; you can redistribute it and/or
  8.     modify it under the terms of the GNU Library General Public
  9.     License as published by the Free Software Foundation version 2.0.
  10.  
  11.     This library is distributed in the hope that it will be useful,
  12.     but WITHOUT ANY WARRANTY; without even the implied warranty of
  13.     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  14.     Library General Public License for more details.
  15.  
  16.     You should have received a copy of the GNU Library General Public License
  17.     along with this library; see the file COPYING.LIB.  If not, write to
  18.     the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
  19.     Boston, MA 02110-1301, USA.
  20. */
  21.  
  22. #ifndef __kio_metainfojob_h__
  23. #define __kio_metainfojob_h__
  24.  
  25. #include <kio/job.h>
  26. #include <kfileitem.h>
  27.  
  28. namespace KIO {
  29.     /**
  30.      * MetaInfoJob is a KIO Job to retrieve meta information from files.
  31.      * 
  32.      * @short KIO Job to retrieve meta information from files.
  33.      * @since 3.1
  34.      */
  35.     class KIO_EXPORT MetaInfoJob : public KIO::Job
  36.     {
  37.         Q_OBJECT
  38.     public:
  39.         /**
  40.          * Creates a new MetaInfoJob.
  41.          *  @param items   A list of KFileItems to get the metainfo for
  42.          *  @param deleteItems If true, the finished KFileItems are deleted
  43.          */
  44.         MetaInfoJob(const KFileItemList &items, bool deleteItems = false);
  45.         virtual ~MetaInfoJob();
  46.  
  47.         /**
  48.          * Removes an item from metainfo extraction.
  49.          *
  50.          * @param item the item that should be removed from the queue
  51.          */
  52.         void removeItem( const KFileItem *item );
  53.  
  54.         /**
  55.          * Returns a list of all available metainfo plugins. The list
  56.          * contains the basenames of the plugins' .desktop files (no path,
  57.          * no .desktop).
  58.      * @return the list of available meta info plugins
  59.          */
  60.         static QStringList availablePlugins();
  61.  
  62.         /**
  63.          * Returns a list of all supported MIME types. The list can
  64.          * contain entries like text/ * (without the space).
  65.      * @return the list of MIME types that are supported
  66.          */
  67.         static QStringList supportedMimeTypes();
  68.  
  69.     signals:
  70.         /**
  71.          * Emitted when the meta info for @p item has been successfully
  72.          * retrieved.
  73.      * @param item the KFileItem describing the fetched item
  74.          */
  75.         void gotMetaInfo( const KFileItem *item );
  76.         /**
  77.          * Emitted when metainfo for @p item could not be extracted,
  78.          * either because a plugin for its MIME type does not
  79.          * exist, or because something went wrong.
  80.      * @param item the KFileItem of the file that failed
  81.          */
  82.         void failed( const KFileItem *item );
  83.  
  84.     protected:
  85.         void getMetaInfo();
  86.  
  87.     protected slots:
  88.         virtual void slotResult( KIO::Job *job );
  89.  
  90.     private slots:
  91.         void start();
  92.         void slotMetaInfo(KIO::Job *, const QByteArray &);
  93.  
  94.     private:
  95.         void determineNextFile();
  96. //        void saveMetaInfo(const QByteArray info);
  97.  
  98.     private:
  99.         struct MetaInfoJobPrivate *d;
  100.     };
  101.  
  102.     /**
  103.      * Retrieves meta information for the given items.
  104.      *
  105.      * @param items files to get metainfo for
  106.      * @return the MetaInfoJob to retrieve the items
  107.      */
  108.     KIO_EXPORT MetaInfoJob* fileMetaInfo(const KFileItemList& items);
  109.  
  110.     /**
  111.      * Retrieves meta information for the given items.
  112.      *
  113.      * @param items files to get metainfo for
  114.      * @return the MetaInfoJob to retrieve the items
  115.      */
  116.     KIO_EXPORT MetaInfoJob* fileMetaInfo(const KURL::List& items);
  117. }
  118.  
  119. #endif
  120.