From 22d9baccef6186f3da0cb10ada835cf28bbcef04 Mon Sep 17 00:00:00 2001 From: Marco Martin Date: Thu, 21 Oct 2010 13:18:50 +0000 Subject: [PATCH] use KIO to access the remote imports svn path=/trunk/KDE/kdelibs/; revision=1188124 --- CMakeLists.txt | 1 + ...declarativenetworkaccessmanagerfactory.cpp | 29 +++++++++++++++++ ...declarativenetworkaccessmanagerfactory_p.h | 31 +++++++++++++++++++ widgets/declarativewidget.cpp | 5 +-- 4 files changed, 64 insertions(+), 2 deletions(-) create mode 100644 private/declarative/declarativenetworkaccessmanagerfactory.cpp create mode 100644 private/declarative/declarativenetworkaccessmanagerfactory_p.h diff --git a/CMakeLists.txt b/CMakeLists.txt index f78945ddd..862981033 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -140,6 +140,7 @@ set(plasma_LIB_SRCS private/wallpaperrenderthread.cpp private/windowpreview.cpp private/kineticscroll.cpp + private/declarative/declarativenetworkaccessmanagerfactory.cpp private/effects/halopainter.cpp private/effects/ripple.cpp querymatch.cpp diff --git a/private/declarative/declarativenetworkaccessmanagerfactory.cpp b/private/declarative/declarativenetworkaccessmanagerfactory.cpp new file mode 100644 index 000000000..19ac8a464 --- /dev/null +++ b/private/declarative/declarativenetworkaccessmanagerfactory.cpp @@ -0,0 +1,29 @@ +/* + * Copyright 2010 Marco Martin + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Library General Public License as + * published by the Free Software Foundation; either version 2, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details + * + * You should have received a copy of the GNU Library General Public + * License along with this program; if not, write to the + * Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#include "declarativenetworkaccessmanagerfactory_p.h" + +#include + +QNetworkAccessManager *DeclarativeNetworkAccessManagerFactory::create(QObject *parent) +{ + return new KIO::AccessManager(parent); +} + + diff --git a/private/declarative/declarativenetworkaccessmanagerfactory_p.h b/private/declarative/declarativenetworkaccessmanagerfactory_p.h new file mode 100644 index 000000000..2908cd312 --- /dev/null +++ b/private/declarative/declarativenetworkaccessmanagerfactory_p.h @@ -0,0 +1,31 @@ +/* + * Copyright 2010 Marco Martin + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Library General Public License as + * published by the Free Software Foundation; either version 2, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details + * + * You should have received a copy of the GNU Library General Public + * License along with this program; if not, write to the + * Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef DECLARATIVENETWORKACCESSMANAGERFACTORY_H +#define DECLARATIVENETWORKACCESSMANAGERFACTORY_H + +#include + +class DeclarativeNetworkAccessManagerFactory : public QDeclarativeNetworkAccessManagerFactory +{ +public: + QNetworkAccessManager *create(QObject *parent); +}; + +#endif diff --git a/widgets/declarativewidget.cpp b/widgets/declarativewidget.cpp index 336174d7d..33fa88fcd 100644 --- a/widgets/declarativewidget.cpp +++ b/widgets/declarativewidget.cpp @@ -32,11 +32,11 @@ #include #include +#include "private/declarative/declarativenetworkaccessmanagerfactory_p.h" + namespace Plasma { - - class DeclarativeWidgetPrivate { public: @@ -165,6 +165,7 @@ DeclarativeWidget::DeclarativeWidget(QGraphicsWidget *parent) setFlag(QGraphicsItem::ItemHasNoContents); d->engine = new QDeclarativeEngine(this); + d->engine->setNetworkAccessManagerFactory(new DeclarativeNetworkAccessManagerFactory); foreach(const QString &importPath, KGlobal::dirs()->findDirs("module", "imports")) { d->engine->addImportPath(importPath); }