-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Code Quality: Introduced IWindowsRecentItemsService #16150
base: main
Are you sure you want to change the base?
Code Quality: Introduced IWindowsRecentItemsService #16150
Conversation
d424572
to
c861720
Compare
This comment was marked as resolved.
This comment was marked as resolved.
Can we use the context menu verb for that? |
0d0a836
to
cf808bc
Compare
src/Files.App/ViewModels/UserControls/Widgets/RecentFilesWidgetViewModel.cs
Show resolved
Hide resolved
It looks like folders are showing in the recent files widget |
This comment was marked as resolved.
This comment was marked as resolved.
Pinned files should be included |
ddf1c68
to
24948f8
Compare
24948f8
to
ba20eeb
Compare
ba20eeb
to
24f5ba6
Compare
This comment was marked as outdated.
This comment was marked as outdated.
There is one issue I discovered where the order of the recent items doesn't match the behavior in |
This comment was marked as outdated.
This comment was marked as outdated.
Sorry to have forgot to mention this, I meant to. |
The behavior in |
I only slightly remember this but I figured it would be reasonable to include why we didn't sort since we did so for the folder flow. The initial implementation read directly from Quick Access so there was no need to sort again. |
src/Files.App/ViewModels/UserControls/Widgets/RecentFilesWidgetViewModel.cs
Show resolved
Hide resolved
cmi.cbSize = (uint)sizeof(CMINVOKECOMMANDINFO); | ||
cmi.nShow = (int)SHOW_WINDOW_CMD.SW_HIDE; | ||
|
||
// Try unpin first for pinned files |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm assuming this includes folders too? If so we should execute both unpinfromhome
and removefromhome
. The former doesn't work for a lot of the default Windows folders like Music & Video.
ba6624b#diff-e7c944353f705cd45acb6c334f0ce1693abda765b0217b207ef03c71c96e2143R180
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh I was confused by these. These verbs are undocumented?
Is there an unofficial documentation about this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was never able to find official docs for this outside of forums, but in my own testing it's feasible & safe to call both if you want to remove a folder. There's probably not a need to invoke these verbs for files though.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see. I'll resolve it shortly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jiejasonliu I just should execute both unpinfromhome and removefromhome? Not necessarily remove
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So remove
is still needed to remove files (non-folders).
If we're trying to unpin folders, then I suggest executing both unpinfromhome
and removefromhome
.
This flow does not know whether the recent item we're handling is a file/folder right?
I'm not sure what happens if you invoke the wrong verbs for the wrong type (file vs. folder), but my guess is nothing and maybe we could fire all three if it's too difficult to distinguish what type of recent item we're handling.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This flow does not know whether the recent item we're handling is a file/folder right?
Yeah, should I add IsFolder to WidgetRecentItem at least?
I'm not sure what happens if you invoke the wrong verbs for the wrong type (file vs. folder), but my guess is nothing and maybe we could fire all three if it's too difficult to distinguish what type of recent item we're handling.
I guess the invocation method would fail with E_FAIL or some HRESULT.
So remove is still needed to remove files (non-folders).
Got it. I'll add invocation code of these 3 verbs
Do you know IApplicationDocumentLists? This is specifically enumeration interface for frequent and recent items. Also IApplicationDestinations is provided for deleting an item and clearing all. I have to try. |
I don't, but the API seems promising. From an glance, it looks like a bunch of |
@jiejasonliu Thank you for the review. Speaking of IApplicationDocumentLists, I confirmed this was a completely different stuff; File Explorer only adds recent 'folders'. Presumably, we still gotta to use a dedicated shell folder, as we have. |
We should aim to match the existing functionality. Aren't recent folders used in the Quick Access widget? |
It has never been used afaik. |
Resolved / Related Issues
Note
There's been a known issue with enumerating recent items, where the service enumerates pinned files as well as recent items. Because of this, if there's any, Clear All doesn't work properly. While this PR didn't introduce this issue we probably want to look into later.
Steps used to test these changes