Changeset View
Changeset View
Standalone View
Standalone View
shell/scripting/appinterface.cpp
Show First 20 Lines • Show All 66 Lines • ▼ Show 20 Line(s) | |||||
67 | } | 67 | } | ||
68 | 68 | | |||
69 | QList<int> AppInterface::activityIds() const | 69 | QList<int> AppInterface::activityIds() const | ||
70 | { | 70 | { | ||
71 | //FIXME: the ints could overflow since Applet::id() returns a uint, | 71 | //FIXME: the ints could overflow since Applet::id() returns a uint, | ||
72 | // however QScript deals with QList<uint> very, very poorly | 72 | // however QScript deals with QList<uint> very, very poorly | ||
73 | QList<int> containments; | 73 | QList<int> containments; | ||
74 | 74 | | |||
75 | foreach (Plasma::Containment *c, m_env->corona()->containments()) { | 75 | const auto cs = m_env->corona()->containments(); | ||
76 | for (Plasma::Containment *c : cs) { | ||||
76 | if (!ScriptEngine::isPanel(c)) { | 77 | if (!ScriptEngine::isPanel(c)) { | ||
77 | containments.append(c->id()); | 78 | containments.append(c->id()); | ||
78 | } | 79 | } | ||
79 | } | 80 | } | ||
80 | 81 | | |||
81 | return containments; | 82 | return containments; | ||
82 | } | 83 | } | ||
83 | 84 | | |||
84 | QList<int> AppInterface::panelIds() const | 85 | QList<int> AppInterface::panelIds() const | ||
85 | { | 86 | { | ||
86 | //FIXME: the ints could overflow since Applet::id() returns a uint, | 87 | //FIXME: the ints could overflow since Applet::id() returns a uint, | ||
87 | // however QScript deals with QList<uint> very, very poorly | 88 | // however QScript deals with QList<uint> very, very poorly | ||
88 | QList<int> panels; | 89 | QList<int> panels; | ||
89 | 90 | | |||
90 | foreach (Plasma::Containment *c, m_env->corona()->containments()) { | 91 | const auto cs = m_env->corona()->containments(); | ||
92 | for (Plasma::Containment *c : cs) { | ||||
91 | //qDebug() << "checking" << (QObject*)c << isPanel(c); | 93 | //qDebug() << "checking" << (QObject*)c << isPanel(c); | ||
92 | if (ScriptEngine::isPanel(c)) { | 94 | if (ScriptEngine::isPanel(c)) { | ||
93 | panels.append(c->id()); | 95 | panels.append(c->id()); | ||
94 | } | 96 | } | ||
95 | } | 97 | } | ||
96 | 98 | | |||
97 | return panels; | 99 | return panels; | ||
98 | } | 100 | } | ||
▲ Show 20 Lines • Show All 87 Lines • ▼ Show 20 Line(s) | 174 | { | |||
186 | 188 | | |||
187 | return false; | 189 | return false; | ||
188 | } | 190 | } | ||
189 | 191 | | |||
190 | QStringList AppInterface::knownWidgetTypes() const | 192 | QStringList AppInterface::knownWidgetTypes() const | ||
191 | { | 193 | { | ||
192 | if (m_knownWidgets.isEmpty()) { | 194 | if (m_knownWidgets.isEmpty()) { | ||
193 | QStringList widgets; | 195 | QStringList widgets; | ||
194 | KPluginInfo::List infoLs = Plasma::PluginLoader::self()->listAppletInfo(QString()); | 196 | const KPluginInfo::List infoLs = Plasma::PluginLoader::self()->listAppletInfo(QString()); | ||
195 | 197 | | |||
196 | foreach (const KPluginInfo &info, infoLs) { | 198 | for (const KPluginInfo &info : infoLs) { | ||
197 | widgets.append(info.pluginName()); | 199 | widgets.append(info.pluginName()); | ||
198 | } | 200 | } | ||
199 | 201 | | |||
200 | const_cast<AppInterface *>(this)->m_knownWidgets = widgets; | 202 | const_cast<AppInterface *>(this)->m_knownWidgets = widgets; | ||
201 | } | 203 | } | ||
202 | 204 | | |||
203 | return m_knownWidgets; | 205 | return m_knownWidgets; | ||
204 | } | 206 | } | ||
Show All 9 Lines | |||||
214 | } | 216 | } | ||
215 | 217 | | |||
216 | QStringList AppInterface::knownContainmentTypes(const QString &type) const | 218 | QStringList AppInterface::knownContainmentTypes(const QString &type) const | ||
217 | { | 219 | { | ||
218 | QStringList containments; | 220 | QStringList containments; | ||
219 | const KPluginInfo::List infoLs = Plasma::PluginLoader::listContainmentsOfType(type); | 221 | const KPluginInfo::List infoLs = Plasma::PluginLoader::listContainmentsOfType(type); | ||
220 | 222 | | |||
221 | containments.reserve(infoLs.count()); | 223 | containments.reserve(infoLs.count()); | ||
222 | foreach (const KPluginInfo &info, infoLs) { | 224 | for (const KPluginInfo &info : infoLs) { | ||
223 | containments.append(info.pluginName()); | 225 | containments.append(info.pluginName()); | ||
224 | } | 226 | } | ||
225 | 227 | | |||
226 | return containments; | 228 | return containments; | ||
227 | } | 229 | } | ||
228 | 230 | | |||
229 | } | 231 | } | ||
230 | 232 | | |||
231 | 233 | | |||
232 | 234 | |