File indexing completed on 2024-05-12 15:54:48

0001 // SPDX-FileCopyrightText: 2019 Linus Jahn <lnj@kaidan.im>
0002 //
0003 // SPDX-License-Identifier: LGPL-2.0-or-later
0004 
0005 #pragma once
0006 
0007 #include <QObject>
0008 #include <QUrl>
0009 
0010 class DirModelUtils : public QObject
0011 {
0012     Q_OBJECT
0013 
0014     Q_PROPERTY(QUrl home READ home CONSTANT)
0015     Q_PROPERTY(QUrl pictures READ pictures CONSTANT)
0016     Q_PROPERTY(QUrl videos READ videos CONSTANT)
0017 public:
0018     explicit DirModelUtils(QObject *parent = nullptr);
0019 
0020     QUrl home() const;
0021     QUrl pictures() const;
0022     QUrl videos() const;
0023 
0024     Q_INVOKABLE bool inHome(const QUrl &url) const;
0025     Q_INVOKABLE QStringList getUrlParts(const QUrl &url) const;
0026     Q_INVOKABLE QUrl partialUrlForIndex(QUrl url, int index) const;
0027     Q_INVOKABLE bool canBeSimplified(QUrl url) const;
0028     Q_INVOKABLE QUrl directoryOfUrl(const QString &path) const;
0029     Q_INVOKABLE QString fileNameOfUrl(const QString &path) const;
0030     Q_INVOKABLE QUrl parentOfUrl(const QUrl &url) const;
0031 
0032     Q_INVOKABLE void mkdir(const QUrl &path) const;
0033 
0034 Q_SIGNALS:
0035     void homePathChanged();
0036 };