KFileItemListProperties Class

Provides information about the common properties of a group of KFileItem objects. More...

Header: #include <KFileItemListProperties>
CMake: find_package(KF6 REQUIRED COMPONENTS KIO)
target_link_libraries(mytarget PRIVATE KF6::KIOCore)

Public Functions

KFileItemListProperties()
KFileItemListProperties(const KFileItemList &items)
KFileItemListProperties(const KFileItemListProperties &)
bool isDirectory() const
(since 5.47) bool isFile() const
bool isLocal() const
KFileItemList items() const
QString mimeGroup() const
QString mimeType() const
void setItems(const KFileItemList &items)
bool supportsDeleting() const
bool supportsMoving() const
bool supportsReading() const
bool supportsWriting() const
QList<QUrl> urlList() const

Detailed Description

Given a list of KFileItems, this class can determine (and cache) the common MIME type for all items, whether all items are directories, whether all items are readable, writable, etc. As soon as one file item does not support a specific capability (read, write etc.), it is marked as unsupported for all items.

This class is implicitly shared, which means it can be used as a value and copied around at almost no cost.

Member Function Documentation

KFileItemListProperties::KFileItemListProperties()

Default constructor. Use setItems to specify the items.

KFileItemListProperties::KFileItemListProperties(const KFileItemList &items)

Constructor that takes a KFileItemList and sets the capabilities supported by all the FileItems as true.

items The list of items that are to have their supported capabilities checked.

KFileItemListProperties::KFileItemListProperties(const KFileItemListProperties &)

Copy constructor

bool KFileItemListProperties::isDirectory() const

Returns true if all items are directories

[since 5.47] bool KFileItemListProperties::isFile() const

Returns whether all items are files, as reported by KFileItem::isFile().

This function was introduced in 5.47.

bool KFileItemListProperties::isLocal() const

Check if files are local

Returns true if all the FileItems are local, otherwise there is one or more remote file, so false.

KFileItemList KFileItemListProperties::items() const

List of fileitems passed to the constructor or to setItems().

See also setItems().

QString KFileItemListProperties::mimeGroup() const

Returns the MIME type group (e.g. "text") of all items, if they all have the same, otherwise an empty string

QString KFileItemListProperties::mimeType() const

Returns the MIME type of all items, if they all have the same, otherwise an empty string

void KFileItemListProperties::setItems(const KFileItemList &items)

Sets the items that are to have their supported capabilities checked.

See also items().

bool KFileItemListProperties::supportsDeleting() const

Check if deleting capability is supported

Returns true if all the FileItems can be deleted, otherwise false.

bool KFileItemListProperties::supportsMoving() const

Check if moving capability is supported

Returns true if all the FileItems can be moved, otherwise false.

bool KFileItemListProperties::supportsReading() const

Check if reading capability is supported

Returns true if all the FileItems can be read, otherwise false.

bool KFileItemListProperties::supportsWriting() const

Check if writing capability is supported (file managers use this mostly for directories)

Returns true if all the FileItems can be written to, otherwise false.

QList<QUrl> KFileItemListProperties::urlList() const

List of urls, gathered from the fileitems