1 | /* |
2 | * This file is part of the KDE Baloo Project |
3 | * Copyright (C) 2013 Vishesh Handa <me@vhanda.in> |
4 | * |
5 | * This library is free software; you can redistribute it and/or |
6 | * modify it under the terms of the GNU Lesser General Public |
7 | * License as published by the Free Software Foundation; either |
8 | * version 2.1 of the License, or (at your option) version 3, or any |
9 | * later version accepted by the membership of KDE e.V. (or its |
10 | * successor approved by the membership of KDE e.V.), which shall |
11 | * act as a proxy defined in Section 6 of version 3 of the license. |
12 | * |
13 | * This library is distributed in the hope that it will be useful, |
14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
16 | * Lesser General Public License for more details. |
17 | * |
18 | * You should have received a copy of the GNU Lesser General Public |
19 | * License along with this library. If not, see <http://www.gnu.org/licenses/>. |
20 | * |
21 | */ |
22 | |
23 | #ifndef _BALOO_FILEFETCHJOB_H |
24 | #define _BALOO_FILEFETCHJOB_H |
25 | |
26 | #include "file_export.h" |
27 | #include <KJob> |
28 | |
29 | namespace Baloo { |
30 | |
31 | class File; |
32 | |
33 | /** |
34 | * The FileFetchJob is responsible for fetching the indexed |
35 | * metadata for a particular file. If the file does not |
36 | * contain any indexed metadata then no data will be returned. |
37 | * However, the file will be sent for indexing. |
38 | */ |
39 | class BALOO_FILE_EXPORT FileFetchJob : public KJob |
40 | { |
41 | Q_OBJECT |
42 | public: |
43 | FileFetchJob(const QString& url, QObject* parent = 0); |
44 | FileFetchJob(const File& file, QObject* parent = 0); |
45 | FileFetchJob(const QStringList& urls, QObject* parent = 0); |
46 | ~FileFetchJob(); |
47 | |
48 | virtual void start(); |
49 | |
50 | enum Errors { |
51 | Error_FileDoesNotExist = 1, |
52 | Error_InvalidId |
53 | }; |
54 | |
55 | File file() const; |
56 | QList<File> files() const; |
57 | |
58 | Q_SIGNALS: |
59 | void fileReceived(const Baloo::File& file); |
60 | |
61 | private Q_SLOTS: |
62 | void doStart(); |
63 | |
64 | private: |
65 | class Private; |
66 | Private* d; |
67 | }; |
68 | |
69 | } |
70 | |
71 | #endif // _BALOO_FILEFETCHJOB_H |
72 | |