mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-29 07:42:04 +00:00
Bug 564900 - Add folder specifically for downloads to Library sidebar
r=mak a=sdwilsh
This commit is contained in:
parent
cf6c48da66
commit
0039b24196
@ -56,7 +56,7 @@ XPCOMUtils.defineLazyGetter(this, "PlacesUtils", function() {
|
||||
});
|
||||
|
||||
var PlacesUIUtils = {
|
||||
ORGANIZER_LEFTPANE_VERSION: 6,
|
||||
ORGANIZER_LEFTPANE_VERSION: 7,
|
||||
ORGANIZER_FOLDER_ANNO: "PlacesOrganizer/OrganizerFolder",
|
||||
ORGANIZER_QUERY_ANNO: "PlacesOrganizer/OrganizerQuery",
|
||||
|
||||
@ -980,6 +980,7 @@ var PlacesUIUtils = {
|
||||
let queries = {
|
||||
"PlacesRoot": { title: "" },
|
||||
"History": { title: this.getString("OrganizerQueryHistory") },
|
||||
"Downloads": { title: this.getString("OrganizerQueryDownloads") },
|
||||
"Tags": { title: this.getString("OrganizerQueryTags") },
|
||||
"AllBookmarks": { title: this.getString("OrganizerQueryAllBookmarks") },
|
||||
"BookmarksToolbar":
|
||||
@ -996,7 +997,7 @@ var PlacesUIUtils = {
|
||||
concreteId: PlacesUtils.unfiledBookmarksFolderId },
|
||||
};
|
||||
// All queries but PlacesRoot.
|
||||
const EXPECTED_QUERY_COUNT = 6;
|
||||
const EXPECTED_QUERY_COUNT = 7;
|
||||
|
||||
// Removes an item and associated annotations, ignoring eventual errors.
|
||||
function safeRemoveItem(aItemId) {
|
||||
@ -1169,7 +1170,12 @@ var PlacesUIUtils = {
|
||||
"&sort=" +
|
||||
Ci.nsINavHistoryQueryOptions.SORT_BY_DATE_DESCENDING);
|
||||
|
||||
// XXX: Downloads.
|
||||
// Downloads.
|
||||
this.create_query("Downloads", leftPaneRoot,
|
||||
"place:transition=" +
|
||||
Ci.nsINavHistoryService.TRANSITION_DOWNLOAD +
|
||||
"&sort=" +
|
||||
Ci.nsINavHistoryQueryOptions.SORT_BY_DATE_DESCENDING);
|
||||
|
||||
// Tags Query.
|
||||
this.create_query("Tags", leftPaneRoot,
|
||||
|
@ -65,6 +65,7 @@ _BROWSER_TEST_FILES = \
|
||||
browser_views_liveupdate.js \
|
||||
browser_sidebarpanels_click.js \
|
||||
browser_library_infoBox.js \
|
||||
browser_library_downloads.js \
|
||||
$(NULL)
|
||||
|
||||
libs:: $(_BROWSER_TEST_FILES)
|
||||
|
@ -0,0 +1,110 @@
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is Places test code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Mozilla Foundation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2010
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Mehdi Mulani <mmulani@mozilla.com> (original author)
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
/*
|
||||
* Tests bug 564900: Add folder specifically for downloads to Library left pane.
|
||||
* https://bugzilla.mozilla.org/show_bug.cgi?id=564900
|
||||
* This test visits various pages then opens the Library and ensures
|
||||
* that both the Downloads folder shows up and that the correct visits
|
||||
* are shown in it.
|
||||
*/
|
||||
|
||||
let now = Date.now();
|
||||
|
||||
function test() {
|
||||
waitForExplicitFinish();
|
||||
|
||||
function windowObserver(aSubject, aTopic, aData) {
|
||||
if (aTopic != "domwindowopened")
|
||||
return;
|
||||
Services.ww.unregisterNotification(windowObserver);
|
||||
let win = aSubject.QueryInterface(Ci.nsIDOMWindow);
|
||||
win.addEventListener("load", function onLoad(event) {
|
||||
win.removeEventListener("load", onLoad, false);
|
||||
executeSoon(function () {
|
||||
// Add visits to compare contents with.
|
||||
fastAddVisit("http://mozilla.com",
|
||||
PlacesUtils.history.TRANSITION_TYPED);
|
||||
fastAddVisit("http://google.com",
|
||||
PlacesUtils.history.TRANSITION_DOWNLOAD);
|
||||
fastAddVisit("http://en.wikipedia.org",
|
||||
PlacesUtils.history.TRANSITION_TYPED);
|
||||
fastAddVisit("http://ubuntu.org",
|
||||
PlacesUtils.history.TRANSITION_DOWNLOAD);
|
||||
|
||||
// Make sure Downloads is present.
|
||||
isnot(win.PlacesOrganizer._places.selectedNode, null,
|
||||
"Downloads is present and selected");
|
||||
|
||||
// Make sure content in right pane exists.
|
||||
let tree = win.document.getElementById("placeContent");
|
||||
isnot(tree, null, "placeContent tree exists");
|
||||
|
||||
// Check results.
|
||||
var contentRoot = tree.result.root;
|
||||
var len = contentRoot.childCount;
|
||||
var testUris = ["http://ubuntu.org/", "http://google.com/"];
|
||||
for (var i = 0; i < len; i++) {
|
||||
is(contentRoot.getChild(i).uri, testUris[i],
|
||||
"Comparing downloads shown at index " + i);
|
||||
}
|
||||
|
||||
win.close();
|
||||
waitForClearHistory(finish);
|
||||
});
|
||||
}, false);
|
||||
}
|
||||
|
||||
Services.ww.registerNotification(windowObserver);
|
||||
PlacesCommandHook.showPlacesOrganizer("Downloads");
|
||||
}
|
||||
|
||||
function fastAddVisit(uri, transition) {
|
||||
PlacesUtils.history.addVisit(PlacesUtils._uri(uri), now++ * 1000,
|
||||
null, transition, false, 0);
|
||||
}
|
||||
|
||||
function waitForClearHistory(aCallback) {
|
||||
let observer = {
|
||||
observe: function(aSubject, aTopic, aData) {
|
||||
Services.obs.removeObserver(this, PlacesUtils.TOPIC_EXPIRATION_FINISHED);
|
||||
aCallback();
|
||||
}
|
||||
};
|
||||
Services.obs.addObserver(observer, PlacesUtils.TOPIC_EXPIRATION_FINISHED, false);
|
||||
|
||||
PlacesUtils.bhistory.removeAllPages();
|
||||
}
|
@ -107,22 +107,28 @@
|
||||
let tree = document.getElementById("tree");
|
||||
tree.place = "place:queryType=1&folder=" + leftPaneFolderId;
|
||||
|
||||
// Open All Bookmarks
|
||||
PlacesUtils.asContainer(tree.view.nodeForTreeIndex(2)).containerOpen = true;
|
||||
|
||||
// The query-property is set on the title column for each row.
|
||||
let titleColumn = tree.treeBoxObject.columns.getColumnAt(0);
|
||||
|
||||
["History", "Tags", "AllBookmarks", "BookmarksToolbar",
|
||||
// Open All Bookmarks
|
||||
tree.selectItems([PlacesUIUtils.leftPaneQueries["AllBookmarks"]]);
|
||||
PlacesUtils.asContainer(tree.selectedNode).containerOpen = true;
|
||||
is(PlacesUIUtils.allBookmarksFolderId, tree.selectedNode.itemId,
|
||||
"Opened All Bookmarks");
|
||||
|
||||
["History", "Downloads", "Tags", "AllBookmarks", "BookmarksToolbar",
|
||||
"BookmarksMenu", "UnfiledBookmarks"].forEach(
|
||||
function(aQueryName, aRow) {
|
||||
let rowProperties = createSupportsArray();
|
||||
tree.view.getCellProperties(aRow, titleColumn, rowProperties);
|
||||
rowProperties = convertPropertiesToJSArray(rowProperties);
|
||||
ok(rowProperties.indexOf("OrganizerQuery_" + aQueryName) != -1,
|
||||
"OrganizerQuery_" + aQueryName + " is set");
|
||||
}
|
||||
);
|
||||
function(aQueryName, aRow) {
|
||||
let found = false;
|
||||
for (let i = 0; i < tree.view.rowCount && !found; i++) {
|
||||
let rowProperties = createSupportsArray();
|
||||
tree.view.getCellProperties(i, titleColumn, rowProperties);
|
||||
rowProperties = convertPropertiesToJSArray(rowProperties);
|
||||
found = rowProperties.indexOf("OrganizerQuery_" + aQueryName) != -1;
|
||||
}
|
||||
ok(found, "OrganizerQuery_" + aQueryName + " is set");
|
||||
}
|
||||
);
|
||||
|
||||
// Close the root node
|
||||
tree.result.root.containerOpen = false;
|
||||
|
@ -56,6 +56,7 @@ browser.jar:
|
||||
skin/classic/browser/places/tag.png (places/tag.png)
|
||||
skin/classic/browser/places/toolbarDropMarker.png (places/toolbarDropMarker.png)
|
||||
skin/classic/browser/places/unsortedBookmarks.png (places/unsortedBookmarks.png)
|
||||
skin/classic/browser/places/downloads.png (places/downloads.png)
|
||||
skin/classic/browser/preferences/alwaysAsk.png (preferences/alwaysAsk.png)
|
||||
skin/classic/browser/preferences/mail.png (preferences/mail.png)
|
||||
skin/classic/browser/preferences/Options.png (preferences/Options.png)
|
||||
|
BIN
browser/themes/gnomestripe/browser/places/downloads.png
Normal file
BIN
browser/themes/gnomestripe/browser/places/downloads.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 599 B |
@ -70,6 +70,11 @@ treechildren::-moz-tree-image(title, query) {
|
||||
list-style-image: url("chrome://browser/skin/places/query.png");
|
||||
}
|
||||
|
||||
treechildren::-moz-tree-image(query, OrganizerQuery_Downloads) {
|
||||
list-style-image: url("chrome://browser/skin/places/downloads.png");
|
||||
-moz-image-region: auto;
|
||||
}
|
||||
|
||||
treechildren::-moz-tree-image(title, query, tagContainer),
|
||||
treechildren::-moz-tree-image(query, OrganizerQuery_Tags) {
|
||||
list-style-image: url("chrome://mozapps/skin/places/tagContainerIcon.png");
|
||||
|
@ -88,6 +88,7 @@ browser.jar:
|
||||
skin/classic/browser/places/twisty-open.gif (places/twisty-open.gif)
|
||||
skin/classic/browser/places/twisty-closed.gif (places/twisty-closed.gif)
|
||||
skin/classic/browser/places/tag.png (places/tag.png)
|
||||
skin/classic/browser/places/downloads.png (places/downloads.png)
|
||||
skin/classic/browser/places/expander-closed-active.png (places/expander-closed-active.png)
|
||||
skin/classic/browser/places/expander-closed.png (places/expander-closed.png)
|
||||
skin/classic/browser/places/expander-open-active.png (places/expander-open-active.png)
|
||||
|
BIN
browser/themes/pinstripe/browser/places/downloads.png
Normal file
BIN
browser/themes/pinstripe/browser/places/downloads.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 678 B |
@ -148,6 +148,10 @@ treechildren::-moz-tree-image(query) {
|
||||
list-style-image: url("chrome://browser/skin/places/query.png");
|
||||
}
|
||||
|
||||
treechildren::-moz-tree-image(query, OrganizerQuery_Downloads) {
|
||||
list-style-image: url("chrome://browser/skin/places/downloads.png");
|
||||
}
|
||||
|
||||
treechildren::-moz-tree-image(title, query, tagContainer),
|
||||
treechildren::-moz-tree-image(query, OrganizerQuery_Tags) {
|
||||
list-style-image: url("chrome://mozapps/skin/places/tagContainerIcon.png");
|
||||
|
@ -70,6 +70,7 @@ browser.jar:
|
||||
skin/classic/browser/places/allBookmarks.png (places/allBookmarks.png)
|
||||
skin/classic/browser/places/unsortedBookmarks.png (places/unsortedBookmarks.png)
|
||||
skin/classic/browser/places/searching_16.png (places/searching_16.png)
|
||||
skin/classic/browser/places/downloads.png (places/downloads.png)
|
||||
skin/classic/browser/preferences/alwaysAsk.png (preferences/alwaysAsk.png)
|
||||
skin/classic/browser/preferences/application.png (preferences/application.png)
|
||||
skin/classic/browser/preferences/mail.png (preferences/mail.png)
|
||||
|
BIN
browser/themes/winstripe/browser/places/downloads.png
Normal file
BIN
browser/themes/winstripe/browser/places/downloads.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 674 B |
@ -85,6 +85,11 @@ treechildren::-moz-tree-image(query, OrganizerQuery_Tags) {
|
||||
-moz-image-region: auto;
|
||||
}
|
||||
|
||||
treechildren::-moz-tree-image(query, OrganizerQuery_Downloads) {
|
||||
list-style-image: url("chrome://browser/skin/places/downloads.png");
|
||||
-moz-image-region: auto;
|
||||
}
|
||||
|
||||
/* calendar icon for folders grouping items by date */
|
||||
treechildren::-moz-tree-image(title, query, dayContainer) {
|
||||
list-style-image: url("chrome://browser/skin/places/calendar.png");
|
||||
|
Loading…
Reference in New Issue
Block a user