• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • applications API Reference
  • KDE Home
  • Contact Us
 

libkonq

  • sources
  • kde-4.12
  • applications
  • kde-baseapps
  • lib
  • konq
konqmimedata.cpp
Go to the documentation of this file.
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 #include "konqmimedata.h"
21 #include <QtCore/QMimeData>
22 #include <kdebug.h>
23 
24 void KonqMimeData::populateMimeData( QMimeData* mimeData,
25  const KUrl::List& kdeURLs,
26  const KUrl::List& mostLocalURLs,
27  bool cut )
28 {
29  if (mostLocalURLs.isEmpty())
30  kdeURLs.populateMimeData(mimeData);
31  else
32  kdeURLs.populateMimeData(mostLocalURLs, mimeData);
33 
34  addIsCutSelection(mimeData, cut);
35 
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;
44  }
45  mimeData->setData("application/x-qiconlist",application_x_qiconlist.toLatin1());
46  //kDebug(1203)<<"setting application/x-qiconlist to "<<application_x_qiconlist;
47 }
48 
49 bool KonqMimeData::decodeIsCutSelection( const QMimeData *mimeData )
50 {
51  QByteArray a = mimeData->data( "application/x-kde-cutselection" );
52  if ( a.isEmpty() )
53  return false;
54  else
55  {
56  kDebug(1203) << "KonqDrag::decodeIsCutSelection : a=" << a;
57  return (a.at(0) == '1'); // true if 1
58  }
59 }
60 
61 void KonqMimeData::addIsCutSelection(QMimeData* mimeData,
62  bool cut)
63 {
64  const QByteArray cutSelectionData = cut ? "1" : "0";
65  mimeData->setData("application/x-kde-cutselection", cutSelectionData);
66 }
konqmimedata.h
KonqMimeData::decodeIsCutSelection
static bool decodeIsCutSelection(const QMimeData *mimeData)
Definition: konqmimedata.cpp:49
KonqMimeData::populateMimeData
static void populateMimeData(QMimeData *mimeData, const KUrl::List &kdeURLs, const KUrl::List &mostLocalURLs, bool cut=false)
Populate a QMimeData with urls, and whether they were cut or copied.
Definition: konqmimedata.cpp:24
KonqMimeData::addIsCutSelection
static void addIsCutSelection(QMimeData *mimeData, bool cut)
Add the information whether the files were cut, into the mimedata.
Definition: konqmimedata.cpp:61
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:31:18 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

libkonq

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

applications API Reference

Skip menu "applications API Reference"
  •   kate
  •       kate
  •   KTextEditor
  •   Kate
  • Applications
  •   Libraries
  •     libkonq
  • Konsole

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal