• David Faure's avatar
    StandardActionManager: compress updates and emit useful signal · 9eda8853
    David Faure authored
    When deleting 5000 emails, KMail uses 100% CPU for a long time.
    This is because the messagelib code (due to threading etc.) removes
    rows one by one from the model. As a result
    - StandardActionManager was recalculating selection (slowly, see
    safeSelectedRows()) after every item
    - StandardMailActionManager was doing the same again
    - QSortFilterProxyModel updates its internal mapping at every step.
    I can't fix the last one, but I fixed the first two:
    1) compress changes with a 0s timer, so we only update the actions
    when going back to the event loop
    2) emit signal for StandardMailActionManager to use the computed
    lists, and more importantly so that it doesn't need its own timer.
    StandardActionManager is now the one which decides when StandardMailActionManager
    should update.
standardactionmanager.h 17.8 KB