KFileMetaData

usermetadata.h
1/*
2 SPDX-FileCopyrightText: 2014 Vishesh Handa <me@vhanda.in>
3
4 SPDX-License-Identifier: LGPL-2.1-or-later
5*/
6
7#ifndef KFILEMETADATA_USERMETADATA_H
8#define KFILEMETADATA_USERMETADATA_H
9
10#include "kfilemetadata_export.h"
11#include <QStringList>
12#include <QUrl>
13
14#include <memory>
15
16namespace KFileMetaData {
17
18class UserMetaDataPrivate;
19/**
20 * \class UserMetaData usermetadata.h <KFileMetaData/UserMetaData>
21 */
22class KFILEMETADATA_EXPORT UserMetaData {
23public:
24 UserMetaData(const QString &filePath);
25 UserMetaData(const UserMetaData &rhs);
26 virtual ~UserMetaData();
27
28 enum Error {
29 NoError = 0
30 };
31
32 /**
33 * @see Attributes
34 */
35 enum Attribute : uint32_t {
36 None = 0x0,
37 Any = None,
38 Tags = 0x1,
39 Rating = 0x2,
40 Comment = 0x4,
41 OriginUrl = 0x8,
42 OriginEmailSubject = 0x10,
43 OriginEmailSender = 0x20,
45 Other = 0xffffff80,
46 All = 0xffffffff,
47 };
48 /**
49 * Stores a combination of #Attribute values.
50 */
51 Q_DECLARE_FLAGS(Attributes, Attribute)
52
53 const UserMetaData& operator =(const UserMetaData& rhs);
54
55 QString filePath() const;
56 bool isSupported() const;
57
58 Error setTags(const QStringList& tags);
59 QStringList tags() const;
60
61 int rating() const;
62 Error setRating(int rating);
63
64 QString userComment() const;
65 Error setUserComment(const QString& userComment);
66
67 QUrl originUrl() const;
68 Error setOriginUrl(const QUrl &originUrl);
69
70 QString originEmailSubject() const;
71 Error setOriginEmailSubject(const QString &originEmailSubject);
72
73 QString originEmailSender() const;
74 Error setOriginEmailSender(const QString &originEmailSender);
75
76 QString originEmailMessageId() const;
77 Error setOriginEmailMessageId(const QString &originEmailMessageId);
78
79 QString attribute(const QString& name);
80 Error setAttribute(const QString& name, const QString& value);
81 bool hasAttribute(const QString& name);
82
83 /**
84 * Query list of available attributes
85 *
86 * Checks for the availability of the given \p attributes. May return
87 * a superset of the input value when the file has attributes set
88 * beyond the requested ones.
89 *
90 * If the input attribute mask is Attribute::Any, either Attribute::None
91 * (the file has no user attributes) or Attribute::All (the file has at
92 * least one attribute set) is returned.
93 *
94 * \since 5.60
95 */
96 Attributes queryAttributes(Attributes attributes = Attribute::Any) const;
97
98private:
99 const std::unique_ptr<UserMetaDataPrivate> d;
100};
101
102Q_DECLARE_OPERATORS_FOR_FLAGS(UserMetaData::Attributes)
103}
104
105#endif // KFILEMETADATA_USERMETADATA_H
QCA_EXPORT bool isSupported(const char *features, const QString &provider=QString())
@ Rating
For ratings stored in Metadata tags.
Definition properties.h:320
@ Comment
Represents a comment stored in the file.
Definition properties.h:74
@ OriginEmailSender
The sender of the email this file was originally attached to.
Definition properties.h:260
@ OriginUrl
The URL this file has originally been downloaded from.
Definition properties.h:250
@ OriginEmailSubject
The subject of the email this file was originally attached to.
Definition properties.h:255
@ OriginEmailMessageId
The message ID of the email this file was originally attached to.
Definition properties.h:265
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Tue Mar 26 2024 11:17:54 by doxygen 1.10.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.