Closed
Bug 310071
Opened 19 years ago
Closed 18 years ago
Use system calls to add files to the recent documents folder
Categories
(Toolkit :: Downloads API, enhancement)
Tracking
()
RESOLVED
FIXED
mozilla1.8.1beta2
People
(Reporter: mconnor, Assigned: Gavin)
References
()
Details
(Keywords: fixed1.8.1)
Attachments
(1 file, 4 obsolete files)
6.46 KB,
patch
|
mconnor
:
review+
benjamin
:
superreview+
mtschrep
:
approval1.8.1+
|
Details | Diff | Splinter Review |
We want to consider using the SHAddToRecentDocs call via the shell service to add downloaded files to the recent documents folder on Windows. There will be a hidden boolean pref to disable this behaviour if desired. This is a 2.0 enhancement, and is a matter of playing nice with the system. Users concerned with privacy already have this disabled/hidden on their systems, since most Windows apps support this well.
Reporter | ||
Comment 1•19 years ago
|
||
*** Bug 309798 has been marked as a duplicate of this bug. ***
Reporter | ||
Comment 2•19 years ago
|
||
*** Bug 310072 has been marked as a duplicate of this bug. ***
Reporter | ||
Updated•19 years ago
|
Status: NEW → ASSIGNED
Flags: blocking-aviary2.0+
Reporter | ||
Updated•18 years ago
|
Priority: -- → P5
Target Milestone: --- → Firefox 2 alpha2
Reporter | ||
Updated•18 years ago
|
Assignee: mconnor → gavin.sharp
Status: ASSIGNED → NEW
Target Milestone: Firefox 2 alpha2 → Firefox 2 beta1
Assignee | ||
Updated•18 years ago
|
Status: NEW → ASSIGNED
Assignee | ||
Updated•18 years ago
|
Whiteboard: [swag: 1d]
Assignee | ||
Updated•18 years ago
|
Assignee: gavin.sharp → nobody
Status: ASSIGNED → NEW
Assignee | ||
Updated•18 years ago
|
Priority: P5 → --
Version: Trunk → 2.0 Branch
Assignee | ||
Comment 3•18 years ago
|
||
This works. I don't know if the error handling should be better, and I've noticed that sometimes the downloadCompleted handler isn't called when files are downloaded quickly. Maybe this would be better called from nsDownloadManager, but I don't see a better place offhand.
Assignee | ||
Comment 4•18 years ago
|
||
Asaf pointed out that I can't depend on browser from toolkit, so I just put this in nsDownloadManager directly.
Assignee: nobody → gavin.sharp
Attachment #221884 -
Attachment is obsolete: true
Status: NEW → ASSIGNED
Assignee | ||
Updated•18 years ago
|
Attachment #221914 -
Flags: superreview?(benjamin)
Attachment #221914 -
Flags: review?(mconnor)
Assignee | ||
Comment 5•18 years ago
|
||
Comment on attachment 221914 [details] [diff] [review] smaller patch Hrm, actually, I see the document added to the "recent docs" list without this patch. Seems windows is doing this itself without our help...
Attachment #221914 -
Attachment is obsolete: true
Attachment #221914 -
Flags: superreview?(benjamin)
Attachment #221914 -
Flags: review?(mconnor)
Assignee | ||
Comment 6•18 years ago
|
||
Ok, the reason I was seeing this work without the patch is because I had "Ask me where to save every file" turned on, which opened the system "Save As" dialog, which apparently has hooks to add any saved items to the most recent documents list.
Assignee | ||
Comment 7•18 years ago
|
||
Attachment #222539 -
Flags: superreview?(benjamin)
Attachment #222539 -
Flags: review?(mconnor)
Assignee | ||
Updated•18 years ago
|
Attachment #222539 -
Attachment is obsolete: true
Attachment #222539 -
Flags: superreview?(benjamin)
Attachment #222539 -
Flags: review?(mconnor)
Assignee | ||
Comment 8•18 years ago
|
||
The last patch only worked because SHAddToRecentDocs takes a path in the platform native encoding (Windows-1252, as I understand it), so converting to UTF-8 isn't correct, and would not work for filenames that cannot be expressed using Windows-1252. There is no SHAddToRecentDocsW, so it looks like we need pass a PIDL that represents the path to the file to SHAddToRecentDocs instead of a path, and I'm not sure how to get one of those. I need help from someone who knows the windows shell APIs more than I do.
Keywords: helpwanted
Assignee | ||
Updated•18 years ago
|
Whiteboard: [swag: 1d] → [swag: ?d]
Assignee | ||
Comment 9•18 years ago
|
||
There are still a lot of things wrong with this patch, but it works. - Putting win32 API calls in nsDownloadManager doesn't feel right - SHParseDisplayName only works in >= WinXP - String usage is probably wrong
Assignee | ||
Comment 10•18 years ago
|
||
This uses a different method that will work in anything greater than 95, and makes sure not to leak the pidl.
Attachment #224294 -
Attachment is obsolete: true
Assignee | ||
Updated•18 years ago
|
Attachment #224365 -
Flags: superreview?(benjamin)
Attachment #224365 -
Flags: review?(mconnor)
Assignee | ||
Updated•18 years ago
|
Keywords: helpwanted
Whiteboard: [swag: ?d] → [patch-r?]
Comment 11•18 years ago
|
||
Comment on attachment 224365 [details] [diff] [review] better patch >Index: toolkit/components/downloads/src/nsDownloadManager.cpp > #define PREF_BDM_FLASHCOUNT "browser.download.manager.flashCount" >+#define PREF_BDM_ADDTORECENTDOCS "browser.download.manager.addtorecentdocs" other prefs here use mixedCase, you should too. >+ if (addToRecentDocs) { >+ LPSHELLFOLDER lpShellFolder = NULL; >+ >+ if (SUCCEEDED(::SHGetDesktopFolder(&lpShellFolder))) { >+ PRUnichar *filePath = ToNewUnicode(path); >+ LPITEMIDLIST lpItemIDList = NULL; >+ if (SUCCEEDED(lpShellFolder->ParseDisplayName(NULL, NULL, filePath, NULL, &lpItemIDList, NULL))) { Does this work even if the file is not saved to the desktop?
Attachment #224365 -
Flags: superreview?(benjamin) → superreview+
Assignee | ||
Comment 12•18 years ago
|
||
(In reply to comment #11) > other prefs here use mixedCase, you should too. will do. > Does this work even if the file is not saved to the desktop? Yes, the Desktop folder is special in that its implementation of ParseDisplayName accepts absolute paths to any file on disk. http://msdn.microsoft.com/library/default.asp?url=/library/en-us/shellcc/platform/shell/reference/ifaces/ishellfolder/parsedisplayname.asp
Reporter | ||
Comment 13•18 years ago
|
||
pushing out non-critical-path bugs to b2
Target Milestone: Firefox 2 beta1 → Firefox 2 beta2
Reporter | ||
Updated•18 years ago
|
Attachment #224365 -
Flags: review?(mconnor) → review+
Comment 14•18 years ago
|
||
Comment on attachment 224365 [details] [diff] [review] better patch >+ if (SUCCEEDED(::SHGetDesktopFolder(&lpShellFolder))) { >+ PRUnichar *filePath = ToNewUnicode(path); >+ LPITEMIDLIST lpItemIDList = NULL; >+ if (SUCCEEDED(lpShellFolder->ParseDisplayName(NULL, NULL, filePath, NULL, &lpItemIDList, NULL))) { Hrm, i'm pretty sure you need W2COLE here to be on the safe side.
Assignee | ||
Updated•18 years ago
|
Whiteboard: [patch-r?] → [checkin needed]
Assignee | ||
Comment 15•18 years ago
|
||
(In reply to comment #14) > Hrm, i'm pretty sure you need W2COLE here to be on the safe side. I discussed this with Asaf, and determined it wouldn't be necessary. Checked in on the trunk. mozilla/toolkit/components/build/Makefile.in 1.37 mozilla/toolkit/components/downloads/src/nsDownloadManager.cpp 1.67
Status: ASSIGNED → RESOLVED
Closed: 18 years ago
Resolution: --- → FIXED
Whiteboard: [checkin needed]
Assignee | ||
Updated•18 years ago
|
Whiteboard: [need-a]
Assignee | ||
Comment 16•18 years ago
|
||
Comment on attachment 224365 [details] [diff] [review] better patch This has been on the trunk for nearly two weeks, with no known regressions.
Attachment #224365 -
Flags: approval1.8.1?
Updated•18 years ago
|
Attachment #224365 -
Flags: approval1.8.1? → approval1.8.1+
Assignee | ||
Updated•18 years ago
|
Whiteboard: [need-a] → [checkin needed (1.8 branch)]
Assignee | ||
Comment 17•18 years ago
|
||
mozilla/toolkit/components/downloads/src/nsDownloadManager.cpp 1.53.2.10 mozilla/toolkit/components/build/Makefile.in 1.24.2.10
Keywords: fixed1.8.1
Whiteboard: [checkin needed (1.8 branch)]
Comment 18•17 years ago
|
||
Had someone actually report this as a bug in our XULRunner app. "browser.download.manager.addtorecentdocs" should be renamed as this applies to the toolkit not just "browser".
Comment 19•17 years ago
|
||
All the download manager prefs are prefixed with browser, so I'm not so sure I agree...
Comment 20•17 years ago
|
||
maybe we should take the opportunity pre3.0 to realign preferences from browser to toolkit for portability.
Updated•16 years ago
|
Product: Firefox → Toolkit
Comment 21•15 years ago
|
||
(In reply to comment #8) > (...) There is no SHAddToRecentDocsW, so it looks like we need > pass a PIDL that represents the path to the file to SHAddToRecentDocs instead > of a path, and I'm not sure how to get one of those. I need help from someone > who knows the windows shell APIs more than I do. Gavin, sorry about the very belated comment but here goes: In this case Microsoft didn't implement ANSI/Unicode as two functions but instead they split the flag in two: if UNICODE is defined SHARD_PATH is set to SHARD_PATHW otherwise it's SHARD_PATHA. So, I believe lines 2209-2222 in nsDownloadManager.cpp could be replaced with if (addToRecentDocs) ::SHAddToRecentDocs(SHARD_PATHW, path.get());
Assignee | ||
Comment 22•15 years ago
|
||
Aiko, could you file a new bug about that? Seems reasonable to me.
You need to log in
before you can comment on or make changes to this bug.
Description
•