• Skip to content
  • Skip to link menu
Trinity API Reference
  • Trinity API Reference
  • tdecore
 

tdecore

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

#include <kurldrag.h>

Inherits TQUriDrag.

Public Member Functions

 KURLDrag (const KURL::List &urls, TQWidget *dragSource=0, const char *name=0)
 
 KURLDrag (const KURL::List &urls, const TQMap< TQString, TQString > &metaData, TQWidget *dragSource=0, const char *name=0)
 
void setExportAsText (bool exp)
 
TQMap< TQString, TQString > & metaData ()
 
virtual const char * format (int i) const
 
virtual TQByteArray encodedData (const char *mime) const
 

Static Public Member Functions

static KURLDrag * newDrag (const KURL::List &urls, TQWidget *dragSource=0, const char *name=0) TDE_DEPRECATED
 
static KURLDrag * newDrag (const KURL::List &urls, const TQMap< TQString, TQString > &metaData, TQWidget *dragSource=0, const char *name=0) TDE_DEPRECATED
 
static bool decode (const TQMimeSource *e, KURL::List &urls)
 
static bool decode (const TQMimeSource *e, KURL::List &urls, TQMap< TQString, TQString > &metaData)
 
static TQString urlToString (const KURL &url)
 
static KURL stringToUrl (const TQCString &s)
 

Protected Member Functions

 KURLDrag (const TQStrList &urls, const TQMap< TQString, TQString > &metaData, TQWidget *dragSource, const char *name) TDE_DEPRECATED
 

Detailed Description

This class is to be used instead of TQUriDrag when using KURL.

The reason is: TQUriDrag (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 KURLDrag constructor. To handle drops, use TQUriDrag::canDecode() and KURLDrag::decode()

Definition at line 44 of file kurldrag.h.

Constructor & Destructor Documentation

◆ KURLDrag() [1/3]

KURLDrag::KURLDrag ( const KURL::List &  urls,
TQWidget *  dragSource = 0,
const char *  name = 0 
)

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

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

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

Definition at line 37 of file kurldrag.cpp.

◆ KURLDrag() [2/3]

KURLDrag::KURLDrag ( const KURL::List &  urls,
const TQMap< TQString, TQString > &  metaData,
TQWidget *  dragSource = 0,
const char *  name = 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 TQObject. Should be set when doing drag-n-drop, but should be 0 when copying to the clipboard
namethe name of the TQObject
See also
metaData()

Definition at line 43 of file kurldrag.cpp.

◆ ~KURLDrag()

KURLDrag::~KURLDrag ( )
virtual

Definition at line 50 of file kurldrag.cpp.

◆ KURLDrag() [3/3]

KURLDrag::KURLDrag ( const TQStrList &  urls,
const TQMap< TQString, TQString > &  metaData,
TQWidget *  dragSource,
const char *  name 
)
protected
Deprecated:
Use a KURLDrag constructor with a KURL::List

Definition at line 292 of file kurldrag.cpp.

Member Function Documentation

◆ decode() [1/2]

bool KURLDrag::decode ( const TQMimeSource *  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 87 of file kurldrag.cpp.

◆ decode() [2/2]

bool KURLDrag::decode ( const TQMimeSource *  e,
KURL::List &  urls,
TQMap< TQString, TQString > &  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 127 of file kurldrag.cpp.

◆ encodedData()

TQByteArray KURLDrag::encodedData ( const char *  mime) const
virtual
Reimplemented from superclass.

Definition at line 190 of file kurldrag.cpp.

◆ format()

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

Definition at line 173 of file kurldrag.cpp.

◆ metaData()

TQMap< TQString, TQString > & KURLDrag::metaData ( )
inline

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
TDEIO::TransferJob

Definition at line 100 of file kurldrag.h.

◆ newDrag() [1/2]

KURLDrag * KURLDrag::newDrag ( const KURL::List &  urls,
const TQMap< TQString, TQString > &  metaData,
TQWidget *  dragSource = 0,
const char *  name = 0 
)
static
Deprecated:
Is equivalent with "new KURLDrag(urls, metaData, dragSource, name)".

Definition at line 81 of file kurldrag.cpp.

◆ newDrag() [2/2]

KURLDrag * KURLDrag::newDrag ( const KURL::List &  urls,
TQWidget *  dragSource = 0,
const char *  name = 0 
)
static
Deprecated:
Is equivalent with "new KURLDrag(urls, dragSource, name)".

Definition at line 76 of file kurldrag.cpp.

◆ setExportAsText()

void KURLDrag::setExportAsText ( bool  exp)

By default, KURLDrag 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 KURLDrag in a KMultipleDrag and another component of the multiple-drag provides better plain text data. In such a case, setExportAsText( false ) should be called.

Since
3.4

Definition at line 68 of file kurldrag.cpp.

◆ stringToUrl()

KURL KURLDrag::stringToUrl ( const TQCString &  s)
static

Converts a string used for dragging to a URL.

Since
3.2

Definition at line 253 of file kurldrag.cpp.

◆ urlToString()

TQString KURLDrag::urlToString ( const KURL &  url)
static

Converts a URL to a string representation suitable for dragging.

Since
3.2

Definition at line 261 of file kurldrag.cpp.


The documentation for this class was generated from the following files:
  • kurldrag.h
  • kurldrag.cpp

tdecore

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

tdecore

Skip menu "tdecore"
  • arts
  • dcop
  • dnssd
  • interfaces
  •   kspeech
  •     interface
  •     library
  •   tdetexteditor
  • kate
  • kded
  • kdoctools
  • kimgio
  • kjs
  • libtdemid
  • libtdescreensaver
  • tdeabc
  • tdecmshell
  • tdecore
  • tdefx
  • tdehtml
  • tdeinit
  • tdeio
  •   bookmarks
  •   httpfilter
  •   kpasswdserver
  •   kssl
  •   tdefile
  •   tdeio
  •   tdeioexec
  • tdeioslave
  •   http
  • tdemdi
  •   tdemdi
  • tdenewstuff
  • tdeparts
  • tdeprint
  • tderandr
  • tderesources
  • tdespell2
  • tdesu
  • tdeui
  • tdeunittest
  • tdeutils
  • tdewallet
Generated for tdecore by doxygen 1.9.4
This website is maintained by Timothy Pearson.