<html>
 <body>
  <div style="font-family: Verdana, Arial, Helvetica, Sans-Serif;">
   <table bgcolor="#f9f3c9" width="100%" cellpadding="8" style="border: 1px #c9c399 solid;">
    <tr>
     <td>
      This is an automatically generated e-mail. To reply, visit:
      <a href="http://git.reviewboard.kde.org/r/113443/">http://git.reviewboard.kde.org/r/113443/</a>
     </td>
    </tr>
   </table>
   <br />




<table bgcolor="#fefadf" width="100%" cellspacing="0" cellpadding="8" style="background-image: url('http://git.reviewboard.kde.org/static/rb/images/review_request_box_top_bg.ab6f3b1072c9.png'); background-position: left top; background-repeat: repeat-x; border: 1px black solid;">
 <tr>
  <td>

<div>Review request for Plasma, Aaron J. Seigo and Marco Martin.</div>
<div>By Eike Hein.</div>










<div style="margin-top: 1.5em;">
 <b style="color: #575012; font-size: 10pt;">Repository: </b>
kde-workspace
</div>


<h1 style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Description </h1>
 <table width="100%" bgcolor="#ffffff" cellspacing="0" cellpadding="10" style="border: 1px solid #b8b5a0">
 <tr>
  <td>
   <pre style="margin: 0; padding: 0; white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">I've noticed that a panel layout JavaScript template file doesn't succeed in scripting the config of a pure-QML applet. I.e. this doesn't work:

foo = panel.addWidget("bar");
foo.currentConfigGroup = new Array("General");
foo.writeConfig("foo", "bar");

It does work for C++ applets however. Also, the config does ultimately make it to disk, and a subsequent restart of plasma-desktop reads it in just fine. Or even just opening and OK'ing the config dialog, even if the setting isn't exposed in the GUI.

So I've been looking at the code a little, and what it comes down to is that kde-workspace/libs/plasmagenericshell/scripting/applet.cpp holds an Applet::reloadConfig() that calls Plasma::Applet::configChanged(), which, if there's a d->script, calls readConfig() on its d->configLoader. ConfigLoader is a KConfigSkeleton subclass, and what KCoreConfigSkeleton::readConfig() does is explicitly read in the config from disk.

Therefore the attached patch addresses this by calling for a config sync ahead of time.

Now, I'm new to those parts of the Plasma code base, and I'm really not sure this is a kosher way to go about it. It's not clear to me whether we want to flush to disk at that time, or if there might be a prohibitive performance penalty. There may be a way to avoid this. Perhaps Plasma::Applet shouldn't clobber the modified config group by pulling in from disk -- but perhaps it needs to for other reasons. That's why someone with the bigger picture of how the design was supposed to operate needs to review this.

Debate welcome. OTOH, I am a bit pressed for time to ideally get this fixed for a release, so there'd be some value in a "good enough" too :).</pre>
  </td>
 </tr>
</table>



<h1 style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Diffs</b> </h1>
<ul style="margin-left: 3em; padding-left: 0;">

 <li>libs/plasmagenericshell/scripting/applet.cpp <span style="color: grey">(3c81f77)</span></li>

</ul>

<p><a href="http://git.reviewboard.kde.org/r/113443/diff/" style="margin-left: 3em;">View Diff</a></p>







  </td>
 </tr>
</table>




  </div>
 </body>
</html>