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