• Skip to content
  • Skip to link menu
KDE 4.2 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     if (mostLocalURLs.isEmpty())
00030         kdeURLs.populateMimeData(mimeData);
00031     else
00032         kdeURLs.populateMimeData(mostLocalURLs, mimeData);
00033 
00034     addIsCutSelection(mimeData, cut);
00035 
00036     // for compatibility reasons
00037     QString application_x_qiconlist;
00038     int items=qMax(kdeURLs.count(),mostLocalURLs.count());
00039     for (int i=0;i<items;i++) {
00040     int offset=i*16;
00041     QString tmp("%1$@@$%2$@@$32$@@$32$@@$%3$@@$%4$@@$32$@@$16$@@$no data$@@$");
00042     tmp=tmp.arg(offset).arg(offset).arg(offset).arg(offset+40);
00043     application_x_qiconlist+=tmp;
00044     }
00045     mimeData->setData("application/x-qiconlist",application_x_qiconlist.toLatin1());
00046     //kDebug(1203)<<"setting application/x-qiconlist to "<<application_x_qiconlist;
00047 }
00048 
00049 bool KonqMimeData::decodeIsCutSelection( const QMimeData *mimeData )
00050 {
00051     QByteArray a = mimeData->data( "application/x-kde-cutselection" );
00052     if ( a.isEmpty() )
00053         return false;
00054     else
00055     {
00056         kDebug(1203) << "KonqDrag::decodeIsCutSelection : a=" << a;
00057         return (a.at(0) == '1'); // true if 1
00058     }
00059 }
00060 
00061 void KonqMimeData::addIsCutSelection(QMimeData* mimeData,
00062                                      bool cut)
00063 {
00064     const QByteArray cutSelectionData = cut ? "1" : "0";
00065     mimeData->setData("application/x-kde-cutselection", cutSelectionData);
00066 }

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.7
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