Port away from KUrl
This commit is contained in:
parent
b78db9acd6
commit
c36c625d9c
@ -22,7 +22,6 @@
|
|||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
|
|
||||||
#include <KUrl>
|
|
||||||
#include <QFont>
|
#include <QFont>
|
||||||
#include <QColor>
|
#include <QColor>
|
||||||
|
|
||||||
|
@ -24,11 +24,11 @@
|
|||||||
|
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
#include <QIcon>
|
#include <QIcon>
|
||||||
|
#include <QUrl>
|
||||||
|
|
||||||
#include <kconfiggroup.h>
|
#include <kconfiggroup.h>
|
||||||
#include <kplugininfo.h>
|
#include <kplugininfo.h>
|
||||||
#include <kshortcut.h>
|
#include <kshortcut.h>
|
||||||
#include <kurl.h>
|
|
||||||
|
|
||||||
#include <plasma/configloader.h>
|
#include <plasma/configloader.h>
|
||||||
#include <plasma/plasma.h>
|
#include <plasma/plasma.h>
|
||||||
|
@ -253,7 +253,7 @@ void PlasmoidPackageTest::createAndInstallPackage()
|
|||||||
QVERIFY(creator.open(QIODevice::WriteOnly));
|
QVERIFY(creator.open(QIODevice::WriteOnly));
|
||||||
creator.addLocalDirectory(m_packageRoot + '/' + "plasmoid_to_package", ".");
|
creator.addLocalDirectory(m_packageRoot + '/' + "plasmoid_to_package", ".");
|
||||||
creator.close();
|
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));
|
QVERIFY(QFile::exists(packagePath));
|
||||||
|
|
||||||
|
@ -338,7 +338,7 @@ void ConfigLoaderHandler::addItem()
|
|||||||
QStringList tmpList = m_default.split(",");
|
QStringList tmpList = m_default.split(",");
|
||||||
QList<QUrl> defaultList;
|
QList<QUrl> defaultList;
|
||||||
foreach (const QString& tmp, tmpList) {
|
foreach (const QString& tmp, tmpList) {
|
||||||
defaultList.append(KUrl(tmp));
|
defaultList.append(QUrl(tmp));
|
||||||
}
|
}
|
||||||
item = m_config->addItemUrlList(m_name, *d->newUrlList(), defaultList, m_key);*/
|
item = m_config->addItemUrlList(m_name, *d->newUrlList(), defaultList, m_key);*/
|
||||||
}
|
}
|
||||||
|
@ -21,8 +21,7 @@
|
|||||||
#define PLASMA_ASSOCIATEDAPPLICATIONMANAGER_P_H
|
#define PLASMA_ASSOCIATEDAPPLICATIONMANAGER_P_H
|
||||||
|
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
|
#include <QUrl>
|
||||||
#include <kurl.h>
|
|
||||||
|
|
||||||
namespace Plasma
|
namespace Plasma
|
||||||
{
|
{
|
||||||
|
@ -20,7 +20,7 @@
|
|||||||
#ifndef PLASMA_CONFIGLOADER_P_H
|
#ifndef PLASMA_CONFIGLOADER_P_H
|
||||||
#define PLASMA_CONFIGLOADER_P_H
|
#define PLASMA_CONFIGLOADER_P_H
|
||||||
|
|
||||||
#include <kurl.h>
|
#include <QUrl>
|
||||||
|
|
||||||
namespace Plasma
|
namespace Plasma
|
||||||
{
|
{
|
||||||
@ -108,9 +108,9 @@ class ConfigLoaderPrivate
|
|||||||
return v;
|
return v;
|
||||||
}
|
}
|
||||||
|
|
||||||
KUrl *newUrl()
|
QUrl *newUrl()
|
||||||
{
|
{
|
||||||
KUrl *v = new KUrl;
|
QUrl *v = new QUrl;
|
||||||
urls.append(v);
|
urls.append(v);
|
||||||
return v;
|
return v;
|
||||||
}
|
}
|
||||||
@ -206,7 +206,7 @@ class ConfigLoaderPrivate
|
|||||||
QList<QFont *> fonts;
|
QList<QFont *> fonts;
|
||||||
QList<qint32 *> ints;
|
QList<qint32 *> ints;
|
||||||
QList<quint32 *> uints;
|
QList<quint32 *> uints;
|
||||||
QList<KUrl *> urls;
|
QList<QUrl *> urls;
|
||||||
QList<QDateTime *> dateTimes;
|
QList<QDateTime *> dateTimes;
|
||||||
QList<double *> doubles;
|
QList<double *> doubles;
|
||||||
QList<QList<qint32> *> intlists;
|
QList<QList<qint32> *> intlists;
|
||||||
|
@ -23,8 +23,6 @@
|
|||||||
|
|
||||||
#include <QXmlDefaultHandler>
|
#include <QXmlDefaultHandler>
|
||||||
|
|
||||||
#include <kurl.h>
|
|
||||||
|
|
||||||
namespace Plasma
|
namespace Plasma
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@ -48,7 +48,6 @@
|
|||||||
#include <kconfiggroup.h>
|
#include <kconfiggroup.h>
|
||||||
#include <kdebug.h>
|
#include <kdebug.h>
|
||||||
|
|
||||||
#include <kurl.h>
|
|
||||||
#include <kwallet.h>
|
#include <kwallet.h>
|
||||||
|
|
||||||
namespace Plasma
|
namespace Plasma
|
||||||
|
@ -611,7 +611,7 @@ QStringList Signing::publicKeys() const
|
|||||||
return d->keysID(false);
|
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 " << plasmoidPath.pathOrUrl();
|
||||||
kDebug() << "Checking existence of " << plasmoidSignaturePath.pathOrUrl();
|
kDebug() << "Checking existence of " << plasmoidSignaturePath.pathOrUrl();
|
||||||
|
@ -25,7 +25,7 @@
|
|||||||
#include <QtCore/QObject>
|
#include <QtCore/QObject>
|
||||||
#include <QtCore/QDateTime>
|
#include <QtCore/QDateTime>
|
||||||
|
|
||||||
#include <kurl.h>
|
#include <QUrl>
|
||||||
|
|
||||||
#include <plasma.h>
|
#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.
|
* @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 ;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -58,9 +58,9 @@ void SigningTest::confirmCtorPerformance()
|
|||||||
|
|
||||||
void SigningTest::missingFiles()
|
void SigningTest::missingFiles()
|
||||||
{
|
{
|
||||||
QVERIFY(m_signing->signerOf(KUrl("/nonexistantpackage"), KUrl("/noneexistantsignature")).isEmpty());
|
QVERIFY(m_signing->signerOf(QUrl::fromLocalFile("/nonexistantpackage"), QUrl::fromLocalFile("/noneexistantsignature")).isEmpty());
|
||||||
QVERIFY(m_signing->signerOf(KUrl(m_path), KUrl("/noneexistantsignature")).isEmpty());
|
QVERIFY(m_signing->signerOf(QUrl::fromLocalFile(m_path), QUrl::fromLocalFile("/noneexistantsignature")).isEmpty());
|
||||||
QVERIFY(m_signing->signerOf(KUrl("/nonexistantpackage"), KUrl(m_sig)).isEmpty());
|
QVERIFY(m_signing->signerOf(QUrl::fromLocalFile("/nonexistantpackage"), QUrl::fromLocalFile(m_sig)).isEmpty());
|
||||||
}
|
}
|
||||||
|
|
||||||
void SigningTest::invalidSignature()
|
void SigningTest::invalidSignature()
|
||||||
|
@ -38,7 +38,7 @@ QScriptValue ScriptEnv::openUrl(QScriptContext *context, QScriptEngine *engine)
|
|||||||
}
|
}
|
||||||
|
|
||||||
QScriptValue v = context->argument(0);
|
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()) {
|
if (!url.isValid()) {
|
||||||
return false;
|
return false;
|
||||||
@ -66,7 +66,7 @@ QScriptValue ScriptEnv::getUrl(QScriptContext *context, QScriptEngine *engine)
|
|||||||
}
|
}
|
||||||
|
|
||||||
QScriptValue v = context->argument(0);
|
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()) {
|
if (!url.isValid()) {
|
||||||
return engine->undefinedValue();
|
return engine->undefinedValue();
|
||||||
@ -98,7 +98,7 @@ QScriptValue ScriptEnv::download(QScriptContext *context, QScriptEngine *engine)
|
|||||||
}
|
}
|
||||||
|
|
||||||
QScriptValue v = context->argument(0);
|
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()) {
|
if (!url.isValid()) {
|
||||||
return engine->undefinedValue();
|
return engine->undefinedValue();
|
||||||
@ -148,7 +148,7 @@ QScriptValue ScriptEnv::download(QScriptContext *context, QScriptEngine *engine)
|
|||||||
}
|
}
|
||||||
|
|
||||||
//TODO: allow showing desktop progress info?
|
//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);
|
return engine->newQObject(job);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -24,7 +24,7 @@
|
|||||||
|
|
||||||
FileDialogProxy::FileDialogProxy(KFileDialog::OperationMode mode, QObject *parent)
|
FileDialogProxy::FileDialogProxy(KFileDialog::OperationMode mode, QObject *parent)
|
||||||
: QObject(parent),
|
: QObject(parent),
|
||||||
m_dialog(new KFileDialog(KUrl("~"), QString(), 0))
|
m_dialog(new KFileDialog(QUrl::fromLocalFile("~"), QString(), 0))
|
||||||
{
|
{
|
||||||
m_dialog->setOperationMode(mode);
|
m_dialog->setOperationMode(mode);
|
||||||
connect(m_dialog, SIGNAL(finished()), this, SLOT(dialogFinished()));
|
connect(m_dialog, SIGNAL(finished()), this, SLOT(dialogFinished()));
|
||||||
@ -35,22 +35,22 @@ FileDialogProxy::~FileDialogProxy()
|
|||||||
delete m_dialog;
|
delete m_dialog;
|
||||||
}
|
}
|
||||||
|
|
||||||
KUrl FileDialogProxy::selectedUrl() const
|
QUrl FileDialogProxy::selectedUrl() const
|
||||||
{
|
{
|
||||||
return m_dialog->selectedUrl();
|
return m_dialog->selectedUrl();
|
||||||
}
|
}
|
||||||
|
|
||||||
void FileDialogProxy::setUrl(const KUrl &url)
|
void FileDialogProxy::setUrl(const QUrl &url)
|
||||||
{
|
{
|
||||||
m_dialog->setUrl(url);
|
m_dialog->setUrl(url);
|
||||||
}
|
}
|
||||||
|
|
||||||
KUrl::List FileDialogProxy::selectedUrls() const
|
QUrl::List FileDialogProxy::selectedUrls() const
|
||||||
{
|
{
|
||||||
return m_dialog->selectedUrls();
|
return m_dialog->selectedUrls();
|
||||||
}
|
}
|
||||||
|
|
||||||
KUrl FileDialogProxy::baseUrl() const
|
QUrl FileDialogProxy::baseUrl() const
|
||||||
{
|
{
|
||||||
return m_dialog->baseUrl();
|
return m_dialog->baseUrl();
|
||||||
}
|
}
|
||||||
|
@ -30,9 +30,9 @@ class QScriptContext;
|
|||||||
class FileDialogProxy : public QObject
|
class FileDialogProxy : public QObject
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
Q_PROPERTY(KUrl url READ selectedUrl WRITE setUrl)
|
Q_PROPERTY(QUrl url READ selectedUrl WRITE setUrl)
|
||||||
Q_PROPERTY(KUrl::List urls READ selectedUrls)
|
Q_PROPERTY(QList<QUrl> urls READ selectedUrls)
|
||||||
Q_PROPERTY(KUrl baseUrl READ baseUrl)
|
Q_PROPERTY(QUrl baseUrl READ baseUrl)
|
||||||
Q_PROPERTY(QString file READ selectedFile)
|
Q_PROPERTY(QString file READ selectedFile)
|
||||||
Q_PROPERTY(QStringList files READ selectedFiles)
|
Q_PROPERTY(QStringList files READ selectedFiles)
|
||||||
Q_PROPERTY(QString filter READ filter WRITE setFilter)
|
Q_PROPERTY(QString filter READ filter WRITE setFilter)
|
||||||
@ -44,11 +44,11 @@ public:
|
|||||||
FileDialogProxy(KFileDialog::OperationMode mode, QObject *parent = 0);
|
FileDialogProxy(KFileDialog::OperationMode mode, QObject *parent = 0);
|
||||||
~FileDialogProxy();
|
~FileDialogProxy();
|
||||||
|
|
||||||
KUrl selectedUrl() const;
|
QUrl selectedUrl() const;
|
||||||
void setUrl(const KUrl &url);
|
void setUrl(const QUrl &url);
|
||||||
|
|
||||||
KUrl::List selectedUrls() const;
|
QList<QUrl> selectedUrls() const;
|
||||||
KUrl baseUrl() const;
|
QUrl baseUrl() const;
|
||||||
QString selectedFile() const;
|
QString selectedFile() const;
|
||||||
QStringList selectedFiles() const;
|
QStringList selectedFiles() const;
|
||||||
|
|
||||||
|
@ -19,32 +19,32 @@
|
|||||||
#include <QtScript/QScriptValue>
|
#include <QtScript/QScriptValue>
|
||||||
#include <QtScript/QScriptEngine>
|
#include <QtScript/QScriptEngine>
|
||||||
#include <QtScript/QScriptContext>
|
#include <QtScript/QScriptContext>
|
||||||
#include <KUrl>
|
#include <QUrl>
|
||||||
#include "backportglobal.h"
|
#include "backportglobal.h"
|
||||||
|
|
||||||
Q_DECLARE_METATYPE(KUrl*)
|
Q_DECLARE_METATYPE(QUrl*)
|
||||||
//Q_DECLARE_METATYPE(KUrl) unneeded; found in kurl.h
|
//Q_DECLARE_METATYPE(QUrl) unneeded; found in qurl.h
|
||||||
|
|
||||||
static QScriptValue ctor(QScriptContext *ctx, QScriptEngine *eng)
|
static QScriptValue ctor(QScriptContext *ctx, QScriptEngine *eng)
|
||||||
{
|
{
|
||||||
if (ctx->argumentCount() == 1)
|
if (ctx->argumentCount() == 1)
|
||||||
{
|
{
|
||||||
QString url = ctx->argument(0).toString();
|
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)
|
static QScriptValue toString(QScriptContext *ctx, QScriptEngine *eng)
|
||||||
{
|
{
|
||||||
DECLARE_SELF(KUrl, toString);
|
DECLARE_SELF(QUrl, toString);
|
||||||
return QScriptValue(eng, self->prettyUrl());
|
return QScriptValue(eng, self->prettyUrl());
|
||||||
}
|
}
|
||||||
|
|
||||||
static QScriptValue protocol(QScriptContext *ctx, QScriptEngine *eng)
|
static QScriptValue protocol(QScriptContext *ctx, QScriptEngine *eng)
|
||||||
{
|
{
|
||||||
DECLARE_SELF(KUrl, protocol);
|
DECLARE_SELF(QUrl, protocol);
|
||||||
if (ctx->argumentCount()) {
|
if (ctx->argumentCount()) {
|
||||||
QString v = ctx->argument(0).toString();
|
QString v = ctx->argument(0).toString();
|
||||||
self->setProtocol(v);
|
self->setProtocol(v);
|
||||||
@ -55,7 +55,7 @@ static QScriptValue protocol(QScriptContext *ctx, QScriptEngine *eng)
|
|||||||
|
|
||||||
static QScriptValue host(QScriptContext *ctx, QScriptEngine *eng)
|
static QScriptValue host(QScriptContext *ctx, QScriptEngine *eng)
|
||||||
{
|
{
|
||||||
DECLARE_SELF(KUrl, protocol);
|
DECLARE_SELF(QUrl, protocol);
|
||||||
if (ctx->argumentCount()) {
|
if (ctx->argumentCount()) {
|
||||||
QString v = ctx->argument(0).toString();
|
QString v = ctx->argument(0).toString();
|
||||||
self->setHost(v);
|
self->setHost(v);
|
||||||
@ -66,7 +66,7 @@ static QScriptValue host(QScriptContext *ctx, QScriptEngine *eng)
|
|||||||
|
|
||||||
static QScriptValue path(QScriptContext *ctx, QScriptEngine *eng)
|
static QScriptValue path(QScriptContext *ctx, QScriptEngine *eng)
|
||||||
{
|
{
|
||||||
DECLARE_SELF(KUrl, path);
|
DECLARE_SELF(QUrl, path);
|
||||||
if (ctx->argumentCount()) {
|
if (ctx->argumentCount()) {
|
||||||
QString v = ctx->argument(0).toString();
|
QString v = ctx->argument(0).toString();
|
||||||
self->setPath(v);
|
self->setPath(v);
|
||||||
@ -77,7 +77,7 @@ static QScriptValue path(QScriptContext *ctx, QScriptEngine *eng)
|
|||||||
|
|
||||||
static QScriptValue user(QScriptContext *ctx, QScriptEngine *eng)
|
static QScriptValue user(QScriptContext *ctx, QScriptEngine *eng)
|
||||||
{
|
{
|
||||||
DECLARE_SELF(KUrl, user);
|
DECLARE_SELF(QUrl, user);
|
||||||
if (ctx->argumentCount()) {
|
if (ctx->argumentCount()) {
|
||||||
QString v = ctx->argument(0).toString();
|
QString v = ctx->argument(0).toString();
|
||||||
self->setUser(v);
|
self->setUser(v);
|
||||||
@ -88,7 +88,7 @@ static QScriptValue user(QScriptContext *ctx, QScriptEngine *eng)
|
|||||||
|
|
||||||
static QScriptValue password(QScriptContext *ctx, QScriptEngine *eng)
|
static QScriptValue password(QScriptContext *ctx, QScriptEngine *eng)
|
||||||
{
|
{
|
||||||
DECLARE_SELF(KUrl, password);
|
DECLARE_SELF(QUrl, password);
|
||||||
if (ctx->argumentCount()) {
|
if (ctx->argumentCount()) {
|
||||||
QString v = ctx->argument(0).toString();
|
QString v = ctx->argument(0).toString();
|
||||||
self->setPassword(v);
|
self->setPassword(v);
|
||||||
@ -97,9 +97,9 @@ static QScriptValue password(QScriptContext *ctx, QScriptEngine *eng)
|
|||||||
return QScriptValue(eng, self->password());
|
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 getter = QScriptValue::PropertyGetter;
|
||||||
QScriptValue::PropertyFlags setter = QScriptValue::PropertySetter;
|
QScriptValue::PropertyFlags setter = QScriptValue::PropertySetter;
|
||||||
|
|
||||||
@ -110,8 +110,8 @@ QScriptValue constructKUrlClass(QScriptEngine *eng)
|
|||||||
proto.setProperty("user", eng->newFunction(user), getter | setter);
|
proto.setProperty("user", eng->newFunction(user), getter | setter);
|
||||||
proto.setProperty("password", eng->newFunction(password), getter | setter);
|
proto.setProperty("password", eng->newFunction(password), getter | setter);
|
||||||
|
|
||||||
eng->setDefaultPrototype(qMetaTypeId<KUrl*>(), proto);
|
eng->setDefaultPrototype(qMetaTypeId<QUrl*>(), proto);
|
||||||
eng->setDefaultPrototype(qMetaTypeId<KUrl>(), proto);
|
eng->setDefaultPrototype(qMetaTypeId<QUrl>(), proto);
|
||||||
|
|
||||||
return eng->newFunction(ctor, proto);
|
return eng->newFunction(ctor, proto);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user