![]() |
Qt 6.x
The Qt SDK
|
DocumentFile Api. More...
#include <androidcontentfileengine.h>
Public Member Functions | |
DocumentFilePtr | createFile (const QString &mimeType, const QString &displayName) |
DocumentFilePtr | createDirectory (const QString &displayName) |
const QJniObject & | uri () const |
const DocumentFilePtr & | parent () const |
QString | name () const |
QString | id () const |
QString | mimeType () const |
bool | isDirectory () const |
bool | isFile () const |
bool | isVirtual () const |
QDateTime | lastModified () const |
int64_t | length () const |
bool | canRead () const |
bool | canWrite () const |
bool | remove () |
bool | exists () const |
std::vector< DocumentFilePtr > | listFiles () |
bool | rename (const QString &newName) |
Static Public Member Functions | |
static DocumentFilePtr | parseFromAnyUri (const QString &filename) |
static DocumentFilePtr | fromSingleUri (const QJniObject &uri) |
static DocumentFilePtr | fromTreeUri (const QJniObject &treeUri) |
Protected Member Functions | |
DocumentFile (const QJniObject &uri, const std::shared_ptr< DocumentFile > &parent) | |
Protected Attributes | |
QJniObject | m_uri |
DocumentFilePtr | m_parent |
DocumentFile Api.
Check https://developer.android.com/reference/androidx/documentfile/provider/DocumentFile for more information.
Definition at line 73 of file androidcontentfileengine.h.
|
protected |
Definition at line 588 of file androidcontentfileengine.cpp.
bool DocumentFile::canRead | ( | ) | const |
Definition at line 732 of file androidcontentfileengine.cpp.
References context, QString::isEmpty(), m_uri, and mimeType().
bool DocumentFile::canWrite | ( | ) | const |
Definition at line 744 of file androidcontentfileengine.cpp.
References DocumentsContract::Document::COLUMN_FLAGS, context, DocumentsContract::Document::FLAG_DIR_SUPPORTS_CREATE, DocumentsContract::Document::FLAG_SUPPORTS_DELETE, DocumentsContract::Document::FLAG_SUPPORTS_WRITE, m_uri, DocumentsContract::Document::MIME_TYPE_DIR, mimeType(), Cursor::queryColumn(), and QVariant::toInt().
DocumentFilePtr DocumentFile::createDirectory | ( | const QString & | displayName | ) |
Definition at line 662 of file androidcontentfileengine.cpp.
References DocumentsContract::createDocument(), displayName(), isDirectory(), m_uri, and DocumentsContract::Document::MIME_TYPE_DIR.
DocumentFilePtr DocumentFile::createFile | ( | const QString & | mimeType, |
const QString & | displayName | ||
) |
Definition at line 652 of file androidcontentfileengine.cpp.
References DocumentsContract::createDocument(), displayName(), isDirectory(), m_uri, and mimeType().
bool DocumentFile::exists | ( | ) | const |
Definition at line 773 of file androidcontentfileengine.cpp.
References QString::isEmpty(), and name().
|
static |
Definition at line 636 of file androidcontentfileengine.cpp.
References uri().
Referenced by parseFromAnyUri().
|
static |
Definition at line 641 of file androidcontentfileengine.cpp.
References DocumentsContract::buildDocumentUriUsingTree(), DocumentsContract::documentId(), DocumentsContract::isDocumentUri(), and DocumentsContract::treeDocumentId().
Referenced by parseFromAnyUri(), and rename().
QString DocumentFile::id | ( | ) | const |
Definition at line 687 of file androidcontentfileengine.cpp.
References DocumentsContract::documentId(), and uri().
bool DocumentFile::isDirectory | ( | ) | const |
Definition at line 697 of file androidcontentfileengine.cpp.
References DocumentsContract::Document::MIME_TYPE_DIR, and mimeType().
Referenced by createDirectory(), and createFile().
bool DocumentFile::isFile | ( | ) | const |
Definition at line 702 of file androidcontentfileengine.cpp.
References QLatin1StringView::isEmpty(), DocumentsContract::Document::MIME_TYPE_DIR, and mimeType().
bool DocumentFile::isVirtual | ( | ) | const |
Definition at line 708 of file androidcontentfileengine.cpp.
References DocumentsContract::Document::COLUMN_FLAGS, DocumentsContract::Document::FLAG_VIRTUAL_DOCUMENT, DocumentsContract::isDocumentUri(), m_uri, Cursor::queryColumn(), and QVariant::toInt().
QDateTime DocumentFile::lastModified | ( | ) | const |
Definition at line 714 of file androidcontentfileengine.cpp.
References DocumentsContract::Document::COLUMN_LAST_MODIFIED, QDateTime::fromMSecsSinceEpoch(), m_uri, and Cursor::queryColumn().
int64_t DocumentFile::length | ( | ) | const |
Definition at line 722 of file androidcontentfileengine.cpp.
References DocumentsContract::Document::COLUMN_SIZE, m_uri, Cursor::queryColumn(), and QVariant::toLongLong().
std::vector< DocumentFilePtr > DocumentFile::listFiles | ( | ) |
Definition at line 778 of file androidcontentfileengine.cpp.
References DocumentsContract::buildChildDocumentsUriUsingTree(), DocumentsContract::buildDocumentUriUsingTree(), DocumentsContract::Document::COLUMN_DOCUMENT_ID, DocumentsContract::documentId(), m_uri, Cursor::queryUri(), and uri().
QString DocumentFile::mimeType | ( | ) | const |
Definition at line 692 of file androidcontentfileengine.cpp.
References DocumentsContract::Document::COLUMN_MIME_TYPE, m_uri, Cursor::queryColumn(), and QVariant::toString().
Referenced by canRead(), canWrite(), createFile(), isDirectory(), and isFile().
QString DocumentFile::name | ( | ) | const |
Definition at line 682 of file androidcontentfileengine.cpp.
References DocumentsContract::Document::COLUMN_DISPLAY_NAME, m_uri, Cursor::queryColumn(), and QVariant::toString().
Referenced by exists().
const DocumentFilePtr & DocumentFile::parent | ( | ) | const |
Definition at line 677 of file androidcontentfileengine.cpp.
References m_parent.
Referenced by rename().
|
static |
Definition at line 606 of file androidcontentfileengine.cpp.
References fileName, fromSingleUri(), fromTreeUri(), DocumentsContract::isDocumentUri(), parseUri(), QString::size(), QUrl::toPercentEncoding(), and uri().
Referenced by AndroidContentFileEngineIterator::hasNext().
bool DocumentFile::remove | ( | ) |
Definition at line 768 of file androidcontentfileengine.cpp.
References DocumentsContract::deleteDocument(), and m_uri.
bool DocumentFile::rename | ( | const QString & | newName | ) |
Definition at line 793 of file androidcontentfileengine.cpp.
References QString::contains(), displayName(), file, fromTreeUri(), QString::left(), m_uri, QString::mid(), DocumentsContract::moveDocument(), parent(), parseUri(), QString::remove(), DocumentsContract::renameDocument(), QString::startsWith(), QUrl::toPercentEncoding(), and uri().
const QJniObject & DocumentFile::uri | ( | ) | const |
Definition at line 672 of file androidcontentfileengine.cpp.
References m_uri.
Referenced by fromSingleUri(), id(), listFiles(), parseFromAnyUri(), and rename().
|
protected |
Definition at line 104 of file androidcontentfileengine.h.
Referenced by parent().
|
protected |
Definition at line 103 of file androidcontentfileengine.h.
Referenced by canRead(), canWrite(), createDirectory(), createFile(), isVirtual(), lastModified(), length(), listFiles(), mimeType(), name(), remove(), rename(), and uri().