• Skip to content
  • Skip to link menu
  • KDE API Reference
  • kdelibs-4.10.5 API Reference
  • KDE Home
  • Contact Us
 

KDECore

  • KUrl
  • List
Public Types | Public Member Functions | Static Public Member Functions
KUrl::List Class Reference

#include <KUrl>

Inheritance diagram for KUrl::List:

List of all members.

Public Types

enum  DecodeOptions { PreferLocalUrls, PreferKdeUrls }

Public Member Functions

 List ()
 List (const KUrl &url)
 List (const QStringList &list)
 List (const QList< KUrl > &list)
 List (const QList< QUrl > &list)
 operator QList< QUrl > () const
 operator QVariant () const
void populateMimeData (QMimeData *mimeData, const KUrl::MetaDataMap &metaData=MetaDataMap(), MimeDataFlags flags=DefaultMimeDataFlags) const
void populateMimeData (const KUrl::List &mostLocalUrls, QMimeData *mimeData, const KUrl::MetaDataMap &metaData=MetaDataMap(), MimeDataFlags flags=DefaultMimeDataFlags) const
QStringList toStringList () const
QStringList toStringList (KUrl::AdjustPathOption trailing) const

Static Public Member Functions

static bool canDecode (const QMimeData *mimeData)
static KUrl::List fromMimeData (const QMimeData *mimeData, KUrl::MetaDataMap *metaData=0)
static KUrl::List fromMimeData (const QMimeData *mimeData, DecodeOptions decodeOptions, KUrl::MetaDataMap *metaData=0)
static QStringList mimeDataTypes ()

Detailed Description

 KUrl::List is a QList that contains KUrls with a few

convenience methods.

See also:
KUrl
QList

Definition at line 146 of file kurl.h.


Member Enumeration Documentation

enum KUrl::List::DecodeOptions

Flags to be used in fromMimeData.

Since:
4.2.3
Enumerator:
PreferLocalUrls 

When the mimedata contains both KDE-style URLs (eg: desktop:/foo) and the "most local" version of the URLs (eg: file:///home/dfaure/Desktop/foo), decode it as local urls.

Useful in paste/drop operations that end up calling KIO, so that urls from other users work as well.

PreferKdeUrls 

When the mimedata contains both KDE-style URLs (eg: desktop:/foo) and the "most local" version of the URLs (eg: file:///home/dfaure/Desktop/foo), decode it as the KDE-style URL.

Useful in DnD code e.g. when moving icons, and the kde-style url is used as identifier for the icons.

Definition at line 289 of file kurl.h.


Constructor & Destructor Documentation

KUrl::List::List ( )
inline

Creates an empty List.

Definition at line 152 of file kurl.h.

KUrl::List::List ( const KUrl &  url)

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

Parameters:
urlthe url to add.

Definition at line 184 of file kurl.cpp.

KUrl::List::List ( const QStringList &  list)

Creates a list that contains the URLs from the given list of strings.

Parameters:
listthe list containing the URLs as strings

Definition at line 201 of file kurl.cpp.

KUrl::List::List ( const QList< KUrl > &  list)

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

Parameters:
listthe list containing the URLs

Definition at line 189 of file kurl.cpp.

KUrl::List::List ( const QList< QUrl > &  list)

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

Parameters:
listthe list containing the URLs
Since:
4.7

Definition at line 194 of file kurl.cpp.


Member Function Documentation

bool KUrl::List::canDecode ( const QMimeData *  mimeData)
static

Return true if mimeData contains URI data.

Definition at line 299 of file kurl.cpp.

KUrl::List KUrl::List::fromMimeData ( const QMimeData *  mimeData,
KUrl::MetaDataMap *  metaData = 0 
)
static

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:
mimeDatathe mime data to extract from; cannot be 0
metaDataoptional pointer to a map holding the metadata
Returns:
the list of urls

Definition at line 369 of file kurl.cpp.

KUrl::List KUrl::List::fromMimeData ( const QMimeData *  mimeData,
DecodeOptions  decodeOptions,
KUrl::MetaDataMap *  metaData = 0 
)
static

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:
mimeDatathe mime data to extract from; cannot be 0
decodeOptionsoptions for decoding
metaDataoptional pointer to a map holding the metadata
Returns:
the list of urls
Since:
4.2.3

Definition at line 311 of file kurl.cpp.

QStringList KUrl::List::mimeDataTypes ( )
static

Return the list of mimeTypes that can be decoded by fromMimeData.

Definition at line 305 of file kurl.cpp.

KUrl::List::operator QList< QUrl > ( ) const

Converts this KUrl::List into a list of QUrl instances.

Since:
4.7

Definition at line 379 of file kurl.cpp.

KUrl::List::operator QVariant ( ) const

Converts this KUrl::List to a QVariant, this allows to use KUrl::List in QVariant() constructor.

Definition at line 374 of file kurl.cpp.

void KUrl::List::populateMimeData ( QMimeData *  mimeData,
const KUrl::MetaDataMap &  metaData = MetaDataMap(),
MimeDataFlags  flags = DefaultMimeDataFlags 
) const

Adds URLs data into the given QMimeData.

By default, populateMimeData 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 adding other mime data which provides better plain text data.

WARNING: do not call this method multiple times on the same mimedata object, you can add urls only once. But you can add other things, e.g. images, XML...

Parameters:
mimeDatathe QMimeData instance used to drag or copy this URL
metaDataKIO 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)
flagsset NoTextExport to prevent setting plain/text data into mimeData In such a case, setExportAsText( false ) should be called.

Definition at line 248 of file kurl.cpp.

void KUrl::List::populateMimeData ( const KUrl::List &  mostLocalUrls,
QMimeData *  mimeData,
const KUrl::MetaDataMap &  metaData = MetaDataMap(),
MimeDataFlags  flags = DefaultMimeDataFlags 
) const

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:
mostLocalUrlsthe "most local" urls
mimeDatathe mime data object to populate
metaDataKIO 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)
flagsset NoTextExport to prevent setting plain/text data into mimeData. In such a case, setExportAsText(false) should be called.
Since:
4.2

Definition at line 288 of file kurl.cpp.

QStringList KUrl::List::toStringList ( ) const

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

Returns:
the list of strings

Definition at line 211 of file kurl.cpp.

QStringList KUrl::List::toStringList ( KUrl::AdjustPathOption  trailing) const

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

Parameters:
trailinguse to add or remove a trailing slash to/from the path.
Returns:
the list of strings
Since:
4.6

Definition at line 216 of file kurl.cpp.


The documentation for this class was generated from the following files:
  • kurl.h
  • kurl.cpp
This file is part of the KDE documentation.
Documentation copyright © 1996-2013 The KDE developers.
Generated on Tue Jul 16 2013 17:47:40 by doxygen 1.8.1.1 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

KDECore

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

kdelibs-4.10.5 API Reference

Skip menu "kdelibs-4.10.5 API Reference"
  • DNSSD
  • Interfaces
  •   KHexEdit
  •   KMediaPlayer
  •   KSpeech
  •   KTextEditor
  • kconf_update
  • KDE3Support
  •   KUnitTest
  • KDECore
  • KDED
  • KDEsu
  • KDEUI
  • KDEWebKit
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • kio
  • KIOSlave
  • KJS
  •   KJS-API
  •   WTF
  • kjsembed
  • KNewStuff
  • KParts
  • KPty
  • Kross
  • KUnitConversion
  • KUtils
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver
Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal