2016-07-27 07:53:26 +08:00
|
|
|
/* eslint global-require: 0*/
|
2016-04-01 06:52:03 +08:00
|
|
|
import React from 'react';
|
2017-09-27 02:33:08 +08:00
|
|
|
import PropTypes from 'prop-types';
|
2016-04-01 06:52:03 +08:00
|
|
|
|
2017-09-27 02:42:18 +08:00
|
|
|
import { Actions } from 'mailspring-exports';
|
2016-04-01 06:52:03 +08:00
|
|
|
import ConfigSchemaItem from './config-schema-item';
|
|
|
|
import WorkspaceSection from './workspace-section';
|
|
|
|
import SendingSection from './sending-section';
|
2017-08-01 13:21:00 +08:00
|
|
|
|
2016-07-27 07:53:26 +08:00
|
|
|
class PreferencesGeneral extends React.Component {
|
2017-09-27 02:33:08 +08:00
|
|
|
static displayName = 'PreferencesGeneral';
|
2016-05-07 07:23:48 +08:00
|
|
|
|
2016-07-27 07:53:26 +08:00
|
|
|
static propTypes = {
|
2017-09-27 02:33:08 +08:00
|
|
|
config: PropTypes.object,
|
|
|
|
configSchema: PropTypes.object,
|
2016-07-27 07:53:26 +08:00
|
|
|
};
|
2016-05-07 07:23:48 +08:00
|
|
|
|
2016-07-27 07:53:26 +08:00
|
|
|
_reboot = () => {
|
|
|
|
const app = require('electron').remote.app;
|
2017-09-27 02:33:08 +08:00
|
|
|
app.relaunch();
|
|
|
|
app.quit();
|
|
|
|
};
|
2016-07-27 07:53:26 +08:00
|
|
|
|
|
|
|
_resetAccountsAndSettings = () => {
|
2017-09-27 02:33:08 +08:00
|
|
|
const rimraf = require('rimraf');
|
2017-09-27 02:36:58 +08:00
|
|
|
rimraf(AppEnv.getConfigDirPath(), { disableGlob: true }, err => {
|
2017-09-27 02:33:08 +08:00
|
|
|
if (err) console.log(err);
|
|
|
|
else this._reboot();
|
|
|
|
});
|
|
|
|
};
|
2016-07-27 07:53:26 +08:00
|
|
|
|
|
|
|
_resetEmailCache = () => {
|
2017-09-27 02:33:08 +08:00
|
|
|
Actions.resetEmailCache();
|
|
|
|
};
|
2016-07-27 07:53:26 +08:00
|
|
|
|
|
|
|
render() {
|
|
|
|
return (
|
2017-09-27 02:33:08 +08:00
|
|
|
<div className="container-general" style={{ maxWidth: 600 }}>
|
2016-07-27 07:53:26 +08:00
|
|
|
<WorkspaceSection config={this.props.config} configSchema={this.props.configSchema} />
|
2016-04-01 06:52:03 +08:00
|
|
|
|
2016-07-27 07:53:26 +08:00
|
|
|
<ConfigSchemaItem
|
|
|
|
configSchema={this.props.configSchema.properties.notifications}
|
|
|
|
keyName="Notifications"
|
|
|
|
keyPath="core.notifications"
|
|
|
|
config={this.props.config}
|
|
|
|
/>
|
|
|
|
|
|
|
|
<div className="platform-note platform-linux-only">
|
2017-09-27 02:33:08 +08:00
|
|
|
N1 desktop notifications on Linux require Zenity. You may need to install it with your
|
|
|
|
package manager (i.e., <code>sudo apt-get install zenity</code>).
|
2016-07-27 07:53:26 +08:00
|
|
|
</div>
|
|
|
|
|
|
|
|
<ConfigSchemaItem
|
|
|
|
configSchema={this.props.configSchema.properties.reading}
|
|
|
|
keyName="Reading"
|
|
|
|
keyPath="core.reading"
|
|
|
|
config={this.props.config}
|
|
|
|
/>
|
|
|
|
|
|
|
|
<ConfigSchemaItem
|
|
|
|
configSchema={this.props.configSchema.properties.composing}
|
|
|
|
keyName="Composing"
|
|
|
|
keyPath="core.composing"
|
|
|
|
config={this.props.config}
|
|
|
|
/>
|
|
|
|
|
2017-09-27 02:33:08 +08:00
|
|
|
<SendingSection config={this.props.config} configSchema={this.props.configSchema} />
|
2016-07-27 07:53:26 +08:00
|
|
|
|
|
|
|
<ConfigSchemaItem
|
|
|
|
configSchema={this.props.configSchema.properties.attachments}
|
|
|
|
keyName="Attachments"
|
|
|
|
keyPath="core.attachments"
|
|
|
|
config={this.props.config}
|
|
|
|
/>
|
|
|
|
|
|
|
|
<div className="local-data">
|
|
|
|
<h6>Local Data</h6>
|
2017-09-27 02:33:08 +08:00
|
|
|
<div className="btn" onClick={this._resetEmailCache}>
|
|
|
|
Reset Email Cache
|
|
|
|
</div>
|
|
|
|
<div className="btn" onClick={this._resetAccountsAndSettings}>
|
|
|
|
Reset Accounts and Settings
|
|
|
|
</div>
|
2016-07-27 07:53:26 +08:00
|
|
|
</div>
|
|
|
|
</div>
|
2017-09-27 02:33:08 +08:00
|
|
|
);
|
2016-07-27 07:53:26 +08:00
|
|
|
}
|
2016-04-01 06:52:03 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
export default PreferencesGeneral;
|