Changeset View
Changeset View
Standalone View
Standalone View
containments/panel/contents/ui/main.qml
Show First 20 Lines • Show All 48 Lines • ▼ Show 20 Line(s) | 35 | //BEGIN properties | |||
---|---|---|---|---|---|
49 | property bool isHorizontal: plasmoid.formFactor != PlasmaCore.Types.Vertical | 49 | property bool isHorizontal: plasmoid.formFactor != PlasmaCore.Types.Vertical | ||
50 | property int fixedWidth: 0 | 50 | property int fixedWidth: 0 | ||
51 | property int fixedHeight: 0 | 51 | property int fixedHeight: 0 | ||
52 | 52 | | |||
53 | //END properties | 53 | //END properties | ||
54 | 54 | | |||
55 | //BEGIN functions | 55 | //BEGIN functions | ||
56 | function addApplet(applet, x, y) { | 56 | function addApplet(applet, x, y) { | ||
57 | var container = appletContainerComponent.createObject(root, { | | |||
58 | applet: applet, | | |||
59 | | ||||
60 | // don't show applet if it choses to be hidden but still make it | 57 | // don't show applet if it choses to be hidden but still make it | ||
61 | // accessible in the panelcontroller | 58 | // accessible in the panelcontroller | ||
62 | visible: Qt.binding(function() { | 59 | // Due to the nature of how "visible" propagates in QML, we need to | ||
63 | return applet.status !== PlasmaCore.Types.HiddenStatus || (!plasmoid.immutable && plasmoid.userConfiguring) | 60 | // explicitly set it on the container (so the Layout ignores it) | ||
61 | // as well as the applet (so it reliably knows about), otherwise it can | ||||
62 | // happen that an applet erroneously thinks it's visible, or suddenly | ||||
63 | // starts thinking that way on teardown (virtual desktop pager) | ||||
64 | // leading to crashes | ||||
65 | var visibleBinding = Qt.binding(function() { | ||||
66 | return applet.status !== PlasmaCore.Types.HiddenStatus || (!plasmoid.immutable && plasmoid.userConfiguring); | ||||
64 | }) | 67 | }) | ||
68 | | ||||
69 | var container = appletContainerComponent.createObject(root, { | ||||
70 | applet: applet, | ||||
71 | visible: visibleBinding | ||||
65 | }); | 72 | }); | ||
66 | 73 | | |||
67 | applet.parent = container; | 74 | applet.parent = container; | ||
68 | applet.anchors.fill = container; | 75 | applet.anchors.fill = container; | ||
69 | 76 | | |||
70 | applet.visible = true; | 77 | applet.visible = visibleBinding; | ||
71 | 78 | | |||
72 | // Is there a DND placeholder? Replace it! | 79 | // Is there a DND placeholder? Replace it! | ||
73 | if (dndSpacer.parent === currentLayout) { | 80 | if (dndSpacer.parent === currentLayout) { | ||
74 | LayoutManager.insertBefore(dndSpacer, container); | 81 | LayoutManager.insertBefore(dndSpacer, container); | ||
75 | dndSpacer.parent = root; | 82 | dndSpacer.parent = root; | ||
76 | return; | 83 | return; | ||
77 | 84 | | |||
78 | // If the provided position is valid, use it. | 85 | // If the provided position is valid, use it. | ||
▲ Show 20 Lines • Show All 363 Lines • Show Last 20 Lines |