MauiKit File Browsing
placeslist.cpp
87 connect(&AppSettings::global(), &AppSettings::settingChanged, [this](const QUrl, const QString &key, const QVariant, const QString &group) {
107FMH::MODEL_LIST PlacesList::getGroup(const KFilePlacesModel &model, const FMStatic::PATHTYPE_KEY &type)
113 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")}};
116 // 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"}};
119 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")}};
133 const auto group = model.groupIndexes(static_cast<KFilePlacesModel::GroupType>(type == FMStatic::PATHTYPE_KEY::BOOKMARKS_PATH ? mapPathType(FMStatic::PATHTYPE_KEY::PLACES_PATH) : mappedType));
135 res << std::accumulate(group.constBegin(), group.constEnd(), FMH::MODEL_LIST(), [&model, &type, this](FMH::MODEL_LIST &list, const QModelIndex &index) -> FMH::MODEL_LIST
138 if (type == FMStatic::PATHTYPE_KEY::BOOKMARKS_PATH && FMStatic::defaultPaths.contains(url.toString()))
146 {FMH::MODEL_KEY::TYPE, type == FMStatic::PATHTYPE_KEY::BOOKMARKS_PATH ? FMStatic::PathTypeLabel(FMStatic::PATHTYPE_KEY::BOOKMARKS_PATH) : FMStatic::PathTypeLabel(type)}};
166 auto bookmarks = AppSettings::global().load(QStringLiteral("BOOKMARKS"), QStringLiteral("PREFERENCES"), {}).toStringList();
168 res << FMStatic::packItems(bookmarks, FMStatic::PathTypeLabel(FMStatic::PATHTYPE_KEY::BOOKMARKS_PATH));
252 this->model->removePlace(this->model->closestItem(QUrl(this->list.at(index)[FMH::MODEL_KEY::PATH])));
256 auto bookmarks = AppSettings::global().load(QStringLiteral("BOOKMARKS"), QStringLiteral("PREFERENCES"), {}).toStringList();
258 AppSettings::global().save(QStringLiteral("BOOKMARKS"), bookmarks, QStringLiteral("PREFERENCES"));
335 auto bookmarks = AppSettings::global().load(QStringLiteral("BOOKMARKS"), QStringLiteral("PREFERENCES"), {}).toStringList();
340 AppSettings::global().save(QStringLiteral("BOOKMARKS"), bookmarks, QStringLiteral("PREFERENCES"));
QVariant load(const QString &key, const QString &group, const QVariant &defaultValue) const
static AppSettings & global()
void save(const QString &key, const QVariant &value, const QString &group)
void settingChanged(QUrl url, QString key, QVariant value, QString group)
static const QString getIconName(const QUrl &path)
Returns the icon name for certain file.
Definition fmstatic.cpp:618
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:369
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:252
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
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:40
static void addBookmark(const QUrl &url)
Add a location to the bookmarks sections.
Definition placeslist.cpp:325
bool setupNeeded(const int &index)
Check if a device type entry needs to be setup, as in mounted.
Definition placeslist.cpp:281
bool isDevice(const int &index)
Check if a entry at the given index is a device.
Definition placeslist.cpp:268
void requestEject(const int &index)
Request to eject a removable device type at the given index.
Definition placeslist.cpp:297
bool contains(const QUrl &path)
Checks of a file URL exists in the places model.
Definition placeslist.cpp:263
int indexOfPath(const QUrl &url) const
Given an URL path, if it exists in the places list return its index position.
Definition placeslist.cpp:344
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:245
void requestSetup(const int &index)
Request to setup or mount the device type entry at the given index.
Definition placeslist.cpp:311
bool containsGroup(const int &group)
Whether the current listing contains a group type.
Definition placeslist.cpp:362
void bookmarksChanged()
Emitted when a new bookmark entry has been added.
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
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)
const_iterator constBegin() const const
const_iterator constEnd() const const
int toInt(bool *ok, int base) const const
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 Sat Dec 21 2024 16:58:02 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006
Documentation copyright © 1996-2024 The KDE developers.
Generated on Sat Dec 21 2024 16:58:02 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.