<table><tr><td style="">Zren created this revision.<br />Herald added a project: Plasma.<br />Herald added a subscriber: plasma-devel.<br />Zren requested review of this revision.
</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/D18961">View Revision</a></tr></table><br /><div><strong>REVISION SUMMARY</strong><div><p>If <tt style="background: #ebebeb; font-size: 13px;">plasmoid.nativeInterface.source != ""</tt>, we copy it to <tt style="background: #ebebeb; font-size: 13px;">plasmoid.configuration.source</tt> + same<br />
with all other properties besides <tt style="background: #ebebeb; font-size: 13px;">needsToBeSquare</tt> which is a "session" variable that updated<br />
right after the migration code.</p>

<p>The selected weather <tt style="background: #ebebeb; font-size: 13px;">services</tt> StringList is not a <tt style="background: #ebebeb; font-size: 13px;">nativeInterface</tt> property, so it needs to be copied differently.</p>

<hr class="remarkup-hr" />

<p>We could also copy the other properties the using the <tt style="background: #ebebeb; font-size: 13px;">configValues().services</tt> pattern if you want the code consistent.</p>

<p>This is a pure QML solution. Ideally, the final patch will have a few more C++ functions/enums exposed to the QML. The <tt style="background: #ebebeb; font-size: 13px;">DisplayUnits.qml</tt> properties could be turned into functions. Eg:</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);">Utils.parseTemperatureUnitId(plasmoid.configuration.temperatureUnitId)</pre></div>

<p>That way we don't have magic numbers (<tt style="background: #ebebeb; font-size: 13px;">6001 // Celcius</tt>)  littered throughout <tt style="background: #ebebeb; font-size: 13px;">DisplayUnits.qml</tt>.</p>

<hr class="remarkup-hr" />

<p>Ideally, we'll only keep the <tt style="background: #ebebeb; font-size: 13px;">nativeInterface</tt> + migration code until Plasma 5.19 assuming Plasma 5.18 is the next Plasma LTS version. We could remove the migration code earlier, as having the user re-setup their weather widget isn't terribly cumbersome for the user.</p>

<p>Once it no longer depends on the <tt style="background: #ebebeb; font-size: 13px;">nativeInterface</tt>, users can easily fork the default weather widget.</p>

<p>Immendiate benefits are that we no longer have to install the widget to <tt style="background: #ebebeb; font-size: 13px;">.../share/plasma/plasmoids/</tt> to test the widget's QML. We can now use <tt style="background: #ebebeb; font-size: 13px;">plasmoidviewer -a package</tt>. Note that we still need to install to <tt style="background: #ebebeb; font-size: 13px;">~/.local/share/plasma/plasmoids/</tt> to test the <tt style="background: #ebebeb; font-size: 13px;">nativeInterface</tt> migration code as mentioned in the test plan.</p></div></div><br /><div><strong>TEST PLAN</strong><div><ul class="remarkup-list">
<li class="remarkup-list-item">Apply patch.</li>
<li class="remarkup-list-item">Copy <tt style="background: #ebebeb; font-size: 13px;">weather/package</tt> to <tt style="background: #ebebeb; font-size: 13px;">~/.local/share/plasma/plasmoids/</tt> and rename the <tt style="background: #ebebeb; font-size: 13px;">package</tt> directory to <tt style="background: #ebebeb; font-size: 13px;">org.kde.plasma.weather</tt>.</li>
<li class="remarkup-list-item">Restart plasmashell with <tt style="background: #ebebeb; font-size: 13px;">kstart5 -- plasmashell --replace</tt></li>
<li class="remarkup-list-item">The settings should have migrated, and the widget should still work.</li>
</ul></div></div><br /><div><strong>REPOSITORY</strong><div><div>R114 Plasma Addons</div></div></div><br /><div><strong>REVISION DETAIL</strong><div><a href="https://phabricator.kde.org/D18961">https://phabricator.kde.org/D18961</a></div></div><br /><div><strong>AFFECTED FILES</strong><div><div>applets/weather/package/contents/config/main.xml<br />
applets/weather/package/contents/ui/CompactRepresentation.qml<br />
applets/weather/package/contents/ui/DisplayUnits.qml<br />
applets/weather/package/contents/ui/config/ConfigAppearance.qml<br />
applets/weather/package/contents/ui/config/ConfigUnits.qml<br />
applets/weather/package/contents/ui/config/ConfigWeatherStation.qml<br />
applets/weather/package/contents/ui/config/WeatherStationPicker.qml<br />
applets/weather/package/contents/ui/main.qml</div></div></div><br /><div><strong>To: </strong>Zren<br /><strong>Cc: </strong>plasma-devel, jraleigh, GB_2, ragreen, Pitel, ZrenBot, lesliezhai, ali-mohamed, jensreuterberg, abetts, sebas, apol, mart<br /></div>