Extend KFilePlacesModel API
AbandonedPublic

Authored by renatoo on Nov 17 2017, 12:20 PM.

Details

Reviewers
dfaure
mwolff
Summary

Extend API to make it possible to be used by external apps;
Make possible to retrieve item bookmark even if that is not a device;
Added 'refresh' function to allow external apps to trigger a bookmark
reload;

Depends on D8332
Depends on D8434
Depends on D8348

Diff Detail

Repository
R241 KIO
Lint
Lint Skipped
Unit
Unit Tests Skipped
renatoo created this revision.Nov 17 2017, 12:20 PM
Restricted Application added a project: Frameworks. · View Herald TranscriptNov 17 2017, 12:20 PM
Restricted Application added a subscriber: Frameworks. · View Herald Transcript
renatoo retitled this revision from Extend API to Extend KFilePlacesModel API.Nov 17 2017, 12:26 PM
dfaure requested changes to this revision.Nov 20 2017, 8:47 AM
dfaure added a subscriber: dfaure.
dfaure added inline comments.
src/filewidgets/kfileplacesmodel.cpp
360

Please double-check indentation, looks like 5 spaces.

859

remove one of the two spaces after '='

Add const in front, while at it.

860

Please swap these two arguments around. In all preceding if()s, you have new != old, while here it's old != new, makes reading more difficult.

src/filewidgets/kfileplacesmodel.h
139

Missing method documentation, including @since 5.41.

This revision now requires changes to proceed.Nov 20 2017, 8:47 AM
mwolff added a subscriber: mwolff.Nov 20 2017, 11:38 AM

the new API and functionality should be covered by tests, it isn't so far as far as I can see.

mwolff requested changes to this revision.Nov 20 2017, 11:38 AM
renatoo updated this revision to Diff 22651.Nov 20 2017, 1:48 PM

Created new function convertUrl
Added @since tag to new functions

renatoo updated this revision to Diff 22652.Nov 20 2017, 1:53 PM

Renamed function from convertUrl to convertedUrl

renatoo updated this revision to Diff 22666.Nov 20 2017, 3:47 PM
renatoo marked 4 inline comments as done.

Fixed code style
Added more unit test

renatoo updated this revision to Diff 22673.Nov 20 2017, 6:17 PM

Added a new role to access icon name property

renatoo updated this revision to Diff 22703.Nov 21 2017, 7:28 PM

Created a public function 'moveItem' to be used by external apps

This seems to be bundling several unrelated additions into the same commit?
Please have one commit per feature / change / addition.

I know that phabricator makes it difficult to have one review per commit, but at least the commits should be separate.

autotests/kfileplacesmodeltest.cpp
893

expectedScheme is part of the expectedUrl already, so I don't see much point in this separate data column and check.

src/filewidgets/kfileplacesmodel.cpp
933

This would fit better in the if/else above.
Just do before = d->items.count() in the if (before == -1) case, no need for the ternary operator nor the no-op (before = before).

935

Can you explain this condition? I understand the idea of an early exit if nothing to do, but I'm surprised that two different values of before would lead to "nothing to do".
There is only one current position....

src/filewidgets/kfileplacesmodel.h
52

///< @since 5.41

dfaure requested changes to this revision.Nov 21 2017, 10:22 PM
dfaure added inline comments.
src/filewidgets/kfileplacesmodel.cpp
913

This should get its own unittest, especially since there are lots of edge cases.

This revision now requires changes to proceed.Nov 21 2017, 10:22 PM
renatoo abandoned this revision.EditedNov 22 2017, 2:21 PM

This review was split in small ones:
D8943
D8944
D8945
D8946
D8947
D8948

mlaurent added inline comments.
src/filewidgets/kfileplacesmodel.cpp
77

QStringLiteral("-%1").arg(...)

96

QLatin1Char('/') +

142

too bad it doesn't provide debug category here in this lib.
(I will add it today or tomorrow)

but don't care about it

oh it was abandoned ! ok :)