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
This commit is contained in:
Marco Martin 2015-10-13 14:24:29 +02:00
parent 7cafe26fa0
commit 84fc7672f6
5 changed files with 36 additions and 5 deletions

View File

@ -362,7 +362,9 @@ void Containment::setLocation(Types::Location location)
Applet *Containment::createApplet(const QString &name, const QVariantList &args) 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) void Containment::addApplet(Applet *applet)

View File

@ -199,7 +199,11 @@ public:
Q_SIGNALS: 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); void appletAdded(Plasma::Applet *applet);
@ -208,6 +212,16 @@ Q_SIGNALS:
*/ */
void appletRemoved(Plasma::Applet *applet); 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 * Emitted when the activity id has changed
*/ */

View File

@ -514,6 +514,10 @@ Containment *CoronaPrivate::addContainment(const QString &name, const QVariantLi
q->requestConfigSync(); q->requestConfigSync();
containment->flushPendingConstraintsEvents(); containment->flushPendingConstraintsEvents();
emit q->containmentAdded(containment); emit q->containmentAdded(containment);
//if id = 0 a new containment has been created, not restored
if (id == 0) {
emit q->containmentCreated(containment);
}
} }
return containment; return containment;

View File

@ -264,10 +264,20 @@ public Q_SLOTS:
Q_SIGNALS: Q_SIGNALS:
/** /**
* This signal indicates a new containment has been added to * 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); 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 * This signal indicates that a containment has been newly
* associated (or dissociated) with a physical screen. * associated (or dissociated) with a physical screen.

View File

@ -62,11 +62,12 @@ xml ed --subnode "/svg:svg/svg:defs" -t elem -n "style" -v "$stylesheet"\
for i in {0..4} for i in {0..4}
do do
xml ed --subnode "//*/*[contains(@style, '${colors[i]}')]" -t attr -n "class" -v "${colorNames[i]}" temp.svg > temp2.svg xml ed --subnode "//*/*[contains(@style, '${colors[i]}')]" -t attr -n "class" -v "${colorNames[i]}" temp.svg > temp2.svg
mv temp2.svg temp.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 done
mv temp.svg $file.svgz mv temp.svg $file.svg
gzip $file.svg gzip $file.svg
mv $file.svg.gz $file.svgz mv $file.svg.gz $file.svgz