1
0
mirror of https://github.com/laurent22/joplin.git synced 2025-11-29 22:48:10 +02:00

Various changes

This commit is contained in:
Laurent Cozic
2017-08-22 19:57:35 +02:00
parent 67b812cab0
commit d9c85a7275
17 changed files with 157 additions and 59 deletions

View File

@@ -20,27 +20,32 @@ class Setting extends BaseModel {
return output;
}
static keys() {
if (this.keys_) return this.keys_;
this.keys_ = [];
for (let n in this.metadata_) {
if (!this.metadata_.hasOwnProperty(n)) continue;
this.keys_.push(n);
static keys(publicOnly = false, appType = null) {
if (!this.keys_) {
this.keys_ = [];
for (let n in this.metadata_) {
if (!this.metadata_.hasOwnProperty(n)) continue;
this.keys_.push(n);
}
this.keys_.sort();
}
return this.keys_;
}
static publicKeys() {
let output = [];
for (let n in this.metadata_) {
if (!this.metadata_.hasOwnProperty(n)) continue;
if (this.metadata_[n].public) output.push(n);
if (appType || publicOnly) {
let output = [];
for (let i = 0; i < this.keys_.length; i++) {
const md = this.settingMetadata(this.keys_[i]);
if (publicOnly && !md.public) continue;
if (appType && md.appTypes && md.appTypes.indexOf(appType) < 0) continue;
output.push(md.key);
}
return output;
} else {
return this.keys_;
}
return output;
}
static isPublic(key) {
return this.publicKeys().indexOf(key) >= 0;
return this.keys(true).indexOf(key) >= 0;
}
static load() {
@@ -205,7 +210,7 @@ class Setting extends BaseModel {
let output = [];
for (let n in options) {
if (!options.hasOwnProperty(n)) continue;
output.push(_('%s (%s)', n, options[n]));
output.push(_('%s: %s', n, options[n]));
}
return output.join(', ');
}
@@ -330,7 +335,7 @@ Setting.metadata_ = {
})},
'uncompletedTodosOnTop': { value: true, type: Setting.TYPE_BOOL, public: true, label: () => _('Show uncompleted todos on top of the lists') },
'trackLocation': { value: true, type: Setting.TYPE_BOOL, public: true, label: () => _('Save location with notes') },
'sync.interval': { value: 300, type: Setting.TYPE_INT, isEnum: true, public: true, label: () => _('Synchronisation interval'), options: () => {
'sync.interval': { value: 300, type: Setting.TYPE_INT, isEnum: true, public: true, appTypes: ['mobile'], label: () => _('Synchronisation interval'), options: () => {
return {
0: _('Disabled'),
300: _('%d minutes', 5),