Menu branch
Ignat Semenov
ragnarokk91 at gmail.com
Wed Apr 17 09:38:45 UTC 2013
Hello plasma devs and users,
Please review the plasma/isemenov/menu branch.
Based on #306537 but goes a bit further than that.
Fixes:
"Arrange icons" (flow configuration) added to the context menu
"Sort order" and "folders first" added to the config UI
Update the "Sort" combo if the user moves the icons while the dialog is open -
fix by Eike Hein, I expressed it using a helper func since the relevant code
has changed slightly
Update sort order, sort direction, flow combos when the user cnahges those
using the context menu if the config dialog is open
Update the align to grid, lock in place, folders first, click to view
checkboxes when the user cnahges those using the context menu if the config
dialog is open
Fix a potential stall (instead of iterating the combos from 0 till maxCount()
(INTMAX) which can result in a minute-long loop (tested) if the value is not
found iterate them from 0 till count()) - thanks goes to tsdgeos for explaiing
me that comboboxes are contiguous
Changed the hardcoded "-1" to an anonymous enum "FolderView::Unsorted = -1"
for code clarity and maintainability
Only show the "Unsorted" action in the "Sort" combo if the view is not sorted.
It appears when the users drags icons around, and lives until the dialog is
closed. Then, when the dialog is opened again, if the view is still unsorted,
it is added to the list. If the user sorts the view using the combo or the
context menu, unsorted still stays until the dialog is closed - probably
better than have it appear and disappear within an open dialog. This
implements aseigo's idea.
Also, since I had to move the flow and sorting direction to QActionGroups (to
enable them in the context menu), and that lead to duplicated for loops, I
created a little helper to add action groups to combos. (trying to follow
"code what to do, not how to do it").
Another thing worth mentioning is the setCurrentItem() helper func. I should
be using QComboBox::findData(), *but* we use enums for the action data, hence
QVariant's and Q_DECLARE_METATYPE. QVariant::operator==() fails for user
defined types, including Q_DECLARE_METATYPE'd enums. Debugged together with
tsdgeos and steveire. So we have to workaround that, in a manually written
loop, which I put in a helper func.
Thank you for your attention!
Best regards,
Ignat Semenov
More information about the Plasma-devel
mailing list