From 84fc7672f628e240be4dde1ab386bf44e679cc3f Mon Sep 17 00:00:00 2001 From: Marco Martin Date: Tue, 13 Oct 2015 14:24:29 +0200 Subject: [PATCH] introduce appletCreated signal appletCreated is different from appletAdded because it gets emitted only when the user explicitly creates one, so not in case of an applet migrating and not during restore needed by https://git.reviewboard.kde.org/r/125562/ REVIEW:125569 Change-Id: I1db9286beb160391c13f1aca0ac48ed490495ea2 --- src/plasma/containment.cpp | 4 +++- src/plasma/containment.h | 16 +++++++++++++++- src/plasma/corona.cpp | 4 ++++ src/plasma/corona.h | 12 +++++++++++- src/tools/apply-stylesheet.sh | 5 +++-- 5 files changed, 36 insertions(+), 5 deletions(-) diff --git a/src/plasma/containment.cpp b/src/plasma/containment.cpp index fef162483..1d166f2eb 100644 --- a/src/plasma/containment.cpp +++ b/src/plasma/containment.cpp @@ -362,7 +362,9 @@ void Containment::setLocation(Types::Location location) Applet *Containment::createApplet(const QString &name, const QVariantList &args) { - return d->createApplet(name, args); + Plasma::Applet *applet = d->createApplet(name, args); + emit appletCreated(applet); + return applet; } void Containment::addApplet(Applet *applet) diff --git a/src/plasma/containment.h b/src/plasma/containment.h index 610689365..0b7a3eff4 100644 --- a/src/plasma/containment.h +++ b/src/plasma/containment.h @@ -199,7 +199,11 @@ public: Q_SIGNALS: /** - * This signal is emitted when a new applet is created by the containment + * This signal is emitted when a new applet is added in the containment + * It may happen in the following situations: + * * The user created the applet + * * The applet was moved in from another containment + * * The applet got restored at startup */ void appletAdded(Plasma::Applet *applet); @@ -208,6 +212,16 @@ Q_SIGNALS: */ void appletRemoved(Plasma::Applet *applet); + /** + * This signal is emitted when a new applet is created by the containment. + * Compared to appletAdded, this gets emitted only when the user explicitly + * creates a new applet, either via the widget explorer or the scripting + * environment. + * @see appletAdded + * @since 5.16 + */ + void appletCreated(Plasma::Applet *applet); + /** * Emitted when the activity id has changed */ diff --git a/src/plasma/corona.cpp b/src/plasma/corona.cpp index f8d5c7dc5..123a5d0a4 100644 --- a/src/plasma/corona.cpp +++ b/src/plasma/corona.cpp @@ -514,6 +514,10 @@ Containment *CoronaPrivate::addContainment(const QString &name, const QVariantLi q->requestConfigSync(); containment->flushPendingConstraintsEvents(); emit q->containmentAdded(containment); + //if id = 0 a new containment has been created, not restored + if (id == 0) { + emit q->containmentCreated(containment); + } } return containment; diff --git a/src/plasma/corona.h b/src/plasma/corona.h index 36ae60b98..d8f829ab8 100644 --- a/src/plasma/corona.h +++ b/src/plasma/corona.h @@ -264,10 +264,20 @@ public Q_SLOTS: Q_SIGNALS: /** * This signal indicates a new containment has been added to - * the Corona + * the Corona: it may occur after creation or restore from config */ void containmentAdded(Plasma::Containment *containment); + /** + * This signal indicates a new containment has been created + * in the Corona. Compared to containmentAdded it can only happen + * after the creation of a new containment. + * + * @see containmentAdded + * @since 5.16 + */ + void containmentCreated(Plasma::Containment *containment); + /** * This signal indicates that a containment has been newly * associated (or dissociated) with a physical screen. diff --git a/src/tools/apply-stylesheet.sh b/src/tools/apply-stylesheet.sh index 96e59fb11..797c5fd73 100755 --- a/src/tools/apply-stylesheet.sh +++ b/src/tools/apply-stylesheet.sh @@ -62,11 +62,12 @@ xml ed --subnode "/svg:svg/svg:defs" -t elem -n "style" -v "$stylesheet"\ for i in {0..4} do xml ed --subnode "//*/*[contains(@style, '${colors[i]}')]" -t attr -n "class" -v "${colorNames[i]}" temp.svg > temp2.svg + mv temp2.svg temp.svg - echo sed -i 's/\(style=".*\)fill:'${colors[i]}'/\1fill:currentColor/g' temp.svg + sed -i 's/\(style=".*\)fill:'${colors[i]}'/\1fill:currentColor/g' temp.svg done -mv temp.svg $file.svgz +mv temp.svg $file.svg gzip $file.svg mv $file.svg.gz $file.svgz