class KURLDrag

# class KURLDrag | This class is to be used instead of QUriDrag when using KURL. More...
Definition | `#include <kurldrag.h>`
Inherits | QUriDrag (qt) [public ]
List of all Methods
Annotated List
Files
Globals
Hierarchy
Index

#### Public Methods

- KURLDrag ( const KURL::List &urls, QWidget* dragSource, const char * name )
- KURLDrag ( const KURL::List &urls, const QMap<QString, QString>& metaData, QWidget* dragSource, const char * name )
- virtual ~KURLDrag ()
- QMap<QString, QString> & metaData ()

#### Public Static Methods

- static KURLDrag * newDrag ( const KURL::List &urls, QWidget* dragSource = 0, const char * name = 0 )
- static KURLDrag * newDrag ( const KURL::List &urls, const QMap<QString, QString>& metaData, QWidget* dragSource = 0, const char * name = 0 )
- 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 )

#### Protected Methods

- KURLDrag ( const QStrList & urls, const QMap<QString,QString>& metaData, QWidget * dragSource, const char* name )
- virtual const char * format ( int i ) const
- virtual QByteArray encodedData ( const char* mime ) const

## Detailed Description

This class is to be used instead of QUriDrag when using KURL. The reason is: QUriDrag (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 KURLDrag::newDrag() with a list of KURLs. To decode a drop, use KURLDrag::decode() or QUriDrag::decodeLocalFiles().

KURLDrag ( const KURL::List &urls, QWidget* dragSource, const char * name ) | ### KURLDrag

Constructs an object to drag the list of URLs in `urls`. The `dragSource` and `name` arguments are passed on to QUriDrag, and the list of urls is converted to UTF-8 before being passed to QUriDrag.

Parameters:

urls | the list of URLs
dragSource | the parent of the QObject
name | the name of the QObject

KURLDrag ( const KURL::List &urls, const QMap<QString, QString>& metaData, QWidget* dragSource, const char * name ) | ### KURLDrag

Constructs an object to drag the list of URLs in `urls`. This version also includes metadata.

Parameters:

urls | the list of URLs
metaData | a map containing meta data
dragSource | the parent of the QObject
name | the name of the QObject

See also: metaData()

~KURLDrag () | ### ~KURLDrag

[virtual]

KURLDrag * newDrag ( const KURL::List &urls, QWidget* dragSource = 0, const char * name = 0 ) | ### newDrag

[static]

KURLDrag * newDrag ( const KURL::List &urls, const QMap<QString, QString>& metaData, QWidget* dragSource = 0, const char * name = 0 ) | ### newDrag

[static]

QMap<QString, QString> & metaData () | ### metaData

Meta-data to associate with those URLs (to be used after newDrag). 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

bool decode ( const QMimeSource *e, KURL::List &urls ) | ### decode

[static]

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

Parameters:

e | the mime source
urls | the list of urls will be written here

Returns: true if successful, false otherwise

bool decode ( const QMimeSource *e, KURL::List &urls, QMap<QString,QString>& metaData ) | ### decode

[static]

Convenience method that decodes the contents of `e` into a list of KURLs and a set of metadata. You should be using this one, if possible.

Parameters:

e | the mime source
urls | the list of urls will be written here
metaData | the metadata map will be written here

Returns: true if successful, false otherwise

bool decode ( QStringList const &e, KURL::List &uris ) | ### decode

[static]

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

KURLDrag ( const QStrList & urls, const QMap<QString,QString>& metaData, QWidget * dragSource, const char* name ) | ### KURLDrag

[protected]

Protected constructor - use newDrag

const char * format ( int i ) | ### format

[protected const virtual]

QByteArray encodedData ( const char* mime ) | ### encodedData

[protected const virtual]

Generated by: root on macppc.ports.openbsd.org on Sat Sep 6 10:36:15 2003, using kdoc 2.0a54.