mirror of
https://github.com/coteditor/CotEditor.git
synced 2024-09-11 11:25:57 +03:00
Disable restart dialog for “Reopen windows from last session” option
This commit is contained in:
parent
f7ba6baf03
commit
137b22fcd1
@ -10,6 +10,7 @@
|
||||
- Change the filter field for the outline inspector to apply the selection of the filter history immediately.
|
||||
- Remove wrapped line marks in the line number view.
|
||||
- Update the Makefile syntax to add `GNUmakefile` to the filename mapping.
|
||||
- [trivial] Remove the dialog urging to restart the application by changing the “Reopen windows from last session” option in the General settings pane.
|
||||
- [dev] Update Yams from 5.1.0 to 5.1.1.
|
||||
|
||||
|
||||
|
@ -26,7 +26,7 @@
|
||||
<tbody>
|
||||
<tr>
|
||||
<th>Reopen windows from last session</th>
|
||||
<td>On starting up, automatically opens the documents that were opened when quitting last time.</td>
|
||||
<td>On starting up, automatically opens the documents that were opened when quitting last time. This change is first applied at the next application launch and is reflected at the next launch after that.</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
|
@ -26,7 +26,7 @@
|
||||
<tbody>
|
||||
<tr>
|
||||
<th>最後のセッションのウインドウを開く</th>
|
||||
<td>CotEditorを起動したときに、前回の終了時に開いていた書類を自動的に開いて表示します。</td>
|
||||
<td>CotEditorを起動したときに、前回の終了時に開いていた書類を自動的に開いて表示します。この設定の変更は次回起動時に適用され、そのさらに次の起動から反映されます。</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
|
@ -1088,6 +1088,7 @@
|
||||
}
|
||||
},
|
||||
"Later" : {
|
||||
"comment" : "button label",
|
||||
"localizations" : {
|
||||
"cs" : {
|
||||
"stringUnit" : {
|
||||
@ -1662,6 +1663,7 @@
|
||||
}
|
||||
},
|
||||
"Restart Now" : {
|
||||
"comment" : "button label",
|
||||
"localizations" : {
|
||||
"cs" : {
|
||||
"stringUnit" : {
|
||||
|
@ -39,10 +39,9 @@ struct GeneralSettingsView: View {
|
||||
@AppStorage(.enablesAutosaveInPlace) private var enablesAutosaveInPlace: Bool
|
||||
@AppStorage(.documentConflictOption) private var documentConflictOption: DocumentConflictOption
|
||||
|
||||
@State private var initialQuitAlwaysKeepsWindows: Bool = false
|
||||
@State private var initialEnablesAutosaveInPlace: Bool = false
|
||||
|
||||
@State private var askingKey: DefaultKey<Bool>?
|
||||
@State private var isAutosaveChangeDialogPresented = false
|
||||
@State private var isWarningsSettingPresented = false
|
||||
|
||||
@State private var commandLineToolStatus: CommandLineToolManager.Status = .none
|
||||
@ -60,14 +59,6 @@ struct GeneralSettingsView: View {
|
||||
|
||||
VStack(alignment: .leading) {
|
||||
Toggle(String(localized: "Reopen windows from last session", table: "GeneralSettings"), isOn: $quitAlwaysKeepsWindows)
|
||||
.onChange(of: self.quitAlwaysKeepsWindows) { newValue in
|
||||
if newValue != self.initialQuitAlwaysKeepsWindows {
|
||||
self.askingKey = .quitAlwaysKeepsWindows
|
||||
}
|
||||
}
|
||||
.onAppear {
|
||||
self.initialQuitAlwaysKeepsWindows = self.quitAlwaysKeepsWindows
|
||||
}
|
||||
|
||||
Text("When nothing else is open:", tableName: "GeneralSettings")
|
||||
Picker(selection: $noDocumentOnLaunchOption) {
|
||||
@ -92,12 +83,26 @@ struct GeneralSettingsView: View {
|
||||
Toggle(String(localized: "Enable Auto Save with Versions", table: "GeneralSettings"), isOn: $enablesAutosaveInPlace)
|
||||
.onChange(of: self.enablesAutosaveInPlace) { newValue in
|
||||
if newValue != self.initialEnablesAutosaveInPlace {
|
||||
self.askingKey = .enablesAutosaveInPlace
|
||||
self.isAutosaveChangeDialogPresented = true
|
||||
}
|
||||
}
|
||||
.onAppear {
|
||||
self.initialEnablesAutosaveInPlace = self.enablesAutosaveInPlace
|
||||
}
|
||||
.alert(String(localized: "The change will be applied first on the next launch.", table: "GeneralSettings"), isPresented: $isAutosaveChangeDialogPresented) {
|
||||
Button(String(localized: "Restart Now", table: "GeneralSettings", comment: "button label")) {
|
||||
(NSApp.delegate as? AppDelegate)?.needsRelaunch = true
|
||||
NSApp.terminate(self)
|
||||
}
|
||||
Button(String(localized: "Later", table: "GeneralSettings", comment: "button label")) {
|
||||
// do nothing
|
||||
}
|
||||
Button("Cancel", role: .cancel) {
|
||||
self.enablesAutosaveInPlace.toggle()
|
||||
}
|
||||
} message: {
|
||||
Text("Do you want to restart CotEditor now?", tableName: "GeneralSettings")
|
||||
}
|
||||
Text("A system feature that automatically overwrites your files while editing. Even if it turned off, CotEditor creates backup covertly for unexpected quit.", tableName: "GeneralSettings")
|
||||
.foregroundStyle(.secondary)
|
||||
.controlSize(.small)
|
||||
@ -185,34 +190,6 @@ struct GeneralSettingsView: View {
|
||||
self.commandLineToolStatus = CommandLineToolManager.shared.validateSymlink()
|
||||
self.commandLineToolURL = CommandLineToolManager.shared.linkURL
|
||||
}
|
||||
.alert(String(localized: "The change will be applied first on the next launch.", table: "GeneralSettings"), isPresented: .constant(self.askingKey != nil)) {
|
||||
Button(String(localized: "Restart Now", table: "GeneralSettings")) {
|
||||
(NSApp.delegate as? AppDelegate)?.needsRelaunch = true
|
||||
NSApp.terminate(self)
|
||||
self.askingKey = nil
|
||||
}
|
||||
Button(String(localized: "Later", table: "GeneralSettings")) {
|
||||
// do nothing
|
||||
self.askingKey = nil
|
||||
}
|
||||
Button("Cancel", role: .cancel) {
|
||||
if let askingKey {
|
||||
// revert state
|
||||
switch askingKey {
|
||||
case .quitAlwaysKeepsWindows:
|
||||
self.quitAlwaysKeepsWindows.toggle()
|
||||
case .enablesAutosaveInPlace:
|
||||
self.enablesAutosaveInPlace.toggle()
|
||||
default:
|
||||
break
|
||||
}
|
||||
|
||||
self.askingKey = nil
|
||||
}
|
||||
}
|
||||
} message: {
|
||||
Text("Do you want to restart CotEditor now?", tableName: "GeneralSettings")
|
||||
}
|
||||
.scenePadding()
|
||||
.frame(minWidth: 600, idealWidth: 600)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user