1
0
mirror of https://github.com/laurent22/joplin.git synced 2025-01-11 18:24:43 +02:00

Handle advanced options

This commit is contained in:
Laurent Cozic 2017-09-24 15:48:23 +01:00
parent 5118779a67
commit fb0e8f36d4
6 changed files with 25 additions and 15 deletions

View File

@ -62,10 +62,13 @@ class Application {
let output = await this.loadItems(type, pattern, options);
if (output.length > 1) {
output.sort((a, b) => { return a.user_updated_time < b.user_updated_time ? +1 : -1; });
let answers = { 0: _('[Cancel]') };
for (let i = 0; i < output.length; i++) {
answers[i + 1] = output[i].title;
}
let msg = _('More than one item match "%s". Please select one:', pattern);
const response = await cliUtils.promptMcq(msg, answers);
if (!response) return null;

View File

@ -32,7 +32,7 @@ class Command extends BaseCommand {
}
async action(args) {
Command.handleAction(args, true);
await Command.handleAction(args, true);
}
}

View File

@ -19,7 +19,7 @@ class Command extends BaseCommand {
}
async action(args) {
CommandDone.handleAction(args, false);
await CommandDone.handleAction(args, false);
}
}

View File

@ -239,20 +239,22 @@ class ScreenHeaderComponent extends Component {
</MenuOption>);
}
if (menuOptionComponents.length) {
menuOptionComponents.push(<View key={'menuOption_' + key++} style={this.styles().divider}/>);
if (this.props.showAdvancedOptions) {
if (menuOptionComponents.length) {
menuOptionComponents.push(<View key={'menuOption_' + key++} style={this.styles().divider}/>);
}
menuOptionComponents.push(
<MenuOption value={() => this.log_press()} key={'menuOption_' + key++} style={this.styles().contextMenuItem}>
<Text style={this.styles().contextMenuItemText}>{_('Log')}</Text>
</MenuOption>);
menuOptionComponents.push(
<MenuOption value={() => this.status_press()} key={'menuOption_' + key++} style={this.styles().contextMenuItem}>
<Text style={this.styles().contextMenuItemText}>{_('Status')}</Text>
</MenuOption>);
}
menuOptionComponents.push(
<MenuOption value={() => this.log_press()} key={'menuOption_' + key++} style={this.styles().contextMenuItem}>
<Text style={this.styles().contextMenuItemText}>{_('Log')}</Text>
</MenuOption>);
menuOptionComponents.push(
<MenuOption value={() => this.status_press()} key={'menuOption_' + key++} style={this.styles().contextMenuItem}>
<Text style={this.styles().contextMenuItemText}>{_('Status')}</Text>
</MenuOption>);
if (menuOptionComponents.length) {
menuOptionComponents.push(<View key={'menuOption_' + key++} style={this.styles().divider}/>);
}
@ -316,6 +318,7 @@ const ScreenHeader = connect(
historyCanGoBack: state.historyCanGoBack,
locale: state.settings.locale,
theme: state.settings.theme,
showAdvancedOptions: state.settings.showAdvancedOptions,
};
}
)(ScreenHeaderComponent)

View File

@ -220,6 +220,8 @@ class NoteScreenComponent extends BaseScreenComponent {
});
if (isNew) Note.updateGeolocation(note.id);
this.refreshNoteMetadata();
Keyboard.dismiss();
}
async saveOneProperty(name, value) {
@ -385,7 +387,7 @@ class NoteScreenComponent extends BaseScreenComponent {
// }
output.push({ title: isTodo ? _('Convert to regular note') : _('Convert to todo'), onPress: () => { this.toggleIsTodo_onPress(); } });
output.push({ title: this.state.showNoteMetadata ? _('Hide metadata') : _('Show metadata'), onPress: () => { this.showMetadata_onPress(); } });
if (this.props.showAdvancedOptions) output.push({ title: this.state.showNoteMetadata ? _('Hide metadata') : _('Show metadata'), onPress: () => { this.showMetadata_onPress(); } });
output.push({ title: _('View location on map'), onPress: () => { this.showOnMap_onPress(); } });
return output;
@ -555,6 +557,7 @@ const NoteScreen = connect(
itemType: state.selectedItemType,
folders: state.folders,
theme: state.settings.theme,
showAdvancedOptions: state.settings.showAdvancedOptions,
};
}
)(NoteScreenComponent)

View File

@ -334,6 +334,7 @@ Setting.metadata_ = {
nonCompleted: _('Non-completed ones only'),
})},
'uncompletedTodosOnTop': { value: true, type: Setting.TYPE_BOOL, public: true, label: () => _('Show uncompleted todos on top of the lists') },
'showAdvancedOptions': { value: false, type: Setting.TYPE_BOOL, public: true, appTypes: ['mobile'], label: () => _('Show advanced options') },
'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, appTypes: ['mobile'], label: () => _('Synchronisation interval'), options: () => {
return {