add more spacing
[personal-kdebase.git] / apps / lib / konq / konqmimedata.cpp
blobbcab0e45b25f001c191ec475c0d91f91667b2a3f
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>
22 #include <kdebug.h>
24 void KonqMimeData::populateMimeData( QMimeData* mimeData,
25 const KUrl::List& kdeURLs,
26 const KUrl::List& mostLocalURLs,
27 bool cut )
29 if (mostLocalURLs.isEmpty())
30 kdeURLs.populateMimeData(mimeData);
31 else
32 kdeURLs.populateMimeData(mostLocalURLs, mimeData);
34 addIsCutSelection(mimeData, cut);
36 // for compatibility reasons
37 QString application_x_qiconlist;
38 int items=qMax(kdeURLs.count(),mostLocalURLs.count());
39 for (int i=0;i<items;i++) {
40 int offset=i*16;
41 QString tmp("%1$@@$%2$@@$32$@@$32$@@$%3$@@$%4$@@$32$@@$16$@@$no data$@@$");
42 tmp=tmp.arg(offset).arg(offset).arg(offset).arg(offset+40);
43 application_x_qiconlist+=tmp;
45 mimeData->setData("application/x-qiconlist",application_x_qiconlist.toLatin1());
46 //kDebug(1203)<<"setting application/x-qiconlist to "<<application_x_qiconlist;
49 bool KonqMimeData::decodeIsCutSelection( const QMimeData *mimeData )
51 QByteArray a = mimeData->data( "application/x-kde-cutselection" );
52 if ( a.isEmpty() )
53 return false;
54 else
56 kDebug(1203) << "KonqDrag::decodeIsCutSelection : a=" << a;
57 return (a.at(0) == '1'); // true if 1
61 void KonqMimeData::addIsCutSelection(QMimeData* mimeData,
62 bool cut)
64 const QByteArray cutSelectionData = cut ? "1" : "0";
65 mimeData->setData("application/x-kde-cutselection", cutSelectionData);