mirror of
https://github.com/Foundry376/Mailspring.git
synced 2025-02-24 08:04:11 +08:00
Added confirmation dialog before resetting accounts and settings (#1486)
This commit is contained in:
parent
b620157464
commit
598d8cc7ef
1 changed files with 20 additions and 11 deletions
|
@ -8,6 +8,7 @@ import WorkspaceSection from './workspace-section';
|
||||||
import SendingSection from './sending-section';
|
import SendingSection from './sending-section';
|
||||||
import LanguageSection from './language-section';
|
import LanguageSection from './language-section';
|
||||||
import { ConfigLike, ConfigSchemaLike } from '../types';
|
import { ConfigLike, ConfigSchemaLike } from '../types';
|
||||||
|
import {remote} from "electron";
|
||||||
|
|
||||||
class PreferencesGeneral extends React.Component<{
|
class PreferencesGeneral extends React.Component<{
|
||||||
config: ConfigLike;
|
config: ConfigLike;
|
||||||
|
@ -27,6 +28,13 @@ class PreferencesGeneral extends React.Component<{
|
||||||
};
|
};
|
||||||
|
|
||||||
_onResetAccountsAndSettings = () => {
|
_onResetAccountsAndSettings = () => {
|
||||||
|
const chosen = remote.dialog.showMessageBox(AppEnv.getCurrentWindow(), {
|
||||||
|
type: 'info',
|
||||||
|
message: localized('Are you sure?'),
|
||||||
|
buttons: [localized('Cancel'), localized('Reset')],
|
||||||
|
});
|
||||||
|
|
||||||
|
if (chosen === 1) {
|
||||||
rimraf(AppEnv.getConfigDirPath(), { disableGlob: true }, err => {
|
rimraf(AppEnv.getConfigDirPath(), { disableGlob: true }, err => {
|
||||||
if (err) {
|
if (err) {
|
||||||
return AppEnv.showErrorDialog(
|
return AppEnv.showErrorDialog(
|
||||||
|
@ -39,6 +47,7 @@ class PreferencesGeneral extends React.Component<{
|
||||||
}
|
}
|
||||||
this._onReboot();
|
this._onReboot();
|
||||||
});
|
});
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
_onResetEmailCache = () => {
|
_onResetEmailCache = () => {
|
||||||
|
|
Loading…
Reference in a new issue