From 7c5e2e49ae5bef1d4071ff1ec555bd7b7beb61c5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ivan=20=C4=8Cuki=C4=87?= Date: Sun, 23 Jun 2013 10:22:37 +0200 Subject: [PATCH 1/8] Enabling C++11 flags for clang and gcc --- CMakeLists.txt | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 9e3153f18..6af9b52ff 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -41,6 +41,12 @@ endif() # in the KDE build system, this is the same as CMAKE_BINARY_DIR. configure_file(${CMAKE_SOURCE_DIR}/CTestCustom.cmake ${CMAKE_BINARY_DIR}/CTestCustom.cmake COPYONLY) +################# Enable C++11 features for clang and gcc ################# + +if(UNIX) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -std=c++0x") +endif() + ################# now find all used packages ################# set (QT_MIN_VERSION "5.2.0") From b78db9acd69f5e5ed33975e09377d51a459e9ab7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ivan=20=C4=8Cuki=C4=87?= Date: Mon, 24 Jun 2013 08:59:13 +0200 Subject: [PATCH 2/8] Properly initialize kded dbus object - kded module uses underscore instead of a dash - dbus interface is based on the generated adapter - added the d_ptr template class --- src/platformstatus/CMakeLists.txt | 29 +++++++-- ...us.desktop => kded_platformstatus.desktop} | 0 src/platformstatus/platformstatus.cpp | 9 ++- src/utils/d_ptr.h | 52 ++++++++++++++++ src/utils/d_ptr_implementation.h | 59 +++++++++++++++++++ 5 files changed, 140 insertions(+), 9 deletions(-) rename src/platformstatus/{kded-platformstatus.desktop => kded_platformstatus.desktop} (100%) create mode 100644 src/utils/d_ptr.h create mode 100644 src/utils/d_ptr_implementation.h diff --git a/src/platformstatus/CMakeLists.txt b/src/platformstatus/CMakeLists.txt index 30e46c614..1181579a4 100644 --- a/src/platformstatus/CMakeLists.txt +++ b/src/platformstatus/CMakeLists.txt @@ -1,10 +1,27 @@ -set(kded_platformstatus_SRCS platformstatus.cpp ) +set( + kded_platformstatus_SRCS + platformstatus.cpp + ) -kde4_add_plugin(kded_platformstatus ${kded_platformstatus_SRCS}) +include_directories("../utils") -target_link_libraries(kded_platformstatus ${KDE4_KDECORE_LIBS} ${KCoreAddons_LIBRARIES} Qt5::DBus) +qt4_add_dbus_adaptor ( + kded_platformstatus_SRCS + org.kde.platformstatus.xml + platformstatus.h PlatformStatus + ) -install(TARGETS kded_platformstatus DESTINATION ${PLUGIN_INSTALL_DIR} ) -install( FILES kded-platformstatus.desktop DESTINATION ${SERVICES_INSTALL_DIR}/kded ) -install( FILES org.kde.platformstatus.xml DESTINATION ${DBUS_INTERFACES_INSTALL_DIR} ) +kde4_add_plugin( kded_platformstatus ${kded_platformstatus_SRCS} ) + +target_link_libraries( + kded_platformstatus + ${KDE4_KDECORE_LIBS} + ${KCoreAddons_LIBRARIES} + Qt5::DBus + Qt5::Quick + ) + +install( TARGETS kded_platformstatus DESTINATION ${PLUGIN_INSTALL_DIR} ) +install( FILES kded_platformstatus.desktop DESTINATION ${SERVICES_INSTALL_DIR}/kded ) +install( FILES org.kde.platformstatus.xml DESTINATION ${DBUS_INTERFACES_INSTALL_DIR} ) diff --git a/src/platformstatus/kded-platformstatus.desktop b/src/platformstatus/kded_platformstatus.desktop similarity index 100% rename from src/platformstatus/kded-platformstatus.desktop rename to src/platformstatus/kded_platformstatus.desktop diff --git a/src/platformstatus/platformstatus.cpp b/src/platformstatus/platformstatus.cpp index fa466a781..d1164c405 100644 --- a/src/platformstatus/platformstatus.cpp +++ b/src/platformstatus/platformstatus.cpp @@ -8,6 +8,8 @@ #include #include +#include "platformstatusadaptor.h" + const char *defaultPackage = "org.kde.desktop"; K_PLUGIN_FACTORY(PlatformStatusFactory, registerPlugin();) @@ -16,10 +18,11 @@ K_EXPORT_PLUGIN(PlatformStatusFactory("platformstatus")) PlatformStatus::PlatformStatus(QObject *parent, const QVariantList &) : KDEDModule(parent) { - QDBusConnection::sessionBus().registerObject("/PlatformStatus", this, - QDBusConnection::ExportAllProperties | - QDBusConnection::ExportAllSignals); + new PlatformStatusAdaptor(this); + QDBusConnection::sessionBus().registerObject("/PlatformStatus", this); + findShellPackage(false); + const QString globalrcPath = QStandardPaths::locate(QStandardPaths::ConfigLocation, "kdeglobals"); connect(KDirWatch::self(), SIGNAL(dirty(QString)), this, SLOT(fileDirtied(QString))); KDirWatch::self()->addFile(globalrcPath); diff --git a/src/utils/d_ptr.h b/src/utils/d_ptr.h new file mode 100644 index 000000000..1eb476748 --- /dev/null +++ b/src/utils/d_ptr.h @@ -0,0 +1,52 @@ +/* + * Copyright (C) 2012 Ivan Cukic + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 2, + * or (at your option) any later version, as published by the Free + * Software Foundation + * + * 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 Lesser General Public License for more details + * + * You should have received a copy of the GNU Lesser 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 D_PTR_H +#define D_PTR_H + +#include + +namespace utils { + +template +class d_ptr { +private: + std::unique_ptr d; + +public: + d_ptr(); + + template + d_ptr(Args && ...); + + ~d_ptr(); + + T * operator->() const; + + T * get() const; +}; + +#define D_PTR \ + class Private; \ + friend class Private; \ + const ::utils::d_ptr d \ + +} // namespace utils + +#endif diff --git a/src/utils/d_ptr_implementation.h b/src/utils/d_ptr_implementation.h new file mode 100644 index 000000000..5380de722 --- /dev/null +++ b/src/utils/d_ptr_implementation.h @@ -0,0 +1,59 @@ +/* + * Copyright (C) 2012 Ivan Cukic + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 2, + * or (at your option) any later version, as published by the Free + * Software Foundation + * + * 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 Lesser General Public License for more details + * + * You should have received a copy of the GNU Lesser 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 D_PTR_IMPLEMENTATION_H +#define D_PTR_IMPLEMENTATION_H + +#include + +namespace utils { + +template +d_ptr::d_ptr() : d(new T()) +{ +} + +template +template +d_ptr::d_ptr(Args && ... args) + : d(new T(std::forward(args)... )) +{ +} + +template +d_ptr::~d_ptr() +{ +} + +template +T * d_ptr::operator->() const +{ + return d.get(); +} + +template +T * d_ptr::get() const +{ + return d.get(); +} + +} // namespace utils + +#endif + From c36c625d9cf4786f526fddbc16833e107957420a Mon Sep 17 00:00:00 2001 From: Kevin Ottens Date: Thu, 27 Jun 2013 16:39:03 +0200 Subject: [PATCH 3/8] 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); } From 12b2cdd19ab0b8655ce84cff2ae10766deb4b6c5 Mon Sep 17 00:00:00 2001 From: Kevin Ottens Date: Thu, 27 Jun 2013 18:36:20 +0200 Subject: [PATCH 4/8] Now this returns true --- src/plasma/configloader.cpp | 3 ++- src/plasma/configloader.h | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/plasma/configloader.cpp b/src/plasma/configloader.cpp index 1376139db..0aea3a1ad 100644 --- a/src/plasma/configloader.cpp +++ b/src/plasma/configloader.cpp @@ -432,7 +432,7 @@ QStringList ConfigLoader::groupList() const return d->groups; } -void ConfigLoader::usrWriteConfig() +bool ConfigLoader::usrWriteConfig() { if (d->saveDefaults) { KConfigSkeletonItem::List itemList = items(); @@ -441,6 +441,7 @@ void ConfigLoader::usrWriteConfig() cg.writeEntry(itemList.at(i)->key(), ""); } } + return true; } } // Plasma namespace diff --git a/src/plasma/configloader.h b/src/plasma/configloader.h index 26334e0f6..cc1a6ccd0 100644 --- a/src/plasma/configloader.h +++ b/src/plasma/configloader.h @@ -142,7 +142,7 @@ protected: /** * Hack used to force writing when no default exists in config file. */ - void usrWriteConfig(); + bool usrWriteConfig(); private: friend class Service; From be417bd8b356082212a9dbd8dcb823f3ae7de82f Mon Sep 17 00:00:00 2001 From: Kevin Ottens Date: Thu, 27 Jun 2013 22:58:24 +0200 Subject: [PATCH 5/8] Just in case we'd have just a local path --- src/scriptengines/javascript/common/extension_io.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/scriptengines/javascript/common/extension_io.cpp b/src/scriptengines/javascript/common/extension_io.cpp index 8f0b56527..644095b20 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); - QUrl url = v.isString() ? QUrl(v.toString()) : qscriptvalue_cast(v); + QUrl url = v.isString() ? QUrl::fromUserInput(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); - QUrl url = v.isString() ? QUrl(v.toString()) : qscriptvalue_cast(v); + QUrl url = v.isString() ? QUrl::fromUserInput(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); - QUrl url = v.isString() ? QUrl(v.toString()) : qscriptvalue_cast(v); + QUrl url = v.isString() ? QUrl::fromUserInput(v.toString()) : qscriptvalue_cast(v); if (!url.isValid()) { return engine->undefinedValue(); From f9f11653ee42179f05456081bac24f858e29db70 Mon Sep 17 00:00:00 2001 From: Kevin Ottens Date: Fri, 28 Jun 2013 07:54:08 +0200 Subject: [PATCH 6/8] KIconThemes have to come first --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 6af9b52ff..6264a5db8 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -57,7 +57,7 @@ find_package(kdeqt5staging REQUIRED NO_MODULE) find_package(KF5 MODULE REQUIRED COMPONENTS CMake Compiler InstallDirs XmlGui KIdleTime ItemModels KWidgetsAddons KWindowSystem KCodecs KArchive KCoreAddons Solid ThreadWeaver KConfig KAuth kjs KWallet - ki18n kguiaddons kservice kwidgets ItemViews KNotifications KCompletion KJobWidgets KConfigWidgets KIconThemes) + ki18n kguiaddons kservice kwidgets ItemViews KNotifications KIconThemes KCompletion KJobWidgets KConfigWidgets) #find_package(KF5Transitional REQUIRED) # those are not "done" yet: From 597397b41f5450f24ddc784e0faa13133fed6bd5 Mon Sep 17 00:00:00 2001 From: Kevin Ottens Date: Fri, 28 Jun 2013 10:07:49 +0200 Subject: [PATCH 7/8] Revert "Enabling C++11 flags for clang and gcc" This reverts commit 7c5e2e49ae5bef1d4071ff1ec555bd7b7beb61c5. In KF5, C++11 is not to be assumed on all our platforms. So don't force it from cmake. That said we have to make sure our code builds in both case (C++11 available or not). I'll get in touch with the build.kde.org admins to sort that out. CCMAIL: ivan.cukic@kde.org --- CMakeLists.txt | 6 ------ 1 file changed, 6 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 6264a5db8..a0fae48e4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -41,12 +41,6 @@ endif() # in the KDE build system, this is the same as CMAKE_BINARY_DIR. configure_file(${CMAKE_SOURCE_DIR}/CTestCustom.cmake ${CMAKE_BINARY_DIR}/CTestCustom.cmake COPYONLY) -################# Enable C++11 features for clang and gcc ################# - -if(UNIX) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -std=c++0x") -endif() - ################# now find all used packages ################# set (QT_MIN_VERSION "5.2.0") From 9c15442cc69311a93718dafc911cebe6b0505c41 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20K=C3=BCgler?= Date: Wed, 26 Jun 2013 01:09:51 +0200 Subject: [PATCH 8/8] fix some includes in porting script --- tools/port-plasma2.sh | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/tools/port-plasma2.sh b/tools/port-plasma2.sh index 2f114172e..804092ec2 100755 --- a/tools/port-plasma2.sh +++ b/tools/port-plasma2.sh @@ -40,7 +40,7 @@ for FS in `find $PWD -name '*.qml'`; do perl -p -i -e 's/QtQuick 1.1/QtQuick 2.0/g' $FS done -exit +#exit # Change plugin definitions, this is useful if you want to @@ -92,6 +92,12 @@ for FS in `find $PWD -name '*.h' -o -name '*.cpp'`; do perl -p -i -e 's/QGraphicsSceneWheel/QWheelEvent/g' $FS perl -p -i -e 's/QGraphicsSceneHoverEvent/QHoverEvent/g' $FS + # Fix up includes + perl -p -i -e 's/\#include \/\#include \/g' $FS + perl -p -i -e 's/\#include \/\#include \/g' $FS + perl -p -i -e 's/\#include \/\#include \/g' $FS + + done