Use Kio::KPlacesModel as source model for PlacesItemModel
AbandonedPublic

Authored by ngraham on Nov 16 2017, 8:40 PM.

Details

Summary

Use Kio::KPlacesModel as source model for PlacesItemModel avoiding
duplicated code.

Depends on D8862
Depends on D8332
Depends on D8434
Depends on D8348
Depends on D8630

Test Plan

Unit test created

Diff Detail

Repository
R318 Dolphin
Lint
Lint Skipped
Unit
Unit Tests Skipped
There are a very large number of changes, so older changes are hidden. Show Older Changes

I don't know if I can change it to accepted as I am not the maintainer and we depend against not release kf5

> so maintainer must accept it not me no ?

so maintainer must accept it not me no ?

When you want a change request, you became a stopper.

Patch doesn't apply for me (running arc patch D8855). Do you need to rebase it?

so maintainer must accept it not me no ?

When you want a change request, you became a stopper.

@mlaurent Meaning, now that you've requested changes, you need to either accept the revision at some point, or resign from it.

renatoo updated this revision to Diff 23231.Dec 1 2017, 8:08 PM

Rebased with mainline

elvisangelaccio requested changes to this revision.Dec 3 2017, 2:50 PM
elvisangelaccio added inline comments.
src/panels/places/placesitem.cpp
159

contains() has a QLatin1String overload which should be preferred.

src/panels/places/placesitemmodel.cpp
54–57 ↗(On Diff #23662)

Please also remove #include <config-baloo.h> from the header file

79–80

Maybe we can use a QScopedPointer for m_sourceModel?

137–138

typo: correct

167

Please call it sourceIndex

424

Sounds like if should not be in this sentence.

547–556

remove one space before +

567

sourceIndex

668

Please call it group

853–855 ↗(On Diff #23662)

There is a similar comment where we define AppNamePrefix, should that be also removed?

src/panels/places/placesitemmodel.h
66–67

typo: hidden

120

override

src/tests/placesitemmodeltest.cpp
152–171

!model ?

193

typo: personal

This revision now requires changes to proceed.Dec 3 2017, 2:50 PM
renatoo updated this revision to Diff 23421.Dec 4 2017, 12:27 PM
renatoo marked 13 inline comments as done.

Fixed typo
Used QScopedPointer for m_sourceModel
Fixed code style

renatoo updated this revision to Diff 23422.Dec 4 2017, 12:31 PM
renatoo marked an inline comment as done.

Fixed typo

mwolff requested changes to this revision.Dec 6 2017, 12:21 PM
mwolff added a subscriber: mwolff.

some small nits and cleanup suggestions from my side, otherwise lgtm.

src/panels/places/placesitem.cpp
159

shouldn't this be equality comparisons instead of contains checks? are there schemas like "foobar-search-asdf" that need to be matched too?

src/panels/places/placesitemmodel.cpp
149

for (int r = 0, c = m_sourceModel->rowCount(); r < c; ++r) {

don't call rowCount on every iteration

405–406

dito, don't call count on every iteration

419

dito

595

dito

723–724

dito, note that you could also just replace this all with a simple return m_indexMap.indexOf(index);, that works too, no? Otherwise try std::find_if + std::distance

734–735

simplify this whole method to return m_indexMap.value(row);

741

dito

src/panels/places/placesitemmodel.h
226

QVector, this QList would allocate every item on the heap

This revision now requires changes to proceed.Dec 6 2017, 12:21 PM
renatoo updated this revision to Diff 23556.Dec 6 2017, 12:45 PM
renatoo marked 5 inline comments as done.

Avoid call model.rowCount() several times while on loop.

renatoo updated this revision to Diff 23557.Dec 6 2017, 12:47 PM
renatoo marked an inline comment as done.

Used QVector insted of QList for m_indexMap

renatoo marked an inline comment as done.Dec 6 2017, 12:49 PM
renatoo added inline comments.
src/panels/places/placesitem.cpp
159

well the search can be "search://" or "baloonsearch://" not sure if anything else. "timeline" I think is fixed there is no variation.

mwolff added inline comments.Dec 6 2017, 12:51 PM
src/panels/places/placesitem.cpp
159

Then check for the three variations, instead of these wildcard searched I propose

mwolff requested changes to this revision.Dec 6 2017, 12:53 PM

sorry, three more cases of the for loops :-/

src/panels/places/placesitemmodel.cpp
109–112

missed this one, sorry

117–120

dito

427

dito

This revision now requires changes to proceed.Dec 6 2017, 12:53 PM
renatoo updated this revision to Diff 23558.Dec 6 2017, 1:02 PM
renatoo marked 6 inline comments as done.

More fixes about rowCount usage

src/panels/places/placesitem.cpp
159

There is several other places that check with contains. Lets keep this way to avoid regressions.

mwolff accepted this revision.Dec 6 2017, 1:04 PM

thank

renatoo updated this revision to Diff 23569.Dec 6 2017, 3:30 PM

Avoid crash while hiding a item.

mlaurent accepted this revision.Dec 8 2017, 8:53 AM

Remove this extra "virtual" and +2

src/panels/places/placesitemmodel.h
120

Remove virtual here as you already use override

elvisangelaccio accepted this revision.Dec 8 2017, 9:04 AM

LGTM as well.

This revision is now accepted and ready to land.Dec 8 2017, 9:04 AM
renatoo updated this revision to Diff 23661.Dec 8 2017, 4:57 PM
renatoo marked an inline comment as done.

Removed override in favor of override

renatoo updated this revision to Diff 23662.Dec 8 2017, 5:04 PM

Rebase with master

Wanna land this? :-)

Closed by commit R318:da6f8fe08625: Use Kio::KPlacesModel as source model for PlacesItemModel (authored by Renato Araujo Oliveira Filho <renato.araujo@kdab.com>). · Explain WhyDec 14 2017, 12:40 PM
This revision was automatically updated to reflect the committed changes.
This revision is now accepted and ready to land.Jan 25 2018, 8:14 PM
markg requested changes to this revision.Jan 28 2018, 1:12 PM

See previous message (i don't know why phabricator immediately marked it as accepted when re-opening).

This revision now requires changes to proceed.Jan 28 2018, 1:12 PM
Restricted Application added a project: Dolphin. · View Herald TranscriptOct 3 2018, 11:22 PM
Restricted Application edited subscribers, added: kfm-devel; removed: Dolphin. · View Herald Transcript
ngraham commandeered this revision.Nov 8 2018, 8:29 PM
ngraham added a reviewer: renatoo.

The test has since been fixed, but unfortunately there's no way to re-close this revision unless the original author (@renatoo) does that, or someone else commandeers and abandons it. Since @renatoo hasn't been active recently, I'll do the latter.

ngraham abandoned this revision.Nov 8 2018, 8:29 PM

I want to make clear that @renatoo was the original author, and this work was committed in da6f8fe0862585287153f0d90e19eab0b34bfbef.