Changeset View
Changeset View
Standalone View
Standalone View
src/plasmaquick/configview.cpp
Show First 20 Lines • Show All 164 Lines • ▼ Show 20 Line(s) | 164 | if (!md.isValid()) { | |||
---|---|---|---|---|---|
165 | qWarning() << "Could not find" << kcm << "specified in X-Plasma-ConfigPlugins"; | 165 | qWarning() << "Could not find" << kcm << "specified in X-Plasma-ConfigPlugins"; | ||
166 | continue; | 166 | continue; | ||
167 | } | 167 | } | ||
168 | 168 | | |||
169 | configModel->appendCategory(md.iconName(), md.name(), QString(), loader.fileName()); | 169 | configModel->appendCategory(md.iconName(), md.name(), QString(), loader.fileName()); | ||
170 | } | 170 | } | ||
171 | } | 171 | } | ||
172 | 172 | | |||
173 | q->engine()->rootContext()->setContextProperty(QStringLiteral("plasmoid"), applet.data()->property("_plasma_graphicObject").value<QObject *>()); | 173 | QObject *plasmoid = applet.data()->property("_plasma_graphicObject").value<QObject *>(); | ||
174 | | ||||
175 | // WORKAROUND FOR BUG: 393630 | ||||
176 | // Usage: in SystemTray's ConfigEntries.qml | ||||
177 | // use plasmoidRootItem.get(string property) instead of plasmoid.rootItem.property | ||||
178 | | ||||
179 | PlasmoidRootItem *plasmoidRootItem = new PlasmoidRootItem(plasmoid->property("rootItem").value<QObject *>(), q); | ||||
180 | q->engine()->rootContext()->setContextProperty(QStringLiteral("plasmoidRootItem"), plasmoidRootItem); | ||||
181 | | ||||
182 | // <-- END WORKAROUND | ||||
183 | | ||||
184 | q->engine()->rootContext()->setContextProperty(QStringLiteral("plasmoid"), plasmoid); | ||||
174 | q->engine()->rootContext()->setContextProperty(QStringLiteral("configDialog"), q); | 185 | q->engine()->rootContext()->setContextProperty(QStringLiteral("configDialog"), q); | ||
186 | | ||||
175 | component->completeCreate(); | 187 | component->completeCreate(); | ||
176 | delete component; | 188 | delete component; | ||
177 | } | 189 | } | ||
178 | 190 | | |||
179 | void ConfigViewPrivate::updateMinimumWidth() | 191 | void ConfigViewPrivate::updateMinimumWidth() | ||
180 | { | 192 | { | ||
181 | if (mainItemLayout) { | 193 | if (mainItemLayout) { | ||
182 | q->setMinimumWidth(mainItemLayout.data()->property("minimumWidth").toInt()); | 194 | q->setMinimumWidth(mainItemLayout.data()->property("minimumWidth").toInt()); | ||
▲ Show 20 Lines • Show All 166 Lines • ▼ Show 20 Line(s) | 359 | if (d->applet) { | |||
349 | cg = KConfigGroup(&cg, "ConfigDialog"); | 361 | cg = KConfigGroup(&cg, "ConfigDialog"); | ||
350 | cg.writeEntry("DialogWidth", re->size().width()); | 362 | cg.writeEntry("DialogWidth", re->size().width()); | ||
351 | cg.writeEntry("DialogHeight", re->size().height()); | 363 | cg.writeEntry("DialogHeight", re->size().height()); | ||
352 | } | 364 | } | ||
353 | 365 | | |||
354 | QQuickWindow::resizeEvent(re); | 366 | QQuickWindow::resizeEvent(re); | ||
355 | } | 367 | } | ||
356 | 368 | | |||
369 | PlasmoidRootItem::PlasmoidRootItem(QObject *rootItem, QObject *parent) | ||||
370 | : QObject(parent), m_rootItem(rootItem) | ||||
371 | { | ||||
372 | } | ||||
373 | | ||||
374 | QVariant PlasmoidRootItem::get(const QString p) | ||||
375 | { | ||||
376 | QByteArray ba = p.toLatin1(); | ||||
377 | const char *c_str = ba.data(); | ||||
378 | return m_rootItem? m_rootItem->property(c_str) : QVariant(); | ||||
379 | } | ||||
357 | } | 380 | } | ||
358 | 381 | | |||
359 | #include "moc_configview.cpp" | 382 | #include "moc_configview.cpp" |