Commit d9ee1353 authored by Stavros Sachtouris's avatar Stavros Sachtouris Committed by Giorgos Korfiatis

Change "sync_on_start" to "ask_to_sync"

The effects of "sync_on_start" have been nullified. The new flag
is not currently used, but it will be reactivated in a follow up
commit.
parent eb435dea
......@@ -230,7 +230,7 @@ class WebSocketProtocol(WebSocket):
"directory": <local directory>,
"exclude": <file path>,
"language": <en|el>,
"sync_on_start": <true|false>
"ask_to_sync": <true|false>
} or {<ERROR>: <ERROR CODE>}
-- PUT SETTINGS --
......@@ -242,7 +242,7 @@ class WebSocketProtocol(WebSocket):
"directory": <local directory>,
"exclude": <file path>,
"language": <en|el>,
"sync_on_start": <true|false>
"ask_to_sync": <true|false>
}
HELPER: {"CREATED": 201, "action": "put settings",} or
{<ERROR>: <ERROR CODE>, "action": "get settings",}
......@@ -264,7 +264,7 @@ class WebSocketProtocol(WebSocket):
settings = dict(
token=None, url=None,
container=None, directory=None,
exclude=None, sync_on_start=True, language="en")
exclude=None, ask_to_sync=True, language="en")
cnf = AgkyraConfig()
essentials = ('url', 'token', 'container', 'directory')
......@@ -356,8 +356,8 @@ class WebSocketProtocol(WebSocket):
self.settings[option] = None
self.set_status(code=STATUS['SETTINGS MISSING'])
self.settings['sync_on_start'] = (
self.cnf.get('global', 'sync_on_start') == 'on')
self.settings['ask_to_sync'] = (
self.cnf.get('global', 'ask_to_sync') == 'on')
self.settings['language'] = self.cnf.get('global', 'language')
# for option in ('container', 'directory', 'exclude'):
......@@ -409,9 +409,8 @@ class WebSocketProtocol(WebSocket):
changes = True
self.cnf.set('global', 'language', self.settings.get('language', 'en'))
sync_on_start = self.settings.get('sync_on_start', False)
self.cnf.set(
'global', 'sync_on_start', 'on' if sync_on_start else 'off')
ask_to_sync = self.settings.get('ask_to_sync', False)
self.cnf.set('global', 'ask_to_sync', 'on' if ask_to_sync else 'off')
if changes:
self.cnf.write()
......@@ -574,8 +573,7 @@ class WebSocketProtocol(WebSocket):
self._load_settings()
can_sync = must_reset_syncing and self.can_sync()
if can_sync:
leave_paused = old_status in ok_not_syncing or \
not self.settings.get('sync_on_start', False)
leave_paused = old_status in ok_not_syncing
LOGGER.debug('Restart backend')
self.init_sync(leave_paused=leave_paused)
......
DEFAULT_GLOBAL = {
"sync_on_start": "on",
"ask_to_sync": "on",
"language": "en"
}
......
......@@ -40,7 +40,7 @@ var globals = {
directory: null,
exclude: null,
language: 'en',
sync_on_start: true
ask_to_sync: true
},
status: {synced: 0, unsynced: 0, failed: 0, code: STATUS['UNINITIALIZED']},
authenticated: false,
......
......@@ -62,7 +62,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
fs.readFileSync(exclude, encoding='utf-8'));
} catch (err) {console.log(err);}
if (!get_setting('language')) set_setting('language', cur_lang);
if (get_setting('sync_on_start')) $('#start_sync_box').click();
if (get_setting('ask_to_sync')) $('#ask_to_sync_box').click();
});
cur_lang = get_setting('language');
......@@ -211,7 +211,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
}
function check_start_sync() {
settings['sync_on_start'] = $('#start_sync_box').is(':checked');
settings['ask_to_sync'] = $('#ask_to_sync_box').is(':checked');
}
function localize() {
......@@ -232,7 +232,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
document.getElementById('title').innerHTML = SETTINGS.TITLE || "Settings";
document.getElementById('appearance_label').innerHTML = SETTINGS.GENERAL || "General";
document.getElementById('language_label').innerHTML = SETTINGS.LANGUAGE || "Language";
document.getElementById('start_sync_label').innerHTML = SETTINGS.SYNCONSTART || "Sync on Start";
document.getElementById('start_sync_label').innerHTML = SETTINGS["ASK TO SYNC"] || "Ask to sync";
document.getElementById('cloud_label').innerHTML = SETTINGS.CLOUD || "Cloud";
document.getElementById('url_label').innerHTML = SETTINGS.URL || "URL";
document.getElementById('token_label').innerHTML = SETTINGS.TOKEN || "Token";
......@@ -299,7 +299,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
<label id="start_sync_label" for="start_sync" class="right inline">Sync on start up</label>
</div>
<div class="small-9 columns" id="start_sync">
<input type="checkbox" name="start_sync_box" id="start_sync_box" onchange="check_start_sync();"/>
<input type="checkbox" name="ask_to_sync_box" id="ask_to_sync_box" onchange="check_start_sync();"/>
</div>
</div>
</fieldset>
......
......@@ -61,7 +61,6 @@
"TITLE": "Ρυθμίσεις",
"GENERAL": "Γενικές ρυθμίσεις",
"LANGUAGE": "Γλώσσα",
"SYNCONSTART": "Έναρξη συγχρονισμού στην εκκίνηση",
"CLOUD": "Απομακρυσμένο σύστημα (νέφος)",
"URL": "Διεύθυνση (URL) νέφους",
"TOKEN": "Κλειδί token",
......
......@@ -61,7 +61,6 @@
"TITLE": "Settings",
"GENERAL": "General Settings",
"LANGUAGE": "Language",
"SYNCONSTART": "Sync on start up",
"CLOUD": "Cloud",
"URL": "Cloud URL",
"TOKEN": "User Token",
......
......@@ -47,7 +47,7 @@ Commands and examples
agkyra_dir: /home/user/.agkyra
default_sync: default
language: en
sync_on_start: on
ask_to_sync: on
cloud default
url: http://www.example.org/identity/v2.0
token: us3r-t0k3n
......
......@@ -26,7 +26,8 @@ Currently, the global settings are the following:
:dfn:`language` The language of the GUI menu, windows and notifications. There are currently two supported languages, Greek (**el**) and English (**en**). The CLI is always in english.
default: ``en``
:dfn:`sync_on_start` A flag indicating whether the syncing should start on start-up. If it is ``off``, the client will start in "paused" mode.
:dfn:`ask_to_sync` GUI only flag. Switch on a dialogue box asking user whether syncing should
start (e.g., on startup or when the user modifies settings).
default: ``on``
Cloud
......
......@@ -93,7 +93,7 @@ Here is a typical configuration:
[global]
default_sync = CLD
language = en
sync_on_start = on
ask_to_sync = on
[cloud "CLD"]
url = http://www.example.org/identity/v2.0
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment