| 1 | /* |
| 2 | This file is part of the KDE Baloo Project |
| 3 | SPDX-FileCopyrightText: 2013 Vishesh Handa <me@vhanda.in> |
| 4 | |
| 5 | SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL |
| 6 | */ |
| 7 | |
| 8 | #ifndef KIO_TIMELINE_H_ |
| 9 | #define KIO_TIMELINE_H_ |
| 10 | |
| 11 | #include <KIO/WorkerBase> |
| 12 | |
| 13 | #include <QDate> |
| 14 | |
| 15 | namespace Baloo |
| 16 | { |
| 17 | |
| 18 | class TimelineProtocol : public KIO::WorkerBase |
| 19 | { |
| 20 | public: |
| 21 | TimelineProtocol(const QByteArray& poolSocket, const QByteArray& appSocket); |
| 22 | ~TimelineProtocol() override; |
| 23 | |
| 24 | /** |
| 25 | * List all files and folders tagged with the corresponding tag. |
| 26 | */ |
| 27 | KIO::WorkerResult listDir(const QUrl& url) override; |
| 28 | |
| 29 | /** |
| 30 | * Files will be forwarded. |
| 31 | * Folders will be created as virtual folders. |
| 32 | */ |
| 33 | KIO::WorkerResult mimetype(const QUrl& url) override; |
| 34 | |
| 35 | /** |
| 36 | * Files will be forwarded. |
| 37 | * Folders will be created as virtual folders. |
| 38 | */ |
| 39 | KIO::WorkerResult stat(const QUrl& url) override; |
| 40 | |
| 41 | private: |
| 42 | void listDays(int month, int year); |
| 43 | void listThisYearsMonths(); |
| 44 | bool filesInDate(const QDate& date); |
| 45 | |
| 46 | /// temp vars for the currently handled URL |
| 47 | QDate m_date; |
| 48 | QString m_filename; |
| 49 | }; |
| 50 | } |
| 51 | |
| 52 | #endif // KIO_TIMELINE_H_ |
| 53 | |