[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-panel-devel
Subject: Re: Review Request 113443: Attempt to unbreak pre-configuring QML applets via desktop scripting
From: "Eike Hein" <hein () kde ! org>
Date: 2013-10-26 15:27:05
Message-ID: 20131026152705.18379.48693 () vidsolbach ! de
[Download RAW message or body]
[Attachment #2 (multipart/alternative)]
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
http://git.reviewboard.kde.org/r/113443/
-----------------------------------------------------------
(Updated Oct. 26, 2013, 3:27 p.m.)
Status
------
This change has been discarded.
Review request for Plasma, Aaron J. Seigo and Marco Martin.
Repository: kde-workspace
Description
-------
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 :).
Diffs
-----
libs/plasmagenericshell/scripting/applet.cpp 3c81f77
Diff: http://git.reviewboard.kde.org/r/113443/diff/
Testing
-------
Thanks,
Eike Hein
[Attachment #5 (text/html)]
<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="#e0e0e0" width="100%" cellpadding="8" style="border: 1px gray solid;">
<tr>
<td>
<h1 style="margin-right: 0.2em; padding: 0; font-size: 10pt;">This change has been \
discarded.</h1> </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>
<p style="color: grey;"><i>Updated Oct. 26, 2013, 3:27 p.m.</i></p>
<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>
_______________________________________________
Plasma-devel mailing list
Plasma-devel@kde.org
https://mail.kde.org/mailman/listinfo/plasma-devel
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic