summaryrefslogtreecommitdiffstats
path: root/src/plugins
diff options
context:
space:
mode:
authorQt Forward Merge Bot <qt_forward_merge_bot@qt-project.org>2020-03-01 01:00:23 +0100
committerSimon Hausmann <simon.hausmann@qt.io>2020-03-03 14:13:02 +0100
commit63312fe2ec1c1d8c0efabc02e3af8e5b47ca320e (patch)
treefc850de8f31581cc6a64db7a78d1cca479e20ce9 /src/plugins
parent5ebb03c47604e0597502fbe1069de636987f33fc (diff)
parentfbebc93617d99d2bf8fed559f17dba8bed15a063 (diff)
Merge remote-tracking branch 'origin/5.15' into dev
Diffstat (limited to 'src/plugins')
-rw-r--r--src/plugins/platforms/android/androidcontentfileengine.cpp47
-rw-r--r--src/plugins/platforms/android/androidcontentfileengine.h6
-rw-r--r--src/plugins/platformthemes/xdgdesktopportal/qxdgdesktopportalfiledialog.cpp2
-rw-r--r--src/plugins/sqldrivers/db2/qsql_db2.cpp2
-rw-r--r--src/plugins/sqldrivers/ibase/qsql_ibase.cpp2
-rw-r--r--src/plugins/sqldrivers/mysql/qsql_mysql.cpp2
-rw-r--r--src/plugins/sqldrivers/oci/qsql_oci.cpp2
-rw-r--r--src/plugins/sqldrivers/odbc/qsql_odbc.cpp2
8 files changed, 57 insertions, 8 deletions
diff --git a/src/plugins/platforms/android/androidcontentfileengine.cpp b/src/plugins/platforms/android/androidcontentfileengine.cpp
index 1444407195..3e3bdc2592 100644
--- a/src/plugins/platforms/android/androidcontentfileengine.cpp
+++ b/src/plugins/platforms/android/androidcontentfileengine.cpp
@@ -44,9 +44,10 @@
#include <QDebug>
-AndroidContentFileEngine::AndroidContentFileEngine(const QString &fileName)
- : QFSFileEngine(fileName)
+AndroidContentFileEngine::AndroidContentFileEngine(const QString &f)
+ : m_file(f)
{
+ setFileName(f);
}
bool AndroidContentFileEngine::open(QIODevice::OpenMode openMode)
@@ -78,6 +79,48 @@ bool AndroidContentFileEngine::open(QIODevice::OpenMode openMode)
return QFSFileEngine::open(openMode, fd, QFile::AutoCloseHandle);
}
+qint64 AndroidContentFileEngine::size() const
+{
+ const jlong size = QJNIObjectPrivate::callStaticMethod<jlong>(
+ "org/qtproject/qt5/android/QtNative", "getSize",
+ "(Landroid/content/Context;Ljava/lang/String;)J", QtAndroidPrivate::context(),
+ QJNIObjectPrivate::fromString(fileName(DefaultName)).object());
+ return (qint64)size;
+}
+
+AndroidContentFileEngine::FileFlags AndroidContentFileEngine::fileFlags(FileFlags type) const
+{
+ FileFlags commonFlags(ReadOwnerPerm|ReadUserPerm|ReadGroupPerm|ReadOtherPerm|ExistsFlag);
+ FileFlags flags;
+ const bool exists = QJNIObjectPrivate::callStaticMethod<jboolean>(
+ "org/qtproject/qt5/android/QtNative", "checkFileExists",
+ "(Landroid/content/Context;Ljava/lang/String;)Z", QtAndroidPrivate::context(),
+ QJNIObjectPrivate::fromString(fileName(DefaultName)).object());
+ if (!exists)
+ return flags;
+ flags = FileType | commonFlags;
+ return type & flags;
+}
+
+QString AndroidContentFileEngine::fileName(FileName f) const
+{
+ switch (f) {
+ case PathName:
+ case AbsolutePathName:
+ case CanonicalPathName:
+ case DefaultName:
+ case AbsoluteName:
+ case CanonicalName:
+ return m_file;
+ case BaseName:
+ {
+ const int pos = m_file.lastIndexOf(QChar(QLatin1Char('/')));
+ return m_file.mid(pos);
+ }
+ default:
+ return QString();
+ }
+}
AndroidContentFileEngineHandler::AndroidContentFileEngineHandler() = default;
AndroidContentFileEngineHandler::~AndroidContentFileEngineHandler() = default;
diff --git a/src/plugins/platforms/android/androidcontentfileengine.h b/src/plugins/platforms/android/androidcontentfileengine.h
index db3def03d6..09e5d77553 100644
--- a/src/plugins/platforms/android/androidcontentfileengine.h
+++ b/src/plugins/platforms/android/androidcontentfileengine.h
@@ -47,6 +47,12 @@ class AndroidContentFileEngine : public QFSFileEngine
public:
AndroidContentFileEngine(const QString &fileName);
bool open(QIODevice::OpenMode openMode) override;
+ qint64 size() const override;
+ FileFlags fileFlags(FileFlags type = FileInfoAll) const override;
+ QString fileName(FileName file = DefaultName) const override;
+private:
+ QString m_file;
+
};
class AndroidContentFileEngineHandler : public QAbstractFileEngineHandler
diff --git a/src/plugins/platformthemes/xdgdesktopportal/qxdgdesktopportalfiledialog.cpp b/src/plugins/platformthemes/xdgdesktopportal/qxdgdesktopportalfiledialog.cpp
index dcf52921aa..13c39436ba 100644
--- a/src/plugins/platformthemes/xdgdesktopportal/qxdgdesktopportalfiledialog.cpp
+++ b/src/plugins/platformthemes/xdgdesktopportal/qxdgdesktopportalfiledialog.cpp
@@ -225,7 +225,7 @@ void QXdgDesktopPortalFileDialog::openPortal()
QRegularExpressionMatch match = regexp.match(filter);
if (match.hasMatch()) {
QString userVisibleName = match.captured(1);
- QStringList filterStrings = match.captured(2).split(QLatin1Char(' '), QString::SkipEmptyParts);
+ QStringList filterStrings = match.captured(2).split(QLatin1Char(' '), Qt::SkipEmptyParts);
FilterConditionList filterConditions;
for (const QString &filterString : filterStrings) {
diff --git a/src/plugins/sqldrivers/db2/qsql_db2.cpp b/src/plugins/sqldrivers/db2/qsql_db2.cpp
index 1d7e985731..ddf54666e7 100644
--- a/src/plugins/sqldrivers/db2/qsql_db2.cpp
+++ b/src/plugins/sqldrivers/db2/qsql_db2.cpp
@@ -1270,7 +1270,7 @@ bool QDB2Driver::open(const QString& db, const QString& user, const QString& pas
QString protocol;
// Set connection attributes
- const QStringList opts(connOpts.split(QLatin1Char(';'), QString::SkipEmptyParts));
+ const QStringList opts(connOpts.split(QLatin1Char(';'), Qt::SkipEmptyParts));
for (int i = 0; i < opts.count(); ++i) {
const QString tmp(opts.at(i));
int idx;
diff --git a/src/plugins/sqldrivers/ibase/qsql_ibase.cpp b/src/plugins/sqldrivers/ibase/qsql_ibase.cpp
index 09c0655f3d..fb364c21f5 100644
--- a/src/plugins/sqldrivers/ibase/qsql_ibase.cpp
+++ b/src/plugins/sqldrivers/ibase/qsql_ibase.cpp
@@ -1477,7 +1477,7 @@ bool QIBaseDriver::open(const QString & db,
if (isOpen())
close();
- const QStringList opts(connOpts.split(QLatin1Char(';'), QString::SkipEmptyParts));
+ const QStringList opts(connOpts.split(QLatin1Char(';'), Qt::SkipEmptyParts));
QString encString;
QByteArray role;
diff --git a/src/plugins/sqldrivers/mysql/qsql_mysql.cpp b/src/plugins/sqldrivers/mysql/qsql_mysql.cpp
index 41141e1dd4..4e2698760f 100644
--- a/src/plugins/sqldrivers/mysql/qsql_mysql.cpp
+++ b/src/plugins/sqldrivers/mysql/qsql_mysql.cpp
@@ -1239,7 +1239,7 @@ bool QMYSQLDriver::open(const QString& db,
stored procedure call will fail.
*/
unsigned int optionFlags = CLIENT_MULTI_STATEMENTS;
- const QStringList opts(connOpts.split(QLatin1Char(';'), QString::SkipEmptyParts));
+ const QStringList opts(connOpts.split(QLatin1Char(';'), Qt::SkipEmptyParts));
QString unixSocket;
QString sslCert;
QString sslCA;
diff --git a/src/plugins/sqldrivers/oci/qsql_oci.cpp b/src/plugins/sqldrivers/oci/qsql_oci.cpp
index aee8e92b36..8da9837a59 100644
--- a/src/plugins/sqldrivers/oci/qsql_oci.cpp
+++ b/src/plugins/sqldrivers/oci/qsql_oci.cpp
@@ -2230,7 +2230,7 @@ bool QOCIDriver::hasFeature(DriverFeature f) const
static void qParseOpts(const QString &options, QOCIDriverPrivate *d)
{
- const QStringList opts(options.split(QLatin1Char(';'), QString::SkipEmptyParts));
+ const QStringList opts(options.split(QLatin1Char(';'), Qt::SkipEmptyParts));
for (int i = 0; i < opts.count(); ++i) {
const QString tmp(opts.at(i));
int idx;
diff --git a/src/plugins/sqldrivers/odbc/qsql_odbc.cpp b/src/plugins/sqldrivers/odbc/qsql_odbc.cpp
index 63e8f9f9fe..be1a06bc1d 100644
--- a/src/plugins/sqldrivers/odbc/qsql_odbc.cpp
+++ b/src/plugins/sqldrivers/odbc/qsql_odbc.cpp
@@ -767,7 +767,7 @@ QChar QODBCDriverPrivate::quoteChar()
bool QODBCDriverPrivate::setConnectionOptions(const QString& connOpts)
{
// Set any connection attributes
- const QStringList opts(connOpts.split(QLatin1Char(';'), QString::SkipEmptyParts));
+ const QStringList opts(connOpts.split(QLatin1Char(';'), Qt::SkipEmptyParts));
SQLRETURN r = SQL_SUCCESS;
for (int i = 0; i < opts.count(); ++i) {
const QString tmp(opts.at(i));