Baloo

kio_tags.h
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 BALOO_KIO_TAGS_H_
9#define BALOO_KIO_TAGS_H_
10
11#include <KFileMetaData/UserMetaData>
12#include <KIO/ForwardingWorkerBase>
13
14#include "query.h"
15
16namespace Baloo
17{
18
19class TagsProtocol : public KIO::ForwardingWorkerBase
20{
22public:
23 TagsProtocol(const QByteArray& pool_socket, const QByteArray& app_socket);
24 ~TagsProtocol() override;
25
26 enum UrlType {
27 InvalidUrl,
28 FileUrl,
29 TagUrl,
30 };
31 Q_ENUM(UrlType)
32
33 /**
34 * List all files and folders tagged with the corresponding tag, along with
35 * additional tags that can be used to filter the results
36 */
37 KIO::WorkerResult listDir(const QUrl& url) override;
38
39 /**
40 * Will be forwarded for files.
41 */
42 KIO::WorkerResult get(const QUrl& url) override;
43
44 /**
45 * Files and folders can be copied to the virtual folders resulting
46 * is assignment of the corresponding tag.
47 */
48 KIO::WorkerResult copy(const QUrl& src, const QUrl& dest, int permissions, KIO::JobFlags flags) override;
49
50 /**
51 * File renaming will be forwarded.
52 * Folder renaming results in renaming of the tag.
53 */
54 KIO::WorkerResult rename(const QUrl& src, const QUrl& dest, KIO::JobFlags flags) override;
55
56 /**
57 * File deletion means remocing the tag
58 * Folder deletion will result in deletion of the tag.
59 */
60 KIO::WorkerResult del(const QUrl& url, bool isfile) override;
61
62 /**
63 * Files will be forwarded.
64 * Tags will be created as virtual folders.
65 */
66 KIO::WorkerResult mimetype(const QUrl& url) override;
67
68 /**
69 * Virtual folders will be created.
70 */
71 KIO::WorkerResult mkdir(const QUrl& url, int permissions) override;
72
73 /**
74 * Files will be forwarded.
75 * Tags will be created as virtual folders.
76 */
77 KIO::WorkerResult stat(const QUrl& url) override;
78
79protected:
80 bool rewriteUrl(const QUrl& url, QUrl& newURL) override;
81
82private:
83 enum ParseFlags {
84 ChopLastSection,
85 LazyValidation,
86 };
87
88 struct ParseResult {
89 UrlType urlType = InvalidUrl;
90 QString decodedUrl;
91 QString tag;
92 QUrl fileUrl;
93 KFileMetaData::UserMetaData metaData = KFileMetaData::UserMetaData(QString());
94 Query query;
95 KIO::UDSEntryList pathUDSResults;
96 };
97
98 ParseResult parseUrl(const QUrl& url, const QList<ParseFlags> &flags = QList<ParseFlags>());
99 QStringList m_unassignedTags;
100};
101}
102
103#endif // BALOO_KIO_TAGS_H_
Implements storage for docIds without any associated data Instantiated for:
Definition coding.cpp:11
Q_ENUM(...)
Q_OBJECTQ_OBJECT
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Tue Mar 26 2024 11:20:16 by doxygen 1.10.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.