mirror of
https://github.com/GitJournal/GitJournal.git
synced 2025-06-28 09:47:35 +08:00
@ -110,6 +110,7 @@ settings:
|
|||||||
title: Misc Settings
|
title: Misc Settings
|
||||||
swipe: Swipe to Delete Note
|
swipe: Swipe to Delete Note
|
||||||
listView: List View
|
listView: List View
|
||||||
|
confirmDelete: Show a Popup to Confirm Deletes
|
||||||
NoteFileNameFormat:
|
NoteFileNameFormat:
|
||||||
iso8601WithTimeZone: ISO8601 With TimeZone
|
iso8601WithTimeZone: ISO8601 With TimeZone
|
||||||
iso8601: ISO8601
|
iso8601: ISO8601
|
||||||
|
@ -485,10 +485,14 @@ class _FolderViewState extends State<FolderView> {
|
|||||||
void _deleteNote() async {
|
void _deleteNote() async {
|
||||||
var note = selectedNote;
|
var note = selectedNote;
|
||||||
|
|
||||||
var shouldDelete = await showDialog(
|
var settings = Provider.of<Settings>(context, listen: false);
|
||||||
|
var shouldDelete = true;
|
||||||
|
if (settings.confirmDelete) {
|
||||||
|
shouldDelete = await showDialog(
|
||||||
context: context,
|
context: context,
|
||||||
builder: (context) => NoteDeleteDialog(),
|
builder: (context) => NoteDeleteDialog(),
|
||||||
);
|
);
|
||||||
|
}
|
||||||
if (shouldDelete == true) {
|
if (shouldDelete == true) {
|
||||||
var stateContainer = Provider.of<Repository>(context, listen: false);
|
var stateContainer = Provider.of<Repository>(context, listen: false);
|
||||||
stateContainer.removeNote(note);
|
stateContainer.removeNote(note);
|
||||||
|
@ -17,6 +17,7 @@ import 'package:gitjournal/editors/markdown_editor.dart';
|
|||||||
import 'package:gitjournal/editors/raw_editor.dart';
|
import 'package:gitjournal/editors/raw_editor.dart';
|
||||||
import 'package:gitjournal/error_reporting.dart';
|
import 'package:gitjournal/error_reporting.dart';
|
||||||
import 'package:gitjournal/repository.dart';
|
import 'package:gitjournal/repository.dart';
|
||||||
|
import 'package:gitjournal/settings.dart';
|
||||||
import 'package:gitjournal/utils.dart';
|
import 'package:gitjournal/utils.dart';
|
||||||
import 'package:gitjournal/utils/logger.dart';
|
import 'package:gitjournal/utils/logger.dart';
|
||||||
import 'package:gitjournal/widgets/folder_selection_dialog.dart';
|
import 'package:gitjournal/widgets/folder_selection_dialog.dart';
|
||||||
@ -293,10 +294,14 @@ class NoteEditorState extends State<NoteEditor> with WidgetsBindingObserver {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var shouldDelete = await showDialog(
|
var settings = Provider.of<Settings>(context, listen: false);
|
||||||
|
var shouldDelete = true;
|
||||||
|
if (settings.confirmDelete) {
|
||||||
|
shouldDelete = await showDialog(
|
||||||
context: context,
|
context: context,
|
||||||
builder: (context) => NoteDeleteDialog(),
|
builder: (context) => NoteDeleteDialog(),
|
||||||
);
|
);
|
||||||
|
}
|
||||||
if (shouldDelete == true) {
|
if (shouldDelete == true) {
|
||||||
_deleteNote(note);
|
_deleteNote(note);
|
||||||
|
|
||||||
|
@ -27,6 +27,14 @@ class _SettingsMiscState extends State<SettingsMisc> {
|
|||||||
settings.save();
|
settings.save();
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
|
SwitchListTile(
|
||||||
|
title: Text(tr('settings.misc.confirmDelete')),
|
||||||
|
value: settings.confirmDelete,
|
||||||
|
onChanged: (bool newVal) {
|
||||||
|
settings.confirmDelete = newVal;
|
||||||
|
settings.save();
|
||||||
|
},
|
||||||
|
),
|
||||||
],
|
],
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
);
|
);
|
||||||
|
@ -65,6 +65,7 @@ class Settings extends ChangeNotifier {
|
|||||||
Set<String> inlineTagPrefixes = {'#'};
|
Set<String> inlineTagPrefixes = {'#'};
|
||||||
|
|
||||||
bool bottomMenuBar = true;
|
bool bottomMenuBar = true;
|
||||||
|
bool confirmDelete = true;
|
||||||
|
|
||||||
bool storeInternally = true;
|
bool storeInternally = true;
|
||||||
String storageLocation = "";
|
String storageLocation = "";
|
||||||
@ -145,6 +146,7 @@ class Settings extends ChangeNotifier {
|
|||||||
sshPassword = _getString(pref, "sshPassword") ?? sshPassword;
|
sshPassword = _getString(pref, "sshPassword") ?? sshPassword;
|
||||||
|
|
||||||
bottomMenuBar = _getBool(pref, "bottomMenuBar") ?? bottomMenuBar;
|
bottomMenuBar = _getBool(pref, "bottomMenuBar") ?? bottomMenuBar;
|
||||||
|
confirmDelete = _getBool(pref, "confirmDelete") ?? confirmDelete;
|
||||||
storeInternally = _getBool(pref, "storeInternally") ?? storeInternally;
|
storeInternally = _getBool(pref, "storeInternally") ?? storeInternally;
|
||||||
storageLocation = _getString(pref, "storageLocation") ?? "";
|
storageLocation = _getString(pref, "storageLocation") ?? "";
|
||||||
}
|
}
|
||||||
@ -241,6 +243,8 @@ class Settings extends ChangeNotifier {
|
|||||||
defaultSet.inlineTagPrefixes);
|
defaultSet.inlineTagPrefixes);
|
||||||
await _setBool(
|
await _setBool(
|
||||||
pref, "bottomMenuBar", bottomMenuBar, defaultSet.bottomMenuBar);
|
pref, "bottomMenuBar", bottomMenuBar, defaultSet.bottomMenuBar);
|
||||||
|
await _setBool(
|
||||||
|
pref, "confirmDelete", confirmDelete, defaultSet.confirmDelete);
|
||||||
await _setBool(
|
await _setBool(
|
||||||
pref, "storeInternally", storeInternally, defaultSet.storeInternally);
|
pref, "storeInternally", storeInternally, defaultSet.storeInternally);
|
||||||
await _setString(
|
await _setString(
|
||||||
@ -353,6 +357,7 @@ class Settings extends ChangeNotifier {
|
|||||||
'emojiParser': emojiParser.toString(),
|
'emojiParser': emojiParser.toString(),
|
||||||
'folderName': folderName.toString(),
|
'folderName': folderName.toString(),
|
||||||
'bottomMenuBar': bottomMenuBar.toString(),
|
'bottomMenuBar': bottomMenuBar.toString(),
|
||||||
|
'confirmDelete': confirmDelete.toString(),
|
||||||
'storeInternally': storeInternally.toString(),
|
'storeInternally': storeInternally.toString(),
|
||||||
'storageLocation': storageLocation,
|
'storageLocation': storageLocation,
|
||||||
'sshPublicKey': sshPublicKey.isNotEmpty.toString(),
|
'sshPublicKey': sshPublicKey.isNotEmpty.toString(),
|
||||||
|
Reference in New Issue
Block a user