Bug 522768 - Add tooltip displaying full path in location column. r=aleca,darktrojan

Implement displaying the full path (including all parents) of a folder as a tooltip in the
location column of the thread pane.

This is achieved by providing a new readonly attribute `prettyPath` in `nsIMsgFolder` which is
returned by `nsMsgDBView::CellTextForColumn` instead of `prettyName`.

Differential Revision: https://phabricator.services.mozilla.com/D188694

--HG--
extra : amend_source : 2b124cd104292cac3a24e80407585781a55d2753
This commit is contained in:
welpy-cw 2023-10-29 19:18:53 +00:00
Родитель c4e200f6e5
Коммит 66af5fcdd0
5 изменённых файлов: 34 добавлений и 2 удалений

Просмотреть файл

@ -6246,6 +6246,16 @@ customElements.whenDefined("tree-view-table-row").then(() => {
continue;
}
if (column.id == "locationCol") {
const prettyPath = cellTexts[textIndex].split("/");
cell.textContent = Array.isArray(prettyPath)
? prettyPath.at(-1)
: cellTexts[textIndex];
cell.title = cellTexts[textIndex];
ariaLabelPromises.push(cellTexts[textIndex]);
continue;
}
if (textIndex >= 0) {
if (isDummyRow) {
cell.textContent = "";

Просмотреть файл

@ -53,6 +53,7 @@ interface nsIMsgFolder : nsISupports {
attribute AString name;
attribute AString prettyName;
readonly attribute AString abbreviatedName;
readonly attribute AString prettyPath;
/**
* Set pretty name again from original name,

Просмотреть файл

@ -3216,6 +3216,27 @@ NS_IMETHODIMP nsMsgDBFolder::GetPrettyName(nsAString& name) {
return GetName(name);
}
NS_IMETHODIMP nsMsgDBFolder::GetPrettyPath(nsAString& aPath) {
nsresult rv;
if (mIsServer) {
aPath.Truncate();
return NS_OK;
}
nsCOMPtr<nsIMsgFolder> parent = do_QueryReferent(mParent);
if (parent) {
parent->GetPrettyPath(aPath);
if (!aPath.IsEmpty()) {
aPath.AppendLiteral("/");
}
}
nsString name;
rv = GetPrettyName(name);
NS_ENSURE_SUCCESS(rv, rv);
aPath.Append(name);
return NS_OK;
}
static bool nonEnglishApp() {
if (nsMsgDBFolder::gIsEnglishApp == -1) {
nsAutoCString locale;

Просмотреть файл

@ -1968,7 +1968,7 @@ nsMsgDBView::CellTextForColumn(int32_t aRow, const nsAString& aColumnName,
nsCOMPtr<nsIMsgFolder> folder;
nsresult rv = GetFolderForViewIndex(aRow, getter_AddRefs(folder));
NS_ENSURE_SUCCESS(rv, rv);
folder->GetPrettyName(aValue);
folder->GetPrettyPath(aValue);
}
break;
}

Просмотреть файл

@ -175,7 +175,7 @@ nsresult nsMsgSearchDBView::FetchLocation(int32_t aRow,
nsCOMPtr<nsIMsgFolder> folder;
nsresult rv = GetFolderForViewIndex(aRow, getter_AddRefs(folder));
NS_ENSURE_SUCCESS(rv, rv);
return folder->GetPrettyName(aLocationString);
return folder->GetPrettyPath(aLocationString);
}
nsresult nsMsgSearchDBView::OnNewHeader(nsIMsgDBHdr* newHdr,