KDE3Support
#include <k3urldrag.h>
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) |
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) |
Protected Member Functions | |
K3URLDrag (const Q3StrList &urls, const QMap< QString, QString > &metaData, QWidget *dragSource) | |
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
-
urls the list of URLs dragSource the 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
-
urls the list of URLs metaData a map containing meta data dragSource the 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.
|
virtual |
Definition at line 51 of file k3urldrag.cpp.
|
protected |
- Deprecated:
- Use a K3URLDrag constructor with a KUrl::List
Definition at line 282 of file k3urldrag.cpp.
Member Function Documentation
|
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
-
e the mime source urls the list of urls will be written here
- Returns
- true if successful, false otherwise
Definition at line 93 of file k3urldrag.cpp.
|
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
-
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
Definition at line 136 of file k3urldrag.cpp.
|
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.
|
virtual |
- Reimplemented from superclass.
Definition at line 181 of file k3urldrag.cpp.
|
virtual |
- Reimplemented from superclass.
Definition at line 164 of file k3urldrag.cpp.
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.
|
static |
- Deprecated:
- Is equivalent with "new K3URLDrag(urls, dragSource, name)".
Definition at line 77 of file k3urldrag.cpp.
|
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.
|
static |
Converts a string used for dragging to a URL.
Definition at line 243 of file k3urldrag.cpp.
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:
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:51:59 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.