Port away from KUrl

This commit is contained in:
Kevin Ottens 2013-06-27 16:39:03 +02:00
parent b78db9acd6
commit c36c625d9c
15 changed files with 45 additions and 50 deletions

View File

@ -22,7 +22,6 @@
#include <QApplication>
#include <QObject>
#include <KUrl>
#include <QFont>
#include <QColor>

View File

@ -24,11 +24,11 @@
#include <QObject>
#include <QIcon>
#include <QUrl>
#include <kconfiggroup.h>
#include <kplugininfo.h>
#include <kshortcut.h>
#include <kurl.h>
#include <plasma/configloader.h>
#include <plasma/plasma.h>

View File

@ -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));

View File

@ -338,7 +338,7 @@ void ConfigLoaderHandler::addItem()
QStringList tmpList = m_default.split(",");
QList<QUrl> 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);*/
}

View File

@ -21,8 +21,7 @@
#define PLASMA_ASSOCIATEDAPPLICATIONMANAGER_P_H
#include <QObject>
#include <kurl.h>
#include <QUrl>
namespace Plasma
{

View File

@ -20,7 +20,7 @@
#ifndef PLASMA_CONFIGLOADER_P_H
#define PLASMA_CONFIGLOADER_P_H
#include <kurl.h>
#include <QUrl>
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<QFont *> fonts;
QList<qint32 *> ints;
QList<quint32 *> uints;
QList<KUrl *> urls;
QList<QUrl *> urls;
QList<QDateTime *> dateTimes;
QList<double *> doubles;
QList<QList<qint32> *> intlists;

View File

@ -23,8 +23,6 @@
#include <QXmlDefaultHandler>
#include <kurl.h>
namespace Plasma
{

View File

@ -48,7 +48,6 @@
#include <kconfiggroup.h>
#include <kdebug.h>
#include <kurl.h>
#include <kwallet.h>
namespace Plasma

View File

@ -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();

View File

@ -25,7 +25,7 @@
#include <QtCore/QObject>
#include <QtCore/QDateTime>
#include <kurl.h>
#include <QUrl>
#include <plasma.h>
@ -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 ;
/**

View File

@ -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()

View File

@ -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<KUrl>(v);
QUrl url = v.isString() ? QUrl(v.toString()) : qscriptvalue_cast<QUrl>(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<KUrl>(v);
QUrl url = v.isString() ? QUrl(v.toString()) : qscriptvalue_cast<QUrl>(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<KUrl>(v);
QUrl url = v.isString() ? QUrl(v.toString()) : qscriptvalue_cast<QUrl>(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);
}

View File

@ -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();
}

View File

@ -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<QUrl> 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<QUrl> selectedUrls() const;
QUrl baseUrl() const;
QString selectedFile() const;
QStringList selectedFiles() const;

View File

@ -19,32 +19,32 @@
#include <QtScript/QScriptValue>
#include <QtScript/QScriptEngine>
#include <QtScript/QScriptContext>
#include <KUrl>
#include <QUrl>
#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<KUrl*>(), proto);
eng->setDefaultPrototype(qMetaTypeId<KUrl>(), proto);
eng->setDefaultPrototype(qMetaTypeId<QUrl*>(), proto);
eng->setDefaultPrototype(qMetaTypeId<QUrl>(), proto);
return eng->newFunction(ctor, proto);
}