MauiKit File Browsing
fmlist.cpp
41 qRegisterMetaType<FMList *>("const FMList*"); // this is needed for QML to know of FMList in the search method
51 this->setStatus({PathStatus::STATUS_CODE::READY, this->list.isEmpty() ? i18n("Nothing here!") : QStringLiteral(""), this->list.isEmpty() ? i18n("This place seems to be empty") : QStringLiteral(""), this->list.isEmpty() ? QStringLiteral("folder-add") : QStringLiteral(""), this->list.isEmpty(), true});
56 connect(this->fm, &FM::pathContentItemsChanged, [this](QVector<QPair<FMH::MODEL, FMH::MODEL>> res) {
80 this->setStatus({PathStatus::STATUS_CODE::ERROR, i18n("Error"), i18n("This URL cannot be listed"), QStringLiteral("documentinfo"), true, false});
86 qDebug() << "SUPOSSED TO REMOVED THIS FORM THE LIST" << index << this->list.count() << item[FMH::MODEL_KEY::PATH];
91 this->setStatus({PathStatus::STATUS_CODE::READY, this->list.isEmpty() ? i18n("Nothing here!") : QStringLiteral(""), this->list.isEmpty() ? i18n("This place seems to be empty") : QStringLiteral(""), this->list.isEmpty() ? QStringLiteral("folder-add") : QStringLiteral(""), this->list.isEmpty(), true});
152 this->setStatus({PathStatus::STATUS_CODE::READY, this->list.isEmpty() ? i18n("Nothing here!") : QStringLiteral(""), this->list.isEmpty() ? i18n("This place seems to be empty") : QStringLiteral(""), this->list.isEmpty() ? QStringLiteral("folder-add") : QStringLiteral(""), this->list.isEmpty(), true});
202 this->assignList(getTagContent(this->path.fileName(), QStringList() << this->filters << FMStatic::FILTER_LIST[static_cast<FMStatic::FILTER_TYPE>(this->filterType)]));
212 this->setStatus({PathStatus::STATUS_CODE::ERROR, i18n("Error"), i18n("This URL cannot be listed"), QStringLiteral("documentinfo"), this->list.isEmpty(), exists});
214 const auto _filters = m_mergeFilters ? QStringList() << this->filters << FMStatic::FILTER_LIST[static_cast<FMStatic::FILTER_TYPE>(this->filterType)] : this->filters.isEmpty() ? FMStatic::FILTER_LIST[static_cast<FMStatic::FILTER_TYPE>(this->filterType)] : this->filters;
338 QUrl path_ = QUrl::fromUserInput(path.simplified(), QStringLiteral("/"), QUrl::AssumeLocalFile).adjusted(QUrl::PreferLocalFile | QUrl::StripTrailingSlash | QUrl::NormalizePathSegments);
346 this->setStatus({PathStatus::STATUS_CODE::LOADING, i18n("Loading content"), i18n("Almost ready!"), QStringLiteral("view-refresh"), true, false});
474 this->fm->createCloudDir(QString(this->path.toString()).replace(FMStatic::PATHTYPE_SCHEME[FMStatic::PATHTYPE_KEY::CLOUD_PATH] + "/" + this->fm->sync->getUser(), ""), name);
523 QString fileName = QString(QStringLiteral("%1/pasted_image-0.%2")).arg(path.toLocalFile(), QStringLiteral("png"));
528 fileName = QString(QStringLiteral("%1/pasted_image-%2.%3")).arg(path.toLocalFile(), QString::number(idx), QStringLiteral("png"));
537 QString fileName = QString(QStringLiteral("%1/pasted_text-0.%2")).arg(path.toLocalFile(), format);
542 fileName = QString(QStringLiteral("%1/pasted_text-%2.%3")).arg(path.toLocalFile(), QString::number(idx), format);
640 FMStatic::setDirConf(QUrl(path.toString() + QStringLiteral("/.directory")), QStringLiteral("Desktop Entry"), QStringLiteral("Icon"), iconName);
728 this->setStatus({PathStatus::ERROR, i18n("Error"), i18n("No path to perform the search"), QStringLiteral("document-info"), true, false});
778 if (item[FMH::MODEL_KEY::LABEL].contains(query, Qt::CaseInsensitive) || item[FMH::MODEL_KEY::SUFFIX].contains(query, Qt::CaseInsensitive) || item[FMH::MODEL_KEY::MIME].contains(query, Qt::CaseInsensitive)) {
829 const auto it = std::find_if(this->items().constBegin(), this->items().constEnd(), [query](const FMH::MODEL &item) -> bool {
871 const auto it = std::find_if(this->items().constBegin(), this->items().constEnd(), [url](const FMH::MODEL &item) -> bool {
int indexOfName(const QString &query)
Given a file-name-query, check if it exists in the current location.
Definition fmlist.cpp:827
void moveToTrash(const QStringList &urls)
Remove and move to the trash the provided set of file URLs.
Definition fmlist.cpp:497
QString path
The URL to location path to proceed listing all of its file entries.
Definition fmlist.h:161
void removeFiles(const QStringList &urls)
Completely remove the set of file URLs provided.
Definition fmlist.cpp:505
void renameFile(const QString &url, const QString &newName)
Rename a file with from a given URL to the a new name provided.
Definition fmlist.cpp:489
bool readOnly
Whether destructive actions or modifications can be done to the current location contents,...
Definition fmlist.h:210
void search(const QString &query, bool recursive=true)
Start a search - starting from the current location - for a given name query.
Definition fmlist.cpp:724
bool foldersFirst
Whether the folders should be sorted first and then the files.
Definition fmlist.h:179
const QUrl previousPath()
The immediate previous path location that was navigated.
Definition fmlist.cpp:667
const QUrl posteriorPath()
The immediate posterior path location that was navigated.
Definition fmlist.cpp:657
bool clipboardHasContent() const
Whether the clipboard has a supported type of content.
Definition fmlist.cpp:599
FMList::FILTER filterType
A convenient way to filter the location contents by a file type (mimetype).
Definition fmlist.h:198
void createSymlink(const QString &url)
Create a symbolic link to the given URL in the current location.
Definition fmlist.cpp:513
bool mergeFilters
Merge the name filters and mimetype filters together for filtering the requested location contentent'...
Definition fmlist.h:237
int cloudDepth
When the location if a remote cloud directory, this allows to define the depth of the levels for list...
Definition fmlist.h:186
void setDirIcon(const int &index, const QString &iconName)
Changes the icon of a directory by making use of the directory config file.
Definition fmlist.cpp:630
void createDir(const QString &name)
Create a new directory within the current directory.
Definition fmlist.cpp:467
void warning(QString message)
Emitted when the listing process has any error message that needs to be notified.
void cutInto(const QStringList &urls)
Cut/move a list of file URLs to the current directory.
Definition fmlist.cpp:622
void remove(const int &index)
Remove an item from the model, this does not remove the file from the file system.
Definition fmlist.cpp:816
void copyInto(const QStringList &urls)
Copy a list of file URLs into the current directory.
Definition fmlist.cpp:614
static FMH::MODEL_LIST search(const QString &query, const QUrl &path, const bool &hidden=false, const bool &onlyDirs=false, const QStringList &filters=QStringList())
Search for files in a path using name filters.
Definition fmstatic.cpp:79
static const QHash< PATHTYPE_KEY, QString > PATHTYPE_SCHEME
The map of the PATH_TYPE to its associated protocol scheme.
Definition fmstatic.h:333
static QHash< FILTER_TYPE, QStringList > FILTER_LIST
Convenient map set of file type extensions.
Definition fmstatic.h:214
static bool createSymlink(const QUrl &path, const QUrl &where)
Creates a symbolic link to a given file URL.
Definition fmstatic.cpp:394
static QUrl parentDir(const QUrl &path)
Given a file URL return its parent directory.
Definition fmstatic.cpp:127
static bool removeFiles(const QList< QUrl > &urls)
List of files to be removed completely.
Definition fmstatic.cpp:296
static const FMH::MODEL getFileInfoModel(const QUrl &path)
getFileInfoModel
Definition fmstatic.cpp:560
static bool isDir(const QUrl &path)
Whether a local file URL is a directory.
Definition fmstatic.cpp:139
static bool createDir(const QUrl &path, const QString &name)
Creates a new directory given a base path and a name.
Definition fmstatic.cpp:371
static void setDirConf(const QUrl &path, const QString &group, const QString &key, const QVariant &value)
Write a configuration key-value entry to the directory conf file.
Definition fmstatic.cpp:464
static void moveToTrash(const QList< QUrl > &urls)
Moves to the trashcan the provided file URLs.
Definition fmstatic.cpp:323
static bool createFile(const QUrl &path, const QString &name)
Creates a file given the base directory path and a file name.
Definition fmstatic.cpp:382
The FM class stands for File Management, and exposes methods for file listing, browsing and handling,...
Definition fm.h:104
void cloudServerContentReady(FMStatic::PATH_CONTENT list)
Emitted once the requested contents of the server are ready.
void newItem(FMH::MODEL item, QUrl path)
Emitted when a new item is available in the remote server in the current location.
void pathContentItemsRemoved(FMStatic::PATH_CONTENT list)
Emitted when a set of entries in the current location have been removed.
void pathContentReady(QUrl path)
Emitted once the contents of the current location are ready and the listing has finished.
void pathContentItemsChanged(QVector< QPair< FMH::MODEL, FMH::MODEL > > items)
Emitted when the current location entries have changed.
void pathContentItemsReady(FMStatic::PATH_CONTENT list)
Emitted when a set of entries for the current location are ready.
void pathContentChanged(QUrl path)
Emitted when the contents of the current location has changed, either by some new entries being added...
void preItemAppended()
void countChanged()
void updateModel(int index, QVector< int > roles)
void postItemAppended()
void preItemRemoved(int index)
void preItemsAppended(uint count)
MauiList(QObject *parent=nullptr)
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
void urlTagged(QString url, QString tag)
Emitted when a tag has been assigened to a file URL.
QList< QUrl > getTagUrls(const QString &tag, const QStringList &filters, const bool &strict=false, const int &limit=9999, const QString &mime=QStringLiteral(""))
Shortcut for getting a list of file URLs associated to a tag, the resulting list of URLs can be filte...
Definition tagging.cpp:348
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...)
const QVector< int > modelRoles(const MODEL &model)
QVector< MODEL > MODEL_LIST
bool fileExists(const QUrl &path)
QHash< MODEL_KEY, QString > MODEL
MODEL_KEY
VehicleSection::Type type(QStringView coachNumber, QStringView coachClassification)
char at(qsizetype i) const const
bool isEmpty() const const
const QMimeData * mimeData(Mode mode) const const
QDateTime currentDateTime()
QDateTime fromString(QStringView string, QStringView format, QCalendar cal)
bool exists(const QString &fileName)
bool exists() const const
void finished()
QFuture< T > future() const const
void setFuture(const QFuture< T > &future)
QClipboard * clipboard()
bool save(QIODevice *device, const char *format, int quality) const const
ReadWrite
QByteArray data(const QString &mimeType) const const
bool hasImage() const const
bool hasText() const const
bool hasUrls() const const
QVariant imageData() const const
QString text() const const
QList< QUrl > urls() const const
QObject(QObject *parent)
Q_EMITQ_EMIT
QMetaObject::Connection connect(const QObject *sender, PointerToMemberFunction signal, Functor functor)
void deleteLater()
QObject * parent() const const
QString arg(Args &&... args) const const
bool isEmpty() const const
QString number(double n, char format, int precision)
QString & replace(QChar before, QChar after, Qt::CaseSensitivity cs)
CaseInsensitive
TextDate
QFuture< T > run(Function function,...)
PreferLocalFile
AssumeLocalFile
QUrl adjusted(FormattingOptions options) const const
QList< QUrl > fromStringList(const QStringList &urls, ParsingMode mode)
QUrl fromUserInput(const QString &userInput, const QString &workingDirectory, UserInputResolutionOptions options)
QString path(ComponentFormattingOptions options) const const
QString toString(FormattingOptions options) const const
QStringList toStringList(const QList< QUrl > &urls, FormattingOptions options)
This file is part of the KDE documentation.
Documentation copyright © 1996-2025 The KDE developers.
Generated on Fri Jan 24 2025 11:49:45 by doxygen 1.13.2 written by Dimitri van Heesch, © 1997-2006
Documentation copyright © 1996-2025 The KDE developers.
Generated on Fri Jan 24 2025 11:49:45 by doxygen 1.13.2 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.