1/* This file is part of the KDE projects
2 Copyright (C) 2005 David Faure <faure@kde.org>
3
4 This library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Library General Public
6 License as published by the Free Software Foundation; either
7 version 2 of the License, or (at your option) any later version.
8
9 This library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Library General Public License for more details.
13
14 You should have received a copy of the GNU Library General Public License
15 along with this library; see the file COPYING.LIB. If not, write to
16 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17 Boston, MA 02110-1301, USA.
18*/
19
20#ifndef KONQMIMEDATA_H
21#define KONQMIMEDATA_H
22
23#include <libkonq_export.h>
24#include <kurl.h>
25class QMimeData;
26
27/**
28 * This class provides functions for creating and decoding clipboard/drag-n-drop data
29 * of URLs. In particular it ships: (kde) urls, most-local urls, and an "is cut" boolean.
30 */
31class LIBKONQ_EXPORT KonqMimeData
32{
33public:
34 /**
35 * Populate a QMimeData with urls, and whether they were cut or copied.
36 *
37 * @param mimeData pointer to the mimeData object to be populated.
38 * Must not be 0.
39 * @param kdeURLs list of urls (which can include kde-specific protocols).
40 * This list can be empty if only local urls are being used anyway.
41 * @param mostLocalURLs "most local urls" (which try to resolve those to file:/ where possible),
42 * @param cut if true, the user selected "cut" (saved as application/x-kde-cutselection in the mimedata).
43 */
44 static void populateMimeData( QMimeData* mimeData,
45 const KUrl::List& kdeURLs,
46 const KUrl::List& mostLocalURLs,
47 bool cut = false );
48
49 /**
50 * Add the information whether the files were cut, into the mimedata.
51 * @param mimeData pointer to the mimeData object to be populated.
52 * Must not be 0.
53 * @param cut if true, the user selected "cut" (saved as application/x-kde-cutselection in the mimedata).
54 * @since 4.2
55 */
56 static void addIsCutSelection(QMimeData* mimeData,
57 bool cut);
58
59 /**
60 * @return true if the urls in @p mimeData were cut
61 */
62 static bool decodeIsCutSelection( const QMimeData *mimeData );
63};
64
65#endif /* KONQMIMEDATA_H */
66
67