mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-22 17:55:50 +00:00
Bug 1293445 - 5 - Rename RESULTS_AS_TAG_QUERY. r=standard8
MozReview-Commit-ID: 7HwPKkGvAvv --HG-- extra : rebase_source : e8c8bb963061c23907bacc68082d4e70a609bbf2
This commit is contained in:
parent
df5bf9e86f
commit
a68b7f8aea
@ -2396,7 +2396,7 @@ BrowserGlue.prototype = {
|
||||
},
|
||||
RecentTags: {
|
||||
title: bundle.GetStringFromName("recentTagsTitle"),
|
||||
url: "place:type=" + queryOptions.RESULTS_AS_TAG_QUERY +
|
||||
url: "place:type=" + queryOptions.RESULTS_AS_TAGS_ROOT +
|
||||
"&sort=" + queryOptions.SORT_BY_LASTMODIFIED_DESCENDING +
|
||||
"&maxResults=" + MAX_RESULTS,
|
||||
parentGuid: PlacesUtils.bookmarks.menuGuid,
|
||||
|
@ -805,7 +805,7 @@ PlacesController.prototype = {
|
||||
node.parent &&
|
||||
PlacesUtils.nodeIsQuery(node.parent) &&
|
||||
PlacesUtils.asQuery(node.parent).queryOptions.resultType ==
|
||||
Ci.nsINavHistoryQueryOptions.RESULTS_AS_TAG_QUERY) {
|
||||
Ci.nsINavHistoryQueryOptions.RESULTS_AS_TAGS_ROOT) {
|
||||
// This is a tag container.
|
||||
// Untag all URIs tagged with this tag only if the tag container is
|
||||
// child of the "Tags" query in the library, in all other places we
|
||||
|
@ -84,7 +84,7 @@
|
||||
// tag containers, so we must fall to the default case.
|
||||
if (PlacesUtils.nodeIsHistoryContainer(queryNode) ||
|
||||
PlacesUtils.nodeIsTagQuery(queryNode) ||
|
||||
options.resultType == options.RESULTS_AS_TAG_QUERY ||
|
||||
options.resultType == options.RESULTS_AS_TAGS_ROOT ||
|
||||
options.resultType == options.RESULTS_AS_ROOTS_QUERY)
|
||||
options.resultType = options.RESULTS_AS_URI;
|
||||
|
||||
|
@ -138,7 +138,7 @@ PlacesTreeView.prototype = {
|
||||
case Ci.nsINavHistoryQueryOptions.RESULTS_AS_DATE_QUERY:
|
||||
case Ci.nsINavHistoryQueryOptions.RESULTS_AS_SITE_QUERY:
|
||||
case Ci.nsINavHistoryQueryOptions.RESULTS_AS_DATE_SITE_QUERY:
|
||||
case Ci.nsINavHistoryQueryOptions.RESULTS_AS_TAG_QUERY:
|
||||
case Ci.nsINavHistoryQueryOptions.RESULTS_AS_TAGS_ROOT:
|
||||
case Ci.nsINavHistoryQueryOptions.RESULTS_AS_ROOTS_QUERY:
|
||||
case Ci.nsINavHistoryQueryOptions.RESULTS_AS_LEFT_PANE_QUERY:
|
||||
return false;
|
||||
|
@ -73,7 +73,7 @@ add_task(async function() {
|
||||
let tagsQuery = await PlacesUtils.bookmarks.insert({
|
||||
parentGuid: root.guid,
|
||||
title: "",
|
||||
url: "place:type=" + Ci.nsINavHistoryQueryOptions.RESULTS_AS_TAG_QUERY,
|
||||
url: "place:type=" + Ci.nsINavHistoryQueryOptions.RESULTS_AS_TAGS_ROOT,
|
||||
});
|
||||
tree.selectItems([tagsQuery.guid]);
|
||||
PlacesUtils.asQuery(tree.selectedNode).containerOpen = true;
|
||||
|
@ -783,14 +783,14 @@ var PlacesUtils = {
|
||||
nodeIsTagQuery: function PU_nodeIsTagQuery(aNode) {
|
||||
if (aNode.type != Ci.nsINavHistoryResultNode.RESULT_TYPE_QUERY)
|
||||
return false;
|
||||
// Direct child of RESULTS_AS_TAG_QUERY.
|
||||
// Direct child of RESULTS_AS_TAGS_ROOT.
|
||||
let parent = aNode.parent;
|
||||
if (parent && PlacesUtils.asQuery(parent).queryOptions.resultType ==
|
||||
Ci.nsINavHistoryQueryOptions.RESULTS_AS_TAG_QUERY)
|
||||
Ci.nsINavHistoryQueryOptions.RESULTS_AS_TAGS_ROOT)
|
||||
return true;
|
||||
// We must also support the right pane of the Library, when the tag query
|
||||
// is the root node. Unfortunately this is also valid for any tag query
|
||||
// selected in the left pane that is not a direct child of RESULTS_AS_TAG_QUERY.
|
||||
// selected in the left pane that is not a direct child of RESULTS_AS_TAGS_ROOT.
|
||||
if (!parent && aNode == aNode.parentResult.root &&
|
||||
PlacesUtils.asQuery(aNode).query.tags.length == 1)
|
||||
return true;
|
||||
|
@ -1055,7 +1055,7 @@ interface nsINavHistoryQueryOptions : nsISupports
|
||||
*
|
||||
* @note Setting this resultType will force queryType to QUERY_TYPE_BOOKMARKS.
|
||||
*/
|
||||
const unsigned short RESULTS_AS_TAG_QUERY = 6;
|
||||
const unsigned short RESULTS_AS_TAGS_ROOT = 6;
|
||||
|
||||
/**
|
||||
* DEPRECATED: This exists for Sync and also to avoid reusing this number.
|
||||
|
@ -1248,7 +1248,7 @@ PlacesSQLQueryBuilder::Select()
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
break;
|
||||
|
||||
case nsINavHistoryQueryOptions::RESULTS_AS_TAG_QUERY:
|
||||
case nsINavHistoryQueryOptions::RESULTS_AS_TAGS_ROOT:
|
||||
rv = SelectAsTag();
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
break;
|
||||
@ -1720,7 +1720,7 @@ PlacesSQLQueryBuilder::SelectAsLeftPane()
|
||||
nsINavHistoryQueryOptions::SORT_BY_DATE_DESCENDING,
|
||||
nsINavHistoryService::TRANSITION_DOWNLOAD,
|
||||
nsINavHistoryQueryOptions::SORT_BY_DATE_DESCENDING,
|
||||
nsINavHistoryQueryOptions::RESULTS_AS_TAG_QUERY,
|
||||
nsINavHistoryQueryOptions::RESULTS_AS_TAGS_ROOT,
|
||||
nsINavHistoryQueryOptions::SORT_BY_TITLE_ASCENDING,
|
||||
nsINavHistoryQueryOptions::RESULTS_AS_ROOTS_QUERY);
|
||||
return NS_OK;
|
||||
@ -3500,8 +3500,8 @@ nsNavHistory::RowToResult(mozIStorageValueArray* aRow,
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
if (itemId != -1 ||
|
||||
aOptions->ResultType() == nsNavHistoryQueryOptions::RESULTS_AS_TAG_QUERY) {
|
||||
// RESULTS_AS_TAG_QUERY has date columns
|
||||
aOptions->ResultType() == nsNavHistoryQueryOptions::RESULTS_AS_TAGS_ROOT) {
|
||||
// RESULTS_AS_TAGS_ROOT has date columns
|
||||
resultNode->mDateAdded = aRow->AsInt64(kGetInfoIndex_ItemDateAdded);
|
||||
resultNode->mLastModified = aRow->AsInt64(kGetInfoIndex_ItemLastModified);
|
||||
if (resultNode->IsFolder()) {
|
||||
|
@ -1294,7 +1294,7 @@ nsNavHistoryQueryOptions::SetResultType(uint16_t aType)
|
||||
return NS_ERROR_INVALID_ARG;
|
||||
// Tag queries, containers and the roots query are bookmarks related, so we
|
||||
// set the QueryType accordingly.
|
||||
if (aType == RESULTS_AS_TAG_QUERY || aType == RESULTS_AS_ROOTS_QUERY ||
|
||||
if (aType == RESULTS_AS_TAGS_ROOT || aType == RESULTS_AS_ROOTS_QUERY ||
|
||||
aType == RESULTS_AS_LEFT_PANE_QUERY) {
|
||||
mQueryType = QUERY_TYPE_BOOKMARKS;
|
||||
}
|
||||
@ -1398,7 +1398,7 @@ nsNavHistoryQueryOptions::SetQueryType(uint16_t aQueryType)
|
||||
{
|
||||
// Tag query and containers are forced to QUERY_TYPE_BOOKMARKS when the
|
||||
// resultType is set.
|
||||
if (mResultType == RESULTS_AS_TAG_QUERY ||
|
||||
if (mResultType == RESULTS_AS_TAGS_ROOT ||
|
||||
mResultType == RESULTS_AS_LEFT_PANE_QUERY ||
|
||||
mResultType == RESULTS_AS_ROOTS_QUERY)
|
||||
return NS_OK;
|
||||
|
@ -118,7 +118,7 @@ getUpdateRequirements(const RefPtr<nsNavHistoryQuery>& aQuery,
|
||||
domainBasedItems = true;
|
||||
|
||||
if (aOptions->ResultType() ==
|
||||
nsINavHistoryQueryOptions::RESULTS_AS_TAG_QUERY)
|
||||
nsINavHistoryQueryOptions::RESULTS_AS_TAGS_ROOT)
|
||||
return QUERYUPDATE_COMPLEX_WITH_BOOKMARKS;
|
||||
|
||||
if (aOptions->ResultType() ==
|
||||
@ -1952,7 +1952,7 @@ nsNavHistoryQueryResultNode::IsContainersQuery()
|
||||
uint16_t resultType = Options()->ResultType();
|
||||
return resultType == nsINavHistoryQueryOptions::RESULTS_AS_DATE_QUERY ||
|
||||
resultType == nsINavHistoryQueryOptions::RESULTS_AS_DATE_SITE_QUERY ||
|
||||
resultType == nsINavHistoryQueryOptions::RESULTS_AS_TAG_QUERY ||
|
||||
resultType == nsINavHistoryQueryOptions::RESULTS_AS_TAGS_ROOT ||
|
||||
resultType == nsINavHistoryQueryOptions::RESULTS_AS_SITE_QUERY ||
|
||||
resultType == nsINavHistoryQueryOptions::RESULTS_AS_ROOTS_QUERY ||
|
||||
resultType == nsINavHistoryQueryOptions::RESULTS_AS_LEFT_PANE_QUERY;
|
||||
@ -2027,7 +2027,7 @@ nsNavHistoryQueryResultNode::GetHasChildren(bool* aHasChildren)
|
||||
|
||||
// Tags are always populated, otherwise they are removed.
|
||||
if (mQuery->Tags().Length() == 1 && mParent &&
|
||||
mParent->mOptions->ResultType() == nsINavHistoryQueryOptions::RESULTS_AS_TAG_QUERY) {
|
||||
mParent->mOptions->ResultType() == nsINavHistoryQueryOptions::RESULTS_AS_TAGS_ROOT) {
|
||||
*aHasChildren = true;
|
||||
return NS_OK;
|
||||
}
|
||||
@ -2040,7 +2040,7 @@ nsNavHistoryQueryResultNode::GetHasChildren(bool* aHasChildren)
|
||||
}
|
||||
|
||||
// For tag containers query we must check if we have any tag
|
||||
if (resultType == nsINavHistoryQueryOptions::RESULTS_AS_TAG_QUERY) {
|
||||
if (resultType == nsINavHistoryQueryOptions::RESULTS_AS_TAGS_ROOT) {
|
||||
nsCOMPtr<nsITaggingService> tagging =
|
||||
do_GetService(NS_TAGGINGSERVICE_CONTRACTID);
|
||||
if (tagging) {
|
||||
@ -2283,7 +2283,7 @@ nsNavHistoryQueryResultNode::Refresh()
|
||||
// query could cause a major slowdown. We should not refresh nested
|
||||
// queries, since we will already refresh the parent one.
|
||||
// The only exception to this, is if the parent query is of QUERYUPDATE_NONE,
|
||||
// this can be the case for the RESULTS_AS_TAG_QUERY
|
||||
// this can be the case for the RESULTS_AS_TAGS_ROOT
|
||||
// under RESULTS_AS_LEFT_PANE_QUERY.
|
||||
if (!mExpanded) {
|
||||
ClearChildren(true);
|
||||
|
@ -18,7 +18,7 @@ var resultTypes = [
|
||||
{value: Ci.nsINavHistoryQueryOptions.RESULTS_AS_DATE_QUERY, name: "RESULTS_AS_DATE_QUERY"},
|
||||
{value: Ci.nsINavHistoryQueryOptions.RESULTS_AS_SITE_QUERY, name: "RESULTS_AS_SITE_QUERY"},
|
||||
{value: Ci.nsINavHistoryQueryOptions.RESULTS_AS_DATE_SITE_QUERY, name: "RESULTS_AS_DATE_SITE_QUERY"},
|
||||
{value: Ci.nsINavHistoryQueryOptions.RESULTS_AS_TAG_QUERY, name: "RESULTS_AS_TAG_QUERY"},
|
||||
{value: Ci.nsINavHistoryQueryOptions.RESULTS_AS_TAGS_ROOT, name: "RESULTS_AS_TAGS_ROOT"},
|
||||
];
|
||||
|
||||
var sortingModes = [
|
||||
@ -140,7 +140,7 @@ function test_query_callback(aSequence) {
|
||||
print("\n\n*** Testing default sorting for resultType (" + resultType.name + ") and sortingMode (" + sortingMode.name + ")");
|
||||
|
||||
// Skip invalid combinations sorting queries by none.
|
||||
if (resultType.value == Ci.nsINavHistoryQueryOptions.RESULTS_AS_TAG_QUERY &&
|
||||
if (resultType.value == Ci.nsINavHistoryQueryOptions.RESULTS_AS_TAGS_ROOT &&
|
||||
(sortingMode.value == Ci.nsINavHistoryQueryOptions.SORT_BY_DATE_ASCENDING ||
|
||||
sortingMode.value == Ci.nsINavHistoryQueryOptions.SORT_BY_DATE_DESCENDING)) {
|
||||
// This is a bookmark query, we can't sort by visit date.
|
||||
@ -193,7 +193,7 @@ function test_query_callback(aSequence) {
|
||||
check_children_sorting(innerContainer,
|
||||
Ci.nsINavHistoryQueryOptions.SORT_BY_TITLE_ASCENDING);
|
||||
innerContainer.containerOpen = false;
|
||||
} else if (resultType.value == Ci.nsINavHistoryQueryOptions.RESULTS_AS_TAG_QUERY) {
|
||||
} else if (resultType.value == Ci.nsINavHistoryQueryOptions.RESULTS_AS_TAGS_ROOT) {
|
||||
// Sorting mode for tag contents is hardcoded for now, to allow for faster
|
||||
// duplicates filtering.
|
||||
check_children_sorting(container,
|
||||
|
@ -12,7 +12,7 @@ const expectedRoots = [{
|
||||
guid: "downloads__v",
|
||||
}, {
|
||||
title: "TagsFolderTitle",
|
||||
uri: `place:sort=${Ci.nsINavHistoryQueryOptions.SORT_BY_TITLE_ASCENDING}&type=${Ci.nsINavHistoryQueryOptions.RESULTS_AS_TAG_QUERY}`,
|
||||
uri: `place:sort=${Ci.nsINavHistoryQueryOptions.SORT_BY_TITLE_ASCENDING}&type=${Ci.nsINavHistoryQueryOptions.RESULTS_AS_TAGS_ROOT}`,
|
||||
guid: "tags_______v",
|
||||
}, {
|
||||
title: "OrganizerQueryAllBookmarks",
|
||||
|
@ -19,7 +19,7 @@ for (const [uri, tagArray] of Object.entries(testData)) {
|
||||
});
|
||||
}
|
||||
|
||||
add_task(async function test_results_as_tag_query() {
|
||||
add_task(async function test_results_as_tags_root() {
|
||||
await task_populateDB(formattedTestData);
|
||||
|
||||
// Construct URL - tag mapping from tag query.
|
||||
@ -31,7 +31,7 @@ add_task(async function test_results_as_tag_query() {
|
||||
}
|
||||
|
||||
const options = PlacesUtils.history.getNewQueryOptions();
|
||||
options.resultType = options.RESULTS_AS_TAG_QUERY;
|
||||
options.resultType = options.RESULTS_AS_TAGS_ROOT;
|
||||
const query = PlacesUtils.history.getNewQuery();
|
||||
const root = PlacesUtils.history.executeQuery(query, options).root;
|
||||
|
||||
|
@ -71,7 +71,7 @@ add_task(async function test_removing_folder_containing_tagged_bookmark_removes_
|
||||
function ensureTagsExist(aTags) {
|
||||
var query = histsvc.getNewQuery();
|
||||
var opts = histsvc.getNewQueryOptions();
|
||||
opts.resultType = opts.RESULTS_AS_TAG_QUERY;
|
||||
opts.resultType = opts.RESULTS_AS_TAGS_ROOT;
|
||||
var resultRoot = histsvc.executeQuery(query, opts).root;
|
||||
|
||||
// Dupe aTags.
|
||||
|
Loading…
Reference in New Issue
Block a user