mirror of
https://github.com/inverse-inc/sogo.git
synced 2026-04-23 05:49:31 +00:00
(feat) manual+auto refresh support for addressbooks/mailboxes
This commit is contained in:
@@ -331,6 +331,9 @@
|
||||
</md-menu-item>
|
||||
</md-menu-content>
|
||||
</md-menu>
|
||||
<md-button class="sg-icon-button" aria-label="Refresh" ng-click="addressbook.selectedFolder.$reload()" >
|
||||
<md-icon>refresh</md-icon>
|
||||
</md-button>
|
||||
</div>
|
||||
</div>
|
||||
<!-- search mode -->
|
||||
|
||||
@@ -401,6 +401,9 @@
|
||||
</md-menu-item>
|
||||
</md-menu-content>
|
||||
</md-menu>
|
||||
<md-button class="sg-icon-button" aria-label="Refresh" ng-click="mailbox.selectedFolder.$filter()" >
|
||||
<md-icon>refresh</md-icon>
|
||||
</md-button>
|
||||
</div>
|
||||
</div>
|
||||
<!-- search mode -->
|
||||
|
||||
@@ -6,8 +6,8 @@
|
||||
/**
|
||||
* @ngInject
|
||||
*/
|
||||
AddressBookController.$inject = ['$scope', '$state', '$mdDialog', 'sgFocus', 'Card', 'AddressBook', 'Dialog', 'sgSettings', 'stateAddressbooks', 'stateAddressbook'];
|
||||
function AddressBookController($scope, $state, $mdDialog, focus, Card, AddressBook, Dialog, Settings, stateAddressbooks, stateAddressbook) {
|
||||
AddressBookController.$inject = ['$scope', '$state', '$timeout', '$mdDialog', 'sgFocus', 'Card', 'AddressBook', 'Dialog', 'Preferences', 'sgSettings', 'stateAddressbooks', 'stateAddressbook'];
|
||||
function AddressBookController($scope, $state, $timeout, $mdDialog, focus, Card, AddressBook, Dialog, Preferences, Settings, stateAddressbooks, stateAddressbook) {
|
||||
var vm = this;
|
||||
|
||||
AddressBook.selectedFolder = stateAddressbook;
|
||||
@@ -98,6 +98,24 @@
|
||||
vm.mode.search = false;
|
||||
vm.selectedFolder.$filter('');
|
||||
}
|
||||
|
||||
// Start the address book refresh timer based on user's preferences
|
||||
Preferences.ready().then(function() {
|
||||
var refreshViewCheck = Preferences.defaults.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;
|
||||
}
|
||||
|
||||
var f = angular.bind(vm.selectedFolder, AddressBook.prototype.$reload);
|
||||
$timeout(f, interval*1000);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
angular
|
||||
|
||||
@@ -6,8 +6,8 @@
|
||||
/**
|
||||
* @ngInject
|
||||
*/
|
||||
MailboxController.$inject = ['$state', 'stateAccounts', 'stateAccount', 'stateMailbox', 'encodeUriFilter', 'sgFocus', 'Dialog', 'Account', 'Mailbox'];
|
||||
function MailboxController($state, stateAccounts, stateAccount, stateMailbox, encodeUriFilter, focus, Dialog, Account, Mailbox) {
|
||||
MailboxController.$inject = ['$state', '$timeout', 'stateAccounts', 'stateAccount', 'stateMailbox', 'encodeUriFilter', 'sgFocus', 'Dialog', 'Account', 'Mailbox', 'Preferences'];
|
||||
function MailboxController($state, $timeout, stateAccounts, stateAccount, stateMailbox, encodeUriFilter, focus, Dialog, Account, Mailbox, Preferences) {
|
||||
var vm = this;
|
||||
|
||||
Mailbox.selectedFolder = stateMailbox;
|
||||
@@ -87,6 +87,24 @@
|
||||
vm.mode.search = false;
|
||||
vm.selectedFolder.$filter();
|
||||
}
|
||||
|
||||
// Start the mailbox refresh timer based on user's preferences
|
||||
Preferences.ready().then(function() {
|
||||
var refreshViewCheck = Preferences.defaults.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;
|
||||
}
|
||||
|
||||
var f = angular.bind(vm.selectedFolder, Mailbox.prototype.$filter);
|
||||
$timeout(f, interval*1000);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
angular
|
||||
|
||||
Reference in New Issue
Block a user