I was working in the solution of OLPC #10930 "copy/paste does not work in if one has not revealed the edit toolbar once"<br>The problem can be reproduced in activities with the new toolbars, like Terminal or Browse.<br>
For example, in Terminal, if you open the activity, select a text and press "Shift-Ctrl-C", nothing is copied,<br>if you show the Edit toolbar and try pressing "Sift-Ctrl-C" again, the text is copied.<br>
The same happen in Browse with "Ctrl-C"<br><br>I have worked in two different solutions:<br>1) <a href="http://dev.laptop.org/attachment/ticket/10930/0001-Update-accelerators-when-the-toolbar-is-set-in-the-a.patch" title="View attachment">0001-Update-accelerators-when-the-toolbar-is-set-in-the-a.patch</a><br>
The patch walk the objects in the toolbar_box when is set in the activity and update the accelerators.<br>This patch resolve the problem in activities Terminal and Browse without changing the activities. <br>If in one activity the programmer set the toolbar_box in the activity before adding all the buttons, <br>
must call the update_accelerators methods after add the controls.<br>Additionally, we can remove the 'hierarchy-changed' signal handlers in toolbutton.py <br><a href="http://dev.laptop.org/attachment/ticket/10930/0001-Remove-hierachy-changed-signal-handlers-in-toolbutto.patch" title="View attachment">0001-Remove-hierachy-changed-signal-handlers-in-toolbutto.patch</a><br>
This code is called many times at the start of the activity, and later every time we show or hide a toolbar.<br><br>2) Another solution is <a href="http://dev.laptop.org/attachment/ticket/10930/0001-Pack-page-in-ToolbarButton-when-is-conected-to-the-w.patch" title="View attachment">0001-Pack-page-in-ToolbarButton-when-is-conected-to-the-w.patch</a><br>
I don't like it, but is a fix using the same technique used in toolbutton.py, <br>Uses the 'hierarchy-changed' signal to pack the toolbar to the toolbarbutton,<br>udating the hierachy of the children and enabling them to setup the accelerators.<br>
The problem with this approach is the code is executed many times, because the toolbars<br>change the parents every time are visible/invisible.<br><br>Comments?<br><br>Gonzalo<br>