Refactor and remove duplicate code in kfileplacesview
ClosedPublic

Authored by mlaurent on Nov 2 2017, 2:11 PM.

Details

Summary

Remove duplicate code.
Use static_cast when we don't test result from dynamic_cast
Remove unused variable

Depends on D8450

Test Plan

compile/test

Diff Detail

Repository
R241 KIO
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
mlaurent created this revision.Nov 2 2017, 2:11 PM
mlaurent updated this revision to Diff 21778.Nov 2 2017, 2:33 PM

Const'ify + use more static_cast

mlaurent updated this revision to Diff 21779.Nov 2 2017, 2:49 PM

Remove virtual keyword when we have override

ngraham added a subscriber: ngraham.Nov 2 2017, 3:16 PM
mlaurent updated this revision to Diff 21828.Nov 3 2017, 9:21 AM

Don't disconnect a model without check if not null.
Const'ify some variables

mlaurent edited the summary of this revision. (Show Details)Nov 3 2017, 9:22 AM
cfeck set the repository for this revision to R241 KIO.Nov 3 2017, 2:27 PM
dfaure requested changes to this revision.Nov 5 2017, 8:51 PM
dfaure added a subscriber: dfaure.
dfaure added inline comments.
src/filewidgets/kfileplacesview.cpp
66

re-indent after the removal of "virtual"

68

same here, please re-indent after the removal of "virtual"

737

You use qobject_cast elsewhere, why not here too?

Or even... you use static_cast for the delegate in 90% of the code, why two uses of qobject_cast?

If it's mandatory for the delegate to be a KFilePlacesViewDelegate, it's mandatory everywhere, right?

(too bad setItemDelegate isn't virtual, we could have caught it there...)

This revision now requires changes to proceed.Nov 5 2017, 8:51 PM
mlaurent updated this revision to Diff 23071.Nov 28 2017, 8:45 AM
mlaurent marked 3 inline comments as done.

Fix comment from David

dfaure accepted this revision.Nov 28 2017, 8:49 AM
This revision is now accepted and ready to land.Nov 28 2017, 8:49 AM
This revision was automatically updated to reflect the committed changes.
Restricted Application added a project: Frameworks. · View Herald TranscriptDec 8 2017, 1:19 PM