From 70a8c1fc2e5033c3eaeac0310a34dcba05f8da58 Mon Sep 17 00:00:00 2001 From: "benjamin%smedbergs.us" Date: Tue, 18 Jul 2006 18:19:17 +0000 Subject: [PATCH] rejigger places UI a bit, add a title bar across the top of the places view, adjust the default entries in the listbox, etc. also fix icons for generic queries and generic non-favicon pages. r=brettw for changes to the cpp. NPOB Original committer: beng%bengoodger.com Original revision: 1.31 Original date: 2006/01/13 20:47:18 --- .../places/src/nsNavHistoryResult.cpp | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/toolkit/components/places/src/nsNavHistoryResult.cpp b/toolkit/components/places/src/nsNavHistoryResult.cpp index ee71c29dd8a..189c78b710b 100644 --- a/toolkit/components/places/src/nsNavHistoryResult.cpp +++ b/toolkit/components/places/src/nsNavHistoryResult.cpp @@ -67,6 +67,8 @@ #include "prprf.h" #include "mozStorageHelper.h" +#define ICONURI_QUERY "chrome://browser/skin/places/query.png" + // emulate string comparison (used for sorting) for PRTime and int inline PRInt32 ComparePRTime(PRTime a, PRTime b) { @@ -170,6 +172,12 @@ NS_IMETHODIMP nsNavHistoryResultNode::GetTime(PRTime *aTime) /* attribute nsIURI con; */ NS_IMETHODIMP nsNavHistoryResultNode::GetIcon(nsIURI** aURI) { + PRInt64 folderId; + GetFolderId(&folderId); + + if (mType == nsINavHistoryResult::RESULT_TYPE_QUERY && folderId == 0) + return NS_NewURI(aURI, ICONURI_QUERY); + nsFaviconService* faviconService = nsFaviconService::GetFaviconService(); NS_ENSURE_TRUE(faviconService, NS_ERROR_NO_INTERFACE); return faviconService->GetFaviconLinkForIconString(mFaviconURL, aURI); @@ -1947,7 +1955,7 @@ NS_IMETHODIMP nsNavHistoryResult::GetCellProperties(PRInt32 row, nsITreeColumn * properties->AppendElement(nsNavHistory::sMenuRootAtom); else if (toolbarRootId == folderId) properties->AppendElement(nsNavHistory::sToolbarRootAtom); - + if (mShowSessions && node->mSessionID != 0) { if (row == 0 || node->mSessionID != VisibleElementAt(row - 1)->mSessionID) { @@ -2129,8 +2137,13 @@ NS_IMETHODIMP nsNavHistoryResult::GetImageSrc(PRInt32 row, nsITreeColumn *col, nsFaviconService* faviconService = nsFaviconService::GetFaviconService(); NS_ENSURE_TRUE(faviconService, NS_ERROR_NO_INTERFACE); + nsCOMPtr iconURI; + nsresult rv = VisibleElementAt(row)->GetIcon(getter_AddRefs(iconURI)); + if (NS_FAILED(rv)) + return rv; + nsCAutoString spec; - faviconService->GetFaviconSpecForIconString(VisibleElementAt(row)->mFaviconURL, spec); + iconURI->GetSpec(spec); // _retval = NS_ConvertUTF8toUTF16(spec); CopyUTF8toUTF16(spec, _retval); return NS_OK;