Allow clearing remote copy of options in sync storage. Fix #282.

This commit is contained in:
FelisCatus 2015-03-14 16:30:26 +08:00
parent 40266f5ffa
commit dab98bb943
11 changed files with 48 additions and 0 deletions

View File

@ -381,6 +381,9 @@ msgstr "Stáhnout ze synchronizace"
msgid "options_syncDisable"
msgstr "Zrušit synchronizaci"
msgid "options_syncReset"
msgstr "Clear remote copy"
msgid "options_syncPristineHelp"
msgstr ""
"Vy můžete nyní automaticky synchronizovat Vaše nastavení, profily napříč "

View File

@ -373,6 +373,9 @@ msgstr "Download from Syncing"
msgid "options_syncDisable"
msgstr "Disable syncing"
msgid "options_syncReset"
msgstr "Clear remote copy"
msgid "options_syncPristineHelp"
msgstr ""
"You can now automatically synchroize your settings and profiles across all "

View File

@ -381,6 +381,9 @@ msgstr "Download from Syncing"
msgid "options_syncDisable"
msgstr "Disable syncing"
msgid "options_syncReset"
msgstr "Clear remote copy"
msgid "options_syncPristineHelp"
msgstr ""
"You can now automatically synchroize your settings and profiles across all "

View File

@ -374,6 +374,9 @@ msgstr "Download from Syncing"
msgid "options_syncDisable"
msgstr "Disable syncing"
msgid "options_syncReset"
msgstr "Clear remote copy"
msgid "options_syncPristineHelp"
msgstr ""
"You can now automatically synchroize your settings and profiles across all "

View File

@ -380,6 +380,9 @@ msgstr "Download from Syncing"
msgid "options_syncDisable"
msgstr "Disable syncing"
msgid "options_syncReset"
msgstr "Clear remote copy"
msgid "options_syncPristineHelp"
msgstr ""
"You can now automatically synchroize your settings and profiles across all "

View File

@ -341,6 +341,9 @@ msgstr "下载云端版本"
msgid "options_syncDisable"
msgstr "禁用同步"
msgid "options_syncReset"
msgstr "删除云端版本"
msgid "options_syncPristineHelp"
msgstr "您可以将设置和情景模式同步到所有使用Chrome浏览器的桌面设备。"

View File

@ -341,6 +341,9 @@ msgstr "下載雲端版本"
msgid "options_syncDisable"
msgstr "禁用同步"
msgid "options_syncReset"
msgstr "刪除雲端版本"
msgid "options_syncPristineHelp"
msgstr "您可以將設定和情景模式同步到所有使用Chrome瀏覽器的桌面裝置。"

View File

@ -140,6 +140,7 @@ angular.module('omegaTarget', []).factory 'omegaTarget', ($q) ->
chrome.tabs.create url: 'chrome://extensions/configureCommands'
setOptionsSync: (enabled, args) ->
callBackground('setOptionsSync', enabled, args)
resetOptionsSync: (enabled, args) -> callBackground('resetOptionsSync')
setRequestInfoCallback: (callback) ->
requestInfoCallback = callback

View File

@ -985,4 +985,20 @@ class Options
@_syncWatchStop = @sync.watchAndPull(@_storage)
return
###*
# Clear the sync storage, resetting syncing state to pristine.
# @returns {Promise} A promise which is fulfilled when the syncing is reset.
###
resetOptionsSync: ->
@log.method('Options#resetOptionsSync', this, arguments)
if not @sync?
return Promise.reject(new Error('Options syncing is unsupported.'))
@sync.enabled = false
@_syncWatchStop?()
@_syncWatchStop = null
@_state.set({'syncOptions': 'conflict'})
return @sync.storage.remove().then =>
@_state.set({'syncOptions': 'pristine'})
module.exports = Options

View File

@ -60,3 +60,8 @@ angular.module('omega').controller 'IoCtrl', ($scope, $rootScope,
omegaTarget.setOptionsSync(false).then ->
$rootScope.applyOptionsConfirm().then ->
$window.location.reload()
$scope.resetOptionsSync = ->
omegaTarget.resetOptionsSync().then ->
$rootScope.applyOptionsConfirm().then ->
$window.location.reload()

View File

@ -66,5 +66,10 @@ section.settings-group
span.glyphicon.glyphicon-cloud-download
= ' '
| {{'options_syncEnableForce' | tr}}
= ' '
button.btn.btn-link(ng-click='resetOptionsSync()')
span.glyphicon.glyphicon-erase
= ' '
| {{'options_syncReset' | tr}}
div(ng-show='syncOptions == "unsupported"')
p.help-block(omega-html='"options_syncUnsupportedHelp" | tr')