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