Home | All Classes | Main Classes | Annotated | Grouped Classes | Functions |

# TQUriDrag Class Reference

The TQUriDrag class provides a drag object for a list of URI references. More...

`#include <ntqdragobject.h>`

Inherits TQStoredDrag.

List of all member functions.

## Public Members

- TQUriDrag ( TQStrList uris, TQWidget * dragSource = 0, const char * name = 0 )
- TQUriDrag ( TQWidget * dragSource = 0, const char * name = 0 )
- ~TQUriDrag ()
- void setFilenames ( const TQStringList & fnames ) (obsolete)
- void setFileNames ( const TQStringList & fnames )
- void setUnicodeUris ( const TQStringList & uuris )
- virtual void setUris ( TQStrList uris )

## Static Public Members

- TQString uriToLocalFile ( const char * uri )
- TQCString localFileToUri ( const TQString & filename )
- TQString uriToUnicodeUri ( const char * uri )
- TQCString unicodeUriToUri ( const TQString & uuri )
- bool canDecode ( const TQMimeSource * e )
- bool decode ( const TQMimeSource * e, TQStrList & l )
- bool decodeToUnicodeUris ( const TQMimeSource * e, TQStringList & l )
- bool decodeLocalFiles ( const TQMimeSource * e, TQStringList & l )

## Detailed Description

The TQUriDrag class provides a drag object for a list of URI references.

URIs are a useful way to refer to files that may be distributed across multiple machines. A URI will often refer to a file on a machine local to both the drag source and the drop target, so the URI can be equivalent to passing a file name but is more extensible.

Use URIs in Unicode form so that the user can comfortably edit and view them. For use in HTTP or other protocols, use the correctly escaped ASCII form.

You can convert a list of file names to file URIs using setFileNames(), or into human-readble form with setUnicodeUris().

Static functions are provided to convert between filenames and URIs, e.g. uriToLocalFile() and localFileToUri(), and to and from human-readable form, e.g. uriToUnicodeUri(), unicodeUriToUri(). You can also decode URIs from a mimesource into a list with decodeLocalFiles() and decodeToUnicodeUris().

See also Drag And Drop Classes.

## Member Function Documentation

### TQUriDrag::TQUriDrag ( TQStrList uris, TQWidget * dragSource = 0, const char * name = 0 )

Constructs an object to drag the list of URIs in uris. The dragSource and name arguments are passed on to TQStoredDrag. Note that URIs are always in escaped UTF8 encoding.

### TQUriDrag::TQUriDrag ( TQWidget * dragSource = 0, const char * name = 0 )

Constructs an object to drag. You must call setUris() before you start the drag(). Passes dragSource and name to the TQStoredDrag constructor.

### TQUriDrag::~TQUriDrag ()

Destroys the object.

### bool TQUriDrag::canDecode ( const TQMimeSource * e )`[static]`

Returns TRUE if decode() would be able to decode e; otherwise returns FALSE.

### bool TQUriDrag::decode ( const TQMimeSource * e, TQStrList & l )`[static]`

Decodes URIs from e, placing the result in l (which is first cleared).

Returns TRUE if e contained a valid list of URIs; otherwise returns FALSE.

Example: dirview/dirview.cpp.

### bool TQUriDrag::decodeLocalFiles ( const TQMimeSource * e, TQStringList & l )`[static]`

Decodes URIs from the mime source event e, converts them to local files if they refer to local files, and places them in l (which is first cleared).

Returns TRUE if contained a valid list of URIs; otherwise returns FALSE. The list will be empty if no URIs were local files.

Example: fileiconview/qfileiconview.cpp.

### bool TQUriDrag::decodeToUnicodeUris ( const TQMimeSource * e, TQStringList & l )`[static]`

Decodes URIs from the mime source event e, converts them to Unicode URIs (only useful for displaying to humans), placing them in l (which is first cleared).

Returns TRUE if contained a valid list of URIs; otherwise returns FALSE.

### TQCString TQUriDrag::localFileToUri ( const TQString & filename )`[static]`

Returns the URI equivalent to the absolute local file filename.

See also uriToLocalFile().

### void TQUriDrag::setFileNames ( const TQStringList & fnames )

Sets the URIs to be the local-file URIs equivalent to fnames.

See also localFileToUri() and setUris().

Example: dirview/dirview.cpp.

### void TQUriDrag::setFilenames ( const TQStringList & fnames )

This function is obsolete. It is provided to keep old source working. We strongly advise against using it in new code.

Use setFileNames() instead (notice the N).

### void TQUriDrag::setUnicodeUris ( const TQStringList & uuris )

Sets the URIs in uuris to be the Unicode URIs (only useful for displaying to humans).

See also localFileToUri() and setUris().

### void TQUriDrag::setUris ( TQStrList uris )`[virtual]`

Changes the list of uris to be dragged.

Note that URIs are always in escaped UTF8 encoding.

### TQCString TQUriDrag::unicodeUriToUri ( const TQString & uuri )`[static]`

Returns the URI equivalent of the Unicode URI given in uuri (only useful for displaying to humans).

See also uriToLocalFile().

### TQString TQUriDrag::uriToLocalFile ( const char * uri )`[static]`

Returns the name of a local file equivalent to uri or a null string if uri is not a local file.

Note that URIs are always in escaped UTF8 encoding.

See also localFileToUri().

Example: dirview/dirview.cpp.

### TQString TQUriDrag::uriToUnicodeUri ( const char * uri )`[static]`

Returns the Unicode URI (only useful for displaying to humans) equivalent of uri.

Note that URIs are always in escaped UTF8 encoding.

See also localFileToUri().

This file is part of the TQt toolkit. Copyright © 1995-2007 Trolltech. All Rights Reserved.