1 /* This file is part of the KDE projects
2 Copyright (C) 2005 David Faure <faure@kde.org>
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.
9 This program 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 General Public License for more details.
14 You should have received a copy of the GNU General Public License
15 along with this program; see the file COPYING. If not, write to
16 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17 Boston, MA 02110-1301, USA.
20 #include "konqmimedata.h"
21 #include <QtCore/QMimeData>
24 void KonqMimeData::populateMimeData( QMimeData
* mimeData
,
25 const KUrl::List
& kdeURLs
,
26 const KUrl::List
& mostLocalURLs
,
29 mostLocalURLs
.populateMimeData( mimeData
);
31 if ( !kdeURLs
.isEmpty() )
33 QMimeData tmpMimeData
;
34 kdeURLs
.populateMimeData(&tmpMimeData
);
35 mimeData
->setData("application/x-kde-urilist",tmpMimeData
.data("text/uri-list"));
38 QByteArray cutSelectionData
= cut
? "1" : "0";
39 mimeData
->setData( "application/x-kde-cutselection", cutSelectionData
);
41 // for compatibility reasons
42 QString application_x_qiconlist
;
43 int items
=qMax(kdeURLs
.count(),mostLocalURLs
.count());
44 for (int i
=0;i
<items
;i
++) {
46 QString
tmp("%1$@@$%2$@@$32$@@$32$@@$%3$@@$%4$@@$32$@@$16$@@$no data$@@$");
47 tmp
=tmp
.arg(offset
).arg(offset
).arg(offset
).arg(offset
+40);
48 application_x_qiconlist
+=tmp
;
50 mimeData
->setData("application/x-qiconlist",application_x_qiconlist
.toLatin1());
51 kDebug(1203)<<"setting application/x-qiconlist to "<<application_x_qiconlist
;
55 bool KonqMimeData::decodeIsCutSelection( const QMimeData
*mimeData
)
57 QByteArray a
= mimeData
->data( "application/x-kde-cutselection" );
62 kDebug(1203) << "KonqDrag::decodeIsCutSelection : a=" << a
;
63 return (a
.at(0) == '1'); // true if 1