Implemented support for hide/show groups
ClosedPublic

Authored by renatoo on Dec 7 2017, 2:38 PM.

Details

Summary

Added an option on PlacesPanel context menu to show or hide the entire
group of places.

Depends on D8855

Test Plan

Open Donlphin and use PlacesPanel context menu to hide and show groups

Diff Detail

Repository
R318 Dolphin
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
renatoo created this revision.Dec 7 2017, 2:38 PM
Restricted Application added a subscriber: Dolphin. · View Herald TranscriptDec 7 2017, 2:38 PM
renatoo requested review of this revision.Dec 7 2017, 2:38 PM
ngraham added a subscriber: ngraham.Dec 7 2017, 2:38 PM
mlaurent accepted this revision.Dec 8 2017, 8:49 AM
This revision is now accepted and ready to land.Dec 8 2017, 8:49 AM
elvisangelaccio added inline comments.
src/panels/places/placesitemmodel.h
24

#include <KFilePlacesModel> ?

mwolff accepted this revision.Dec 8 2017, 12:35 PM
mwolff added a subscriber: mwolff.

I agree with the suggestion by Elvis, otherwise lgtm besides one more suggestion for potential cleanup

src/panels/places/placesitemmodel.cpp
477

usually it would be preferred if you could add a proper role for the group type. Then you could just do

auto groupType = index.data(KFilePlacesModel::GroupTypeRole).value<KFilePlacesModel::GroupType>();
item->setGroupHidden(model->isGrouHidden(groupType));

at this point, it's then even better to just make this possible:

auto groupHidden = index.data(KFilePlacesModel::GroupHiddenRole).toBool();
item->setGroupHidden(groupHidden);
renatoo updated this revision to Diff 23646.Dec 8 2017, 1:26 PM
renatoo marked 2 inline comments as done.

Used new KFilePlacesModel::GroupHiddenRole to retrieve information instead of call the model method

I can't apply this patch, can you please rebase it?

renatoo updated this revision to Diff 23663.Dec 8 2017, 5:05 PM

Rebased with master

I can't apply this patch, can you please rebase it?

done

I can't apply this patch, can you please rebase it?

done

arc patch D9242 still doesn't work, looks like something else is missing.

It appears we still need to land D8855 first.

I can't apply this patch, can you please rebase it?

done

arc patch D9242 still doesn't work, looks like something else is missing.

works nice for me

It appears we still need to land D8855 first.

I do not think this is the problem since that after run: arc patch D9242. I got both changes on my tree.

It appears we still need to land D8855 first.

I do not think this is the problem since that after run: arc patch D9242. I got both changes on my tree.

I get:

$ arc patch D9242
 INFO  Base commit is not in local repository; trying to fetch.
Created and checked out branch arcpatch-D9242.
 INFO  Base commit is not in local repository; trying to fetch.
Checking patch src/filewidgets/kfileplacesmodel.h...
error: src/filewidgets/kfileplacesmodel.h: does not exist in index
Checking patch src/filewidgets/kfileplacesmodel.cpp...
error: src/filewidgets/kfileplacesmodel.cpp: does not exist in index
Checking patch autotests/kfileplacesmodeltest.cpp...
error: autotests/kfileplacesmodeltest.cpp: does not exist in index

 Patch Failed! 
Usage Exception: Unable to apply patch!

It appears we still need to land D8855 first.

I do not think this is the problem since that after run: arc patch D9242. I got both changes on my tree.

I get:

$ arc patch D9242
 INFO  Base commit is not in local repository; trying to fetch.
Created and checked out branch arcpatch-D9242.
 INFO  Base commit is not in local repository; trying to fetch.
Checking patch src/filewidgets/kfileplacesmodel.h...
error: src/filewidgets/kfileplacesmodel.h: does not exist in index
Checking patch src/filewidgets/kfileplacesmodel.cpp...
error: src/filewidgets/kfileplacesmodel.cpp: does not exist in index
Checking patch autotests/kfileplacesmodeltest.cpp...
error: autotests/kfileplacesmodeltest.cpp: does not exist in index

 Patch Failed! 
Usage Exception: Unable to apply patch!

very strange why this patch is checking for KIO files? This is a dolphin patch

rkflx added a subscriber: rkflx.Dec 8 2017, 8:42 PM
rkflx added a comment.EditedDec 8 2017, 8:48 PM

very strange why this patch is checking for KIO files? This is a dolphin patch

The summary has a dependency on D9252, which makes arc patch fetch it. However, the dependency itself is based on a git commit hash from R241 KIO and does not relate to the current git repo, so things go wrong. Try removing the dependency from the summary and then test with a clean repo checkout.

Alternatively, try arc patch --skip-dependencies.

renatoo edited the summary of this revision. (Show Details)Dec 11 2017, 12:09 PM

I can't apply this patch, can you please rebase it?

@elvisangelaccio I removed the KIO dependency from the summary could you try again? Or use the solution proposed by @rkflx

This time I got: https://paste.kde.org/p02sygoma

(I tried on fresh clone)

This time I got: https://paste.kde.org/p02sygoma

(I tried on fresh clone)

And if I manually download the patch, it fails with a similar error when applying it.

rkflx added a comment.EditedDec 12 2017, 9:03 PM

If you use --skip-dependencies, you'd have to apply D8855 manually too, of course. Then it works for me.

The reason arc patch D9242 still does not work is because the dependency on D9252 is still there. Just removing it from the summary is not enough apparently, you have to use "Edit Related Revisions". It is all very logical once you stumbled upon this the first time…

Try this, I hope then it will work. Also, look at the "Stack" tab to see what's going on…

For the record:

  1. arc patch D8855
  2. arc patch D9242 --skip-dependencies

this worked for me. Building now...

Patch seems to work fine, nice job!

src/panels/places/placespanel.cpp
340

Should we add this new action/option in dolphin_placespanelsettings.kcfg ?

rkflx added a comment.EditedDec 12 2017, 10:50 PM

(OT)


Interesting that plain arc patch still fails. --trace shows it tries to fetch 7ef5e26f2f474f3245dedfbb4aa2e5c1acceb951 from R241 KIO, which is the parent commit of D8243, i.e. a transitive dependency of D8855. The error message matches exactly the files from D8243, too.

What I cannot figure out is why applying D8855 works, and for D9242 it fails. Sounds like a bug in arc, of which there are plenty in upstream Phab. In general cross-repo dependencies are not a sensible thing to have, so perhaps cleaning this up (i.e. fixing the dependencies of D8855) would help. However, I will stop here as this is not worth the effort ;)

renatoo added inline comments.Dec 13 2017, 12:02 PM
src/panels/places/placespanel.cpp
340

I do not think that is necessary we already store the visible/hide group on the bookmark file, storing it in another file will require a new level of abstraction to filter it and make it even more complex.

franckarrecot accepted this revision.Dec 13 2017, 12:25 PM
elvisangelaccio accepted this revision.Dec 13 2017, 10:34 PM

LGTM then.

Closed by commit R318:5f1df43b8789: Implemented support for hide/show groups (authored by Renato Araujo Oliveira Filho <renato.araujo@kdab.com>). · Explain WhyDec 14 2017, 12:42 PM
This revision was automatically updated to reflect the committed changes.