akonadi
#include <mimetypechecker.h>
Public Member Functions | |
| MimeTypeChecker () | |
| MimeTypeChecker (const MimeTypeChecker &other) | |
| ~MimeTypeChecker () | |
| void | addWantedMimeType (const QString &mimeType) |
| bool | containsWantedMimeType (const QStringList &mimeTypes) const |
| bool | isWantedCollection (const Collection &collection) const |
| bool | isWantedItem (const Item &item) const |
| bool | isWantedMimeType (const QString &mimeType) const |
| MimeTypeChecker & | operator= (const MimeTypeChecker &other) |
| void | removeWantedMimeType (const QString &mimeType) |
| void | setWantedMimeTypes (const QStringList &mimeTypes) |
| QStringList | wantedMimeTypes () const |
Static Public Member Functions | |
| static bool | isWantedCollection (const Collection &collection, const QString &wantedMimeType) |
| static bool | isWantedItem (const Item &item, const QString &wantedMimeType) |
Detailed Description
Helper for checking MIME types of Collections and Items.
When it is necessary to decide whether an item has a certain MIME type or whether a collection can contain a certain MIME type, direct string comparison might not render the desired result because MIME types can have aliases and be a node in an "inheritance" hierachy.
For example a check like this
would fail to detect "text/x-vcard" as being the same MIME type.
- Note
- KDE deals with this inside the KMimeType framework, this class is just a convenience helper for common Akonadi related checks.
Example: Checking whether an Akonadi::Item is contact MIME type
Example: Checking whether an Akonadi::Collection could contain calendar items
Example: Checking whether an Akonadi::Collection could contain Calendar Event items (i.e. KCal::Event), making use of the respective MIME type "subclassing" provided by Akonadi's MIME type extensions.
Example: Checking for items of more than one MIME type and treat one of them specially.
This class is implicitly shared.
- Since
- 4.3
Definition at line 109 of file mimetypechecker.h.
Constructor & Destructor Documentation
| MimeTypeChecker::MimeTypeChecker | ( | ) |
Creates an empty MIME type checker.
An empty checker will not report any items or collections as wanted.
Definition at line 29 of file mimetypechecker.cpp.
| MimeTypeChecker::MimeTypeChecker | ( | const MimeTypeChecker & | other | ) |
Creates a new MIME type checker from an other.
Definition at line 34 of file mimetypechecker.cpp.
| MimeTypeChecker::~MimeTypeChecker | ( | ) |
Destroys the MIME type checker.
Definition at line 39 of file mimetypechecker.cpp.
Member Function Documentation
| void MimeTypeChecker::addWantedMimeType | ( | const QString & | mimeType | ) |
Adds another MIME type to the list of wanted MIME types this instance checks against.
- Parameters
-
mimeType The MIME types to add to the checklist.
- See also
- setWantedMimeTypes()
Definition at line 62 of file mimetypechecker.cpp.
| bool MimeTypeChecker::containsWantedMimeType | ( | const QStringList & | mimeTypes | ) | const |
Checks whether any of the given MIME types is covered by one of the wanted MIME types.
- Parameters
-
mimeTypes The MIME types to check.
- Returns
trueif any of the MIME types inmimeTypesis coverd by one of the wanted MIME types,falseotherwise.
- Since
- 4.6
Definition at line 171 of file mimetypechecker.cpp.
| bool MimeTypeChecker::isWantedCollection | ( | const Collection & | collection | ) | const |
Checks whether a given collection has one of the wanted MIME types.
- Parameters
-
collection The collection to check the content MIME types of.
- Returns
trueif one of thecollectioncontent MIME types is one of the wanted ones,falseif non is, the collection is invalid or has an empty content MIME type list.
Definition at line 86 of file mimetypechecker.cpp.
|
static |
Checks whether a given collection has the given MIME type.
- Parameters
-
collection The collection to check the content MIME types of. wantedMimeType The MIME type to check against.
- Returns
trueif one of thecollectioncontent MIME types is the given wanted one,falseif it isn't, the collection is invalid or has an empty content MIME type list.
Definition at line 133 of file mimetypechecker.cpp.
| bool MimeTypeChecker::isWantedItem | ( | const Item & | item | ) | const |
Checks whether a given item has one of the wanted MIME types.
- Parameters
-
item The item to check the MIME type of.
- Returns
trueif theitemMIME type is one of the wanted ones,falseif it isn't, the item is invalid or has an empty MIME type.
- See also
- setWantedMimeTypes()
- Item::mimeType()
Definition at line 72 of file mimetypechecker.cpp.
|
static |
Checks whether a given item has the given wanted MIME type.
- Parameters
-
item The item to check the MIME type of. wantedMimeType The MIME type to check against.
- Returns
trueif theitemMIME type is the given one,falseif it isn't, the item is invalid or has an empty MIME type.
- See also
- setWantedMimeTypes()
- Item::mimeType()
Definition at line 110 of file mimetypechecker.cpp.
| bool MimeTypeChecker::isWantedMimeType | ( | const QString & | mimeType | ) | const |
Checks whether a given mime type is covered by one of the wanted MIME types.
- Parameters
-
mimeType The mime type to check.
- Returns
trueif the mime typemimeTypeis coverd by one of the wanted MIME types,falseotherwise.
- Since
- 4.6
Definition at line 166 of file mimetypechecker.cpp.
| MimeTypeChecker & MimeTypeChecker::operator= | ( | const MimeTypeChecker & | other | ) |
Assigns the other to this checker and returns a reference to this checker.
Definition at line 43 of file mimetypechecker.cpp.
| void MimeTypeChecker::removeWantedMimeType | ( | const QString & | mimeType | ) |
Removes a MIME type from the list of wanted MIME types this instance checks against.
- Parameters
-
mimeType The MIME type to remove from the checklist.
- See also
- addWantedMimeType()
Definition at line 67 of file mimetypechecker.cpp.
| void MimeTypeChecker::setWantedMimeTypes | ( | const QStringList & | mimeTypes | ) |
Sets the list of wanted MIME types this instance checks against.
- Parameters
-
mimeTypes The list of MIME types to check against.
- See also
- wantedMimeTypes()
Definition at line 57 of file mimetypechecker.cpp.
| QStringList MimeTypeChecker::wantedMimeTypes | ( | ) | const |
Returns the list of wanted MIME types this instance checks against.
- See also
- setWantedMimeTypes()
Definition at line 52 of file mimetypechecker.cpp.
The documentation for this class was generated from the following files:
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:38:05 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.
KDE API Reference