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

KDE3Support

Public Member Functions | Static Public Member Functions | Protected Member Functions | List of all members
K3URLDrag Class Reference

#include <k3urldrag.h>

Inheritance diagram for K3URLDrag:
Inheritance graph
[legend]

Public Member Functions

 K3URLDrag (const KUrl::List &urls, QWidget *dragSource=0)
 
 K3URLDrag (const KUrl::List &urls, const QMap< QString, QString > &metaData, QWidget *dragSource=0)
 
virtual ~K3URLDrag ()
 
virtual QByteArray encodedData (const char *mime) const
 
virtual const char * format (int i) const
 
QMap< QString, QString > & metaData ()
 
void setExportAsText (bool exp)
 
- Public Member Functions inherited from Q3UriDrag
 Q3UriDrag (const Q3StrList &uris, QWidget *dragSource, const char *name)
 
 Q3UriDrag (QWidget *dragSource, const char *name)
 
 ~Q3UriDrag ()
 
void setFilenames (const QString &name)
 
void setFileNames (const QStringList &filenames)
 
void setFileNames (const QString &name)
 
void setFilenames (const QStringList &list)
 
void setUnicodeUris (const QStringList &list)
 
virtual void setUris (const QList< QByteArray > &list)
 
- Public Member Functions inherited from Q3StoredDrag
 Q3StoredDrag (const char *mimeType, QWidget *dragSource, const char *name)
 
 ~Q3StoredDrag ()
 
virtual void setEncodedData (const QByteArray &data)
 
- Public Member Functions inherited from Q3DragObject
 Q3DragObject (QWidget *dragSource, const char *name)
 
virtual  ~Q3DragObject ()
 
bool drag ()
 
void dragCopy ()
 
void dragLink ()
 
bool dragMove ()
 
QPixmap pixmap () const
 
QPoint pixmapHotSpot () const
 
virtual void setPixmap (QPixmap pm)
 
virtual void setPixmap (QPixmap pm, const QPoint &hotspot)
 
QWidget * source ()
 
- Public Member Functions inherited from QObject
 QObject (QObject *parent)
 
 QObject (QObject *parent, const char *name)
 
virtual  ~QObject ()
 
bool blockSignals (bool block)
 
QObject * child (const char *objName, const char *inheritsClass, bool recursiveSearch) const
 
const QObjectList & children () const
 
const char * className () const
 
bool connect (const QObject *sender, const char *signal, const char *method, Qt::ConnectionType type) const
 
void deleteLater ()
 
void destroyed (QObject *obj)
 
bool disconnect (const QObject *receiver, const char *method)
 
bool disconnect (const char *signal, const QObject *receiver, const char *method)
 
void dumpObjectInfo ()
 
void dumpObjectTree ()
 
QList< QByteArray > dynamicPropertyNames () const
 
virtual bool event (QEvent *e)
 
virtual bool eventFilter (QObject *watched, QEvent *event)
 
T findChild (const QString &name) const
 
QList< T > findChildren (const QRegExp &regExp) const
 
QList< T > findChildren (const QString &name) const
 
bool inherits (const char *className) const
 
void insertChild (QObject *object)
 
void installEventFilter (QObject *filterObj)
 
bool isA (const char *className) const
 
bool isWidgetType () const
 
void killTimer (int id)
 
virtual const QMetaObject * metaObject () const
 
void moveToThread (QThread *targetThread)
 
const char * name () const
 
const char * name (const char *defaultName) const
 
QString objectName () const
 
QObject * parent () const
 
QVariant property (const char *name) const
 
void removeChild (QObject *object)
 
void removeEventFilter (QObject *obj)
 
void setName (const char *name)
 
void setObjectName (const QString &name)
 
void setParent (QObject *parent)
 
bool setProperty (const char *name, const QVariant &value)
 
bool signalsBlocked () const
 
int startTimer (int interval)
 
QThread * thread () const
 
- Public Member Functions inherited from QMimeSource
virtual  ~QMimeSource ()
 
virtual QByteArray encodedData (const char *format) const =0
 
virtual const char * format (int i) const =0
 
virtual bool provides (const char *mimeType) const
 

Static Public Member Functions

static bool decode (const QMimeSource *e, KUrl::List &urls)
 
static bool decode (const QMimeSource *e, KUrl::List &urls, QMap< QString, QString > &metaData)
 
static bool decode (QStringList const &e, KUrl::List &uris)
 
static K3URLDrag * newDrag (const KUrl::List &urls, QWidget *dragSource=0)
 
static K3URLDrag * newDrag (const KUrl::List &urls, const QMap< QString, QString > &metaData, QWidget *dragSource=0)
 
static KUrl stringToUrl (const QByteArray &s)
 
static QString urlToString (const KUrl &url)
 
- Static Public Member Functions inherited from Q3UriDrag
bool canDecode (const QMimeSource *source)
 
bool decode (const QMimeSource *source, Q3StrList &list)
 
bool decodeLocalFiles (const QMimeSource *source, QStringList &list)
 
bool decodeToUnicodeUris (const QMimeSource *source, QStringList &list)
 
QByteArray localFileToUri (const QString &filename)
 
QByteArray unicodeUriToUri (const QString &string)
 
QString uriToLocalFile (const char *string)
 
QString uriToUnicodeUri (const char *string)
 
- Static Public Member Functions inherited from Q3DragObject
QWidget * target ()
 
- Static Public Member Functions inherited from QObject
bool connect (const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type)
 
bool connect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method, Qt::ConnectionType type)
 
bool disconnect (const QObject *sender, const char *signal, const QObject *receiver, const char *method)
 
bool disconnect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method)
 
QString tr (const char *sourceText, const char *disambiguation, int n)
 
QString trUtf8 (const char *sourceText, const char *disambiguation, int n)
 

Protected Member Functions

 K3URLDrag (const Q3StrList &urls, const QMap< QString, QString > &metaData, QWidget *dragSource)
 
- Protected Member Functions inherited from Q3DragObject
virtual bool drag (DragMode mode)
 
- Protected Member Functions inherited from QObject
bool checkConnectArgs (const char *signal, const QObject *object, const char *method)
 
virtual void childEvent (QChildEvent *event)
 
virtual void connectNotify (const char *signal)
 
virtual void customEvent (QEvent *event)
 
virtual void disconnectNotify (const char *signal)
 
int receivers (const char *signal) const
 
QObject * sender () const
 
int senderSignalIndex () const
 
virtual void timerEvent (QTimerEvent *event)
 

Additional Inherited Members

- Static Protected Member Functions inherited from QObject
QByteArray normalizeSignalSlot (const char *signalSlot)
 
- Properties inherited from QObject
 objectName
 

Detailed Description

This class is to be used instead of Q3UriDrag when using KUrl.

The reason is: Q3UriDrag (and the XDND/W3C standards) expect URLs to be encoded in UTF-8 (unicode), but KUrl uses the current locale by default. The other reasons for using this class are:

  • it exports text/plain (for dropping/pasting into lineedits, mails etc.)
  • it has support for metadata, shipped as part of the dragobject This is important, for instance to set a correct HTTP referrer (some websites require it for downloading e.g. an image).

To create a drag object, use the K3URLDrag constructor. To handle drops, use Q3UriDrag::canDecode() and K3URLDrag::decode()

Definition at line 46 of file k3urldrag.h.

Constructor & Destructor Documentation

K3URLDrag::K3URLDrag ( const KUrl::List &  urls,
QWidget *  dragSource = 0 
)

Constructs an object to drag the list of URLs in urls.

The dragSource and name arguments are passed on to Q3UriDrag, and the list of urls is converted to UTF-8 before being passed to Q3UriDrag.

Parameters
urlsthe list of URLs
dragSourcethe parent of the QObject. Should be set when doing drag-n-drop, but should be 0 when copying to the clipboard

Definition at line 37 of file k3urldrag.cpp.

K3URLDrag::K3URLDrag ( const KUrl::List &  urls,
const QMap< QString, QString > &  metaData,
QWidget *  dragSource = 0 
)

Constructs an object to drag the list of URLs in urls.

This version also includes metadata.

Parameters
urlsthe list of URLs
metaDataa map containing meta data
dragSourcethe parent of the QObject. Should be set when doing drag-n-drop, but should be 0 when copying to the clipboard
See also
metaData()

Definition at line 43 of file k3urldrag.cpp.

K3URLDrag::~K3URLDrag ( )
virtual

Definition at line 51 of file k3urldrag.cpp.

K3URLDrag::K3URLDrag ( const Q3StrList &  urls,
const QMap< QString, QString > &  metaData,
QWidget *  dragSource 
)
protected
Deprecated:
Use a K3URLDrag constructor with a KUrl::List

Definition at line 282 of file k3urldrag.cpp.

Member Function Documentation

bool K3URLDrag::decode ( const QMimeSource *  e,
KUrl::List &  urls 
)
static

Convenience method that decodes the contents of e into a list of KUrls.

Decoding will fail if at least one decoded value is not a valid KUrl.

Parameters
ethe mime source
urlsthe list of urls will be written here
Returns
true if successful, false otherwise

Definition at line 93 of file k3urldrag.cpp.

bool K3URLDrag::decode ( const QMimeSource *  e,
KUrl::List &  urls,
QMap< QString, QString > &  metaData 
)
static

Convenience method that decodes the contents of e into a list of KUrls and a set of metadata.

Decoding will fail if at least one decoded value is not a valid KUrl. You should be using this one, if possible.

Parameters
ethe mime source
urlsthe list of urls will be written here
metaDatathe metadata map will be written here
Returns
true if successful, false otherwise

Definition at line 136 of file k3urldrag.cpp.

static bool K3URLDrag::decode ( QStringList const &  e,
KUrl::List &  uris 
)
static

Convenience method that decodes the contents of e into a list of KUrls for Qt versions without a MIME clipboard.

Decoding will fail if at least one value in the list is not a valid KUrl.

QByteArray K3URLDrag::encodedData ( const char *  mime) const
virtual
Reimplemented from superclass.

Reimplemented from Q3StoredDrag.

Definition at line 181 of file k3urldrag.cpp.

const char * K3URLDrag::format ( int  i) const
virtual
Reimplemented from superclass.

Reimplemented from Q3StoredDrag.

Definition at line 164 of file k3urldrag.cpp.

QMap< QString, QString > & K3URLDrag::metaData ( )

Meta-data to associate with those URLs.

This is an alternative way of setting the metadata: either use the constructor to pass it all at once, or use drag->metaData()["key"] = data;

See also
KIO::TransferJob

Definition at line 88 of file k3urldrag.cpp.

K3URLDrag * K3URLDrag::newDrag ( const KUrl::List &  urls,
QWidget *  dragSource = 0 
)
static
Deprecated:
Is equivalent with "new K3URLDrag(urls, dragSource, name)".

Definition at line 77 of file k3urldrag.cpp.

K3URLDrag * K3URLDrag::newDrag ( const KUrl::List &  urls,
const QMap< QString, QString > &  metaData,
QWidget *  dragSource = 0 
)
static
Deprecated:
Is equivalent with "new K3URLDrag(urls, metaData, dragSource, name)".

Definition at line 82 of file k3urldrag.cpp.

void K3URLDrag::setExportAsText ( bool  exp)

By default, K3URLDrag also exports the URLs as plain text, for e.g.

dropping onto a text editor. But in some cases this might not be wanted, e.g. if using the K3URLDrag in a KMultipleDrag and another component of the multiple-drag provides better plain text data. In such a case, setExportAsText( false ) should be called.

Definition at line 69 of file k3urldrag.cpp.

KUrl K3URLDrag::stringToUrl ( const QByteArray &  s)
static

Converts a string used for dragging to a URL.

Definition at line 243 of file k3urldrag.cpp.

QString K3URLDrag::urlToString ( const KUrl &  url)
static

Converts a URL to a string representation suitable for dragging.

Definition at line 251 of file k3urldrag.cpp.


The documentation for this class was generated from the following files:
  • k3urldrag.h
  • k3urldrag.cpp
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:26:48 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

KDE3Support

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

kdelibs API Reference

Skip menu "kdelibs API Reference"
  • DNSSD
  • Interfaces
  •   KHexEdit
  •   KMediaPlayer
  •   KSpeech
  •   KTextEditor
  • kconf_update
  • KDE3Support
  •   KUnitTest
  • KDECore
  • KDED
  • KDEsu
  • KDEUI
  • KDEWebKit
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • kio
  • KIOSlave
  • KJS
  •   KJS-API
  •   WTF
  • kjsembed
  • KNewStuff
  • KParts
  • KPty
  • Kross
  • KUnitConversion
  • KUtils
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver

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