KFilePlacesModel

Search for usage in LXR

#include <KFilePlacesModel>

Inheritance diagram for KFilePlacesModel:

Public Types

enum  AdditionalRoles {
  UrlRole = 0x069CD12B, HiddenRole = 0x0741CAAC, SetupNeededRole = 0x059A935D, FixedDeviceRole = 0x332896C1,
  CapacityBarRecommendedRole = 0x1548C5C4, GroupRole = 0x0a5b64ee, IconNameRole = 0x00a45c00, GroupHiddenRole = 0x21a4b936,
  TeardownAllowedRole = 0x02533364, EjectAllowedRole = 0x0A16AC5B, TeardownOverlayRecommendedRole = 0x032EDCCE, DeviceAccessibilityRole = 0x023FFD93
}
 
enum  DeviceAccessibility { SetupNeeded, SetupInProgress, Accessible, TeardownInProgress }
 
enum  GroupType {
  PlacesType, RemoteType, RecentlySavedType, SearchForType,
  DevicesType, RemovableDevicesType, UnknownType, TagsType
}
 
- Public Types inherited from QAbstractItemModel
enum  CheckIndexOption
 
enum  LayoutChangeHint
 

Properties

QStringList supportedSchemes
 
- Properties inherited from QObject
 objectName
 

Signals

void errorMessage (const QString &message)
 
void groupHiddenChanged (KFilePlacesModel::GroupType group, bool hidden)
 
void reloaded ()
 
void setupDone (const QModelIndex &index, bool success)
 
void supportedSchemesChanged ()
 
void teardownDone (const QModelIndex &index, Solid::ErrorType error, const QVariant &errorData)
 

Public Member Functions

 KFilePlacesModel (const QString &alternativeApplicationName, QObject *parent=nullptr)
 
 KFilePlacesModel (QObject *parent=nullptr)
 
Q_INVOKABLE void addPlace (const QString &text, const QUrl &url, const QString &iconName, const QString &appName, const QModelIndex &after)
 
Q_INVOKABLE void addPlace (const QString &text, const QUrl &url, const QString &iconName=QString(), const QString &appName=QString())
 
KBookmark bookmarkForIndex (const QModelIndex &index) const
 
KBookmark bookmarkForUrl (const QUrl &searchUrl) const
 
QModelIndex closestItem (const QUrl &url) const
 
int columnCount (const QModelIndex &parent=QModelIndex()) const override
 
QVariant data (const QModelIndex &index, int role) const override
 
Q_INVOKABLE KFilePlacesModel::DeviceAccessibility deviceAccessibility (const QModelIndex &index) const
 
Solid::Device deviceForIndex (const QModelIndex &index) const
 
bool dropMimeData (const QMimeData *data, Qt::DropAction action, int row, int column, const QModelIndex &parent) override
 
Q_INVOKABLE void editPlace (const QModelIndex &index, const QString &text, const QUrl &url, const QString &iconName=QString(), const QString &appName=QString())
 
Q_INVOKABLE QActionejectActionForIndex (const QModelIndex &index) const
 
Qt::ItemFlags flags (const QModelIndex &index) const override
 
Q_INVOKABLE QModelIndexList groupIndexes (const GroupType type) const
 
Q_INVOKABLE GroupType groupType (const QModelIndex &index) const
 
Q_INVOKABLE int hiddenCount () const
 
Q_INVOKABLE QIcon icon (const QModelIndex &index) const
 
QModelIndex index (int row, int column, const QModelIndex &parent=QModelIndex()) const override
 
Q_INVOKABLE bool isDevice (const QModelIndex &index) const
 
Q_INVOKABLE bool isEjectAllowed (const QModelIndex &index) const
 
Q_INVOKABLE bool isGroupHidden (const GroupType type) const
 
Q_INVOKABLE bool isGroupHidden (const QModelIndex &index) const
 
Q_INVOKABLE bool isHidden (const QModelIndex &index) const
 
Q_INVOKABLE bool isTeardownAllowed (const QModelIndex &index) const
 
Q_INVOKABLE bool isTeardownOverlayRecommended (const QModelIndex &index) const
 
QMimeDatamimeData (const QModelIndexList &indexes) const override
 
QStringList mimeTypes () const override
 
Q_INVOKABLE bool movePlace (int itemRow, int row)
 
QModelIndex parent (const QModelIndex &child) const override
 
Q_INVOKABLE void refresh () const
 
Q_INVOKABLE void removePlace (const QModelIndex &index) const
 
Q_INVOKABLE void requestEject (const QModelIndex &index)
 
Q_INVOKABLE void requestSetup (const QModelIndex &index)
 
Q_INVOKABLE void requestTeardown (const QModelIndex &index)
 
QHash< int, QByteArrayroleNames () const override
 
int rowCount (const QModelIndex &parent=QModelIndex()) const override
 
Q_INVOKABLE void setGroupHidden (const GroupType type, bool hidden)
 
Q_INVOKABLE void setPlaceHidden (const QModelIndex &index, bool hidden)
 
void setSupportedSchemes (const QStringList &schemes)
 
Q_INVOKABLE bool setupNeeded (const QModelIndex &index) const
 
Qt::DropActions supportedDropActions () const override
 
QStringList supportedSchemes () const
 
Q_INVOKABLE QActionteardownActionForIndex (const QModelIndex &index) const
 
Q_INVOKABLE QString text (const QModelIndex &index) const
 
Q_INVOKABLE QUrl url (const QModelIndex &index) const
 
- Public Member Functions inherited from QAbstractItemModel
 QAbstractItemModel (QObject *parent)
 
virtual QModelIndex buddy (const QModelIndex &index) const const
 
virtual bool canDropMimeData (const QMimeData *data, Qt::DropAction action, int row, int column, const QModelIndex &parent) const const
 
virtual bool canFetchMore (const QModelIndex &parent) const const
 
bool checkIndex (const QModelIndex &index, QAbstractItemModel::CheckIndexOptions options) const const
 
void columnsAboutToBeInserted (const QModelIndex &parent, int first, int last)
 
void columnsAboutToBeMoved (const QModelIndex &sourceParent, int sourceStart, int sourceEnd, const QModelIndex &destinationParent, int destinationColumn)
 
void columnsAboutToBeRemoved (const QModelIndex &parent, int first, int last)
 
void columnsInserted (const QModelIndex &parent, int first, int last)
 
void columnsMoved (const QModelIndex &parent, int start, int end, const QModelIndex &destination, int column)
 
void columnsRemoved (const QModelIndex &parent, int first, int last)
 
void dataChanged (const QModelIndex &topLeft, const QModelIndex &bottomRight, const QVector< int > &roles)
 
virtual void fetchMore (const QModelIndex &parent)
 
virtual bool hasChildren (const QModelIndex &parent) const const
 
bool hasIndex (int row, int column, const QModelIndex &parent) const const
 
virtual QVariant headerData (int section, Qt::Orientation orientation, int role) const const
 
void headerDataChanged (Qt::Orientation orientation, int first, int last)
 
bool insertColumn (int column, const QModelIndex &parent)
 
virtual bool insertColumns (int column, int count, const QModelIndex &parent)
 
bool insertRow (int row, const QModelIndex &parent)
 
virtual bool insertRows (int row, int count, const QModelIndex &parent)
 
virtual QMap< int, QVariantitemData (const QModelIndex &index) const const
 
void layoutAboutToBeChanged (const QList< QPersistentModelIndex > &parents, QAbstractItemModel::LayoutChangeHint hint)
 
void layoutChanged (const QList< QPersistentModelIndex > &parents, QAbstractItemModel::LayoutChangeHint hint)
 
virtual QModelIndexList match (const QModelIndex &start, int role, const QVariant &value, int hits, Qt::MatchFlags flags) const const
 
void modelAboutToBeReset ()
 
void modelReset ()
 
bool moveColumn (const QModelIndex &sourceParent, int sourceColumn, const QModelIndex &destinationParent, int destinationChild)
 
virtual bool moveColumns (const QModelIndex &sourceParent, int sourceColumn, int count, const QModelIndex &destinationParent, int destinationChild)
 
bool moveRow (const QModelIndex &sourceParent, int sourceRow, const QModelIndex &destinationParent, int destinationChild)
 
virtual bool moveRows (const QModelIndex &sourceParent, int sourceRow, int count, const QModelIndex &destinationParent, int destinationChild)
 
bool removeColumn (int column, const QModelIndex &parent)
 
virtual bool removeColumns (int column, int count, const QModelIndex &parent)
 
bool removeRow (int row, const QModelIndex &parent)
 
virtual bool removeRows (int row, int count, const QModelIndex &parent)
 
virtual void revert ()
 
void rowsAboutToBeInserted (const QModelIndex &parent, int start, int end)
 
void rowsAboutToBeMoved (const QModelIndex &sourceParent, int sourceStart, int sourceEnd, const QModelIndex &destinationParent, int destinationRow)
 
void rowsAboutToBeRemoved (const QModelIndex &parent, int first, int last)
 
void rowsInserted (const QModelIndex &parent, int first, int last)
 
void rowsMoved (const QModelIndex &parent, int start, int end, const QModelIndex &destination, int row)
 
void rowsRemoved (const QModelIndex &parent, int first, int last)
 
virtual bool setData (const QModelIndex &index, const QVariant &value, int role)
 
virtual bool setHeaderData (int section, Qt::Orientation orientation, const QVariant &value, int role)
 
virtual bool setItemData (const QModelIndex &index, const QMap< int, QVariant > &roles)
 
void setSupportedDragActions (Qt::DropActions actions)
 
virtual QModelIndex sibling (int row, int column, const QModelIndex &index) const const
 
virtual void sort (int column, Qt::SortOrder order)
 
virtual QSize span (const QModelIndex &index) const const
 
virtual bool submit ()
 
virtual Qt::DropActions supportedDragActions () const const
 
- Public Member Functions inherited from QObject
 QObject (QObject *parent)
 
bool blockSignals (bool block)
 
const QObjectListchildren () const const
 
QMetaObject::Connection connect (const QObject *sender, const char *signal, const char *method, Qt::ConnectionType type) const const
 
void deleteLater ()
 
void destroyed (QObject *obj)
 
bool disconnect (const char *signal, const QObject *receiver, const char *method) const const
 
bool disconnect (const QObject *receiver, const char *method) const const
 
void dumpObjectInfo ()
 
void dumpObjectInfo () const const
 
void dumpObjectTree ()
 
void dumpObjectTree () const const
 
QList< QByteArraydynamicPropertyNames () const const
 
virtual bool event (QEvent *e)
 
virtual bool eventFilter (QObject *watched, QEvent *event)
 
findChild (const QString &name, Qt::FindChildOptions options) const const
 
QList< T > findChildren (const QRegExp &regExp, Qt::FindChildOptions options) const const
 
QList< T > findChildren (const QRegularExpression &re, Qt::FindChildOptions options) const const
 
QList< T > findChildren (const QString &name, Qt::FindChildOptions options) const const
 
bool inherits (const char *className) const const
 
void installEventFilter (QObject *filterObj)
 
bool isWidgetType () const const
 
bool isWindowType () const const
 
void killTimer (int id)
 
virtual const QMetaObjectmetaObject () const const
 
void moveToThread (QThread *targetThread)
 
QString objectName () const const
 
void objectNameChanged (const QString &objectName)
 
QObjectparent () const const
 
QVariant property (const char *name) const const
 
 Q_CLASSINFO (Name, Value)
 
 Q_DISABLE_COPY (Class)
 
 Q_DISABLE_COPY_MOVE (Class)
 
 Q_DISABLE_MOVE (Class)
 
 Q_EMIT Q_EMIT
 
 Q_ENUM (...)
 
 Q_ENUM_NS (...)
 
 Q_ENUMS (...)
 
 Q_FLAG (...)
 
 Q_FLAG_NS (...)
 
 Q_FLAGS (...)
 
 Q_GADGET Q_GADGET
 
 Q_INTERFACES (...)
 
 Q_INVOKABLE Q_INVOKABLE
 
 Q_NAMESPACE Q_NAMESPACE
 
 Q_NAMESPACE_EXPORT (EXPORT_MACRO)
 
 Q_OBJECT Q_OBJECT
 
 Q_PROPERTY (...)
 
 Q_REVISION Q_REVISION
 
 Q_SET_OBJECT_NAME (Object)
 
 Q_SIGNAL Q_SIGNAL
 
 Q_SIGNALS Q_SIGNALS
 
 Q_SLOT Q_SLOT
 
 Q_SLOTS Q_SLOTS
 
qFindChild (const QObject *obj, const QString &name)
 
QList< T > qFindChildren (const QObject *obj, const QRegExp &regExp)
 
QList< T > qFindChildren (const QObject *obj, const QString &name)
 
qobject_cast (const QObject *object)
 
qobject_cast (QObject *object)
 
 QT_NO_NARROWING_CONVERSIONS_IN_CONNECT QT_NO_NARROWING_CONVERSIONS_IN_CONNECT
 
void removeEventFilter (QObject *obj)
 
void setObjectName (const QString &name)
 
void setParent (QObject *parent)
 
bool setProperty (const char *name, const QVariant &value)
 
bool signalsBlocked () const const
 
int startTimer (int interval, Qt::TimerType timerType)
 
int startTimer (std::chrono::milliseconds time, Qt::TimerType timerType)
 
QThreadthread () const const
 

Static Public Member Functions

static QUrl convertedUrl (const QUrl &url)
 
- Static Public Member Functions inherited from QObject
QMetaObject::Connection connect (const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type)
 
QMetaObject::Connection connect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method, Qt::ConnectionType type)
 
QMetaObject::Connection connect (const QObject *sender, PointerToMemberFunction signal, const QObject *context, Functor functor, Qt::ConnectionType type)
 
QMetaObject::Connection connect (const QObject *sender, PointerToMemberFunction signal, const QObject *receiver, PointerToMemberFunction method, Qt::ConnectionType type)
 
QMetaObject::Connection connect (const QObject *sender, PointerToMemberFunction signal, Functor functor)
 
bool disconnect (const QMetaObject::Connection &connection)
 
bool disconnect (const QObject *sender, const char *signal, const QObject *receiver, const char *method)
 
bool disconnect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method)
 
bool disconnect (const QObject *sender, PointerToMemberFunction signal, const QObject *receiver, PointerToMemberFunction method)
 
QString tr (const char *sourceText, const char *disambiguation, int n)
 
QString trUtf8 (const char *sourceText, const char *disambiguation, int n)
 

Additional Inherited Members

- Public Attributes inherited from QAbstractItemModel
typedef CheckIndexOptions
 
 DoNotUseParent
 
 HorizontalSortHint
 
 IndexIsValid
 
 NoLayoutChangeHint
 
 NoOption
 
 ParentIsInvalid
 
 VerticalSortHint
 
- Public Attributes inherited from QObject
typedef QObjectList
 
- Protected Member Functions inherited from QAbstractItemModel
void beginInsertColumns (const QModelIndex &parent, int first, int last)
 
void beginInsertRows (const QModelIndex &parent, int first, int last)
 
bool beginMoveColumns (const QModelIndex &sourceParent, int sourceFirst, int sourceLast, const QModelIndex &destinationParent, int destinationChild)
 
bool beginMoveRows (const QModelIndex &sourceParent, int sourceFirst, int sourceLast, const QModelIndex &destinationParent, int destinationChild)
 
void beginRemoveColumns (const QModelIndex &parent, int first, int last)
 
void beginRemoveRows (const QModelIndex &parent, int first, int last)
 
void beginResetModel ()
 
void changePersistentIndex (const QModelIndex &from, const QModelIndex &to)
 
void changePersistentIndexList (const QModelIndexList &from, const QModelIndexList &to)
 
QModelIndex createIndex (int row, int column, quintptr id) const const
 
QModelIndex createIndex (int row, int column, void *ptr) const const
 
void endInsertColumns ()
 
void endInsertRows ()
 
void endMoveColumns ()
 
void endMoveRows ()
 
void endRemoveColumns ()
 
void endRemoveRows ()
 
void endResetModel ()
 
QModelIndexList persistentIndexList () const const
 
void reset ()
 
void resetInternalData ()
 
void setRoleNames (const QHash< int, QByteArray > &roleNames)
 
- Protected Member Functions inherited from QObject
virtual void childEvent (QChildEvent *event)
 
virtual void connectNotify (const QMetaMethod &signal)
 
virtual void customEvent (QEvent *event)
 
virtual void disconnectNotify (const QMetaMethod &signal)
 
bool isSignalConnected (const QMetaMethod &signal) const const
 
int receivers (const char *signal) const const
 
QObjectsender () const const
 
int senderSignalIndex () const const
 
virtual void timerEvent (QTimerEvent *event)
 

Detailed Description

This class is a list view model. Each entry represents a "place" where user can access files. Only relevant when used with QListView or QTableView.

Definition at line 35 of file kfileplacesmodel.h.

Member Enumeration Documentation

◆ AdditionalRoles

Enumerator
UrlRole 

roleName is "url".

See also
url()
HiddenRole 

roleName is "isHidden".

See also
isHidden()
SetupNeededRole 

roleName is "isSetupNeeded".

See also
setupNeeded()
FixedDeviceRole 

Whether the place is a fixed device (neither hotpluggable nor removable).

roleName is "isFixedDevice".

CapacityBarRecommendedRole 

Whether the place should have its free space displayed in a capacity bar.

roleName is "isCapacityBarRecommended".

GroupRole 

The name of the group, for example "Remote" or "Devices".

roleName is "group".

Since
5.40
IconNameRole 

roleName is "iconName".

See also
icon()
Since
5.41
GroupHiddenRole 

roleName is "isGroupHidden".

See also
isGroupHidden()
Since
5.42
TeardownAllowedRole 

roleName is "isTeardownAllowed".

See also
isTeardownAllowed().
Since
5.91
EjectAllowedRole 

roleName is "isEjectAllowed".

Since
5.94.
TeardownOverlayRecommendedRole 

roleName is "isTeardownOverlayRecommended".

See also
isTeardownOverlayRecommended()
Since
5.95
DeviceAccessibilityRole 

roleName is "deviceAccessibility".

See also
deviceAccessibility()
Since
5.99

Definition at line 44 of file kfileplacesmodel.h.

◆ GroupType

Describes the available group types used in this model.

Since
5.42
Enumerator
PlacesType 

"Places" section

RemoteType 

"Remote" section

RecentlySavedType 

"Recent" section

SearchForType 

"Search for" section

DevicesType 

"Devices" section

RemovableDevicesType 

"Removable Devices" section

UnknownType 

Unknown GroupType.

TagsType 

"Tags" section.

Since
5.54

Definition at line 115 of file kfileplacesmodel.h.

Constructor & Destructor Documentation

◆ KFilePlacesModel()

KFilePlacesModel::KFilePlacesModel ( const QString alternativeApplicationName,
QObject parent = nullptr 
)

Construct a new KFilePlacesModel with an alternativeApplicationName.

Parameters
alternativeApplicationNameThis value will be used to filter bookmarks in addition to the actual application name
parentParent object
Since
5.43

Definition at line 245 of file kfileplacesmodel.cpp.

Member Function Documentation

◆ addPlace() [1/2]

Q_INVOKABLE void KFilePlacesModel::addPlace ( const QString text,
const QUrl url,
const QString iconName,
const QString appName,
const QModelIndex after 
)

Adds a new place to the model.

Parameters
textThe user-visible text for the place
urlThe URL of the place. It will be stored in its QUrl::FullyEncoded string format.
iconNameThe icon of the place
appNameIf set as the value of QCoreApplication::applicationName(), will make the place visible only in this application.
afterThe index after which the new place will be added.

◆ addPlace() [2/2]

Q_INVOKABLE void KFilePlacesModel::addPlace ( const QString text,
const QUrl url,
const QString iconName = QString(),
const QString appName = QString() 
)

Adds a new place to the model.

Parameters
textThe user-visible text for the place
urlThe URL of the place. It will be stored in its QUrl::FullyEncoded string format.
iconNameThe icon of the place
appNameIf set as the value of QCoreApplication::applicationName(), will make the place visible only in this application.

◆ bookmarkForIndex()

KBookmark KFilePlacesModel::bookmarkForIndex ( const QModelIndex index) const
Returns
The KBookmark instance of the place at index index. If the index is not valid, a default KBookmark instance is returned.

◆ bookmarkForUrl()

KBookmark KFilePlacesModel::bookmarkForUrl ( const QUrl searchUrl) const
Returns
The KBookmark instance of the place with url searchUrl. If the bookmark corresponding to searchUrl is not found, a default KBookmark instance is returned.
Since
5.63

Definition at line 227 of file kfileplacesmodel.cpp.

◆ closestItem()

QModelIndex KFilePlacesModel::closestItem ( const QUrl url) const

Returns the closest item for the URL url.

The closest item is defined as item which is equal to the URL or at least is a parent URL. If there are more than one possible parent URL candidates, the item which covers the bigger range of the URL is returned.

Example: the url is '/home/peter/Documents/Music'. Available items are:

  • /home/peter
  • /home/peter/Documents

The returned item will the one for '/home/peter/Documents'.

◆ columnCount()

int KFilePlacesModel::columnCount ( const QModelIndex parent = QModelIndex()) const
overridevirtual

Get the number of columns for a model index.

Implements QAbstractItemModel.

◆ convertedUrl()

static QUrl KFilePlacesModel::convertedUrl ( const QUrl url)
static

Converts the URL, which contains "virtual" URLs for system-items like "timeline:/lastmonth" into a Query-URL "timeline:/2017-10" that will be handled by the corresponding KIO worker.

Virtual URLs for bookmarks are used to be independent from internal format changes.

Parameters
anurl
Returns
the converted URL, which can be handled by a KIO worker
Since
5.41

◆ data()

QVariant KFilePlacesModel::data ( const QModelIndex index,
int  role 
) const
overridevirtual

Get a visible data based on Qt role for the given index.

Return the device information for the give index.

Parameters
indexThe QModelIndex which contains the row, column to fetch the data.
roleThe Interview data role(ex: Qt::DisplayRole).
Returns
the data for the given index and role.

Implements QAbstractItemModel.

◆ deviceAccessibility()

Q_INVOKABLE KFilePlacesModel::DeviceAccessibility KFilePlacesModel::deviceAccessibility ( const QModelIndex index) const
Returns
Whether this device is currently accessible or being (un)mounted.
Since
5.99

◆ deviceForIndex()

Solid::Device KFilePlacesModel::deviceForIndex ( const QModelIndex index) const
Returns
The solid device of the place at index index, if it is a device. Otherwise a default Solid::Device() instance is returned.
See also
isDevice()

◆ editPlace()

Q_INVOKABLE void KFilePlacesModel::editPlace ( const QModelIndex index,
const QString text,
const QUrl url,
const QString iconName = QString(),
const QString appName = QString() 
)

Edits the place with index index.

Parameters
textThe new user-visible text for the place
urlThe new URL of the place
iconNameThe new icon of the place
appNameThe new application-local filter for the place (
See also
addPlace()).

◆ ejectActionForIndex()

Q_INVOKABLE QAction* KFilePlacesModel::ejectActionForIndex ( const QModelIndex index) const
Returns
A QAction with a proper translated label that can be used to trigger the requestEject() method for the place at index index.
See also
requestEject()

◆ errorMessage

void KFilePlacesModel::errorMessage ( const QString message)
signal

message An error message explaining what went wrong.

◆ groupHiddenChanged

void KFilePlacesModel::groupHiddenChanged ( KFilePlacesModel::GroupType  group,
bool  hidden 
)
signal

Emitted whenever the visibility of the group group changes.

Parameters
hiddenThe new visibility of the group.
See also
setGroupHidden()
Since
5.42

◆ groupIndexes()

Q_INVOKABLE QModelIndexList KFilePlacesModel::groupIndexes ( const GroupType  type) const
Returns
The list of model indexes that have @ type as their group type.
See also
groupType()
Since
5.42

◆ groupType()

Q_INVOKABLE GroupType KFilePlacesModel::groupType ( const QModelIndex index) const
Returns
The group type of the place at index index.
Since
5.42

◆ hiddenCount()

Q_INVOKABLE int KFilePlacesModel::hiddenCount ( ) const
Returns
The number of hidden places in the model.
See also
isHidden()

◆ icon()

Q_INVOKABLE QIcon KFilePlacesModel::icon ( const QModelIndex index) const
Returns
The icon of the place at index index.

◆ index()

QModelIndex KFilePlacesModel::index ( int  row,
int  column,
const QModelIndex parent = QModelIndex() 
) const
overridevirtual

Get the children model index for the given row and column.

Implements QAbstractItemModel.

◆ isDevice()

Q_INVOKABLE bool KFilePlacesModel::isDevice ( const QModelIndex index) const
Returns
Whether the place at index index is a device handled by Solid.
See also
deviceForIndex()

◆ isEjectAllowed()

Q_INVOKABLE bool KFilePlacesModel::isEjectAllowed ( const QModelIndex index) const
Returns
Whether the place is a device that can be ejected, e.g. it is a CD, DVD, etc.

It does not indicate whether the eject can succeed.

Since
5.94

◆ isGroupHidden() [1/2]

Q_INVOKABLE bool KFilePlacesModel::isGroupHidden ( const GroupType  type) const
Returns
Whether the group type type is hidden.
Since
5.42

◆ isGroupHidden() [2/2]

Q_INVOKABLE bool KFilePlacesModel::isGroupHidden ( const QModelIndex index) const
Returns
Whether the group of the place at index index is hidden.
Since
5.42

◆ isHidden()

Q_INVOKABLE bool KFilePlacesModel::isHidden ( const QModelIndex index) const
Returns
Whether the place at index index is hidden or is inside an hidden group.

◆ isTeardownAllowed()

Q_INVOKABLE bool KFilePlacesModel::isTeardownAllowed ( const QModelIndex index) const
Returns
Whether the place is a device that can be unmounted, e.g. it is mounted but does not point at system Root or the user's Home directory.

It does not indicate whether the teardown can succeed.

Since
5.91

◆ isTeardownOverlayRecommended()

Q_INVOKABLE bool KFilePlacesModel::isTeardownOverlayRecommended ( const QModelIndex index) const
Returns
Whether showing an inline teardown button is recommended, e.g. when it is a removable drive.
Since
5.95

◆ movePlace()

Q_INVOKABLE bool KFilePlacesModel::movePlace ( int  itemRow,
int  row 
)

Move place at itemRow to a position before row.

Returns
Whether the place has been moved.
Since
5.41

◆ parent()

QModelIndex KFilePlacesModel::parent ( const QModelIndex child) const
overridevirtual

Get the parent QModelIndex for the given model child.

Implements QAbstractItemModel.

◆ refresh()

Q_INVOKABLE void KFilePlacesModel::refresh ( ) const

Reload bookmark information.

Since
5.41

◆ reloaded

void KFilePlacesModel::reloaded ( )
signal

Called once the model has been reloaded.

Since
5.71

◆ removePlace()

Q_INVOKABLE void KFilePlacesModel::removePlace ( const QModelIndex index) const

Deletes the place with index index from the model.

◆ requestEject()

Q_INVOKABLE void KFilePlacesModel::requestEject ( const QModelIndex index)

Ejects the place at index index by triggering the eject functionality of its Solid device.

See also
deviceForIndex()

◆ requestSetup()

Q_INVOKABLE void KFilePlacesModel::requestSetup ( const QModelIndex index)

Mounts the place at index index by triggering the setup functionality of its Solid device.

See also
deviceForIndex()

◆ requestTeardown()

Q_INVOKABLE void KFilePlacesModel::requestTeardown ( const QModelIndex index)

Unmounts the place at index index by triggering the teardown functionality of its Solid device.

See also
deviceForIndex()

◆ roleNames()

QHash<int, QByteArray> KFilePlacesModel::roleNames ( ) const
overridevirtual

Reimplemented from QAbstractItemModel.

See also
AdditionalRoles

Reimplemented from QAbstractItemModel.

◆ rowCount()

int KFilePlacesModel::rowCount ( const QModelIndex parent = QModelIndex()) const
overridevirtual

Get the number of rows for a model index.

Implements QAbstractItemModel.

◆ setGroupHidden()

Q_INVOKABLE void KFilePlacesModel::setGroupHidden ( const GroupType  type,
bool  hidden 
)

Changes the visibility of the group with type type.

Parameters
hiddenWhether the group should be hidden or visible.
See also
isGroupHidden()
Since
5.42

◆ setPlaceHidden()

Q_INVOKABLE void KFilePlacesModel::setPlaceHidden ( const QModelIndex index,
bool  hidden 
)

Changes the visibility of the place with index index, but only if the place is not inside an hidden group.

Parameters
hiddenWhether the place should be hidden or visible.
See also
isGroupHidden()

◆ setSupportedSchemes()

void KFilePlacesModel::setSupportedSchemes ( const QStringList schemes)

Set the URL schemes that the file widget should allow navigating to.

If the returned list is empty, all schemes are supported. Examples for schemes are "file" or "ftp".

See also
QFileDialog::setSupportedSchemes
Since
5.43

◆ setupDone

void KFilePlacesModel::setupDone ( const QModelIndex index,
bool  success 
)
signal

Emitted after the Solid setup ends.

Parameters
successWhether the Solid setup has been successful.
See also
requestSetup()

◆ setupNeeded()

Q_INVOKABLE bool KFilePlacesModel::setupNeeded ( const QModelIndex index) const
Returns
Whether the place at index index needs to be mounted before it can be used.

◆ supportedSchemes()

QStringList KFilePlacesModel::supportedSchemes ( ) const

Returns the URL schemes that the file widget should allow navigating to.

If the returned list is empty, all schemes are supported.

See also
QFileDialog::supportedSchemes
Since
5.43

◆ supportedSchemesChanged

void KFilePlacesModel::supportedSchemesChanged ( )
signal

Emitted whenever the list of supported schemes has been changed.

Since
5.94

◆ teardownActionForIndex()

Q_INVOKABLE QAction* KFilePlacesModel::teardownActionForIndex ( const QModelIndex index) const
Returns
A QAction with a proper translated label that can be used to trigger the requestTeardown() method for the place at index index.
See also
requestTeardown()

◆ teardownDone

void KFilePlacesModel::teardownDone ( const QModelIndex index,
Solid::ErrorType  error,
const QVariant errorData 
)
signal

Emitted after the teardown of a device ends.

Note
In case of an error, the errorMessage signal will also be emitted with a message describing the error.
Parameters
errorType of error that occurred, if any.
errorDataMore information about the error, if any.
Since
5.100

◆ text()

Q_INVOKABLE QString KFilePlacesModel::text ( const QModelIndex index) const
Returns
The user-visible text of the place at index index.

◆ url()

Q_INVOKABLE QUrl KFilePlacesModel::url ( const QModelIndex index) const
Returns
The URL of the place at index index.

The documentation for this class was generated from the following files:
This file is part of the KDE documentation.
Documentation copyright © 1996-2022 The KDE developers.
Generated on Tue Dec 6 2022 03:56:07 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.