MauiKit File Browsing
placeslist.cpp
98FMH::MODEL_LIST PlacesList::getGroup(const KFilePlacesModel &model, const FMStatic::PATHTYPE_KEY &type)
104 res << FMH::MODEL {{FMH::MODEL_KEY::PATH, FMStatic::PATHTYPE_URI[FMStatic::PATHTYPE_KEY::TAGS_PATH] + QStringLiteral("fav")}, {FMH::MODEL_KEY::ICON, QStringLiteral("love")}, {FMH::MODEL_KEY::LABEL, i18n("Favorite")}, {FMH::MODEL_KEY::TYPE, QStringLiteral("Quick")}};
107 // res << FMH::MODEL {{FMH::MODEL_KEY::PATH, "recentdocuments:///"}, {FMH::MODEL_KEY::ICON, "view-media-recent"}, {FMH::MODEL_KEY::LABEL, "Recent"}, {FMH::MODEL_KEY::TYPE, "Quick"}};
110 res << FMH::MODEL {{FMH::MODEL_KEY::PATH, QStringLiteral("tags:///")}, {FMH::MODEL_KEY::ICON, QStringLiteral("tag")}, {FMH::MODEL_KEY::LABEL, i18n("Tags")}, {FMH::MODEL_KEY::TYPE, QStringLiteral("Quick")}};
124 const auto group = model.groupIndexes(static_cast<KFilePlacesModel::GroupType>(type == FMStatic::PATHTYPE_KEY::BOOKMARKS_PATH ? mapPathType(FMStatic::PATHTYPE_KEY::PLACES_PATH) : mappedType));
126 res << std::accumulate(group.constBegin(), group.constEnd(), FMH::MODEL_LIST(), [&model, &type, this](FMH::MODEL_LIST &list, const QModelIndex &index) -> FMH::MODEL_LIST
129 if (type == FMStatic::PATHTYPE_KEY::BOOKMARKS_PATH && FMStatic::defaultPaths.contains(url.toString()))
137 {FMH::MODEL_KEY::TYPE, type == FMStatic::PATHTYPE_KEY::BOOKMARKS_PATH ? FMStatic::PathTypeLabel(FMStatic::PATHTYPE_KEY::BOOKMARKS_PATH) : FMStatic::PathTypeLabel(type)}};
162 res << FMStatic::packItems(bookmarks, FMStatic::PathTypeLabel(FMStatic::PATHTYPE_KEY::BOOKMARKS_PATH));
246 this->model->removePlace(this->model->closestItem(QUrl(this->list.at(index)[FMH::MODEL_KEY::PATH])));
static const QString getIconName(const QUrl &path)
Returns the icon name for certain file.
Definition fmstatic.cpp:617
static FMH::MODEL_LIST packItems(const QStringList &items, const QString &type)
Given a list of path URLs pack all the info of such files as a FMH::MODEL_LIST.
Definition fmstatic.cpp:57
static const QHash< PATHTYPE_KEY, QString > PATHTYPE_URI
Similar to PATHTYPE_SCHEME, but mapped with the complete scheme.
Definition fmstatic.h:375
static QString PathTypeLabel(const FMStatic::PATHTYPE_KEY &key)
Given a PATHTYPE_KEY return a user friendly string.
Definition fmstatic.cpp:31
static FMH::MODEL_LIST getDefaultPaths()
A model list of the default paths in most systems, such as Home, Pictures, Video, Downloads,...
Definition fmstatic.cpp:74
static bool isDefaultPath(const QString &path)
Checks if a given path URL is a default path as found in the defaultPaths method.
Definition fmstatic.cpp:122
PATHTYPE_KEY
The different location types supported. Most of them need of KDE KIO framework to be fully operationa...
Definition fmstatic.h:258
Q_INVOKABLE bool isDevice(const QModelIndex &index) const
Q_INVOKABLE void requestSetup(const QModelIndex &index)
Q_INVOKABLE bool setupNeeded(const QModelIndex &index) const
Q_INVOKABLE void removePlace(const QModelIndex &index) const
Solid::Device deviceForIndex(const QModelIndex &index) const
GroupType
void reloaded()
Q_INVOKABLE void addPlace(const QString &text, const QUrl &url, const QString &iconName, const QString &appName, const QModelIndex &after)
void setupDone(const QModelIndex &index, bool success)
QModelIndex closestItem(const QUrl &url) const
Q_INVOKABLE void requestEject(const QModelIndex &index)
Q_INVOKABLE QModelIndexList groupIndexes(const GroupType type) const
void countChanged()
void preItemRemoved(int index)
void preListChanged()
void postListChanged()
void postItemRemoved()
int indexOf(const FMH::MODEL_KEY &key, const QString &value) const
bool exists(const FMH::MODEL_KEY &key, const QString &value) const
The list model of the system locations, such as bookmarks, standard places, networks and devices.
Definition placeslist.h:44
static void addBookmark(const QUrl &url)
Add a location to the bookmarks sections.
Definition placeslist.cpp:322
bool setupNeeded(const int &index)
Check if a device type entry needs to be setup, as in mounted.
Definition placeslist.cpp:278
bool isDevice(const int &index)
Check if a entry at the given index is a device.
Definition placeslist.cpp:265
void requestEject(const int &index)
Request to eject a removable device type at the given index.
Definition placeslist.cpp:294
bool contains(const QUrl &path)
Checks of a file URL exists in the places model.
Definition placeslist.cpp:260
int indexOfPath(const QUrl &url) const
Given an URL path, if it exists in the places list return its index position.
Definition placeslist.cpp:341
void removePlace(const int &index)
Removes a place from the model and if the data at the given index is a file URL bookmark then it gets...
Definition placeslist.cpp:239
void requestSetup(const int &index)
Request to setup or mount the device type entry at the given index.
Definition placeslist.cpp:308
bool containsGroup(const int &group)
Whether the current listing contains a group type.
Definition placeslist.cpp:359
void bookmarksChanged()
Emitted when a new bookmark entry has been added.
QString udi() const
FMH::MODEL_LIST getTags(const int &limit=5)
Get all the tags available with detailed information packaged as a FMH::MODEL_LIST.
Definition tagging.cpp:374
QString i18n(const char *text, const TYPE &arg...)
void rowsInserted(const QModelIndex &parent, int first, int last)
QString dirName() const const
bool contains(const Key &key) const const
iterator insert(const Key &key, const T &value)
T value(const Key &key) const const
const_reference at(qsizetype i) const const
void clear()
void removeAt(qsizetype i)
qsizetype size() const const
Q_EMITQ_EMIT
QMetaObject::Connection connect(const QObject *sender, PointerToMemberFunction signal, Functor functor)
void beginGroup(QAnyStringView prefix)
void endGroup()
void setValue(QAnyStringView key, const QVariant &value)
QVariant value(QAnyStringView key) const const
QString & insert(qsizetype position, QChar ch)
QFuture< ArgsType< Signal > > connect(Sender *sender, Signal signal)
QString toLocalFile() const const
QString toString(FormattingOptions options) const const
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri May 17 2024 11:51:27 by doxygen 1.10.0 written by Dimitri van Heesch, © 1997-2006
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri May 17 2024 11:51:27 by doxygen 1.10.0 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.