KFileMetaData

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

KDE's Doxygen guidelines are available online.