<table><tr><td style="">broulik added inline comments.
</td><a style="text-decoration: none; padding: 4px 8px; margin: 0 8px 8px; float: right; color: #464C5C; font-weight: bold; border-radius: 3px; background-color: #F7F7F9; background-image: linear-gradient(to bottom,#fff,#f1f0f1); display: inline-block; border: 1px solid rgba(71,87,120,.2);" href="https://phabricator.kde.org/D16212">View Revision</a></tr></table><br /><div><strong>INLINE COMMENTS</strong><div><div style="margin: 6px 0 12px 0;"><div style="border: 1px solid #C7CCD9; border-radius: 3px;"><div style="padding: 0; background: #F7F7F7; border-color: #e3e4e8; border-style: solid; border-width: 0 0 1px 0; margin: 0;"><div style="color: #74777d; background: #eff2f4; padding: 6px 8px; overflow: hidden;"><a style="float: right; text-decoration: none;" href="https://phabricator.kde.org/D16212#inline-101075">View Inline</a><span style="color: #4b4d51; font-weight: bold;">DeviceItem.qml:38</span></div>
<div style="font: 11px/15px "Menlo", "Consolas", "Monaco", monospace; white-space: pre-wrap; clear: both; padding: 4px 0; margin: 0;"><div style="padding: 0 8px; margin: 0 4px; background: rgba(251, 175, 175, .7);">    <span style="color: #004012">property</span> <span style="color: #004012">bool</span> <span style="color: #004012">mounted</span>
</div><div style="padding: 0 8px; margin: 0 4px; background: rgba(151, 234, 151, .6);">    <span style="color: #004012">property</span> <span style="color: #004012">bool</span> <span style="color: #aa4000">mounted<span class="bright">:</span></span><span class="bright"> </span><span style="color: #000a65"><span class="bright">false</span></span>
</div><div style="padding: 0 8px; margin: 0 4px; ">    <span style="color: #004012">property</span> <span style="color: #004012">bool</span> <span style="color: #aa4000">expanded:</span> <span style="color: #004012">devicenotifier</span><span class="p">.</span><span style="color: #004012">expandedDevice</span> <span style="color: #aa2211">==</span> <span style="color: #004012">udi</span>
</div></div></div>
<div style="margin: 8px 0; padding: 0 12px;"><p style="padding: 0; margin: 8px;">Isn't this overridden anyway? It's also the default anyway</p></div></div><br /><div style="border: 1px solid #C7CCD9; border-radius: 3px;"><div style="padding: 0; background: #F7F7F7; border-color: #e3e4e8; border-style: solid; border-width: 0 0 1px 0; margin: 0;"><div style="color: #74777d; background: #eff2f4; padding: 6px 8px; overflow: hidden;"><a style="float: right; text-decoration: none;" href="https://phabricator.kde.org/D16212#inline-101072">View Inline</a><span style="color: #4b4d51; font-weight: bold;">DeviceItem.qml:90</span></div>
<div style="font: 11px/15px "Menlo", "Consolas", "Monaco", monospace; white-space: pre-wrap; clear: both; padding: 4px 0; margin: 0;"><div style="padding: 0 8px; margin: 0 4px; background: rgba(151, 234, 151, .6);">    <span style="color: #aa4000">function</span> <span style="color: #004012">unMount</span><span class="p">()</span> <span class="p">{</span>
</div><div style="padding: 0 8px; margin: 0 4px; background: rgba(151, 234, 151, .6);">        <span style="color: #aa4000">if</span> <span class="p">(</span><span style="color: #004012">mounted</span><span class="p">)</span> <span class="p">{</span>
</div></div></div>
<div style="margin: 8px 0; padding: 0 12px;"><p style="padding: 0; margin: 8px;"><tt style="background: #ebebeb; font-size: 13px;">unmount</tt>?</p></div></div><br /><div style="border: 1px solid #C7CCD9; border-radius: 3px;"><div style="padding: 0; background: #F7F7F7; border-color: #e3e4e8; border-style: solid; border-width: 0 0 1px 0; margin: 0;"><div style="color: #74777d; background: #eff2f4; padding: 6px 8px; overflow: hidden;"><a style="float: right; text-decoration: none;" href="https://phabricator.kde.org/D16212#inline-101073">View Inline</a><span style="color: #4b4d51; font-weight: bold;">DeviceItem.qml:92</span></div>
<div style="font: 11px/15px "Menlo", "Consolas", "Monaco", monospace; white-space: pre-wrap; clear: both; padding: 4px 0; margin: 0;"><div style="padding: 0 8px; margin: 0 4px; background: rgba(151, 234, 151, .6);">        <span style="color: #aa4000">if</span> <span class="p">(</span><span style="color: #004012">mounted</span><span class="p">)</span> <span class="p">{</span>
</div><div style="padding: 0 8px; margin: 0 4px; background: rgba(151, 234, 151, .6);">            <span style="color: #004012">actionTriggered</span><span class="p">();</span>
</div><div style="padding: 0 8px; margin: 0 4px; background: rgba(151, 234, 151, .6);">        <span class="p">}</span>
</div></div></div>
<div style="margin: 8px 0; padding: 0 12px;"><p style="padding: 0; margin: 8px;">Can we assume "action" is always unmount?</p></div></div><br /><div style="border: 1px solid #C7CCD9; border-radius: 3px;"><div style="padding: 0; background: #F7F7F7; border-color: #e3e4e8; border-style: solid; border-width: 0 0 1px 0; margin: 0;"><div style="color: #74777d; background: #eff2f4; padding: 6px 8px; overflow: hidden;"><a style="float: right; text-decoration: none;" href="https://phabricator.kde.org/D16212#inline-101074">View Inline</a><span style="color: #4b4d51; font-weight: bold;">DeviceItem.qml:96</span></div>
<div style="font: 11px/15px "Menlo", "Consolas", "Monaco", monospace; white-space: pre-wrap; clear: both; padding: 4px 0; margin: 0;"><div style="padding: 0 8px; margin: 0 4px; background: rgba(151, 234, 151, .6);">    <span style="color: #aa4000">ListView.onAdd:</span> <span class="p">{</span>
</div><div style="padding: 0 8px; margin: 0 4px; background: rgba(151, 234, 151, .6);">        <span style="color: #aa4000">if</span> <span class="p">(</span><span style="color: #004012">model</span><span class="p">[</span><span style="color: #766510">"Removable"</span><span class="p">])</span> <span class="p">{</span>
</div></div></div>
<div style="margin: 8px 0; padding: 0 12px;"><p style="padding: 0; margin: 8px;">It looks like you instead want to use</p>

<div class="remarkup-code-block" style="margin: 12px 0;" data-code-lang="text" data-sigil="remarkup-code-block"><pre class="remarkup-code" style="font: 11px/15px "Menlo", "Consolas", "Monaco", monospace; padding: 12px; margin: 0; background: rgba(71, 87, 120, 0.08);">Connections {
    target: unmountAll
    onClicked: ...
}</pre></div></div></div><br /><div style="border: 1px solid #C7CCD9; border-radius: 3px;"><div style="padding: 0; background: #F7F7F7; border-color: #e3e4e8; border-style: solid; border-width: 0 0 1px 0; margin: 0;"><div style="color: #74777d; background: #eff2f4; padding: 6px 8px; overflow: hidden;"><a style="float: right; text-decoration: none;" href="https://phabricator.kde.org/D16212#inline-101076">View Inline</a><span style="color: #4b4d51; font-weight: bold;">DeviceItem.qml:120</span></div>
<div style="font: 11px/15px "Menlo", "Consolas", "Monaco", monospace; white-space: pre-wrap; clear: both; padding: 4px 0; margin: 0;"><div style="padding: 0 8px; margin: 0 4px; background: rgba(151, 234, 151, .6);">        <span style="color: #aa4000">if</span> <span class="p">(</span><span style="color: #004012">model</span><span class="p">[</span><span style="color: #766510">"Removable"</span><span class="p">])</span> <span class="p">{</span>
</div><div style="padding: 0 8px; margin: 0 4px; background: rgba(151, 234, 151, .6);">            <span style="color: #004012">unmountAll</span><span class="p">.</span><span style="color: #004012">clicked</span><span class="p">.</span><span style="color: #004012">disconnect</span><span class="p">(</span><span style="color: #004012">unMount</span><span class="p">)</span>
</div></div></div>
<div style="margin: 8px 0; padding: 0 12px;"><p style="padding: 0; margin: 8px;">Careful about accessing model properties after the item has been removed from the model, I don't think this works?</p></div></div><br /><div style="border: 1px solid #C7CCD9; border-radius: 3px;"><div style="padding: 0; background: #F7F7F7; border-color: #e3e4e8; border-style: solid; border-width: 0 0 1px 0; margin: 0;"><div style="color: #74777d; background: #eff2f4; padding: 6px 8px; overflow: hidden;"><a style="float: right; text-decoration: none;" href="https://phabricator.kde.org/D16212#inline-101070">View Inline</a><span style="color: #4b4d51; font-weight: bold;">FullRepresentation.qml:113</span></div>
<div style="font: 11px/15px "Menlo", "Consolas", "Monaco", monospace; white-space: pre-wrap; clear: both; padding: 4px 0; margin: 0;"><div style="padding: 0 8px; margin: 0 4px; background: rgba(251, 175, 175, .7);">    <span class="bright"></span><span style="color: #004012"><span class="bright">ColumnLayout</span></span> <span class="p">{</span>
</div><div style="padding: 0 8px; margin: 0 4px; background: rgba(151, 234, 151, .6);">    <span class="bright"></span><span style="color: #004012"><span class="bright">Item</span></span> <span class="p">{</span>
</div><div style="padding: 0 8px; margin: 0 4px; ">        <span style="color: #aa4000">anchors.fill:</span> <span style="color: #004012">parent</span>
</div></div></div>
<div style="margin: 8px 0; padding: 0 12px;"><p style="padding: 0; margin: 8px;">Why this change? <tt style="background: #ebebeb; font-size: 13px;">ColumnLayout</tt> should layout everything automatically without the need for nachors</p></div></div><br /><div style="border: 1px solid #C7CCD9; border-radius: 3px;"><div style="padding: 0; background: #F7F7F7; border-color: #e3e4e8; border-style: solid; border-width: 0 0 1px 0; margin: 0;"><div style="color: #74777d; background: #eff2f4; padding: 6px 8px; overflow: hidden;"><a style="float: right; text-decoration: none;" href="https://phabricator.kde.org/D16212#inline-101071">View Inline</a><span style="color: #4b4d51; font-weight: bold;">FullRepresentation.qml:118</span></div>
<div style="font: 11px/15px "Menlo", "Consolas", "Monaco", monospace; white-space: pre-wrap; clear: both; padding: 4px 0; margin: 0;"><div style="padding: 0 8px; margin: 0 4px; background: rgba(151, 234, 151, .6);">            <span style="color: #aa4000">id: unmountAll</span>
</div><div style="padding: 0 8px; margin: 0 4px; background: rgba(151, 234, 151, .6);">            <span style="color: #aa4000">enabled:</span> <span style="color: #000a65">true</span>
</div><div style="padding: 0 8px; margin: 0 4px; background: rgba(151, 234, 151, .6);">            <span style="color: #aa4000">visible:</span> <span style="color: #004012">devicenotifier</span><span class="p">.</span><span style="color: #004012">mountedRemovables</span><span class="p">.</span><span style="color: #004012">length</span> <span style="color: #aa2211">></span> <span style="color: #601200">1</span><span class="p">;</span>
</div></div></div>
<div style="margin: 8px 0; padding: 0 12px;"><p style="padding: 0; margin: 8px;">This is the default value anyway</p></div></div><br /><div style="border: 1px solid #C7CCD9; border-radius: 3px;"><div style="padding: 0; background: #F7F7F7; border-color: #e3e4e8; border-style: solid; border-width: 0 0 1px 0; margin: 0;"><div style="color: #74777d; background: #eff2f4; padding: 6px 8px; overflow: hidden;"><a style="float: right; text-decoration: none;" href="https://phabricator.kde.org/D16212#inline-101077">View Inline</a><span style="color: #4b4d51; font-weight: bold;">FullRepresentation.qml:204</span></div>
<div style="font: 11px/15px "Menlo", "Consolas", "Monaco", monospace; white-space: pre-wrap; clear: both; padding: 4px 0; margin: 0;"><div style="padding: 0 8px; margin: 0 4px; background: rgba(151, 234, 151, .6);">                <span style="color: #aa4000">var</span> <span style="color: #004012">index</span> <span style="color: #aa2211">=</span> <span style="color: #004012">devicenotifier</span><span class="p">.</span><span style="color: #004012">mountedRemovables</span><span class="p">.</span><span style="color: #004012">indexOf</span><span class="p">(</span><span style="color: #004012">udi</span><span class="p">);</span>
</div><div style="padding: 0 8px; margin: 0 4px; background: rgba(151, 234, 151, .6);">                <span style="color: #aa4000">if</span> <span class="p">(</span><span style="color: #004012">mounted</span> <span style="color: #aa2211">&&</span> <span style="color: #004012">sdSource</span><span class="p">.</span><span style="color: #004012">data</span><span class="p">[</span><span style="color: #004012">udi</span><span class="p">]</span> <span style="color: #aa2211">&&</span> <span style="color: #004012">sdSource</span><span class="p">.</span><span style="color: #004012">data</span><span class="p">[</span><span style="color: #004012">udi</span><span class="p">][</span><span style="color: #766510">"Removable"</span><span class="p">]</span> <span style="color: #aa2211">&&</span> <span style="color: #004012">index</span> <span style="color: #aa2211"><</span> <span style="color: #601200">0</span><span class="p">)</span> <span class="p">{</span>
</div><div style="padding: 0 8px; margin: 0 4px; background: rgba(151, 234, 151, .6);">                    <span style="color: #004012">devicenotifier</span><span class="p">.</span><span style="color: #004012">mountedRemovables</span><span class="p">.</span><span style="color: #004012">push</span><span class="p">(</span><span style="color: #004012">udi</span><span class="p">);</span>
</div></div></div>
<div style="margin: 8px 0; padding: 0 12px;"><p style="padding: 0; margin: 8px;">Check <tt style="background: #ebebeb; font-size: 13px;">index</tt> first to avoid potentially heavy access on <tt style="background: #ebebeb; font-size: 13px;">data</tt> in case the condition isn't met</p></div></div><br /><div style="border: 1px solid #C7CCD9; border-radius: 3px;"><div style="padding: 0; background: #F7F7F7; border-color: #e3e4e8; border-style: solid; border-width: 0 0 1px 0; margin: 0;"><div style="color: #74777d; background: #eff2f4; padding: 6px 8px; overflow: hidden;"><a style="float: right; text-decoration: none;" href="https://phabricator.kde.org/D16212#inline-101078">View Inline</a><span style="color: #4b4d51; font-weight: bold;">devicenotifier.qml:51</span></div>
<div style="font: 11px/15px "Menlo", "Consolas", "Monaco", monospace; white-space: pre-wrap; clear: both; padding: 4px 0; margin: 0;"><div style="padding: 0 8px; margin: 0 4px; ">    <span style="color: #004012">property</span> <span style="color: #304a96">int</span> <span style="color: #aa4000">currentIndex:</span> <span style="color: #aa2211">-</span><span style="color: #601200">1</span>
</div><div style="padding: 0 8px; margin: 0 4px; background: rgba(151, 234, 151, .6);">    <span style="color: #004012">property</span> <span style="color: #aa4000">var</span> <span style="color: #aa4000">mountedRemovables:</span> <span class="p">[]</span>
</div></div></div>
<div style="margin: 8px 0; padding: 0 12px;"><p style="padding: 0; margin: 8px;">Can this be done more declaratively? I'm not a huge fan of having the delegate (which may not even be created in case it is scrolled out of view) programmatically do this.</p>

<p style="padding: 0; margin: 8px;">I would at least opt for updating it in <tt style="background: #ebebeb; font-size: 13px;">onDataChanged</tt> of the <tt style="background: #ebebeb; font-size: 13px;">DataSource</tt> or <tt style="background: #ebebeb; font-size: 13px;">onRowsAdded</tt>/<tt style="background: #ebebeb; font-size: 13px;">onRowsRemoved</tt> or something along the lines of that</p></div></div></div></div></div><br /><div><strong>REPOSITORY</strong><div><div>R120 Plasma Workspace</div></div></div><br /><div><strong>BRANCH</strong><div><div>arc_unmountall (branched from master)</div></div></div><br /><div><strong>REVISION DETAIL</strong><div><a href="https://phabricator.kde.org/D16212">https://phabricator.kde.org/D16212</a></div></div><br /><div><strong>To: </strong>thsurrel, Plasma, VDG, ngraham<br /><strong>Cc: </strong>broulik, ngraham, plasma-devel, jraleigh, GB_2, ragreen, Pitel, ZrenBot, lesliezhai, ali-mohamed, jensreuterberg, abetts, sebas, apol, mart<br /></div>