• Skip to content
  • Skip to link menu
KDE 4.1 API Reference
  • KDE API Reference
  • API Reference
  • Sitemap
  • Contact Us
 

libkonq

konqmimedata.cpp

Go to the documentation of this file.
00001 /* This file is part of the KDE projects
00002    Copyright (C) 2005 David Faure <faure@kde.org>
00003 
00004    This library is free software; you can redistribute it and/or
00005    modify it under the terms of the GNU Library General Public
00006    License as published by the Free Software Foundation; either
00007    version 2 of the License, or (at your option) any later version.
00008 
00009    This program is distributed in the hope that it will be useful,
00010    but WITHOUT ANY WARRANTY; without even the implied warranty of
00011    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00012     General Public License for more details.
00013 
00014    You should have received a copy of the GNU General Public License
00015    along with this program; see the file COPYING.  If not, write to
00016    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00017    Boston, MA 02110-1301, USA.
00018 */
00019 
00020 #include "konqmimedata.h"
00021 #include <QtCore/QMimeData>
00022 #include <kdebug.h>
00023 
00024 void KonqMimeData::populateMimeData( QMimeData* mimeData,
00025                                      const KUrl::List& kdeURLs,
00026                                      const KUrl::List& mostLocalURLs,
00027                                      bool cut )
00028 {
00029     mostLocalURLs.populateMimeData( mimeData );
00030 
00031     if ( !kdeURLs.isEmpty() )
00032     {
00033         QMimeData tmpMimeData;
00034         kdeURLs.populateMimeData(&tmpMimeData);
00035         mimeData->setData("application/x-kde-urilist",tmpMimeData.data("text/uri-list"));
00036     }
00037 
00038     QByteArray cutSelectionData = cut ? "1" : "0";
00039     mimeData->setData( "application/x-kde-cutselection", cutSelectionData );
00040 
00041     // for compatibility reasons
00042     QString application_x_qiconlist;
00043     int items=qMax(kdeURLs.count(),mostLocalURLs.count());
00044     for (int i=0;i<items;i++) {
00045     int offset=i*16;
00046     QString tmp("%1$@@$%2$@@$32$@@$32$@@$%3$@@$%4$@@$32$@@$16$@@$no data$@@$");
00047     tmp=tmp.arg(offset).arg(offset).arg(offset).arg(offset+40);
00048     application_x_qiconlist+=tmp;
00049     }
00050     mimeData->setData("application/x-qiconlist",application_x_qiconlist.toLatin1());
00051     kDebug(1203)<<"setting application/x-qiconlist to "<<application_x_qiconlist;
00052 
00053 }
00054 
00055 bool KonqMimeData::decodeIsCutSelection( const QMimeData *mimeData )
00056 {
00057     QByteArray a = mimeData->data( "application/x-kde-cutselection" );
00058     if ( a.isEmpty() )
00059         return false;
00060     else
00061     {
00062         kDebug(1203) << "KonqDrag::decodeIsCutSelection : a=" << a;
00063         return (a.at(0) == '1'); // true if 1
00064     }
00065 }

libkonq

Skip menu "libkonq"
  • Main Page
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Class Members
  • Related Pages

API Reference

Skip menu "API Reference"
  • Konsole
  • Libraries
  •   libkonq
Generated for API Reference by doxygen 1.5.4
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal