From c36c625d9cf4786f526fddbc16833e107957420a Mon Sep 17 00:00:00 2001 From: Kevin Ottens Date: Thu, 27 Jun 2013 16:39:03 +0200 Subject: [PATCH] Port away from KUrl --- src/declarativeimports/core/theme.h | 1 - src/plasma/applet.h | 2 +- src/plasma/autotests/plasmoidpackagetest.cpp | 2 +- src/plasma/configloader.cpp | 2 +- .../private/associatedapplicationmanager_p.h | 3 +- src/plasma/private/configloader_p.h | 8 ++--- src/plasma/private/configloaderhandler_p.h | 2 -- src/plasma/remote/authorizationmanager.cpp | 1 - src/plasma/staging/signing.cpp | 2 +- src/plasma/staging/signing.h | 4 +-- src/plasma/staging/signingtest.cpp | 6 ++-- .../javascript/common/extension_io.cpp | 8 ++--- .../simplebindings/filedialogproxy.cpp | 10 +++---- .../simplebindings/filedialogproxy.h | 14 ++++----- .../javascript/simplebindings/url.cpp | 30 +++++++++---------- 15 files changed, 45 insertions(+), 50 deletions(-) diff --git a/src/declarativeimports/core/theme.h b/src/declarativeimports/core/theme.h index 281183287..6204c0097 100644 --- a/src/declarativeimports/core/theme.h +++ b/src/declarativeimports/core/theme.h @@ -22,7 +22,6 @@ #include #include -#include #include #include diff --git a/src/plasma/applet.h b/src/plasma/applet.h index 6f10e09c5..f0f2dcd01 100644 --- a/src/plasma/applet.h +++ b/src/plasma/applet.h @@ -24,11 +24,11 @@ #include #include +#include #include #include #include -#include #include #include diff --git a/src/plasma/autotests/plasmoidpackagetest.cpp b/src/plasma/autotests/plasmoidpackagetest.cpp index 00458f35b..8f62afd47 100644 --- a/src/plasma/autotests/plasmoidpackagetest.cpp +++ b/src/plasma/autotests/plasmoidpackagetest.cpp @@ -253,7 +253,7 @@ void PlasmoidPackageTest::createAndInstallPackage() QVERIFY(creator.open(QIODevice::WriteOnly)); creator.addLocalDirectory(m_packageRoot + '/' + "plasmoid_to_package", "."); creator.close(); - KIO::NetAccess::del(KUrl(m_packageRoot + "/plasmoid_to_package"), 0); + KIO::NetAccess::del(QUrl::fromLocalFile(m_packageRoot + "/plasmoid_to_package"), 0); QVERIFY(QFile::exists(packagePath)); diff --git a/src/plasma/configloader.cpp b/src/plasma/configloader.cpp index ce20d16b9..1376139db 100644 --- a/src/plasma/configloader.cpp +++ b/src/plasma/configloader.cpp @@ -338,7 +338,7 @@ void ConfigLoaderHandler::addItem() QStringList tmpList = m_default.split(","); QList defaultList; foreach (const QString& tmp, tmpList) { - defaultList.append(KUrl(tmp)); + defaultList.append(QUrl(tmp)); } item = m_config->addItemUrlList(m_name, *d->newUrlList(), defaultList, m_key);*/ } diff --git a/src/plasma/private/associatedapplicationmanager_p.h b/src/plasma/private/associatedapplicationmanager_p.h index 7b2865540..36adb2f97 100644 --- a/src/plasma/private/associatedapplicationmanager_p.h +++ b/src/plasma/private/associatedapplicationmanager_p.h @@ -21,8 +21,7 @@ #define PLASMA_ASSOCIATEDAPPLICATIONMANAGER_P_H #include - -#include +#include namespace Plasma { diff --git a/src/plasma/private/configloader_p.h b/src/plasma/private/configloader_p.h index 15a7703ec..e429d9e68 100644 --- a/src/plasma/private/configloader_p.h +++ b/src/plasma/private/configloader_p.h @@ -20,7 +20,7 @@ #ifndef PLASMA_CONFIGLOADER_P_H #define PLASMA_CONFIGLOADER_P_H -#include +#include namespace Plasma { @@ -108,9 +108,9 @@ class ConfigLoaderPrivate return v; } - KUrl *newUrl() + QUrl *newUrl() { - KUrl *v = new KUrl; + QUrl *v = new QUrl; urls.append(v); return v; } @@ -206,7 +206,7 @@ class ConfigLoaderPrivate QList fonts; QList ints; QList uints; - QList urls; + QList urls; QList dateTimes; QList doubles; QList *> intlists; diff --git a/src/plasma/private/configloaderhandler_p.h b/src/plasma/private/configloaderhandler_p.h index 8431abdba..df96a3328 100644 --- a/src/plasma/private/configloaderhandler_p.h +++ b/src/plasma/private/configloaderhandler_p.h @@ -23,8 +23,6 @@ #include -#include - namespace Plasma { diff --git a/src/plasma/remote/authorizationmanager.cpp b/src/plasma/remote/authorizationmanager.cpp index 775884a13..3a8378354 100644 --- a/src/plasma/remote/authorizationmanager.cpp +++ b/src/plasma/remote/authorizationmanager.cpp @@ -48,7 +48,6 @@ #include #include -#include #include namespace Plasma diff --git a/src/plasma/staging/signing.cpp b/src/plasma/staging/signing.cpp index facfaa895..204d41d98 100644 --- a/src/plasma/staging/signing.cpp +++ b/src/plasma/staging/signing.cpp @@ -611,7 +611,7 @@ QStringList Signing::publicKeys() const return d->keysID(false); } -QString Signing::signerOf(const KUrl &plasmoidPath, const KUrl &plasmoidSignaturePath) const +QString Signing::signerOf(const QUrl &plasmoidPath, const QUrl &plasmoidSignaturePath) const { kDebug() << "Checking existence of " << plasmoidPath.pathOrUrl(); kDebug() << "Checking existence of " << plasmoidSignaturePath.pathOrUrl(); diff --git a/src/plasma/staging/signing.h b/src/plasma/staging/signing.h index 7c93f6096..219eb6a8c 100644 --- a/src/plasma/staging/signing.h +++ b/src/plasma/staging/signing.h @@ -25,7 +25,7 @@ #include #include -#include +#include #include @@ -138,7 +138,7 @@ public: * * @return a Qstring with the signer's unique key id, or an empty one if a signer was not found. */ - QString signerOf(const KUrl &plasmoidPath, const KUrl &plasmoidSignaturePath = KUrl()) const ; + QString signerOf(const QUrl &plasmoidPath, const QUrl &plasmoidSignaturePath = QUrl()) const ; /** diff --git a/src/plasma/staging/signingtest.cpp b/src/plasma/staging/signingtest.cpp index 7b8f654fb..4fcc03c68 100644 --- a/src/plasma/staging/signingtest.cpp +++ b/src/plasma/staging/signingtest.cpp @@ -58,9 +58,9 @@ void SigningTest::confirmCtorPerformance() void SigningTest::missingFiles() { - QVERIFY(m_signing->signerOf(KUrl("/nonexistantpackage"), KUrl("/noneexistantsignature")).isEmpty()); - QVERIFY(m_signing->signerOf(KUrl(m_path), KUrl("/noneexistantsignature")).isEmpty()); - QVERIFY(m_signing->signerOf(KUrl("/nonexistantpackage"), KUrl(m_sig)).isEmpty()); + QVERIFY(m_signing->signerOf(QUrl::fromLocalFile("/nonexistantpackage"), QUrl::fromLocalFile("/noneexistantsignature")).isEmpty()); + QVERIFY(m_signing->signerOf(QUrl::fromLocalFile(m_path), QUrl::fromLocalFile("/noneexistantsignature")).isEmpty()); + QVERIFY(m_signing->signerOf(QUrl::fromLocalFile("/nonexistantpackage"), QUrl::fromLocalFile(m_sig)).isEmpty()); } void SigningTest::invalidSignature() diff --git a/src/scriptengines/javascript/common/extension_io.cpp b/src/scriptengines/javascript/common/extension_io.cpp index 7e43efff8..8f0b56527 100644 --- a/src/scriptengines/javascript/common/extension_io.cpp +++ b/src/scriptengines/javascript/common/extension_io.cpp @@ -38,7 +38,7 @@ QScriptValue ScriptEnv::openUrl(QScriptContext *context, QScriptEngine *engine) } QScriptValue v = context->argument(0); - KUrl url = v.isString() ? KUrl(v.toString()) : qscriptvalue_cast(v); + QUrl url = v.isString() ? QUrl(v.toString()) : qscriptvalue_cast(v); if (!url.isValid()) { return false; @@ -66,7 +66,7 @@ QScriptValue ScriptEnv::getUrl(QScriptContext *context, QScriptEngine *engine) } QScriptValue v = context->argument(0); - KUrl url = v.isString() ? KUrl(v.toString()) : qscriptvalue_cast(v); + QUrl url = v.isString() ? QUrl(v.toString()) : qscriptvalue_cast(v); if (!url.isValid()) { return engine->undefinedValue(); @@ -98,7 +98,7 @@ QScriptValue ScriptEnv::download(QScriptContext *context, QScriptEngine *engine) } QScriptValue v = context->argument(0); - KUrl url = v.isString() ? KUrl(v.toString()) : qscriptvalue_cast(v); + QUrl url = v.isString() ? QUrl(v.toString()) : qscriptvalue_cast(v); if (!url.isValid()) { return engine->undefinedValue(); @@ -148,7 +148,7 @@ QScriptValue ScriptEnv::download(QScriptContext *context, QScriptEngine *engine) } //TODO: allow showing desktop progress info? - KIO::CopyJob *job = KIO::copy(url, KUrl(requestedFileName), KIO::HideProgressInfo); + KIO::CopyJob *job = KIO::copy(url, QUrl::fromLocalFile(requestedFileName), KIO::HideProgressInfo); return engine->newQObject(job); } diff --git a/src/scriptengines/javascript/simplebindings/filedialogproxy.cpp b/src/scriptengines/javascript/simplebindings/filedialogproxy.cpp index 406f44275..5e3ae9944 100644 --- a/src/scriptengines/javascript/simplebindings/filedialogproxy.cpp +++ b/src/scriptengines/javascript/simplebindings/filedialogproxy.cpp @@ -24,7 +24,7 @@ FileDialogProxy::FileDialogProxy(KFileDialog::OperationMode mode, QObject *parent) : QObject(parent), - m_dialog(new KFileDialog(KUrl("~"), QString(), 0)) + m_dialog(new KFileDialog(QUrl::fromLocalFile("~"), QString(), 0)) { m_dialog->setOperationMode(mode); connect(m_dialog, SIGNAL(finished()), this, SLOT(dialogFinished())); @@ -35,22 +35,22 @@ FileDialogProxy::~FileDialogProxy() delete m_dialog; } -KUrl FileDialogProxy::selectedUrl() const +QUrl FileDialogProxy::selectedUrl() const { return m_dialog->selectedUrl(); } -void FileDialogProxy::setUrl(const KUrl &url) +void FileDialogProxy::setUrl(const QUrl &url) { m_dialog->setUrl(url); } -KUrl::List FileDialogProxy::selectedUrls() const +QUrl::List FileDialogProxy::selectedUrls() const { return m_dialog->selectedUrls(); } -KUrl FileDialogProxy::baseUrl() const +QUrl FileDialogProxy::baseUrl() const { return m_dialog->baseUrl(); } diff --git a/src/scriptengines/javascript/simplebindings/filedialogproxy.h b/src/scriptengines/javascript/simplebindings/filedialogproxy.h index e47d0c27c..6aa6f3dce 100644 --- a/src/scriptengines/javascript/simplebindings/filedialogproxy.h +++ b/src/scriptengines/javascript/simplebindings/filedialogproxy.h @@ -30,9 +30,9 @@ class QScriptContext; class FileDialogProxy : public QObject { Q_OBJECT - Q_PROPERTY(KUrl url READ selectedUrl WRITE setUrl) - Q_PROPERTY(KUrl::List urls READ selectedUrls) - Q_PROPERTY(KUrl baseUrl READ baseUrl) + Q_PROPERTY(QUrl url READ selectedUrl WRITE setUrl) + Q_PROPERTY(QList urls READ selectedUrls) + Q_PROPERTY(QUrl baseUrl READ baseUrl) Q_PROPERTY(QString file READ selectedFile) Q_PROPERTY(QStringList files READ selectedFiles) Q_PROPERTY(QString filter READ filter WRITE setFilter) @@ -44,11 +44,11 @@ public: FileDialogProxy(KFileDialog::OperationMode mode, QObject *parent = 0); ~FileDialogProxy(); - KUrl selectedUrl() const; - void setUrl(const KUrl &url); + QUrl selectedUrl() const; + void setUrl(const QUrl &url); - KUrl::List selectedUrls() const; - KUrl baseUrl() const; + QList selectedUrls() const; + QUrl baseUrl() const; QString selectedFile() const; QStringList selectedFiles() const; diff --git a/src/scriptengines/javascript/simplebindings/url.cpp b/src/scriptengines/javascript/simplebindings/url.cpp index 7330d9b1c..2b704c414 100644 --- a/src/scriptengines/javascript/simplebindings/url.cpp +++ b/src/scriptengines/javascript/simplebindings/url.cpp @@ -19,32 +19,32 @@ #include #include #include -#include +#include #include "backportglobal.h" -Q_DECLARE_METATYPE(KUrl*) -//Q_DECLARE_METATYPE(KUrl) unneeded; found in kurl.h +Q_DECLARE_METATYPE(QUrl*) +//Q_DECLARE_METATYPE(QUrl) unneeded; found in qurl.h static QScriptValue ctor(QScriptContext *ctx, QScriptEngine *eng) { if (ctx->argumentCount() == 1) { QString url = ctx->argument(0).toString(); - return qScriptValueFromValue(eng, KUrl(url)); + return qScriptValueFromValue(eng, QUrl(url)); } - return qScriptValueFromValue(eng, KUrl()); + return qScriptValueFromValue(eng, QUrl()); } static QScriptValue toString(QScriptContext *ctx, QScriptEngine *eng) { - DECLARE_SELF(KUrl, toString); + DECLARE_SELF(QUrl, toString); return QScriptValue(eng, self->prettyUrl()); } static QScriptValue protocol(QScriptContext *ctx, QScriptEngine *eng) { - DECLARE_SELF(KUrl, protocol); + DECLARE_SELF(QUrl, protocol); if (ctx->argumentCount()) { QString v = ctx->argument(0).toString(); self->setProtocol(v); @@ -55,7 +55,7 @@ static QScriptValue protocol(QScriptContext *ctx, QScriptEngine *eng) static QScriptValue host(QScriptContext *ctx, QScriptEngine *eng) { - DECLARE_SELF(KUrl, protocol); + DECLARE_SELF(QUrl, protocol); if (ctx->argumentCount()) { QString v = ctx->argument(0).toString(); self->setHost(v); @@ -66,7 +66,7 @@ static QScriptValue host(QScriptContext *ctx, QScriptEngine *eng) static QScriptValue path(QScriptContext *ctx, QScriptEngine *eng) { - DECLARE_SELF(KUrl, path); + DECLARE_SELF(QUrl, path); if (ctx->argumentCount()) { QString v = ctx->argument(0).toString(); self->setPath(v); @@ -77,7 +77,7 @@ static QScriptValue path(QScriptContext *ctx, QScriptEngine *eng) static QScriptValue user(QScriptContext *ctx, QScriptEngine *eng) { - DECLARE_SELF(KUrl, user); + DECLARE_SELF(QUrl, user); if (ctx->argumentCount()) { QString v = ctx->argument(0).toString(); self->setUser(v); @@ -88,7 +88,7 @@ static QScriptValue user(QScriptContext *ctx, QScriptEngine *eng) static QScriptValue password(QScriptContext *ctx, QScriptEngine *eng) { - DECLARE_SELF(KUrl, password); + DECLARE_SELF(QUrl, password); if (ctx->argumentCount()) { QString v = ctx->argument(0).toString(); self->setPassword(v); @@ -97,9 +97,9 @@ static QScriptValue password(QScriptContext *ctx, QScriptEngine *eng) return QScriptValue(eng, self->password()); } -QScriptValue constructKUrlClass(QScriptEngine *eng) +QScriptValue constructQUrlClass(QScriptEngine *eng) { - QScriptValue proto = qScriptValueFromValue(eng, KUrl()); + QScriptValue proto = qScriptValueFromValue(eng, QUrl()); QScriptValue::PropertyFlags getter = QScriptValue::PropertyGetter; QScriptValue::PropertyFlags setter = QScriptValue::PropertySetter; @@ -110,8 +110,8 @@ QScriptValue constructKUrlClass(QScriptEngine *eng) proto.setProperty("user", eng->newFunction(user), getter | setter); proto.setProperty("password", eng->newFunction(password), getter | setter); - eng->setDefaultPrototype(qMetaTypeId(), proto); - eng->setDefaultPrototype(qMetaTypeId(), proto); + eng->setDefaultPrototype(qMetaTypeId(), proto); + eng->setDefaultPrototype(qMetaTypeId(), proto); return eng->newFunction(ctor, proto); }