KUrl.List

KDE 4.5 PyKDE API Reference

- KDE's Python API

# List Class Reference

`from PyKDE4.kdecore import *`

Namespace: KUrl

## Detailed Description

\class List kurl.h <KUrl>

KUrl.List is a QList that contains KUrls with a few convenience methods.

See also:
  KUrl

See also:
  QList

## Enumerations
DecodeOptions | { PreferLocalUrls, PreferKdeUrls }
## Methods
| __init__ (self)
| __init__ (self, KUrl url)
| __init__ (self, QStringList list)
| __init__ (self, [KUrl] list)
int | __contains__ (self, KUrl a0)
| __delitem__ (self, int a0)
| __delitem__ (self, SIP_PYSLICE a0)
int | __len__ (self)
| __setitem__ (self, int a0, KUrl a1)
| __setitem__ (self, SIP_PYSLICE a0, KUrl.List a1)
bool | operator != (self, KUrl.List a0)
KUrl.List | operator * (self, int a0)
KUrl.List | operator *= (self, int a0)
KUrl.List | operator + (self, KUrl.List a0)
KUrl.List | operator += (self, KUrl.List a0)
bool | operator == (self, KUrl.List a0)
KUrl | operator [] (self, int a0)
KUrl.List | operator [] (self, SIP_PYSLICE a0)
| populateMimeData (self, QMimeData mimeData, {QString:QString} metaData=KUrl.MetaDataMap(), KUrl.MimeDataFlags flags=KUrl.DefaultMimeDataFlags)
| populateMimeData (self, KUrl.List mostLocalUrls, QMimeData mimeData, {QString:QString} metaData=KUrl.MetaDataMap(), KUrl.MimeDataFlags flags=KUrl.DefaultMimeDataFlags)
QStringList | toStringList (self)
## Static Methods
bool | canDecode (QMimeData mimeData)
KUrl.List | fromMimeData (QMimeData mimeData, {QString:QString} metaData=0)
KUrl.List | fromMimeData (QMimeData mimeData, KUrl.List.DecodeOptions decodeOptions, {QString:QString} metaData=0)
QStringList | mimeDataTypes ()

## Method Documentation

__init__ | ( |  | self ) |

Creates an empty List.

__init__ | ( | self, |
|  | KUrl | url
| ) |  |  |

Creates a list that contains the given URL as only item.

Parameters:

  | url | the url to add.

__init__ | ( | self, |
|  | QStringList | list
| ) |  |  |

Creates a list that contains the URLs from the given QList<KUrl>.

Parameters:

  | list | the list containing the URLs

__init__ | ( | self, |
|  | [KUrl] | list
| ) |  |  |

Creates a list that contains the URLs from the given QList<KUrl>.

Parameters:

  | list | the list containing the URLs

int __contains__ | ( | self, |
|  | KUrl | a0
| ) |  |  |

__delitem__ | ( | self, |
|  | int | a0
| ) |  |  |

__delitem__ | ( | self, |
|  | SIP_PYSLICE | a0
| ) |  |  |

int __len__ | ( |  | self ) |

__setitem__ | ( | self, |
|  | int | a0,
|  | KUrl | a1
| ) |  |  |

__setitem__ | ( | self, |
|  | SIP_PYSLICE | a0,
|  | KUrl.List | a1
| ) |  |  |

bool operator != | ( | self, |
|  | KUrl.List | a0
| ) |  |  |

KUrl.List operator * | ( | self, |
|  | int | a0
| ) |  |  |

KUrl.List operator *= | ( | self, |
|  | int | a0
| ) |  |  |

KUrl.List operator + | ( | self, |
|  | KUrl.List | a0
| ) |  |  |

KUrl.List operator += | ( | self, |
|  | KUrl.List | a0
| ) |  |  |

bool operator == | ( | self, |
|  | KUrl.List | a0
| ) |  |  |

KUrl operator [] | ( | self, |
|  | int | a0
| ) |  |  |

KUrl.List operator [] | ( | self, |
|  | SIP_PYSLICE | a0
| ) |  |  |

populateMimeData | ( | self, |
|  | QMimeData | mimeData,
|  | {QString:QString} | metaData=KUrl.MetaDataMap(),
|  | KUrl.MimeDataFlags | flags=KUrl.DefaultMimeDataFlags
| ) |  |  |

Adds URLs into the given QMimeData.

This should add both the KDE-style URLs (eg: desktop:/foo) and the "most local" version of the URLs (eg: file:home/jbloggs/Desktop/foo) to the mimedata.

This method should be called on the KDE-style URLs.

     QMimeData* mimeData = new QMimeData();

     KUrl.List kdeUrls;
     kdeUrls << "desktop:/foo";
     kdeUrls << "desktop:/bar";

     KUrl.List normalUrls;
     normalUrls << "file:home/jbloggs/Desktop/foo";
     normalUrls << "file:home/jbloggs/Desktop/bar";

     kdeUrls.populateMimeData(normalUrls, mimeData);

Parameters:

  | mostLocalUrls | the "most local" urls
  | mimeData | the mime data object to populate
  | metaData | KIO metadata shipped in the mime data, which is used for instance to set a correct HTTP referrer (some websites require it for downloading e.g. an image)
  | flags | set NoTextExport to prevent setting plain/text data into mimeData. In such a case, <code>setExportAsText(false)</code> should be called.

Since:
  4.2

populateMimeData | ( | self, |
|  | KUrl.List | mostLocalUrls,
|  | QMimeData | mimeData,
|  | {QString:QString} | metaData=KUrl.MetaDataMap(),
|  | KUrl.MimeDataFlags | flags=KUrl.DefaultMimeDataFlags
| ) |  |  |

Adds URLs into the given QMimeData.

This should add both the KDE-style URLs (eg: desktop:/foo) and the "most local" version of the URLs (eg: file:home/jbloggs/Desktop/foo) to the mimedata.

This method should be called on the KDE-style URLs.

     QMimeData* mimeData = new QMimeData();

     KUrl.List kdeUrls;
     kdeUrls << "desktop:/foo";
     kdeUrls << "desktop:/bar";

     KUrl.List normalUrls;
     normalUrls << "file:home/jbloggs/Desktop/foo";
     normalUrls << "file:home/jbloggs/Desktop/bar";

     kdeUrls.populateMimeData(normalUrls, mimeData);

Parameters:

  | mostLocalUrls | the "most local" urls
  | mimeData | the mime data object to populate
  | metaData | KIO metadata shipped in the mime data, which is used for instance to set a correct HTTP referrer (some websites require it for downloading e.g. an image)
  | flags | set NoTextExport to prevent setting plain/text data into mimeData. In such a case, <code>setExportAsText(false)</code> should be called.

Since:
  4.2

QStringList toStringList | ( |  | self ) |

Converts the URLs of this list to a list of strings.

Returns:
  the list of strings

## Static Method Documentation

bool canDecode | ( | QMimeData | mimeData
| ) |  |  |

Return true if mimeData contains URI data

KUrl.List fromMimeData | ( | QMimeData | mimeData,
|  | {QString:QString} | metaData=0
| ) |  |  |

Extract a list of KUrls from the contents of mimeData. Decoding will fail if mimeData does not contain any URLs, or if at least one extracted URL is not valid.

Parameters:

  | mimeData | the mime data to extract from; cannot be 0
  | decodeOptions | options for decoding
  | metaData | optional pointer to a map holding the metadata

Returns:
  the list of urls

Since:
  4.2.3

KUrl.List fromMimeData | ( | QMimeData | mimeData,
|  | KUrl.List.DecodeOptions | decodeOptions,
|  | {QString:QString} | metaData=0
| ) |  |  |

Extract a list of KUrls from the contents of mimeData. Decoding will fail if mimeData does not contain any URLs, or if at least one extracted URL is not valid.

Parameters:

  | mimeData | the mime data to extract from; cannot be 0
  | decodeOptions | options for decoding
  | metaData | optional pointer to a map holding the metadata

Returns:
  the list of urls

Since:
  4.2.3

QStringList mimeDataTypes | ( |  | ) |

Return the list of mimeTypes that can be decoded by fromMimeData

## Enumeration Documentation

DecodeOptions

Flags to be used in fromMimeData.

Since:
  4.2.3

Enumerator:

  PreferLocalUrls |
  PreferKdeUrls |