KContacts

vcarddrag.h
1/*
2 This file is part of the KContacts framework.
3
4 SPDX-FileCopyrightText: 2002-2010 Tobias Koenig <tokoe@kde.org>
5
6 SPDX-License-Identifier: LGPL-2.0-or-later
7*/
8
9#ifndef KCONTACTS_VCARDDRAG_H
10#define KCONTACTS_VCARDDRAG_H
11
12#include "kcontacts_export.h"
13
14#include <QMimeData>
15#include <kcontacts/addressee.h>
16
17namespace KContacts
18{
19/**
20 @brief Utility function for implementing drag&drop for vCards
21
22 See the Qt drag'n'drop documentation.
23
24 @since 4.5
25*/
26namespace VCardDrag
27{
28/**
29 Adds the vCard representation as data of the drag object.
30
31 @param md the object to set the data on
32 @param content the vCard data to set
33
34 @return Always @c true
35*/
36KCONTACTS_EXPORT bool populateMimeData(QMimeData *md, const QByteArray &content);
37
38/**
39 Adds the vCard representation as data of the drag object.
40
41 @param md the object to set the data on
42 @param contacts list of Addressee objects to serialize to vCard
43
44 @return @c true if serializing of the given list worked, otherwise @c false
45
46 @see VCardConverter::createVCards()
47*/
48KCONTACTS_EXPORT bool populateMimeData(QMimeData *md, const KContacts::Addressee::List &contacts);
49
50/**
51 Returns if drag&drop object can be decoded to vCard.
52
53 @param md the object to check for vCard data
54
55 @return @c true if the given data object contains a vCard MIME type, otherwise @c false
56*/
57KCONTACTS_EXPORT bool canDecode(const QMimeData *md);
58
59/**
60 Decodes the drag&drop object to vCard component @p content.
61
62 @param md the object to check for vCard data
63 @param content where to put the vCard data from @p md
64
65 @return @c true if there was data for the vCard MIME type, otherwise @c false
66
67 @see canDecode()
68*/
69KCONTACTS_EXPORT bool fromMimeData(const QMimeData *md, QByteArray &content);
70
71/**
72 Decodes the MIME data @p md and puts the resulting vCard into @p contacts.
73
74 @param md the object to check for vCard data
75 @param contacts where to put the parsed vCards from @p md
76
77 @return @c true if there was data for the vCard MIME type and it could be parsed successfully,
78 otherwise @c false
79
80 @see canDecode()
81*/
82KCONTACTS_EXPORT bool fromMimeData(const QMimeData *md, KContacts::Addressee::List &contacts);
83}
84}
85
86#endif // VCARDDRAG_H
KCONTACTS_EXPORT bool canDecode(const QMimeData *md)
Returns if drag&drop object can be decoded to vCard.
Definition vcarddrag.cpp:56
KCONTACTS_EXPORT bool fromMimeData(const QMimeData *md, QByteArray &content)
Decodes the drag&drop object to vCard component content.
Definition vcarddrag.cpp:61
KCONTACTS_EXPORT bool populateMimeData(QMimeData *md, const QByteArray &content)
Adds the vCard representation as data of the drag object.
Definition vcarddrag.cpp:39
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri Nov 8 2024 11:58:37 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.