Changed the configurable variable SOGoMailMessageCheck to a general refresh associated to the current view

This commit is contained in:
Alexandre Cloutier
2014-08-29 13:16:30 -04:00
parent 126a05d391
commit d62c504763
37 changed files with 316 additions and 267 deletions

View File

@@ -11,6 +11,8 @@ var Contact = {
currentContactId: null
};
var refreshViewCheckTimer;
function openContactsFolder(contactsFolder, reload, idx) {
if ((contactsFolder && contactsFolder != Contact.currentAddressBook)
|| reload) {
@@ -1363,6 +1365,7 @@ function initContacts(event) {
configureAddressBooks();
configureDraggables();
updateAddressBooksMenus();
initRefreshViewCheckTimer();
var table = $("contactsList");
if (table) {
@@ -1625,4 +1628,24 @@ function onContactsReload () {
openContactsFolder(Contact.currentAddressBook, true);
}
function initRefreshViewCheckTimer() {
var refreshViewCheck = UserDefaults["SOGoRefreshViewCheck"];
if (refreshViewCheck && refreshViewCheck != "manually") {
var interval;
if (refreshViewCheck == "once_per_hour")
interval = 3600;
else if (refreshViewCheck == "every_minute")
interval = 60;
else {
interval = parseInt(refreshViewCheck.substr(6)) * 60;
}
refreshViewCheckTimer = window.setInterval(onRefreshViewCheckCallback,
interval * 1000);
}
}
function onRefreshViewCheckCallback(event) {
onContactsReload();
}
document.observe("dom:loaded", initContacts);