File indexing completed on 2024-05-05 03:52:17

0001 /*
0002     This file is part of the KDE Baloo Project
0003     SPDX-FileCopyrightText: 2013 Vishesh Handa <me@vhanda.in>
0004 
0005     SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
0006 */
0007 
0008 #ifndef KIO_TIMELINE_H_
0009 #define KIO_TIMELINE_H_
0010 
0011 #include <KIO/WorkerBase>
0012 
0013 #include <QDate>
0014 
0015 namespace Baloo
0016 {
0017 
0018 class TimelineProtocol : public KIO::WorkerBase
0019 {
0020 public:
0021     TimelineProtocol(const QByteArray& poolSocket, const QByteArray& appSocket);
0022     ~TimelineProtocol() override;
0023 
0024     /**
0025      * List all files and folders tagged with the corresponding tag.
0026      */
0027     KIO::WorkerResult listDir(const QUrl& url) override;
0028 
0029     /**
0030      * Files will be forwarded.
0031      * Folders will be created as virtual folders.
0032      */
0033     KIO::WorkerResult mimetype(const QUrl& url) override;
0034 
0035     /**
0036      * Files will be forwarded.
0037      * Folders will be created as virtual folders.
0038      */
0039     KIO::WorkerResult stat(const QUrl& url) override;
0040 
0041 private:
0042     void listDays(int month, int year);
0043     void listThisYearsMonths();
0044     bool filesInDate(const QDate& date);
0045 
0046     /// temp vars for the currently handled URL
0047     QDate m_date;
0048     QString m_filename;
0049 };
0050 }
0051 
0052 #endif // KIO_TIMELINE_H_