зеркало из https://github.com/mozilla/gecko-dev.git
provide sensible defaults for categories & custom reminders
This commit is contained in:
Родитель
38a296c7ab
Коммит
57d1586781
|
@ -154,7 +154,13 @@ function loadReminders()
|
|||
var prefService = Components.classes["@mozilla.org/preferences-service;1"]
|
||||
.getService(Components.interfaces.nsIPrefService);
|
||||
var prefBranch = prefService.getBranch("calendar.reminder.");
|
||||
var pref = prefBranch.getCharPref("custom");
|
||||
|
||||
var pref = "length=15;unit=minutes;relation=START,length=3;unit=hours;relation=START";
|
||||
try {
|
||||
var newPref = prefBranch.getCharPref("custom");
|
||||
if(newPref && newPref != "")
|
||||
pref = newPref;
|
||||
} catch (ex) {}
|
||||
|
||||
var reminderArray = [];
|
||||
var reminders = pref.split(',');
|
||||
|
@ -186,7 +192,6 @@ function saveReminders(reminderArray)
|
|||
var prefService = Components.classes["@mozilla.org/preferences-service;1"]
|
||||
.getService(Components.interfaces.nsIPrefService);
|
||||
var prefBranch = prefService.getBranch("calendar.reminder.");
|
||||
var pref = prefBranch.getCharPref("custom");
|
||||
|
||||
var result = "";
|
||||
for each(var reminder in reminderArray) {
|
||||
|
|
|
@ -282,44 +282,42 @@ function loadDialog(item)
|
|||
}
|
||||
|
||||
// Categories
|
||||
var categoriesString = "Anniversary,Birthday,Business,Calls,Clients,Competition,Customer,Favorites,Follow up,Gifts,Holidays,Ideas,Issues,Miscellaneous,Personal,Projects,Public Holiday,Status,Suppliers,Travel,Vacation";
|
||||
try {
|
||||
var categoriesString = getLocalizedPref("calendar.categories.names");
|
||||
var categoriesList = categoriesString.split( "," );
|
||||
var categories = getLocalizedPref("calendar.categories.names");
|
||||
if (categories && categories != "")
|
||||
categoriesString = categories;
|
||||
} catch (ex) {}
|
||||
var categoriesList = categoriesString.split( "," );
|
||||
|
||||
// insert the category already in the menulist so it doesn't get lost
|
||||
var itemCategory = item.getProperty("CATEGORIES");
|
||||
if (itemCategory) {
|
||||
if (categoriesString.indexOf(itemCategory) == -1)
|
||||
categoriesList[categoriesList.length] = itemCategory;
|
||||
}
|
||||
categoriesList.sort();
|
||||
// insert the category already in the menulist so it doesn't get lost
|
||||
var itemCategory = item.getProperty("CATEGORIES");
|
||||
if (itemCategory) {
|
||||
if (categoriesString.indexOf(itemCategory) == -1)
|
||||
categoriesList[categoriesList.length] = itemCategory;
|
||||
}
|
||||
categoriesList.sort();
|
||||
|
||||
var oldMenulist = document.getElementById("item-categories");
|
||||
while (oldMenulist.hasChildNodes()) {
|
||||
oldMenulist.removeChild(oldMenulist.lastChild);
|
||||
}
|
||||
|
||||
var categoryMenuList = document.getElementById("item-categories");
|
||||
var indexToSelect = 0;
|
||||
|
||||
// Add a 'none' option to allow users to cancel the category
|
||||
var noneItem = categoryMenuList.appendItem(calGetString("calendar", "None"), "NONE");
|
||||
|
||||
for (var i in categoriesList) {
|
||||
var catItem = categoryMenuList.appendItem(categoriesList[i], categoriesList[i]);
|
||||
catItem.value = categoriesList[i];
|
||||
if (itemCategory && categoriesList[i] == itemCategory) {
|
||||
indexToSelect = parseInt(i)+1; // Add 1 because of 'None'
|
||||
}
|
||||
}
|
||||
|
||||
categoryMenuList.selectedIndex = indexToSelect;
|
||||
|
||||
} catch (ex) {
|
||||
// The app using this dialog doesn't support categories
|
||||
//document.getElementById("categories-box").collapsed = true;
|
||||
var oldMenulist = document.getElementById("item-categories");
|
||||
while (oldMenulist.hasChildNodes()) {
|
||||
oldMenulist.removeChild(oldMenulist.lastChild);
|
||||
}
|
||||
|
||||
var categoryMenuList = document.getElementById("item-categories");
|
||||
var indexToSelect = 0;
|
||||
|
||||
// Add a 'none' option to allow users to cancel the category
|
||||
var noneItem = categoryMenuList.appendItem(calGetString("calendar", "None"), "NONE");
|
||||
|
||||
for (var i in categoriesList) {
|
||||
var catItem = categoryMenuList.appendItem(categoriesList[i], categoriesList[i]);
|
||||
catItem.value = categoriesList[i];
|
||||
if (itemCategory && categoriesList[i] == itemCategory) {
|
||||
indexToSelect = parseInt(i)+1; // Add 1 because of 'None'
|
||||
}
|
||||
}
|
||||
|
||||
categoryMenuList.selectedIndex = indexToSelect;
|
||||
|
||||
// URL
|
||||
gURL = item.getProperty("URL");
|
||||
|
|
Загрузка…
Ссылка в новой задаче