From 9cce6a6899ebcccb50df6fef9029b24899b47e6d Mon Sep 17 00:00:00 2001 From: "benjamin%smedbergs.us" Date: Tue, 18 Jul 2006 17:06:01 +0000 Subject: [PATCH] Bug 329854 r=joe.hughes Add a excludeReadOnlyFolders to query options for use when filing. Original committer: brettw%gmail.com Original revision: 1.21 Original date: 2006/03/10 19:44:28 --- .../places/src/nsNavHistoryQuery.cpp | 26 +++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/toolkit/components/places/src/nsNavHistoryQuery.cpp b/toolkit/components/places/src/nsNavHistoryQuery.cpp index 270b26a54fd..34aeba39c2a 100644 --- a/toolkit/components/places/src/nsNavHistoryQuery.cpp +++ b/toolkit/components/places/src/nsNavHistoryQuery.cpp @@ -152,6 +152,7 @@ static void SetOptionsKeyUint32(const nsCString& aValue, #define QUERYKEY_RESULT_TYPE "type" #define QUERYKEY_EXCLUDE_ITEMS "excludeItems" #define QUERYKEY_EXCLUDE_QUERIES "excludeQueries" +#define QUERYKEY_EXCLUDE_READ_ONLY_FOLDERS "excludeReadOnlyFolders" #define QUERYKEY_EXPAND_QUERIES "expandQueries" #define QUERYKEY_FORCE_ORIGINAL_TITLE "originalTitle" #define QUERYKEY_INCLUDE_HIDDEN "includeHidden" @@ -416,6 +417,12 @@ nsNavHistory::QueriesToQueryString(nsINavHistoryQuery **aQueries, aQueryString += NS_LITERAL_CSTRING(QUERYKEY_EXCLUDE_QUERIES "=1"); } + // exclude read only folders + if (options->ExcludeReadOnlyFolders()) { + AppendAmpersandIfNonempty(aQueryString); + aQueryString += NS_LITERAL_CSTRING(QUERYKEY_EXCLUDE_READ_ONLY_FOLDERS "=1"); + } + // expand queries if (options->ExpandQueries()) { AppendAmpersandIfNonempty(aQueryString); @@ -627,6 +634,11 @@ nsNavHistory::TokensToQueries(const nsTArray& aTokens, SetOptionsKeyBool(kvp.value, aOptions, &nsINavHistoryQueryOptions::SetExcludeQueries); + // exclude read only folders + } else if (kvp.key.EqualsLiteral(QUERYKEY_EXCLUDE_READ_ONLY_FOLDERS)) { + SetOptionsKeyBool(kvp.value, aOptions, + &nsINavHistoryQueryOptions::SetExcludeReadOnlyFolders); + // expand queries } else if (kvp.key.EqualsLiteral(QUERYKEY_EXPAND_QUERIES)) { SetOptionsKeyBool(kvp.value, aOptions, @@ -1058,6 +1070,20 @@ nsNavHistoryQueryOptions::SetExcludeQueries(PRBool aExclude) return NS_OK; } +// excludeReadOnlyFolders +NS_IMETHODIMP +nsNavHistoryQueryOptions::GetExcludeReadOnlyFolders(PRBool* aExclude) +{ + *aExclude = mExcludeReadOnlyFolders; + return NS_OK; +} +NS_IMETHODIMP +nsNavHistoryQueryOptions::SetExcludeReadOnlyFolders(PRBool aExclude) +{ + mExcludeReadOnlyFolders = aExclude; + return NS_OK; +} + // expandQueries NS_IMETHODIMP nsNavHistoryQueryOptions::GetExpandQueries(PRBool* aExpand)