Cleanup random hexadecimal roles
Closed, ResolvedPublic

Description

A bunch of models, like KFilePlacesModel and KDirModel use random hexadecimal numbers for their roles. What's the history behind that and can this be cleaned up?

broulik created this task.Dec 14 2019, 4:49 PM
dfaure added a subscriber: dfaure.Dec 14 2019, 9:05 PM

The idea is that it removes the risk of conflicting with more usual numbers like UserRole or UserRole+1 that some proxymodel might use as well.

What problem do the hexadecimal numbers create?

Nothing, just don't know what to use when I add a new one :D

printf "0x%08X\n" $(($RANDOM*$RANDOM))
(in a terminal)

:-)

@broulik can we remove this task from the dashboard?

printf "0x%08X\n" $(($RANDOM*$RANDOM))
(in a terminal)

:-)

Perhaps some code comments indicating this in relevant places could help clear up the ambiguity?

This is already there in kdirmodel.h
Here's a MR for doing the same in kfileplacesmodel.h: https://invent.kde.org/frameworks/kio/-/merge_requests/130
Any other model that needs this?

Merged. Please reopen this (or just paste the comment) if you find more.

dfaure moved this task from Backlog to Done on the KF6 board.Sep 13 2020, 11:38 AM
ngraham closed this task as Resolved.Sep 13 2020, 1:28 PM
ngraham claimed this task.

LGTM! Thanks David.