diff --git a/src/plasmaquick/CMakeLists.txt b/src/plasmaquick/CMakeLists.txt index 75ffe6fc6..613dd5574 100644 --- a/src/plasmaquick/CMakeLists.txt +++ b/src/plasmaquick/CMakeLists.txt @@ -4,10 +4,10 @@ set(plasmaquick_LIB_SRC plasmaquickview.cpp configmodel.cpp configview.cpp - private/configcategory_p.cpp - packageaccessmanager.cpp - packageaccessmanagerfactory.cpp packageurlinterceptor.cpp + private/configcategory_p.cpp + private/packageaccessmanager.cpp + private/packageaccessmanagerfactory.cpp #private/containmentconfigview_p.cpp #private/currentcontainmentactionsmodel_p.cpp ) @@ -41,7 +41,6 @@ set(plasmaquick_LIB_INCLUDES plasmaquickview.h configview.h configmodel.h - packageaccessmanagerfactory.h # temporary, remove once folded into urlinterceptor packageurlinterceptor.h ) diff --git a/src/plasmaquick/packageurlinterceptor.cpp b/src/plasmaquick/packageurlinterceptor.cpp index e8a7a5cd8..122eab74b 100644 --- a/src/plasmaquick/packageurlinterceptor.cpp +++ b/src/plasmaquick/packageurlinterceptor.cpp @@ -18,6 +18,7 @@ */ #include "packageurlinterceptor.h" +#include "private/packageaccessmanagerfactory.h" #include #include @@ -90,7 +91,7 @@ QUrl PackageUrlInterceptor::intercept(const QUrl &path, QQmlAbstractUrlIntercept qDebug() << "Trying" << platform; //search for a platformqml/ path sibling of this import path - QString platformPath = import+"/../platformqml/"+platform+path.path().mid(import.length()); + QString platformPath = import+QStringLiteral("/../platformqml/")+platform+path.path().mid(import.length()); QFile f(platformPath); qDebug() << "Found a platform specific file:" << QUrl::fromLocalFile(platformPath)< +#include #include @@ -37,6 +38,8 @@ public: virtual QUrl intercept(const QUrl &path, QQmlAbstractUrlInterceptor::DataType type); + static QQmlNetworkAccessManagerFactory* createPackageAccessManagerFactory(const Plasma::Package &package); + static inline QByteArray prefixForType(QQmlAbstractUrlInterceptor::DataType type, const QString &fileName) { switch (type) { diff --git a/src/plasmaquick/packageaccessmanager.cpp b/src/plasmaquick/private/packageaccessmanager.cpp similarity index 100% rename from src/plasmaquick/packageaccessmanager.cpp rename to src/plasmaquick/private/packageaccessmanager.cpp diff --git a/src/plasmaquick/packageaccessmanager.h b/src/plasmaquick/private/packageaccessmanager.h similarity index 100% rename from src/plasmaquick/packageaccessmanager.h rename to src/plasmaquick/private/packageaccessmanager.h diff --git a/src/plasmaquick/packageaccessmanagerfactory.cpp b/src/plasmaquick/private/packageaccessmanagerfactory.cpp similarity index 100% rename from src/plasmaquick/packageaccessmanagerfactory.cpp rename to src/plasmaquick/private/packageaccessmanagerfactory.cpp diff --git a/src/plasmaquick/packageaccessmanagerfactory.h b/src/plasmaquick/private/packageaccessmanagerfactory.h similarity index 100% rename from src/plasmaquick/packageaccessmanagerfactory.h rename to src/plasmaquick/private/packageaccessmanagerfactory.h diff --git a/src/plasmaquick/private/qqmlabstracturlinterceptor_p.h b/src/plasmaquick/private/qqmlabstracturlinterceptor_p.h deleted file mode 100644 index 01ef3e65e..000000000 --- a/src/plasmaquick/private/qqmlabstracturlinterceptor_p.h +++ /dev/null @@ -1,66 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2013 Research In Motion. -** Contact: http://www.qt-project.org/legal -** -** This file is part of the QtQml module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ -//Private API for 5.1 (at least) -#ifndef QQMLABSTRACTURLINTERCEPTOR_H -#define QQMLABSTRACTURLINTERCEPTOR_H - -#include - -QT_BEGIN_NAMESPACE - -class QQmlAbstractUrlInterceptor -{ - Q_FLAGS(InterceptionPoint) -public: - enum DataType { //Matches QQmlDataBlob::Type - QmlFile = 0, - JavaScriptFile = 1, - QmldirFile = 2, - UrlString = 0x1000 - }; - - QQmlAbstractUrlInterceptor() {} - virtual ~QQmlAbstractUrlInterceptor() {} - virtual QUrl intercept(const QUrl &path, DataType type) = 0; -}; - -QT_END_NAMESPACE -#endif diff --git a/src/scriptengines/qml/plasmoid/appletinterface.cpp b/src/scriptengines/qml/plasmoid/appletinterface.cpp index ff348bef3..32889bb01 100644 --- a/src/scriptengines/qml/plasmoid/appletinterface.cpp +++ b/src/scriptengines/qml/plasmoid/appletinterface.cpp @@ -47,7 +47,7 @@ #include "containmentinterface.h" #include #include -#include + #include Q_DECLARE_METATYPE(AppletInterface*) @@ -110,7 +110,8 @@ void AppletInterface::init() QQmlNetworkAccessManagerFactory *factory = engine->networkAccessManagerFactory(); engine->setNetworkAccessManagerFactory(0); delete factory; - engine->setNetworkAccessManagerFactory(new PackageAccessManagerFactory(m_appletScriptEngine->package())); + //engine->setNetworkAccessManagerFactory(new PackageAccessManagerFactory(m_appletScriptEngine->package())); + engine->setNetworkAccessManagerFactory(PackageUrlInterceptor::createPackageAccessManagerFactory(m_appletScriptEngine->package())); //Hook generic url resolution to the applet package as well //TODO: same thing will have to be done for every qqmlengine: PackageUrlInterceptor is material for plasmaquick? diff --git a/src/scriptengines/qml/plasmoid/declarativeappletscript.cpp b/src/scriptengines/qml/plasmoid/declarativeappletscript.cpp index 64ec42387..648f59ea5 100644 --- a/src/scriptengines/qml/plasmoid/declarativeappletscript.cpp +++ b/src/scriptengines/qml/plasmoid/declarativeappletscript.cpp @@ -46,7 +46,6 @@ #include "plasmoid/containmentinterface.h" #include -#include #include