MauiKit File Browsing
tagging.h
34 * @brief The Tagging class provides quick methods to access and modify the tags associated to the files.
36 * @note This class follows a singleton pattern and it is thread safe, by creating a new instance for each new thread that request access to the singleton. All of the internal instances are self-handled and destroyed when the application quits.
38 * Graphical interfaces are provided which implement most of this class functionality and can be quickly used:
75 * @brief Retrieve the information into a model, optionally you can pass a modifier callback function to manipulate or discard items in the model
77 * @param modifier a callback function that sends as an argument a reference to the current item being retrieved, which can be modified in-place, and expects a boolean value to be returned to decide if such item should de added to the model or not
80 const QVariantList get(const QString &query, std::function<bool(QVariantMap &item)> modifier = nullptr);
83 * @brief Checks if a given tag exists, it can be strictly enforced, meaning it is checked if the tag was created by the application making the request
85 * @param strict whether the search should be strictly enforced. If strict is true then the tag should have been created by the app making the request, otherwise checks if the tag exists and could have been created by any other application.
91 * @brief Checks if a given tag is associated to a give file URL. The check can be strictly enforced, meaning the given URL was tagged by the application making the request
101 * @brief Adds a new tag, the newly created tag gets associated to the app making the call. If the tag already exists nothing is changed. If the tag exists the app making the request will get associated to the tag too
107 bool tag(const QString &tag, const QString &color = QString(), const QString &comment = QString());
117 bool tagUrl(const QString &url, const QString &tag, const QString &color = QString(), const QString &comment = QString());
121 * @brief Updates the tags associated to a file URL. If any of the given tags doesn't exists then they get created, if a tag associated to the current file URL is missing in the new passed tags then those get removed
129 * @brief Updates a file URL to a new URL, preserving all associated tags. This is useful if a file is rename or moved to a new location
146 * @brief Returns a list model of all the tags. The model can be strictly enforced to only tags that were created by the application making the call
153 * @brief Returns a model of all the file URLs associated to a tag, the result can be strictly enforced to only file URLs associated to a tag created by the application making the request, restrict it to a maximum limit, filter by the mime-type or just add a modifier function
155 * @param strict strictly enforced to only file URLs associated to the given tag created by the application making the request
158 * @param modifier a callback function that sends as an argument a reference to the current item being retrieved, which can be modified, and expects a boolean value to be returned to decide if such item should be added to the model or not
161 QVariantList getUrls(const QString &tag, const bool &strict = false, const int &limit = MAX_LIMIT, const QString &mimeType = QStringLiteral(""), std::function<bool(QVariantMap &item)> modifier = nullptr);
164 * @brief Returns a model list of all the tags associated to a file URL. The result can be strictly enforced to only tags created by the application making the call
200 * @brief Checks if a file URL has been marked as favorite. This works if the tagging component has been enabled, otherwise returns false as default.
202 * @param strict strictly check if the file has been marked as favorite by the app making the request or not
208 * @brief If the given file has been marked as favorite then the tag is removed. This works if the tagging component has been enabled, otherwise returns false as default.
215 * @brief Marks a file URL as favorite. This works if the tagging component has been enabled, otherwise returns false as default.
222 * @brief Toggle the fav tag of a given file, meaning, if a file is marked as fav then the tag gets removed and if it is not marked then the fav tag gets added.
229 * @brief Shortcut for getting a list of file URLs associated to a tag, the resulting list of URLs can be filtered by regular expression or by mime-type and limited
232 * @param strict if strict then the URLs returned are only associated to the application making the call, meaning, that such tag was added by such application only.
234 * @param mime the mime-type filtering, for example, `"image/\*"` or `"image/png"`, `"audio/mp4"`
237 QList<QUrl> getTagUrls(const QString &tag, const QStringList &filters, const bool &strict = false, const int &limit = 9999, const QString &mime = QStringLiteral(""));
The TAGDB class exposes methods to add, remove and modify tags in the MauiKit FileBrowsing Tagging sy...
Definition tagdb.h:56
The Tagging class provides quick methods to access and modify the tags associated to the files.
Definition tagging.h:43
void urlTagged(QString url, QString tag)
Emitted when a tag has been assigened to a file URL.
void urlTagRemoved(QString tag, QString url)
Emitted when a tag has been dissociated from a file URL.
void urlRemoved(QString url)
Emitted when a file has been removed a thus all associations to any tag.
CppOwnership
void setObjectOwnership(QObject *object, ObjectOwnership ownership)
Q_SIGNALSQ_SIGNALS
Q_SLOTSQ_SLOTS
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri Dec 27 2024 11:48:47 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri Dec 27 2024 11:48:47 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.