Changeset View
Changeset View
Standalone View
Standalone View
src/plasma/private/containment_p.cpp
Show First 20 Lines • Show All 110 Lines • ▼ Show 20 Line(s) | 109 | { | |||
---|---|---|---|---|---|
111 | if (appletStatus == q->status()) { | 111 | if (appletStatus == q->status()) { | ||
112 | emit q->statusChanged(appletStatus); | 112 | emit q->statusChanged(appletStatus); | ||
113 | return; | 113 | return; | ||
114 | } | 114 | } | ||
115 | 115 | | |||
116 | if (appletStatus < q->status() || appletStatus == Plasma::Types::HiddenStatus) { | 116 | if (appletStatus < q->status() || appletStatus == Plasma::Types::HiddenStatus) { | ||
117 | // check to see if any other applet has a higher status, and stick with that if we do | 117 | // check to see if any other applet has a higher status, and stick with that if we do | ||
118 | // we'll treat HiddenStatus as lowest as we cannot change the enum value which is highest anymore | 118 | // we'll treat HiddenStatus as lowest as we cannot change the enum value which is highest anymore | ||
119 | foreach (Applet *applet, applets) { | 119 | for (Applet *applet : qAsConst(applets)) { | ||
120 | if (applet->status() > appletStatus && applet->status() != Plasma::Types::HiddenStatus) { | 120 | if (applet->status() > appletStatus && applet->status() != Plasma::Types::HiddenStatus) { | ||
121 | appletStatus = applet->status(); | 121 | appletStatus = applet->status(); | ||
122 | } | 122 | } | ||
123 | } | 123 | } | ||
124 | } | 124 | } | ||
125 | 125 | | |||
126 | if (appletStatus != Plasma::Types::HiddenStatus) { | 126 | if (appletStatus != Plasma::Types::HiddenStatus) { | ||
127 | q->setStatus(appletStatus); | 127 | q->setStatus(appletStatus); | ||
Show All 24 Lines | 143 | if (constraints & Plasma::Types::ImmutableConstraint) { | |||
152 | 152 | | |||
153 | action = q->actions()->action(QStringLiteral("add widgets")); | 153 | action = q->actions()->action(QStringLiteral("add widgets")); | ||
154 | if (action) { | 154 | if (action) { | ||
155 | action->setEnabled(unlocked); | 155 | action->setEnabled(unlocked); | ||
156 | action->setVisible(unlocked); | 156 | action->setVisible(unlocked); | ||
157 | } | 157 | } | ||
158 | 158 | | |||
159 | // tell the applets too | 159 | // tell the applets too | ||
160 | foreach (Applet *a, applets) { | 160 | for (Applet *a : qAsConst(applets)) { | ||
161 | /*Why qMin? | 161 | /*Why qMin? | ||
162 | * the applets immutability() is the maximum between internal applet immutability | 162 | * the applets immutability() is the maximum between internal applet immutability | ||
163 | * and the immutability of its containment. | 163 | * and the immutability of its containment. | ||
164 | * so not set higher immutability in the internal member of Applet | 164 | * so not set higher immutability in the internal member of Applet | ||
165 | * or the applet will not be able to be unlocked properly | 165 | * or the applet will not be able to be unlocked properly | ||
166 | */ | 166 | */ | ||
167 | a->setImmutability(qMin(q->immutability(), a->d->immutability)); | 167 | a->setImmutability(qMin(q->immutability(), a->d->immutability)); | ||
168 | a->updateConstraints(Types::ImmutableConstraint); | 168 | a->updateConstraints(Types::ImmutableConstraint); | ||
169 | } | 169 | } | ||
170 | } | 170 | } | ||
171 | 171 | | |||
172 | // pass on the constraints that are relevant here | 172 | // pass on the constraints that are relevant here | ||
173 | Types::Constraints appletConstraints = Types::NoConstraint; | 173 | Types::Constraints appletConstraints = Types::NoConstraint; | ||
174 | if (constraints & Types::FormFactorConstraint) { | 174 | if (constraints & Types::FormFactorConstraint) { | ||
175 | appletConstraints |= Types::FormFactorConstraint; | 175 | appletConstraints |= Types::FormFactorConstraint; | ||
176 | } | 176 | } | ||
177 | 177 | | |||
178 | if (constraints & Types::ScreenConstraint) { | 178 | if (constraints & Types::ScreenConstraint) { | ||
179 | appletConstraints |= Types::ScreenConstraint; | 179 | appletConstraints |= Types::ScreenConstraint; | ||
180 | } | 180 | } | ||
181 | 181 | | |||
182 | if (appletConstraints != Types::NoConstraint) { | 182 | if (appletConstraints != Types::NoConstraint) { | ||
183 | foreach (Applet *applet, applets) { | 183 | for (Applet *applet : qAsConst(applets)) { | ||
184 | applet->updateConstraints(appletConstraints); | 184 | applet->updateConstraints(appletConstraints); | ||
185 | } | 185 | } | ||
186 | } | 186 | } | ||
187 | } | 187 | } | ||
188 | 188 | | |||
189 | Applet *ContainmentPrivate::createApplet(const QString &name, const QVariantList &args, uint id) | 189 | Applet *ContainmentPrivate::createApplet(const QString &name, const QVariantList &args, uint id) | ||
190 | { | 190 | { | ||
191 | if (!q->isContainment()) { | 191 | if (!q->isContainment()) { | ||
▲ Show 20 Lines • Show All 74 Lines • Show Last 20 Lines |