KDELibs4Support

metainfojob.h
1 // -*- c++ -*-
2 /* This file is part of the KDE libraries
3  Copyright (C) 2001 Rolf Magnus <[email protected]>
4  parts of this taken from previewjob.h
5 
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 
10  This library is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13  Library General Public License for more details.
14 
15  You should have received a copy of the GNU Library General Public License
16  along with this library; see the file COPYING.LIB. If not, write to
17  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18  Boston, MA 02110-1301, USA.
19 */
20 
21 #ifndef KIO_METAINFOJOB_H
22 #define KIO_METAINFOJOB_H
23 
24 #include <kdelibs4support_export.h>
25 #include <kio/job.h>
26 #include <kfileitem.h>
27 #include <kfilemetainfo.h>
28 
29 namespace KIO
30 {
31 class MetaInfoJobPrivate;
32 /**
33  * MetaInfoJob is a KIO Job to retrieve meta information from files.
34  *
35  * @short KIO Job to retrieve meta information from files.
36  * @deprecated use Nepomuk or Strigi
37  * Note: this job doesn't even work as before, KFileItem::setMetaInfo
38  * doesn't exist anymore.
39  */
40 class KDELIBS4SUPPORT_DEPRECATED_EXPORT MetaInfoJob : public KIO::Job
41 {
42  Q_OBJECT
43 public:
44  /**
45  * Creates a new MetaInfoJob.
46  * @param items A list of KFileItems to get the metainfo for
47  * @param w Flags which serve as a preset which can be customized
48  * with other parameters.
49  * @param iocost The allowed cost in terms of io to retrieve the
50  * metainfo. The approximate maximum number of bytes to
51  * be read is 10^iocost. Negative values mean that
52  * there is no limit on the cost. 0 means that no fields
53  * other than the required fields will be retrieved.
54  * The default value of 3 means about 1024 bytes per
55  * file may be read. This is merely a suggestion and not
56  * a hard limit.
57  * @param cpucost The allowed cost in terms of cpu to determine the
58  * information in the fields. The number mean the amount
59  * of instructions allowed is 10^cpucost and is a suggestion only.
60  * The default value of 6 means that about a million
61  * instructions (10^6) are allowed. This is useful for
62  * expensive fields like md5 or thumbnails.
63  * @param requiredfields The names of fields or groups of fields that should
64  * be retrieved regardless of cost.
65  * @param requestedfields The names of fields or groups of fields that should
66  * be retrieved first.
67  */
68  KDELIBS4SUPPORT_DEPRECATED explicit MetaInfoJob(const KFileItemList &items, KFileMetaInfo::WhatFlags w = KFileMetaInfo::Everything,
69  int iocost = 3, int cpucost = 6, const QStringList &requiredfields = QStringList(),
70  const QStringList &requestedfields = QStringList());
71  ~MetaInfoJob() override;
72 
73  /**
74  * Removes an item from metainfo extraction.
75  *
76  * @param item the item that should be removed from the queue
77  */
78  void removeItem(const KFileItem &item);
79 
80 Q_SIGNALS:
81  /**
82  * Emitted when the meta info for @p item has been successfully
83  * retrieved.
84  * @param item the KFileItem describing the fetched item
85  */
86  void gotMetaInfo(const KFileItem &item);
87  /**
88  * Emitted when metainfo for @p item could not be extracted,
89  * either because a plugin for its MIME type does not
90  * exist, or because something went wrong.
91  * @param item the KFileItem of the file that failed
92  */
93  void failed(const KFileItem &item);
94 
95 protected:
96  void getMetaInfo();
97 
98 protected Q_SLOTS:
99  void slotResult(KJob *job) override;
100 
101 private Q_SLOTS:
102  void start() override;
103  void slotMetaInfo(KIO::Job *, const QByteArray &);
104 
105 private:
106  void determineNextFile();
107 // void saveMetaInfo(const QByteArray info);
108 
109 private:
110  Q_DECLARE_PRIVATE(MetaInfoJob)
111  MetaInfoJobPrivate *d;
112 };
113 
114 /**
115  * Retrieves meta information for the given items.
116  *
117  * @param items files to get metainfo for
118  * @return the MetaInfoJob to retrieve the items
119  * @deprecated use strigi or KFileMetaInfo
120  */
121 KDELIBS4SUPPORT_DEPRECATED_EXPORT MetaInfoJob *fileMetaInfo(const KFileItemList &items);
122 
123 /**
124  * Retrieves meta information for the given items.
125  *
126  * @param items files to get metainfo for
127  * @return the MetaInfoJob to retrieve the items
128  * @deprecated use strigi or KFileMetaInfo
129  */
130 KDELIBS4SUPPORT_DEPRECATED_EXPORT MetaInfoJob *fileMetaInfo(const QList<QUrl> &items);
131 }
132 
133 #endif
Q_SCRIPTABLE Q_NOREPLY void start()
@ Everything
read everything, even if it might take a while
Definition: kfilemetainfo.h:88
MetaInfoJob is a KIO Job to retrieve meta information from files.
Definition: metainfojob.h:40
This file is part of the KDE documentation.
Documentation copyright © 1996-2023 The KDE developers.
Generated on Sun Dec 3 2023 04:00:05 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.