Make bookmarks "Sorted By" menu localizable and add accesskeys (Bookmarks Manager part). b=91774 r=mano

This commit is contained in:
mats.palmgren%bredband.net 2006-11-09 03:03:05 +00:00
Родитель 7338ac2ba2
Коммит 34081bdf5d
3 изменённых файлов: 0 добавлений и 1537 удалений

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

@ -1,271 +0,0 @@
# -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
#
# ***** 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 mozilla.org code.
#
# The Initial Developer of the Original Code is
# Netscape Communications Corporation.
# Portions created by the Initial Developer are Copyright (C) 1998
# the Initial Developer. All Rights Reserved.
#
# Contributor(s):
# Ben Goodger <ben@netscape.com> (Original Author, v3.0)
# Pierre Chanial <chanial@noos.fr>
#
# 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 *****
var gSearchBox;
////////////////////////////////////////////////////////////////////////////////
// Initialize the command controllers, set focus, tree root,
// window title state, etc.
function Startup()
{
const windowNode = document.getElementById("bookmark-window");
const bookmarksView = document.getElementById("bookmarks-view");
const bookmarksFolder = document.getElementById("bookmark-folders-view");
var titleString;
// If we've been opened with a parameter, root the tree on it.
if ("arguments" in window && window.arguments[0]) {
var title;
var uri = window.arguments[0];
bookmarksView.tree.setAttribute("ref", uri);
bookmarksFolder.setAttribute("hidden","true")
document.getElementById("bookmarks-search").setAttribute("hidden","true")
document.getElementById("bookmark-views-splitter").setAttribute("hidden","true")
if (uri.substring(0,5) == "find:") {
title = BookmarksUtils.getLocaleString("search_results_title");
// Update the windowtype so that future searches are directed
// there and the window is not re-used for bookmarks.
windowNode.setAttribute("windowtype", "bookmarks:searchresults");
}
else
title = BookmarksUtils.getProperty(window.arguments[0], gNC_NS+"Name");
titleString = BookmarksUtils.getLocaleString("window_title", title);
}
else {
titleString = BookmarksUtils.getLocaleString("bookmarks_title", title);
// always open the bookmark root folder
if (!bookmarksFolder.treeBoxObject.view.isContainerOpen(0))
bookmarksFolder.treeBoxObject.view.toggleOpenState(0);
bookmarksFolder.treeBoxObject.view.selection.select(0);
}
bookmarksView.treeBoxObject.view.selection.select(0);
document.title = titleString;
document.getElementById("CommandUpdate_Bookmarks").setAttribute("commandupdater","true");
bookmarksView.focus();
var bkmkTxnSvc = Components.classes["@mozilla.org/bookmarks/transactionmanager;1"]
.getService(Components.interfaces.nsIBookmarkTransactionManager);
bkmkTxnSvc.transactionManager.AddListener(BookmarkEditMenuTxnListener);
}
function Shutdown()
{
var bkmkTxnSvc = Components.classes["@mozilla.org/bookmarks/transactionmanager;1"]
.getService(Components.interfaces.nsIBookmarkTransactionManager);
bkmkTxnSvc.transactionManager.RemoveListener(BookmarkEditMenuTxnListener);
// Store current window position and size in window attributes (for persistence).
var win = document.getElementById("bookmark-window");
win.setAttribute("x", screenX);
win.setAttribute("y", screenY);
win.setAttribute("height", outerHeight);
win.setAttribute("width", outerWidth);
}
var gConstructedViewMenuSortItems = false;
function fillViewMenu(aEvent)
{
var adjacentElement = document.getElementById("fill-before-this-node");
var popupElement = aEvent.target;
var bookmarksView = document.getElementById("bookmarks-view");
var columns = bookmarksView.columns;
if (!gConstructedViewMenuSortItems) {
for (var i = 0; i < columns.length; ++i) {
var accesskey = columns[i].accesskey;
var menuitem = document.createElement("menuitem");
var name = BookmarksUtils.getLocaleString("SortMenuItem", columns[i].label);
menuitem.setAttribute("label", name);
menuitem.setAttribute("accesskey", columns[i].accesskey);
menuitem.setAttribute("resource", columns[i].resource);
menuitem.setAttribute("id", "sortMenuItem:" + columns[i].resource);
menuitem.setAttribute("checked", columns[i].sortActive);
menuitem.setAttribute("name", "sortSet");
menuitem.setAttribute("type", "radio");
popupElement.insertBefore(menuitem, adjacentElement);
}
gConstructedViewMenuSortItems = true;
}
const kPrefSvcContractID = "@mozilla.org/preferences-service;1";
const kPrefSvcIID = Components.interfaces.nsIPrefService;
var prefSvc = Components.classes[kPrefSvcContractID].getService(kPrefSvcIID);
var bookmarksSortPrefs = prefSvc.getBranch("browser.bookmarks.sort.");
if (gConstructedViewMenuSortItems) {
var resource = bookmarksSortPrefs.getCharPref("resource");
var element = document.getElementById("sortMenuItem:" + resource);
if (element)
element.setAttribute("checked", "true");
}
var sortAscendingMenu = document.getElementById("ascending");
var sortDescendingMenu = document.getElementById("descending");
var noSortMenu = document.getElementById("natural");
sortAscendingMenu.setAttribute("checked", "false");
sortDescendingMenu.setAttribute("checked", "false");
noSortMenu.setAttribute("checked", "false");
var direction = bookmarksSortPrefs.getCharPref("direction");
if (direction == "natural")
sortAscendingMenu.setAttribute("checked", "true");
else if (direction == "ascending")
sortDescendingMenu.setAttribute("checked", "true");
else
noSortMenu.setAttribute("checked", "true");
}
function onViewMenuSortItemSelected(aEvent)
{
var resource = aEvent.target.getAttribute("resource");
const kPrefSvcContractID = "@mozilla.org/preferences-service;1";
const kPrefSvcIID = Components.interfaces.nsIPrefService;
var prefSvc = Components.classes[kPrefSvcContractID].getService(kPrefSvcIID);
var bookmarksSortPrefs = prefSvc.getBranch("browser.bookmarks.sort.");
switch (resource) {
case "":
break;
case "direction":
var dirn = bookmarksSortPrefs.getCharPref("direction");
if (aEvent.target.id == "ascending")
bookmarksSortPrefs.setCharPref("direction", "natural");
else if (aEvent.target.id == "descending")
bookmarksSortPrefs.setCharPref("direction", "ascending");
else
bookmarksSortPrefs.setCharPref("direction", "descending");
break;
default:
bookmarksSortPrefs.setCharPref("resource", resource);
var direction = bookmarksSortPrefs.getCharPref("direction");
if (direction == "descending")
bookmarksSortPrefs.setCharPref("direction", "natural");
break;
}
aEvent.stopPropagation();
}
var gConstructedColumnsMenuItems = false;
function fillColumnsMenu(aEvent)
{
var bookmarksView = document.getElementById("bookmarks-view");
var columns = bookmarksView.columns;
var i;
if (!gConstructedColumnsMenuItems) {
for (i = 0; i < columns.length; ++i) {
var menuitem = document.createElement("menuitem");
menuitem.setAttribute("label", columns[i].label);
menuitem.setAttribute("resource", columns[i].resource);
menuitem.setAttribute("id", "columnMenuItem:" + columns[i].resource);
menuitem.setAttribute("type", "checkbox");
menuitem.setAttribute("checked", columns[i].hidden != "true");
aEvent.target.appendChild(menuitem);
}
gConstructedColumnsMenuItems = true;
}
else {
for (i = 0; i < columns.length; ++i) {
var element = document.getElementById("columnMenuItem:" + columns[i].resource);
if (element && columns[i].hidden != "true")
element.setAttribute("checked", "true");
}
}
aEvent.stopPropagation();
}
function onViewMenuColumnItemSelected(aEvent)
{
var resource = aEvent.target.getAttribute("resource");
if (resource != "") {
var bookmarksView = document.getElementById("bookmarks-view");
bookmarksView.toggleColumnVisibility(resource);
}
aEvent.stopPropagation();
}
function onViewSelected(aEvent)
{
var statusBar = document.getElementById("statusbar-text");
var displayValue;
var selection = aEvent.target.getTreeSelection();
var bookmarksView = document.getElementById("bookmarks-view");
if (selection.length == 0)
return;
if (aEvent.target.id == "bookmark-folders-view" && selection)
bookmarksView.tree.setAttribute("ref",selection.item[0].Value);
if (statusBar && selection.length == 1) {
//protocol broken since we have unique ID...
//var protocol = selection.protocol[0];
if (selection.isContainer[0]) {// && protocol != "find" && protocol != "file") {
RDFC.Init(aEvent.target.db, selection.item[0]);
var count = 0;
var children = RDFC.GetElements();
while (children.hasMoreElements()) {
if (BookmarksUtils.resolveType(children.getNext()) != "BookmarkSeparator")
count++;
}
displayValue = BookmarksUtils.getLocaleString("status_foldercount", String(count));
}
else if (selection.type[0] == "Bookmark")
displayValue = BookmarksUtils.getProperty(selection.item[0], gNC_NS+"URL", aEvent.target.db)
else
displayValue = "";
statusBar.label = displayValue;
}
}

Разница между файлами не показана из-за своего большого размера Загрузить разницу

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

@ -1,188 +0,0 @@
# ***** 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 mozilla.org code.
#
# The Initial Developer of the Original Code is
# Netscape Communications Corporation.
# Portions created by the Initial Developer are Copyright (C) 1998
# the Initial Developer. All Rights Reserved.
#
# Contributor(s):
#
# 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 *****
description_PersonalToolbarFolder = Folders and bookmarks in this folder appear on the Bookmarks Toolbar.
cmd_bm_open = Open
cmd_bm_open_accesskey = O
cmd_bm_expandfolder = Expand
cmd_bm_expandfolder_accesskey = x
cmd_bm_collapsefolder = Collapse
cmd_bm_collapsefolder_accesskey = C
cmd_bm_openfolder = Open All in Tabs
cmd_bm_openfolder_accesskey = O
cmd_bm_managefolder = Manage Folder
cmd_bm_managefolder_accesskey = M
cmd_bm_find = Find a Bookmark...
cmd_cut = Cut
cmd_cut_accesskey = t
cmd_copy = Copy
cmd_copy_accesskey = C
cmd_paste = Paste
cmd_paste_accesskey = P
cmd_delete = Delete
cmd_delete_accesskey = D
cmd_bm_movebookmark = Move Bookmark(s)...
cmd_bm_movebookmark_accesskey = M
cmd_selectAll = Select All
cmd_selectAll_accesskey = A
cmd_bm_rename = Rename...
cmd_bm_rename_accesskey = R
cmd_bm_renamebookmark2 = Change Location...
cmd_bm_renamebookmark2_accesskey = L
cmd_bm_properties = Properties
cmd_bm_properties_accesskey = r
cmd_bm_refreshlivemark = Reload Live Bookmark
cmd_bm_refreshlivemark_accesskey = L
cmd_bm_refreshmicrosummary = Reload Live Title
cmd_bm_refreshmicrosummary_accesskey = L
cmd_bm_sortbyname = Sort By Name
cmd_bm_sortbyname_accesskey = S
cmd_bm_undo = Undo
cmd_bm_undo_accesskey = U
cmd_bm_cut_undo = Undo Cut
cmd_bm_cut_undo_accesskey = U
cmd_bm_delete_undo = Undo Delete Bookmark
cmd_bm_delete_undo_accesskey = U
cmd_bm_paste_undo = Undo Paste
cmd_bm_paste_undo_accesskey = U
cmd_bm_newbookmark_undo = Undo New Bookmark
cmd_bm_newbookmark_undo_accesskey = U
cmd_bm_newlivemark_undo = Undo New Live Bookmark
cmd_bm_newlivemark_undo_accesskey = U
cmd_bm_newfolder_undo = Undo New Folder
cmd_bm_newfolder_undo_accesskey = U
cmd_bm_newseparator_undo = Undo New Separator
cmd_bm_newseparator_undo_accesskey = U
cmd_bm_drag_undo = Undo Drag Bookmark
cmd_bm_drag_undo_accesskey = U
cmd_bm_move_undo = Undo Move Bookmark
cmd_bm_move_undo_accesskey = U
cmd_bm_import_undo = Undo Import
cmd_bm_import_undo_accesskey = U
cmd_bm_redo = Redo
cmd_bm_redo_accesskey = R
cmd_bm_cut_redo = Redo Cut
cmd_bm_cut_redo_accesskey = R
cmd_bm_delete_redo = Redo Delete Bookmark
cmd_bm_delete_redo_accesskey = R
cmd_bm_paste_redo = Redo Paste
cmd_bm_paste_redo_accesskey = R
cmd_bm_newbookmark_redo = Redo New Bookmark
cmd_bm_newbookmark_redo_accesskey = R
cmd_bm_newlivemark_redo = Redo New Live Bookmark
cmd_bm_newlivemark_redo_accesskey = R
cmd_bm_newfolder_redo = Redo New Folder
cmd_bm_newfolder_redo_accesskey = R
cmd_bm_newseparator_redo = Redo New Separator
cmd_bm_newseparator_redo_accesskey = R
cmd_bm_drag_redo = Redo Drag Bookmark
cmd_bm_drag_redo_accesskey = R
cmd_bm_move_redo = Redo Move Bookmark
cmd_bm_move_redo_accesskey = R
cmd_bm_import_redo = Redo Import
cmd_bm_import_redo_accesskey = R
cmd_bm_openinnewwindow = Open in New Window
cmd_bm_openinnewwindow_accesskey = N
cmd_bm_openinnewtab = Open in New Tab
cmd_bm_openinnewtab_accesskey = w
cmd_bm_newfolder = New Folder...
cmd_bm_newfolder_accesskey = F
cmd_bm_newbookmark = New Bookmark...
cmd_bm_newbookmark_accesskey = B
cmd_bm_newseparator = New Separator
cmd_bm_newseparator_accesskey = S
ile_newfolder = New Folder
ile_newbookmark = New Bookmark
ile_newlivemark = New Live Bookmark
newfolder_dialog_title = Create New Folder
newfolder_dialog_msg = Create a New Folder named:
window_title = %S - Bookmarks
search_results_title = Search Results
bookmarks_title = Bookmarks Manager
file_in = File in "%S"
BookmarksRoot = Bookmarks
BookmarksToolbarFolder = Bookmarks Toolbar Folder
status_foldercount = %S object(s)
WebPageUpdated = The following web page has been updated:
WebPageTitle = Title:
WebPageURL = URL:
WebPageAskDisplay = Would you like to display it?
WebPageAskStopOption = Stop checking for updates on this web page
pleaseEnterALocation = Please enter a location
pleaseEnterADuration = Please enter a duration.
pleaseSelectANotification = Please enter at least one notification method.
SortMenuItem = Sorted by %S
ShortFindTitle = Find: '%S'
FindTitle = Find: %S %S '%S' in %S
ImportedIEFavorites = Imported IE Favorites
ImportedIEStaticFavorites = Imported IE Favorites
ImportedNetPositiveBookmarks = Imported NetPositive Bookmarks
SelectImport = Import Bookmarks File
EnterExport = Export Bookmarks File
search_button_label = Find
emptyFolder = (Empty)
addBookmarkPromptTitle=Add Bookmark?
addBookmarkPromptMessage=Add Bookmark to "%S" (%S)?
addBookmarkPromptButton=Add Bookmark
addLiveBookmarkTitle=Add Live Bookmark
BookmarksLivemarkLoading=Live Bookmark loading...
BookmarksLivemarkFailed=Live Bookmark feed failed to load.
bookmarkCurTabTitle=Add Bookmark
bookmarkAllTabsTitle=Bookmark All Tabs
tabs.openWarningTitle=Confirm open
tabs.openWarningMultipleBranded=You are about to open %S tabs. This might slow down %S while the pages are loading. Are you sure you want to continue?
tabs.openButtonMultiple=Open tabs
tabs.openWarningPromptMeBranded=Warn me when opening multiple tabs might slow down %S