Disable debug output in hot path, more QString ctor improvements
This commit is contained in:
parent
0435cc8b47
commit
4f5aa5fab4
@ -84,17 +84,17 @@ QUrl PackageUrlInterceptor::intercept(const QUrl &path, QQmlAbstractUrlIntercept
|
|||||||
//it's from an import, good
|
//it's from an import, good
|
||||||
//TODO: implement imports whitelist?
|
//TODO: implement imports whitelist?
|
||||||
if (path.path().startsWith(import)) {
|
if (path.path().startsWith(import)) {
|
||||||
qDebug() << "Found import, access granted" << path;
|
//qDebug() << "Found import, access granted" << path;
|
||||||
|
|
||||||
//check if there is a platform specific file that overrides this import
|
//check if there is a platform specific file that overrides this import
|
||||||
foreach (const QString &platform, KDeclarative::runtimePlatform()) {
|
foreach (const QString &platform, KDeclarative::runtimePlatform()) {
|
||||||
qDebug() << "Trying" << platform;
|
//qDebug() << "Trying" << platform;
|
||||||
|
|
||||||
//search for a platformqml/ path sibling of this import path
|
//search for a platformqml/ path sibling of this import path
|
||||||
const QString &platformPath = import+QStringLiteral("/../platformqml/")+platform+path.path().mid(import.length());
|
const QString &platformPath = import+QStringLiteral("/../platformqml/")+platform+path.path().mid(import.length());
|
||||||
const QFile f(platformPath);
|
const QFile f(platformPath);
|
||||||
|
|
||||||
qDebug() << "Found a platform specific file:" << QUrl::fromLocalFile(platformPath)<<f.exists();
|
//qDebug() << "Found a platform specific file:" << QUrl::fromLocalFile(platformPath)<<f.exists();
|
||||||
if (f.exists()) {
|
if (f.exists()) {
|
||||||
return QUrl::fromLocalFile(platformPath);
|
return QUrl::fromLocalFile(platformPath);
|
||||||
}
|
}
|
||||||
|
@ -52,7 +52,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
//failed by type, let's try by extension
|
//failed by type, let's try by extension
|
||||||
const QString extension = fileName.mid(fileName.lastIndexOf(QLatin1Char('.')) + 1).toLower();
|
const QString &extension = fileName.mid(fileName.lastIndexOf(QLatin1Char('.')) + 1).toLower();
|
||||||
|
|
||||||
if (extension == QStringLiteral("svg") || extension == QStringLiteral("svgz") ||
|
if (extension == QStringLiteral("svg") || extension == QStringLiteral("svgz") ||
|
||||||
extension == QStringLiteral("png") || extension == QStringLiteral("gif") ||
|
extension == QStringLiteral("png") || extension == QStringLiteral("gif") ||
|
||||||
|
@ -27,7 +27,7 @@ public:
|
|||||||
ErrorReply(QNetworkAccessManager::Operation op, const QNetworkRequest &req)
|
ErrorReply(QNetworkAccessManager::Operation op, const QNetworkRequest &req)
|
||||||
: QNetworkReply()
|
: QNetworkReply()
|
||||||
{
|
{
|
||||||
setError(QNetworkReply::ContentOperationNotPermittedError, "The plasmoid has not been authorized to load remote content");
|
setError(QNetworkReply::ContentOperationNotPermittedError, QStringLiteral("The plasmoid has not been authorized to load remote content"));
|
||||||
setOperation(op);
|
setOperation(op);
|
||||||
setRequest(req);
|
setRequest(req);
|
||||||
setUrl(req.url());
|
setUrl(req.url());
|
||||||
@ -60,14 +60,14 @@ QNetworkReply *PackageAccessManager::createRequest(QNetworkAccessManager::Operat
|
|||||||
{
|
{
|
||||||
QUrl reqUrl(req.url());
|
QUrl reqUrl(req.url());
|
||||||
|
|
||||||
if (reqUrl.scheme() == "plasmapackage") {
|
if (reqUrl.scheme() == QStringLiteral("plasmapackage")) {
|
||||||
QNetworkRequest request = req;
|
QNetworkRequest request = req;
|
||||||
reqUrl.setScheme("file");
|
reqUrl.setScheme(QStringLiteral("file"));
|
||||||
reqUrl.setPath(m_package.filePath(0, reqUrl.path()));
|
reqUrl.setPath(m_package.filePath(0, reqUrl.path()));
|
||||||
request.setUrl(reqUrl);
|
request.setUrl(reqUrl);
|
||||||
return QNetworkAccessManager::createRequest(op, request, outgoingData);
|
return QNetworkAccessManager::createRequest(op, request, outgoingData);
|
||||||
} else if ((reqUrl.scheme() == "http") ||
|
} else if ((reqUrl.scheme() == QStringLiteral("http")) ||
|
||||||
((reqUrl.scheme() == "file" || reqUrl.scheme() == "desktop"))) {
|
((reqUrl.scheme() == QStringLiteral("file") || reqUrl.scheme() == QStringLiteral("desktop")))) {
|
||||||
return new ErrorReply(op, req);
|
return new ErrorReply(op, req);
|
||||||
} else {
|
} else {
|
||||||
#ifndef PLASMA_NO_KIO
|
#ifndef PLASMA_NO_KIO
|
||||||
|
@ -28,7 +28,7 @@
|
|||||||
|
|
||||||
class AppletAuthorization;
|
class AppletAuthorization;
|
||||||
|
|
||||||
class PLASMAQUICK_EXPORT PackageAccessManagerFactory : public QQmlNetworkAccessManagerFactory
|
class PackageAccessManagerFactory : public QQmlNetworkAccessManagerFactory
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
PackageAccessManagerFactory(const Plasma::Package &package);
|
PackageAccessManagerFactory(const Plasma::Package &package);
|
||||||
|
Loading…
Reference in New Issue
Block a user