From 63256915d84b7d0700db491678d48bb53a3d53af8f6491f0cc3599d71a17ea05 Mon Sep 17 00:00:00 2001 From: Hrvoje Senjan Date: Sun, 1 Jun 2014 18:48:56 +0000 Subject: [PATCH 1/3] 4.100.0 OBS-URL: https://build.opensuse.org/package/show/KDE:Frameworks5/kdeclarative?expand=0&rev=19 --- kdeclarative-4.100.0.tar.xz | 3 +++ kdeclarative-4.99.0.tar.xz | 3 --- kdeclarative.changes | 9 +++++++++ kdeclarative.spec | 10 ++++++++-- 4 files changed, 20 insertions(+), 5 deletions(-) create mode 100644 kdeclarative-4.100.0.tar.xz delete mode 100644 kdeclarative-4.99.0.tar.xz diff --git a/kdeclarative-4.100.0.tar.xz b/kdeclarative-4.100.0.tar.xz new file mode 100644 index 0000000..0882a0f --- /dev/null +++ b/kdeclarative-4.100.0.tar.xz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e33708cdd149e465dc897720f82a2392798f02ac37c862589e97cf7a65088f36 +size 2813732 diff --git a/kdeclarative-4.99.0.tar.xz b/kdeclarative-4.99.0.tar.xz deleted file mode 100644 index 12f0acd..0000000 --- a/kdeclarative-4.99.0.tar.xz +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:edb3db347acf96bae9e95635f9e41e885221c44db926031bc66763cdb89feae8 -size 2813388 diff --git a/kdeclarative.changes b/kdeclarative.changes index 65e11c7..f64cf49 100644 --- a/kdeclarative.changes +++ b/kdeclarative.changes @@ -1,3 +1,12 @@ +------------------------------------------------------------------- +Sun Jun 1 18:02:34 UTC 2014 - hrvoje.senjan@gmail.com + +- Update to 4.100.0 + * API improvements and cleanups + * Buildsystem fixes + * For more details please see: + http://www.kde.org/announcements/announce-frameworks5-beta3.php + ------------------------------------------------------------------- Sun May 4 01:41:05 UTC 2014 - hrvoje.senjan@gmail.com diff --git a/kdeclarative.spec b/kdeclarative.spec index 2d7784b..87a7dce 100644 --- a/kdeclarative.spec +++ b/kdeclarative.spec @@ -18,10 +18,10 @@ %define lname libKF5Declarative5 Name: kdeclarative -Version: 4.99.0 +Version: 4.100.0 Release: 0 BuildRequires: cmake >= 2.8.12 -BuildRequires: extra-cmake-modules >= 0.0.13 +BuildRequires: extra-cmake-modules >= 0.0.14 BuildRequires: fdupes BuildRequires: kconfig-devel >= %{_kf5_version} BuildRequires: kcoreaddons-devel >= %{_kf5_version} @@ -51,6 +51,7 @@ KDeclarative provides integration of QML and KDE workspaces. %package -n %lname Summary: Integration of QML and KDE workspaces Group: System/GUI/KDE +Recommends: %lname-lang = %{version} %description -n %lname KDeclarative provides integration of QML and KDE workspaces. @@ -66,6 +67,7 @@ Requires: kio-devel >= %{_kf5_version} KDeclarative provides integration of QML and KDE workspaces. Development files. +%lang_package -n %lname %prep %setup -q @@ -77,10 +79,14 @@ Development files. %kf5_makeinstall -C build %fdupes -s %{buildroot} + %find_lang %{name}5 + %post -n %lname -p /sbin/ldconfig %postun -n %lname -p /sbin/ldconfig +%files -n %lname-lang -f %{name}5.lang + %files -n %lname %defattr(-,root,root) %doc COPYING* README* From 5ef784a3390c272892e27063158adf9713fcc0edba1835b9014a0ca1da0aee4b Mon Sep 17 00:00:00 2001 From: Hrvoje Senjan Date: Tue, 3 Jun 2014 20:39:44 +0000 Subject: [PATCH 2/3] OBS-URL: https://build.opensuse.org/package/show/KDE:Frameworks5/kdeclarative?expand=0&rev=20 --- baselibs.conf | 3 +++ kdeclarative.changes | 1 + kdeclarative.spec | 3 ++- 3 files changed, 6 insertions(+), 1 deletion(-) create mode 100644 baselibs.conf diff --git a/baselibs.conf b/baselibs.conf new file mode 100644 index 0000000..7c6cf27 --- /dev/null +++ b/baselibs.conf @@ -0,0 +1,3 @@ +libKF5Declarative5 +kdeclarative-devel + requires "libKF5Declarative5- = " diff --git a/kdeclarative.changes b/kdeclarative.changes index f64cf49..d3df0b1 100644 --- a/kdeclarative.changes +++ b/kdeclarative.changes @@ -6,6 +6,7 @@ Sun Jun 1 18:02:34 UTC 2014 - hrvoje.senjan@gmail.com * Buildsystem fixes * For more details please see: http://www.kde.org/announcements/announce-frameworks5-beta3.php +- Add baselibs.conf ------------------------------------------------------------------- Sun May 4 01:41:05 UTC 2014 - hrvoje.senjan@gmail.com diff --git a/kdeclarative.spec b/kdeclarative.spec index 87a7dce..368976f 100644 --- a/kdeclarative.spec +++ b/kdeclarative.spec @@ -42,7 +42,8 @@ Summary: Integration of QML and KDE workspaces License: LGPL-2.1+ Group: System/GUI/KDE Url: http://www.kde.org -Source0: kdeclarative-%{version}.tar.xz +Source: http://download.kde.org/unstable/frameworks/%{version}/%{name}-%{version}.tar.xz +Source1: baselibs.conf BuildRoot: %{_tmppath}/%{name}-%{version}-build %description From 93b39328259f19c2e4879faa57396161a5825185426cf107710ebc7dc2d22137 Mon Sep 17 00:00:00 2001 From: Hrvoje Senjan Date: Sat, 7 Jun 2014 19:50:23 +0000 Subject: [PATCH 3/3] OBS-URL: https://build.opensuse.org/package/show/KDE:Frameworks5/kdeclarative?expand=0&rev=21 --- af7c0f8194.patch | 522 +++++++++++++++++++++++++++++++++++++++++++ kdeclarative.changes | 1 + kdeclarative.spec | 3 + 3 files changed, 526 insertions(+) create mode 100644 af7c0f8194.patch diff --git a/af7c0f8194.patch b/af7c0f8194.patch new file mode 100644 index 0000000..b884de4 --- /dev/null +++ b/af7c0f8194.patch @@ -0,0 +1,522 @@ +diff --git a/src/kdeclarative/kdeclarative.cpp b/src/kdeclarative/kdeclarative.cpp +index a35dac5..b3906e2 100644 +--- a/src/kdeclarative/kdeclarative.cpp ++++ b/src/kdeclarative/kdeclarative.cpp +@@ -39,7 +39,8 @@ namespace KDeclarative { + QStringList KDeclarativePrivate::s_runtimePlatform; + + KDeclarativePrivate::KDeclarativePrivate() +- : initialized(false) ++ : initialized(false), ++ contextObj(0) + { + } + +@@ -86,8 +87,14 @@ void KDeclarative::setupBindings() + + /*Create a context object for the root qml context. + in this way we can register global functions, in this case the i18n() family*/ +- RootContext *contextObj = new RootContext(d->declarativeEngine.data()); +- d->declarativeEngine.data()->rootContext()->setContextObject(contextObj); ++ if (!d->contextObj) { ++ d->contextObj = new RootContext(d->declarativeEngine.data()); ++ } ++ d->declarativeEngine.data()->rootContext()->setContextObject(d->contextObj); ++ ++ if (!d->translationDomain.isNull()) { ++ d->contextObj->setProperty("translationDomain", d->translationDomain); ++ } + + /* Tell the engine to search for platform-specific imports first + (so it will "win" in import name resolution). +@@ -111,6 +118,19 @@ void KDeclarative::setupBindings() + d->declarativeEngine.data()->addImageProvider(QString(QStringLiteral("icon")), new KIconProvider); + } + ++void KDeclarative::setTranslationDomain(const QString &translationDomain) ++{ ++ d->translationDomain = translationDomain; ++ if (d->contextObj) { ++ d->contextObj->setProperty("translationDomain", d->translationDomain); ++ } ++} ++ ++QString KDeclarative::translationDomain() const ++{ ++ return d->translationDomain; ++} ++ + void KDeclarative::setupQmlJsDebugger() + { + if (QCoreApplication::arguments().contains(QLatin1String("-qmljsdebugger"))) { +diff --git a/src/kdeclarative/kdeclarative.h b/src/kdeclarative/kdeclarative.h +index b4a274b..1d21964 100644 +--- a/src/kdeclarative/kdeclarative.h ++++ b/src/kdeclarative/kdeclarative.h +@@ -54,6 +54,30 @@ public: + QQmlEngine *declarativeEngine() const; + + /** ++ * Call this method before calling setupBindings to install a translation domain for all ++ * i18n global functions. If a translation domain is set all i18n calls delegate to the ++ * matching i18nd calls with the provided translation domain. ++ * ++ * The translationDomain affects all i18n calls including those from imports. Because of ++ * that modules intended to be used as imports should prefer the i18nd variants and set ++ * the translation domain explicitly in each call. ++ * ++ * This method is only required if your declarative usage is inside a library. If it's ++ * in an application there is no need to set the translation domain as the application's ++ * domain can be used. ++ * ++ * @param translationDomain The translation domain to be used for i18n calls. ++ * @since 5.0 ++ */ ++ void setTranslationDomain(const QString &translationDomain); ++ ++ /** ++ * @return the translation domain for the i18n calls done in this QML engine ++ * @since 5.0 ++ */ ++ QString translationDomain() const; ++ ++ /** + * This method must be called very early at startup time to ensure the + * QQuickDebugger is enabled. Ideally it should be called in main(), + * after command-line options are defined. +diff --git a/src/kdeclarative/private/kdeclarative_p.h b/src/kdeclarative/private/kdeclarative_p.h +index 6b61d12..7ef9d0a 100644 +--- a/src/kdeclarative/private/kdeclarative_p.h ++++ b/src/kdeclarative/private/kdeclarative_p.h +@@ -21,6 +21,7 @@ + #define KDECLARATIVE_P_H + + #include "kdeclarative.h" ++#include "rootcontext_p.h" + + #include + +@@ -33,7 +34,9 @@ public: + + QPointer declarativeEngine; + bool initialized; ++ QString translationDomain; + static QStringList s_runtimePlatform; ++ QPointer contextObj; + }; + + } +diff --git a/src/kdeclarative/private/rootcontext.cpp b/src/kdeclarative/private/rootcontext.cpp +index 1230666..d88b566 100644 +--- a/src/kdeclarative/private/rootcontext.cpp ++++ b/src/kdeclarative/private/rootcontext.cpp +@@ -44,7 +44,12 @@ QString RootContext::i18n(const QString &message, const QString ¶m1, const Q + return QString(); + } + +- KLocalizedString trMessage = ki18n(message.toUtf8().constData()); ++ KLocalizedString trMessage; ++ if (!m_translationDomain.isNull()) { ++ trMessage = ki18nd(m_translationDomain.toUtf8().constData(), message.toUtf8().constData()); ++ } else { ++ trMessage = ki18n(message.toUtf8().constData()); ++ } + + if (!param1.isNull()) { + trMessage = trMessage.subs(param1); +@@ -87,7 +92,12 @@ QString RootContext::i18nc(const QString &context, const QString &message, const + return QString(); + } + +- KLocalizedString trMessage = ki18nc(context.toUtf8().constData(), message.toUtf8().constData()); ++ KLocalizedString trMessage; ++ if (!m_translationDomain.isNull()) { ++ trMessage = ki18ndc(m_translationDomain.toUtf8().constData(), context.toUtf8().constData(), message.toUtf8().constData()); ++ } else { ++ trMessage = ki18nc(context.toUtf8().constData(), message.toUtf8().constData()); ++ } + + if (!param1.isNull()) { + trMessage = trMessage.subs(param1); +@@ -130,7 +140,12 @@ QString RootContext::i18np(const QString &singular, const QString &plural, const + return QString(); + } + +- KLocalizedString trMessage = ki18np(singular.toUtf8().constData(), plural.toUtf8().constData()); ++ KLocalizedString trMessage; ++ if (!m_translationDomain.isNull()) { ++ trMessage = ki18ndp(m_translationDomain.toUtf8().constData(), singular.toUtf8().constData(), plural.toUtf8().constData()); ++ } else { ++ trMessage = ki18np(singular.toUtf8().constData(), plural.toUtf8().constData()); ++ } + + if (!param1.isNull()) { + bool ok; +@@ -179,7 +194,196 @@ QString RootContext::i18ncp(const QString &context, const QString &singular, con + return QString(); + } + +- KLocalizedString trMessage = ki18ncp(context.toUtf8().constData(), singular.toUtf8().constData(), plural.toUtf8().constData()); ++ KLocalizedString trMessage; ++ if (!m_translationDomain.isNull()) { ++ trMessage = ki18ndcp(m_translationDomain.toUtf8().constData(), context.toUtf8().constData(), singular.toUtf8().constData(), plural.toUtf8().constData()); ++ } else { ++ trMessage = ki18ncp(context.toUtf8().constData(), singular.toUtf8().constData(), plural.toUtf8().constData()); ++ } ++ ++ if (!param1.isNull()) { ++ bool ok; ++ int num = param1.toInt(&ok); ++ if (ok) { ++ trMessage = trMessage.subs(num); ++ } else { ++ trMessage = trMessage.subs(param1); ++ } ++ } ++ if (!param2.isNull()) { ++ trMessage = trMessage.subs(param2); ++ } ++ if (!param3.isNull()) { ++ trMessage = trMessage.subs(param3); ++ } ++ if (!param4.isNull()) { ++ trMessage = trMessage.subs(param4); ++ } ++ if (!param5.isNull()) { ++ trMessage = trMessage.subs(param5); ++ } ++ if (!param6.isNull()) { ++ trMessage = trMessage.subs(param6); ++ } ++ if (!param7.isNull()) { ++ trMessage = trMessage.subs(param7); ++ } ++ if (!param8.isNull()) { ++ trMessage = trMessage.subs(param8); ++ } ++ if (!param9.isNull()) { ++ trMessage = trMessage.subs(param9); ++ } ++ if (!param10.isNull()) { ++ trMessage = trMessage.subs(param10); ++ } ++ ++ return trMessage.toString(); ++} ++ ++QString RootContext::i18nd(const QString &domain, const QString &message, const QString ¶m1, const QString ¶m2, const QString ¶m3, const QString ¶m4, const QString ¶m5, const QString ¶m6, const QString ¶m7, const QString ¶m8, const QString ¶m9, const QString ¶m10) const ++{ ++ if (domain.isNull() || message.isNull()) { ++ qWarning() << "i18nd() needs at least two parameters"; ++ return QString(); ++ } ++ ++ KLocalizedString trMessage = ki18nd(domain.toUtf8().constData(), message.toUtf8().constData()); ++ ++ if (!param1.isNull()) { ++ trMessage = trMessage.subs(param1); ++ } ++ if (!param2.isNull()) { ++ trMessage = trMessage.subs(param2); ++ } ++ if (!param3.isNull()) { ++ trMessage = trMessage.subs(param3); ++ } ++ if (!param4.isNull()) { ++ trMessage = trMessage.subs(param4); ++ } ++ if (!param5.isNull()) { ++ trMessage = trMessage.subs(param5); ++ } ++ if (!param6.isNull()) { ++ trMessage = trMessage.subs(param6); ++ } ++ if (!param7.isNull()) { ++ trMessage = trMessage.subs(param7); ++ } ++ if (!param8.isNull()) { ++ trMessage = trMessage.subs(param8); ++ } ++ if (!param9.isNull()) { ++ trMessage = trMessage.subs(param9); ++ } ++ if (!param10.isNull()) { ++ trMessage = trMessage.subs(param10); ++ } ++ ++ return trMessage.toString(); ++} ++ ++QString RootContext::i18ndc(const QString &domain, const QString &context, const QString &message, const QString ¶m1, const QString ¶m2, const QString ¶m3, const QString ¶m4, const QString ¶m5, const QString ¶m6, const QString ¶m7, const QString ¶m8, const QString ¶m9, const QString ¶m10) const ++{ ++ if (domain.isNull() || context.isNull() || message.isNull()) { ++ qWarning() << "i18ndc() needs at least three arguments"; ++ return QString(); ++ } ++ ++ KLocalizedString trMessage = ki18ndc(domain.toUtf8().constData(), context.toUtf8().constData(), message.toUtf8().constData()); ++ ++ if (!param1.isNull()) { ++ trMessage = trMessage.subs(param1); ++ } ++ if (!param2.isNull()) { ++ trMessage = trMessage.subs(param2); ++ } ++ if (!param3.isNull()) { ++ trMessage = trMessage.subs(param3); ++ } ++ if (!param4.isNull()) { ++ trMessage = trMessage.subs(param4); ++ } ++ if (!param5.isNull()) { ++ trMessage = trMessage.subs(param5); ++ } ++ if (!param6.isNull()) { ++ trMessage = trMessage.subs(param6); ++ } ++ if (!param7.isNull()) { ++ trMessage = trMessage.subs(param7); ++ } ++ if (!param8.isNull()) { ++ trMessage = trMessage.subs(param8); ++ } ++ if (!param9.isNull()) { ++ trMessage = trMessage.subs(param9); ++ } ++ if (!param10.isNull()) { ++ trMessage = trMessage.subs(param10); ++ } ++ ++ return trMessage.toString(); ++} ++ ++QString RootContext::i18ndp(const QString &domain, const QString &singular, const QString &plural, const QString ¶m1, const QString ¶m2, const QString ¶m3, const QString ¶m4, const QString ¶m5, const QString ¶m6, const QString ¶m7, const QString ¶m8, const QString ¶m9, const QString ¶m10) const ++{ ++ if (domain.isNull() || singular.isNull() || plural.isNull()) { ++ qWarning() << "i18ndp() needs at least three arguments"; ++ return QString(); ++ } ++ ++ KLocalizedString trMessage = ki18ndp(domain.toUtf8().constData(), singular.toUtf8().constData(), plural.toUtf8().constData()); ++ ++ if (!param1.isNull()) { ++ bool ok; ++ int num = param1.toInt(&ok); ++ if (ok) { ++ trMessage = trMessage.subs(num); ++ } else { ++ trMessage = trMessage.subs(param1); ++ } ++ } ++ if (!param2.isNull()) { ++ trMessage = trMessage.subs(param2); ++ } ++ if (!param3.isNull()) { ++ trMessage = trMessage.subs(param3); ++ } ++ if (!param4.isNull()) { ++ trMessage = trMessage.subs(param4); ++ } ++ if (!param5.isNull()) { ++ trMessage = trMessage.subs(param5); ++ } ++ if (!param6.isNull()) { ++ trMessage = trMessage.subs(param6); ++ } ++ if (!param7.isNull()) { ++ trMessage = trMessage.subs(param7); ++ } ++ if (!param8.isNull()) { ++ trMessage = trMessage.subs(param8); ++ } ++ if (!param9.isNull()) { ++ trMessage = trMessage.subs(param9); ++ } ++ if (!param10.isNull()) { ++ trMessage = trMessage.subs(param10); ++ } ++ ++ return trMessage.toString(); ++} ++ ++QString RootContext::i18ndcp(const QString &domain, const QString &context, const QString &singular, const QString &plural, const QString ¶m1, const QString ¶m2, const QString ¶m3, const QString ¶m4, const QString ¶m5, const QString ¶m6, const QString ¶m7, const QString ¶m8, const QString ¶m9, const QString ¶m10) const ++{ ++ if (domain.isNull() || context.isNull() || singular.isNull() || plural.isNull()) { ++ qWarning() << "i18ndcp() needs at least four arguments"; ++ return QString(); ++ } ++ ++ KLocalizedString trMessage = ki18ndcp(domain.toUtf8().constData(), context.toUtf8().constData(), singular.toUtf8().constData(), plural.toUtf8().constData()); + + if (!param1.isNull()) { + bool ok; +diff --git a/src/kdeclarative/private/rootcontext_p.h b/src/kdeclarative/private/rootcontext_p.h +index 16694b1..94df09f 100644 +--- a/src/kdeclarative/private/rootcontext_p.h ++++ b/src/kdeclarative/private/rootcontext_p.h +@@ -27,6 +27,7 @@ namespace KDeclarative { + class RootContext : public QObject + { + Q_OBJECT ++ Q_PROPERTY(QString translationDomain MEMBER m_translationDomain NOTIFY translationDomainChanged) + + public: + RootContext(QObject *parent = 0); +@@ -39,6 +40,20 @@ public: + Q_INVOKABLE QString i18np(const QString &singular, const QString &plural, const QString ¶m1 = QString(), const QString ¶m2 = QString(), const QString ¶m3 = QString(), const QString ¶m4 = QString(), const QString ¶m5 = QString(), const QString ¶m6 = QString(), const QString ¶m7 = QString(), const QString ¶m8 = QString(), const QString ¶m9 = QString(), const QString ¶m10 = QString()) const; + + Q_INVOKABLE QString i18ncp(const QString &context, const QString &singular, const QString &plural, const QString ¶m1 = QString(), const QString ¶m2 = QString(), const QString ¶m3 = QString(), const QString ¶m4 = QString(), const QString ¶m5 = QString(), const QString ¶m6 = QString(), const QString ¶m7 = QString(), const QString ¶m8 = QString(), const QString ¶m9 = QString(), const QString ¶m10 = QString()) const; ++ ++ Q_INVOKABLE QString i18nd(const QString &domain, const QString &message, const QString ¶m1 = QString(), const QString ¶m2 = QString(), const QString ¶m3 = QString(), const QString ¶m4 = QString(), const QString ¶m5 = QString(), const QString ¶m6 = QString(), const QString ¶m7 = QString(), const QString ¶m8 = QString(), const QString ¶m9 = QString(), const QString ¶m10 = QString()) const; ++ ++ Q_INVOKABLE QString i18ndc(const QString &domain, const QString &context, const QString &message, const QString ¶m1 = QString(), const QString ¶m2 = QString(), const QString ¶m3 = QString(), const QString ¶m4 = QString(), const QString ¶m5 = QString(), const QString ¶m6 = QString(), const QString ¶m7 = QString(), const QString ¶m8 = QString(), const QString ¶m9 = QString(), const QString ¶m10 = QString()) const; ++ ++ Q_INVOKABLE QString i18ndp(const QString &domain, const QString &singular, const QString &plural, const QString ¶m1 = QString(), const QString ¶m2 = QString(), const QString ¶m3 = QString(), const QString ¶m4 = QString(), const QString ¶m5 = QString(), const QString ¶m6 = QString(), const QString ¶m7 = QString(), const QString ¶m8 = QString(), const QString ¶m9 = QString(), const QString ¶m10 = QString()) const; ++ ++ Q_INVOKABLE QString i18ndcp(const QString &domain, const QString &context, const QString &singular, const QString &plural, const QString ¶m1 = QString(), const QString ¶m2 = QString(), const QString ¶m3 = QString(), const QString ¶m4 = QString(), const QString ¶m5 = QString(), const QString ¶m6 = QString(), const QString ¶m7 = QString(), const QString ¶m8 = QString(), const QString ¶m9 = QString(), const QString ¶m10 = QString()) const; ++ ++Q_SIGNALS: ++ void translationDomainChanged(const QString&); ++ ++private: ++ QString m_translationDomain; + }; + + } +diff --git a/src/kdeclarative/qmlobject.cpp b/src/kdeclarative/qmlobject.cpp +index ca13097..029edaf 100644 +--- a/src/kdeclarative/qmlobject.cpp ++++ b/src/kdeclarative/qmlobject.cpp +@@ -88,6 +88,7 @@ public: + QmlObjectIncubator incubator; + QQmlComponent *component; + QTimer *executionEndTimer; ++ KDeclarative kdeclarative; + bool delay : 1; + }; + +@@ -117,12 +118,6 @@ void QmlObjectPrivate::execute(const QUrl &source) + component = new QQmlComponent(engine, q); + delete incubator.object(); + +- KDeclarative kdeclarative; +- kdeclarative.setDeclarativeEngine(engine); +- +- //binds things like kconfig and icons +- kdeclarative.setupBindings(); +- + component->loadUrl(source); + + if (delay) { +@@ -146,6 +141,9 @@ QmlObject::QmlObject(QObject *parent) + d(new QmlObjectPrivate(this)) + { + d->engine = new QQmlEngine(this); ++ d->kdeclarative.setDeclarativeEngine(d->engine); ++ //binds things like kconfig and icons ++ d->kdeclarative.setupBindings(); + d->engine->setIncubationController(new QmlObjectIncubationController(0)); + } + +@@ -159,6 +157,9 @@ QmlObject::QmlObject(QQmlEngine *engine, QObject *parent) + d->engine = new QQmlEngine(this); + d->engine->setIncubationController(new QmlObjectIncubationController(0)); + } ++ d->kdeclarative.setDeclarativeEngine(d->engine); ++ //binds things like kconfig and icons ++ d->kdeclarative.setupBindings(); + } + + QmlObject::~QmlObject() +@@ -169,6 +170,16 @@ QmlObject::~QmlObject() + delete d; + } + ++void QmlObject::setTranslationDomain(const QString &translationDomain) ++{ ++ d->kdeclarative.setTranslationDomain(translationDomain); ++} ++ ++QString QmlObject::translationDomain() const ++{ ++ return d->kdeclarative.translationDomain(); ++} ++ + void QmlObject::setSource(const QUrl &source) + { + d->source = source; +diff --git a/src/kdeclarative/qmlobject.h b/src/kdeclarative/qmlobject.h +index 2da6c9c..cd74829 100644 +--- a/src/kdeclarative/qmlobject.h ++++ b/src/kdeclarative/qmlobject.h +@@ -55,6 +55,7 @@ class KDECLARATIVE_EXPORT QmlObject : public QObject + Q_OBJECT + + Q_PROPERTY(QUrl source READ source WRITE setSource) ++ Q_PROPERTY(QString translationDomain READ translationDomain WRITE setTranslationDomain) + Q_PROPERTY(bool initializationDelayed READ isInitializationDelayed WRITE setInitializationDelayed) + Q_PROPERTY(QObject *rootObject READ rootObject) + +@@ -77,6 +78,30 @@ public: + ~QmlObject(); + + /** ++ * Call this method before calling setupBindings to install a translation domain for all ++ * i18n global functions. If a translation domain is set all i18n calls delegate to the ++ * matching i18nd calls with the provided translation domain. ++ * ++ * The translationDomain affects all i18n calls including those from imports. Because of ++ * that modules intended to be used as imports should prefer the i18nd variants and set ++ * the translation domain explicitly in each call. ++ * ++ * This method is only required if your declarative usage is inside a library. If it's ++ * in an application there is no need to set the translation domain as the application's ++ * domain can be used. ++ * ++ * @param translationDomain The translation domain to be used for i18n calls. ++ * @since 5.0 ++ */ ++ void setTranslationDomain(const QString &translationDomain); ++ ++ /** ++ * @return the translation domain for the i18n calls done in this QML engine ++ * @since 5.0 ++ */ ++ QString translationDomain() const; ++ ++ /** + * Sets the path of the QML file to parse and execute + * + * @param path the absolute path of a QML file +diff --git a/src/qmlcontrols/kcoreaddons/kcoreaddonsplugin.cpp b/src/qmlcontrols/kcoreaddons/kcoreaddonsplugin.cpp +index 65dd75f..3c1a96e 100644 +--- a/src/qmlcontrols/kcoreaddons/kcoreaddonsplugin.cpp ++++ b/src/qmlcontrols/kcoreaddons/kcoreaddonsplugin.cpp +@@ -1,5 +1,6 @@ + /* + * Copyright 2014 Bhushan Shah ++ * Copyright 2014 David Edmundson + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as +@@ -24,10 +25,18 @@ + + #include "formats.h" + ++static QObject *formats_singletontype_provider(QQmlEngine *engine, QJSEngine *scriptEngine) ++{ ++ Q_UNUSED(engine) ++ Q_UNUSED(scriptEngine) ++ ++ return new Formats(); ++} ++ + void KCoreAddonsPlugin::registerTypes(const char *uri) + { + Q_ASSERT(uri == QLatin1String("org.kde.kcoreaddons")); + +- qmlRegisterType(uri, 1, 0, "Formats"); ++ qmlRegisterSingletonType(uri, 1, 0, "Format", formats_singletontype_provider); + qRegisterMetaType(); + } +\ No newline at end of file diff --git a/kdeclarative.changes b/kdeclarative.changes index d3df0b1..0240879 100644 --- a/kdeclarative.changes +++ b/kdeclarative.changes @@ -7,6 +7,7 @@ Sun Jun 1 18:02:34 UTC 2014 - hrvoje.senjan@gmail.com * For more details please see: http://www.kde.org/announcements/announce-frameworks5-beta3.php - Add baselibs.conf +- Add af7c0f8194.patch, to improve QML translation API ------------------------------------------------------------------- Sun May 4 01:41:05 UTC 2014 - hrvoje.senjan@gmail.com diff --git a/kdeclarative.spec b/kdeclarative.spec index 368976f..65a5605 100644 --- a/kdeclarative.spec +++ b/kdeclarative.spec @@ -44,6 +44,8 @@ Group: System/GUI/KDE Url: http://www.kde.org Source: http://download.kde.org/unstable/frameworks/%{version}/%{name}-%{version}.tar.xz Source1: baselibs.conf +# PATCH-FIX-UPSTREAM af7c0f8194.patch +Patch0: af7c0f8194.patch BuildRoot: %{_tmppath}/%{name}-%{version}-build %description @@ -71,6 +73,7 @@ Development files. %lang_package -n %lname %prep %setup -q +%patch0 -p1 %build %cmake_kf5 -d build