MauiKit File Browsing
fmstatic.cpp
33 static const QHash<FMStatic::PATHTYPE_KEY, QString> PATHTYPE_LABEL = {{PATHTYPE_KEY::PLACES_PATH, i18n("Places")},
79FMH::MODEL_LIST FMStatic::search(const QString &query, const QUrl &path, const bool &hidden, const bool &onlyDirs, const QStringList &filters)
91 dirFilter = (onlyDirs ? QDir::AllDirs | QDir::NoDotDot | QDir::NoDot : QDir::Files | QDir::AllDirs | QDir::NoDotDot | QDir::NoDot);
226 const auto _destination = QUrl(destinationDir.toString() + QStringLiteral("/") + FMStatic::getFileInfoModel(url)[FMH::MODEL_KEY::LABEL]);
231 const auto _destination = QUrl(destinationDir.toString() + QStringLiteral("/") + FMStatic::getFileInfoModel(url)[FMH::MODEL_KEY::LABEL]);
272 QUrl where_ = QUrl(where.toString() + QStringLiteral("/") + FMStatic::getFileInfoModel(url)[FMH::MODEL_KEY::LABEL]);
282 _where = QUrl(where.toString() + QStringLiteral("/") + FMStatic::getFileInfoModel(url)[FMH::MODEL_KEY::LABEL]);
348 for (const QFileInfo &info : dir.entryInfoList(QDir::NoDotAndDotDot | QDir::System | QDir::Hidden | QDir::AllDirs | QDir::Files, QDir::DirsFirst))
368 return FMStatic::cut({url}, QUrl(url.toString().left(url.toString().lastIndexOf(QStringLiteral("/")))), name);
374 auto job = KIO::mkdir(name.isEmpty() ? path : QUrl(path.toString() + QStringLiteral("/") + name));
402 return QFile::link(path.toLocalFile(), where.toLocalFile() + QStringLiteral("/") + QFileInfo(path.toLocalFile()).fileName());
520 if (FMStatic::checkFileType(FMStatic::FILTER_TYPE::FONT, mimetype) || FMStatic::checkFileType(FMStatic::FILTER_TYPE::TEXT, mimetype) || FMStatic::checkFileType(FMStatic::FILTER_TYPE::AUDIO, mimetype) || FMStatic::checkFileType(FMStatic::FILTER_TYPE::DOCUMENT, mimetype) || FMStatic::checkFileType(FMStatic::FILTER_TYPE::VIDEO, mimetype) || url.toString().endsWith(QStringLiteral(".appimage"), Qt::CaseInsensitive)) {
543 {FMH::MODEL_KEY::MODIFIED, kfile.time(KFileItem::FileTimes::ModificationTime).toString(Qt::TextDate)},
544 {FMH::MODEL_KEY::LAST_READ, kfile.time(KFileItem::FileTimes::AccessTime).toString(Qt::TextDate)},
556 {FMH::MODEL_KEY::COUNT, kfile.isLocalFile() && kfile.isDir() ? QString::number(QDir(kfile.localPath()).count()-2) : QStringLiteral("0")}};
564 res = FMStatic::getFileInfo(KFileItem(path, KFileItem::MimeTypeDetermination::NormalMimeTypeDetermination));
588 {FMH::MODEL_KEY::LABEL, path.toString() == HomePath ? QStringLiteral("Home") : file.fileName()},
603 {FMH::MODEL_KEY::COUNT, file.isDir() ? QString::number(QDir(path.toLocalFile()).count()) : QStringLiteral("0")}};
631 return dirConfIcon(QUrl(QString(path.toString() + QStringLiteral("/%1")).arg(QStringLiteral(".directory"))));
static const QString getIconName(const QUrl &path)
Returns the icon name for certain file.
Definition fmstatic.cpp:618
static QStringList nameFilters(const int &type)
Given a filter type return a list of associated name filters, as their suffixes.
Definition fmstatic.cpp:501
static const QHash< QString, PATHTYPE_KEY > PATHTYPE_SCHEME_NAME
The protocol scheme mapped to its PATHTYPE_KEY.
Definition fmstatic.h:351
static bool fileExists(const QUrl &path)
Checks if a local file exists in the file system.
Definition fmstatic.cpp:155
static const QStringList defaultPaths
The internally defined quick standard locations.
Definition fmstatic.h:441
static bool group(const QList< QUrl > &urls, const QUrl &destinationDir, const QString &name)
Perform a move operation of the given files to a new destination.
Definition fmstatic.cpp:244
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 QMap< QString, QString > folderIcon
A mapping of the standard location to a icon name.
Definition fmstatic.h:457
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 bool cut(const QList< QUrl > &urls, const QUrl &where)
Perform a move/cut of a list of files to a destination.
Definition fmstatic.cpp:256
static QHash< FILTER_TYPE, QStringList > FILTER_LIST
Convenient map set of file type extensions.
Definition fmstatic.h:214
static bool isCloud(const QUrl &path)
Whether a path is a URL server instead of a local file.
Definition fmstatic.cpp:150
static void openLocation(const QStringList &urls)
Open the file URLs with the default file manager.
Definition fmstatic.cpp:423
static void openUrl(const QUrl &url)
Given a URL it tries to open it using the default application associated to it.
Definition fmstatic.cpp:406
static QUrl fileDir(const QUrl &path)
Given a file URL, return its parent directory.
Definition fmstatic.cpp:160
static FMStatic::PATHTYPE_KEY getPathType(const QUrl &url)
Given a file URL with a well defined scheme, get the PATHTYPE_KEY.
Definition fmstatic.cpp:646
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 const QString dirConfIcon(const QUrl &path)
Return the icon name set in the directory .directory conf file.
Definition fmstatic.cpp:437
static void bookmark(const QUrl &url)
Add a directory URL to the places bookmarks.
Definition fmstatic.cpp:496
static QString PathTypeLabel(const FMStatic::PATHTYPE_KEY &key)
Given a PATHTYPE_KEY return a user friendly string.
Definition fmstatic.cpp:31
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 copy(const QList< QUrl > &urls, const QUrl &destinationDir)
Perform a copy of the files to the given destination.
Definition fmstatic.cpp:216
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 const QMap< FILTER_TYPE, QStringList > SUPPORTED_MIMETYPES
The map set of the supported mime types for the FM classes.
Definition fmstatic.h:171
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
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 const QString getMime(const QUrl &path)
Get the mime type of the given file path.
Definition fmstatic.cpp:506
static bool checkFileType(const int &type, const QString &mimeTypeName)
Checks if a mime-type belongs to a file type, for example, whether image/jpg belongs to the type FMH:...
Definition fmstatic.cpp:486
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
PATHTYPE_KEY
The different location types supported. Most of them need of KDE KIO framework to be fully operationa...
Definition fmstatic.h:252
SimpleConfig
QString iconName() const
QUrl mostLocalUrl(bool *local=nullptr) const
bool isLocalFile() const
KIO::filesize_t size() const
bool isLink() const
Q_INVOKABLE QDateTime time(KFileItem::FileTimes which) const
QString mimetype() const
bool isFile() const
QString linkDest() const
QString localPath() const
bool isDir() const
bool isHidden() const
QString name(bool lowerCase=false) const
void start() override
void setRunExecutables(bool allow)
virtual Q_SCRIPTABLE void start()=0
static void openUrl(const QUrl &url)
static QStringList sdDirs()
static void addBookmark(const QUrl &url)
Add a location to the bookmarks sections.
Definition placeslist.cpp:325
bool updateUrl(const QString &url, const QString &newUrl)
Updates a file URL to a new URL, preserving all associated tags.
Definition tagging.cpp:205
QString i18n(const char *text, const TYPE &arg...)
bool fileExists(const QUrl &path)
QHash< MODEL_KEY, QString > MODEL
const QVariantMap toMap(const MODEL &model)
KIOCORE_EXPORT DeleteJob * del(const QList< QUrl > &src, JobFlags flags=DefaultFlags)
KIOCORE_EXPORT CopyJob * move(const QList< QUrl > &src, const QUrl &dest, JobFlags flags=DefaultFlags)
KIOCORE_EXPORT MkdirJob * mkdir(const QUrl &url, int permissions=-1)
KIOCORE_EXPORT CopyJob * copy(const QList< QUrl > &src, const QUrl &dest, JobFlags flags=DefaultFlags)
KIOCORE_EXPORT CopyJob * trash(const QList< QUrl > &src, JobFlags flags=DefaultFlags)
KIOCORE_EXPORT CopyJob * link(const QList< QUrl > &src, const QUrl &destDir, JobFlags flags=DefaultFlags)
KIOCORE_EXPORT EmptyTrashJob * emptyTrash()
HideProgressInfo
QString toString(QStringView format, QCalendar cal) const const
bool openUrl(const QUrl &url)
Filters
DirsFirst
QString absolutePath() const const
qsizetype count() const const
bool exists() const const
bool mkdir(const QString &dirName) const const
QChar separator()
Subdirectories
QString fileName() const const
bool hasNext() const const
QString next()
bool copy(const QString &fileName, const QString &newName)
bool link(const QString &fileName, const QString &linkName)
bool open(FILE *fh, OpenMode mode, FileHandleFlags handleFlags)
bool remove()
bool rename(const QString &newName)
virtual void close() override
QDateTime birthTime() const const
QString completeSuffix() const const
QDir dir() const const
bool exists(const QString &path)
QString fileName() const const
bool isDir() const const
bool isFile() const const
bool isHidden() const const
bool isSymLink() const const
QDateTime lastModified() const const
QDateTime lastRead() const const
qint64 size() const const
QString symLinkTarget() const const
ReadWrite
void clear()
qsizetype count() const const
bool contains(const Key &key) const const
QMimeType mimeTypeForFile(const QFileInfo &fileInfo, MatchMode mode) const const
name
void beginGroup(QAnyStringView prefix)
void endGroup()
QString group() const const
void setValue(QAnyStringView key, const QVariant &value)
void sync()
QVariant value(QAnyStringView key) const const
bool contains(QChar ch, Qt::CaseSensitivity cs) const const
bool endsWith(QChar c, Qt::CaseSensitivity cs) const const
bool isEmpty() const const
qsizetype lastIndexOf(QChar ch, Qt::CaseSensitivity cs) const const
QString left(qsizetype n) const const
QString number(double n, char format, int precision)
bool contains(QLatin1StringView str, Qt::CaseSensitivity cs) const const
CaseInsensitive
TextDate
QUrl fromLocalFile(const QString &localFile)
QString scheme() const const
QString toLocalFile() const const
QString toString(FormattingOptions options) const const
QString toString() const const
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Mon Nov 18 2024 12:10:48 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006
Documentation copyright © 1996-2024 The KDE developers.
Generated on Mon Nov 18 2024 12:10:48 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.