Akonadi

gidextractor.cpp
1/*
2 SPDX-FileCopyrightText: 2013 Christian Mollekopf <mollekopf@kolabsys.com>
3
4 SPDX-License-Identifier: LGPL-2.0-or-later
5*/
6#include "gidextractor_p.h"
7#include "gidextractorinterface.h"
8
9#include "item.h"
10#include "typepluginloader_p.h"
11
12using namespace Akonadi;
13
14QString GidExtractor::extractGid(const Item &item)
15{
16 const QObject *object = TypePluginLoader::objectForMimeTypeAndClass(item.mimeType(), item.availablePayloadMetaTypeIds());
17 if (object) {
18 const GidExtractorInterface *extractor = qobject_cast<const GidExtractorInterface *>(object);
19 if (extractor) {
20 return extractor->extractGid(item);
21 }
22 }
23 return QString();
24}
25
26QString GidExtractor::getGid(const Item &item)
27{
28 const QString gid = item.gid();
29 if (!gid.isNull()) {
30 return gid;
31 }
32 if (item.loadedPayloadParts().isEmpty()) {
33 return QString();
34 }
35 return extractGid(item);
36}
An interface to extract the GID of an object contained in an akonadi item.
virtual QString extractGid(const Item &item) const =0
Extracts the globally unique id of item.
Helper integration between Akonadi and Qt.
bool isNull() const const
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Sat Dec 21 2024 17:01:42 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.