Commit ded14fc1 authored by AlmAck's avatar AlmAck

plasma-frameworks patch

parent 1f2573a1
From 344dbeb93884af36f66e9a5133e7be7bd1b1e70d Mon Sep 17 00:00:00 2001
From: David Rosca <nowrep@gmail.com>
Date: Tue, 22 Dec 2015 15:46:00 +0100
Subject: [PATCH] AppletQuickItem: Drop timer to create full representation
The timer only added 250ms delay before creating the full representation,
sometimes resulting in showing empty popup for a moment.
REVIEW: 126468
---
src/plasmaquick/appletquickitem.cpp | 9 ++-------
src/plasmaquick/appletquickitem.h | 1 -
src/plasmaquick/private/appletquickitem_p.h | 2 --
3 files changed, 2 insertions(+), 10 deletions(-)
diff --git a/src/plasmaquick/appletquickitem.cpp b/src/plasmaquick/appletquickitem.cpp
index 5f6b857..ec2ed24 100644
--- a/src/plasmaquick/appletquickitem.cpp
+++ b/src/plasmaquick/appletquickitem.cpp
@@ -407,11 +407,6 @@ AppletQuickItem::AppletQuickItem(Plasma::Applet *applet, QQuickItem *parent)
d->containmentPackage = d->applet->containment()->package();
}
- d->compactRepresentationCheckTimer.setSingleShot(true);
- d->compactRepresentationCheckTimer.setInterval(250);
- connect(&d->compactRepresentationCheckTimer, SIGNAL(timeout()),
- this, SLOT(compactRepresentationCheck()));
-
if (applet->pluginInfo().isValid()) {
const QString rootPath = applet->pluginInfo().property(QStringLiteral("X-Plasma-RootPath")).toString();
if (!rootPath.isEmpty()) {
@@ -582,7 +577,7 @@ void AppletQuickItem::init()
//HACK: check the Layout properties we wrote
QQmlProperty p(this, "Layout.minimumWidth", QtQml::qmlContext(d->qmlObject->rootObject()));
- d->compactRepresentationCheckTimer.start();
+ d->compactRepresentationCheck();
qmlObject()->engine()->rootContext()->setBaseUrl(qmlObject()->source());
qmlObject()->engine()->setContextForObject(this, qmlObject()->engine()->rootContext());
}
@@ -746,7 +741,7 @@ void AppletQuickItem::geometryChanged(const QRectF &newGeometry, const QRectF &o
Q_UNUSED(oldGeometry)
QQuickItem::geometryChanged(newGeometry, oldGeometry);
- d->compactRepresentationCheckTimer.start();
+ d->compactRepresentationCheck();
}
void AppletQuickItem::itemChange(ItemChange change, const ItemChangeData &value)
diff --git a/src/plasmaquick/appletquickitem.h b/src/plasmaquick/appletquickitem.h
index dffbcf3..1e0174a 100644
--- a/src/plasmaquick/appletquickitem.h
+++ b/src/plasmaquick/appletquickitem.h
@@ -152,7 +152,6 @@ protected:
private:
AppletQuickItemPrivate *const d;
- Q_PRIVATE_SLOT(d, void compactRepresentationCheck())
Q_PRIVATE_SLOT(d, void minimumWidthChanged())
Q_PRIVATE_SLOT(d, void minimumHeightChanged())
Q_PRIVATE_SLOT(d, void preferredWidthChanged())
diff --git a/src/plasmaquick/private/appletquickitem_p.h b/src/plasmaquick/private/appletquickitem_p.h
index 5a7f9db..94cfada 100644
--- a/src/plasmaquick/private/appletquickitem_p.h
+++ b/src/plasmaquick/private/appletquickitem_p.h
@@ -93,8 +93,6 @@ public:
QPointer<QObject> representationLayout;
QPointer<QObject> ownLayout;
- QTimer compactRepresentationCheckTimer;
-
Plasma::Applet *applet;
KDeclarative::QmlObject *qmlObject;
--
2.4.1
diff --git a/src/plasmaquick/appletquickitem.h b/src/plasmaquick/appletquickitem.h
index 1e0174a..4f25f5d 100644
--- a/src/plasmaquick/appletquickitem.h
+++ b/src/plasmaquick/appletquickitem.h
@@ -146,6 +146,7 @@ protected:
KDeclarative::QmlObject *qmlObject();
//Reimplementation
+ void childEvent(QChildEvent *event) Q_DECL_OVERRIDE;
void geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry) Q_DECL_OVERRIDE;
void itemChange(ItemChange change, const ItemChangeData &value) Q_DECL_OVERRIDE;
diff --git a/src/plasmaquick/appletquickitem.cpp b/src/plasmaquick/appletquickitem.cpp
index 28f1eb5..7fba310 100644
--- a/src/plasmaquick/appletquickitem.cpp
+++ b/src/plasmaquick/appletquickitem.cpp
@@ -50,7 +50,11 @@ AppletQuickItemPrivate::AppletQuickItemPrivate(Plasma::Applet *a, AppletQuickIte
applet(a),
expanded(false)
{
- if (!a->pluginInfo().isValid()) {
+}
+
+void AppletQuickItemPrivate::init()
+{
+ if (!applet->pluginInfo().isValid()) {
// This `qmlObject` is used in other parts of the code
qmlObject = new KDeclarative::QmlObject(q);
return;
@@ -383,6 +387,7 @@ AppletQuickItem::AppletQuickItem(Plasma::Applet *applet, QQuickItem *parent)
: QQuickItem(parent),
d(new AppletQuickItemPrivate(applet, this))
{
+ d->init();
if (d->applet) {
d->appletPackage = d->applet->package();
}
@@ -726,6 +731,21 @@ QObject *AppletQuickItem::rootItem()
return d->qmlObject->rootObject();
}
+void AppletQuickItem::childEvent(QChildEvent *event)
+{
+ // Added child may be QQuickLayoutAttached
+ if (event->added() && !d->ownLayout && d->currentRepresentationItem) {
+ // Child has not yet finished initialization at this point
+ QTimer::singleShot(0, this, [this]() {
+ if (!d->ownLayout) {
+ d->connectLayoutAttached(d->currentRepresentationItem);
+ }
+ });
+ }
+
+ QQuickItem::childEvent(event);
+}
+
void AppletQuickItem::geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry)
{
Q_UNUSED(oldGeometry)
diff --git a/src/plasmaquick/private/appletquickitem_p.h b/src/plasmaquick/private/appletquickitem_p.h
index 1f99d2f..9c24734 100644
--- a/src/plasmaquick/private/appletquickitem_p.h
+++ b/src/plasmaquick/private/appletquickitem_p.h
@@ -55,6 +55,8 @@ class AppletQuickItemPrivate
public:
AppletQuickItemPrivate(Plasma::Applet *a, AppletQuickItem *item);
+ void init();
+
QQuickItem *createCompactRepresentationItem();
QQuickItem *createFullRepresentationItem();
QQuickItem *createCompactRepresentationExpanderItem();
......@@ -4,7 +4,7 @@ source ../frameworks.conf
pkgname=plasma-framework
pkgver=${KFVersion}
pkgrel=2
pkgrel=3
pkgdesc='Plasma library and runtime components based upon KF5 and Qt5'
arch=('x86_64')
url='https://projects.kde.org/projects/frameworks/plasma-framework'
......@@ -14,15 +14,16 @@ makedepends=("extra-cmake-modules>=${KFECMVersion}" 'qt5-tools' 'kdoctools')
options=("debug")
groups=('kf5')
source=("${KFServer}/${pkgname}-${pkgver}.tar.xz"
'0001-AppletQuickItem-Drop-timer-to-create-full-representa.patch')
'AppletQuickItem-Fix-finding-own-attached-layout.patch')
sha256sums=( $(getSum ${pkgname})
'8ceb9be7336583870a7a485e1b510517a6e8629dc2bcd9b17d6bf06c83f160d0')
'6094c6d9a7997554c74f930dc551517bf6e35e6e90700152aab12dec45455b86')
prepare() {
mkdir -p build
cd $pkgname-$pkgver
patch -p1 -R < $srcdir/0001-AppletQuickItem-Drop-timer-to-create-full-representa.patch
# https://bugs.kde.org/show_bug.cgi?id=358849
patch -Np1 < $srcdir/AppletQuickItem-Fix-finding-own-attached-layout.patch
}
build() {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment