Merge lp://staging/~zsombi/ubuntu-ui-toolkit/60-action-value-type into lp://staging/~zsombi/ubuntu-ui-toolkit/listitem-master

Proposed by Zsombor Egri
Status: Merged
Approved by: Tim Peeters
Approved revision: 1297
Merged at revision: 1277
Proposed branch: lp://staging/~zsombi/ubuntu-ui-toolkit/60-action-value-type
Merge into: lp://staging/~zsombi/ubuntu-ui-toolkit/listitem-master
Prerequisite: lp://staging/~zsombi/ubuntu-ui-toolkit/55-snap-options
Diff against target: 283 lines (+102/-13)
7 files modified
modules/Ubuntu/Components/Themes/Ambiance/ListItemPanel.qml (+1/-0)
modules/Ubuntu/Components/plugin/ucaction.h (+1/-0)
modules/Ubuntu/Components/plugin/uclistitem.cpp (+2/-2)
modules/Ubuntu/Components/plugin/uclistitemactions.cpp (+36/-1)
modules/Ubuntu/Components/plugin/uclistitemactions_p.h (+6/-0)
tests/resources/listitems/ListItemTest.qml (+9/-7)
tests/unit_x11/tst_components/tst_listitem.qml (+47/-3)
To merge this branch: bzr merge lp://staging/~zsombi/ubuntu-ui-toolkit/60-action-value-type
Reviewer Review Type Date Requested Status
Tim Peeters Approve
Zsombor Egri continuous-integration Pending
Review via email: mp+235175@code.staging.launchpad.net

Description of the change

Use the index of the ListItem when triggering the action. The action's parameter type must be integer, if none set, the panel will set it to integer.

To post a comment you must log in.
1253. By Zsombor Egri

prereq sync

1254. By Zsombor Egri

prereq sync

1255. By Zsombor Egri

prereq sync

1256. By Zsombor Egri

prereq sync

1257. By Zsombor Egri

prereq sync

1258. By Zsombor Egri

prereq sync

1259. By Zsombor Egri

prereq sync

1260. By Zsombor Egri

prereq sync

1261. By Zsombor Egri

prereq sync

1262. By Zsombor Egri

prereq sync

1263. By Zsombor Egri

prereq sync

1264. By Zsombor Egri

prereq sync

1265. By Zsombor Egri

prereq sync

1266. By Zsombor Egri

prereq sync

1267. By Zsombor Egri

fixing action triggering due to snap policy changes

1268. By Zsombor Egri

prereq sync

1269. By Zsombor Egri

test case adjusted

1270. By Zsombor Egri

index fetched every time is required to make sure we always use teh proper index

1271. By Zsombor Egri

prereq sync

1272. By Zsombor Egri

index fix

1273. By Zsombor Egri

prereq sync

1274. By Zsombor Egri

prereq sync

1275. By Zsombor Egri

panel width fixes

1276. By Zsombor Egri

prereq sync

1277. By Zsombor Egri

build fix

1278. By Zsombor Egri

tests adjustments

1279. By Zsombor Egri

prereq sync

1280. By Zsombor Egri

prereq sync

1281. By Zsombor Egri

prereq sync

1282. By Zsombor Egri

prereq sync

1283. By Zsombor Egri

prereq sync

1284. By Zsombor Egri

prereq sync

1285. By Zsombor Egri

prereq sync

1286. By Zsombor Egri

prereq sync

1287. By Zsombor Egri

prereq sync

1288. By Zsombor Egri

prereq sync

1289. By Zsombor Egri

semicolon removal rolled back

1290. By Zsombor Egri

prereq sync

Revision history for this message
Tim Peeters (tpeeters) wrote :

19 actionsRow.selectedAction.trigger(actionsRow.listItemIndex >= 0 ? actionsRow.listItemIndex : null);
20 actionsRow.selectedAction = null;

should this be guarded by if (parameterType == Integer) ?

Revision history for this message
Tim Peeters (tpeeters) wrote :

16 + if (actionsRow.selectedAction.parameterType === Action.None) {
17 + actionsRow.selectedAction.parameterType = Action.Integer;
18 + }

Is there an easy way to check this only once when the ListItemActions is created for all of its Actions, instead of every time an action is triggered?

Revision history for this message
Tim Peeters (tpeeters) wrote :

^or perhaps it makes sense to change the default to Integer, or to auto-detect the type in ucaction.cpp?

Revision history for this message
Tim Peeters (tpeeters) wrote :

67 + * However this will only work if the \l {Action::parameterType}{parameterType}
68 + * will be set to Action.Integer or not set at all, in which case the ListItem
69 + * will set the type to Action.Integer.

Alternatively, we can simply change the doc to ", in which case the ListItem will change the type from Action.None to Action.Integer when it is triggered." to be more explicit about what will happen.

Do we have a need to somehow support other parameter types here? (I don't know how). If not, let's not pass the index when the type is different (add the if-statement of my first comment), and add a sentence to the doc: "If the parameterType is neither Action.Integer or the default Action.None, no value will be passed when triggering the action."

1291. By Zsombor Egri

prereq sync

Revision history for this message
Zsombor Egri (zsombi) wrote :

> 19
> actionsRow.selectedAction.trigger(actionsRow.listItemIndex >= 0 ?
> actionsRow.listItemIndex : null);
> 20 actionsRow.selectedAction = null;
>
> should this be guarded by if (parameterType == Integer) ?

Action.trigger() handles that.

1292. By Zsombor Egri

prereq sync

1293. By Zsombor Egri

move action parameterType checking to C++ at the action's addition time

Revision history for this message
Zsombor Egri (zsombi) wrote :

> 16 + if (actionsRow.selectedAction.parameterType ===
> Action.None) {
> 17 + actionsRow.selectedAction.parameterType =
> Action.Integer;
> 18 + }
>
> Is there an easy way to check this only once when the ListItemActions is
> created for all of its Actions, instead of every time an action is triggered?

We can do that in C++, yes. Revno 1293 is the one having it.

1294. By Zsombor Egri

prere sync

Revision history for this message
Zsombor Egri (zsombi) wrote :

> 67 + * However this will only work if the \l
> {Action::parameterType}{parameterType}
> 68 + * will be set to Action.Integer or not set at all, in which case the
> ListItem
> 69 + * will set the type to Action.Integer.
>
>
> Alternatively, we can simply change the doc to ", in which case the ListItem
> will change the type from Action.None to Action.Integer when it is triggered."
> to be more explicit about what will happen.

Happened. revno 1295.

>
> Do we have a need to somehow support other parameter types here? (I don't know
> how). If not, let's not pass the index when the type is different (add the if-
> statement of my first comment), and add a sentence to the doc: "If the
> parameterType is neither Action.Integer or the default Action.None, no value
> will be passed when triggering the action."

We cannot really handle other parameters tbh... I mean only thing we know is the index of the ListItem. Not more. And Action.trigger() will pass undefined to the signal if the functoins' parameter type differs from the one in parameterType.

1295. By Zsombor Egri

action parameter type restrictions documentation reformulated

1296. By Zsombor Egri

prereq sync

1297. By Zsombor Egri

prereq sync

Revision history for this message
Tim Peeters (tpeeters) wrote :

thanks, it works as expected now.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
The diff is not available at this time. You can reload the page or download it.

Subscribers

People subscribed via source and target branches

to all changes: