mirror of
https://github.com/microsoft/terminal.git
synced 2026-07-08 18:16:28 +00:00
## Summary of the Pull Request Replaces the `warning.confirmCloseAllTabs` setting with a `warning.confirmOnClose` enum setting that accepts the following: - `never`: don't present a warning dialog when closing a session - `automatic`: present a warning dialog when closing multiple tabs/panes at once - `always`: present a warning dialog when closing any session The confirmation dialog contains a "don't ask me again" checkbox. When checked, we update the setting to `never`. This setting also affects the following actions: - "close other tabs" - "close tabs after" - "close other panes" - "quit" The appropriate confirmation dialog is shown in these scenarios. We also present an aggregate dialog instead of prompting the user once per tab/pane. If there are no other tabs/panes, we don't present a dialog and treat the key binding as unhandled (passing the key through). ## References and Relevant Issues Iteration of #19944 ## Validation Steps Performed - closing a tab: - ✅ 1 pane --> no dialog - ✅ 2 panes --> dialog - ✅ action and middle clicking tab trigger same flow - close all other tabs: - ✅ no other tabs --> no dialog - ✅ 1 other tab --> dialog - close all other panes: - ✅ 1 pane --> no dialog - ✅ 2 panes --> dialog - close all tabs after the current tab: - ✅ no tabs after --> no dialog (even if tabs before) - ✅ 1 tab after --> dialog - close window: - ✅ 2 tabs --> dialog - ✅ 2 panes --> dialog - ✅ 1 tab with one pane --> no dialog - Quit the Terminal: - ✅ 3 windows --> dialog - ✅1 window --> dialog - ✅ "don't ask me again" checkbox checked --> setting changed to "never" - ✅ "never" --> no dialog for scenarios above - ✅ "always" --> dialog always appears, even when closing a single pane ## PR Checklist Closes #5301 Closes #6641 "don't ask me again" checkbox is also mentioned in #10000 Co-authored by @zadjii-msft
48 lines
2.4 KiB
C++
48 lines
2.4 KiB
C++
// Copyright (c) Microsoft Corporation.
|
|
// Licensed under the MIT license.
|
|
|
|
#pragma once
|
|
|
|
#include "InteractionViewModel.g.h"
|
|
#include "ViewModelHelpers.h"
|
|
#include "Utils.h"
|
|
|
|
namespace winrt::Microsoft::Terminal::Settings::Editor::implementation
|
|
{
|
|
struct InteractionViewModel : InteractionViewModelT<InteractionViewModel>, ViewModelHelper<InteractionViewModel>
|
|
{
|
|
public:
|
|
InteractionViewModel(Model::GlobalAppSettings globalSettings);
|
|
|
|
// DON'T YOU DARE ADD A `WINRT_CALLBACK(PropertyChanged` TO A CLASS DERIVED FROM ViewModelHelper. Do this instead:
|
|
using ViewModelHelper<InteractionViewModel>::PropertyChanged;
|
|
|
|
GETSET_BINDABLE_ENUM_SETTING(TabSwitcherMode, Model::TabSwitcherMode, _GlobalSettings.TabSwitcherMode);
|
|
GETSET_BINDABLE_ENUM_SETTING(CopyFormat, winrt::Microsoft::Terminal::Control::CopyFormat, _GlobalSettings.CopyFormatting);
|
|
GETSET_BINDABLE_ENUM_SETTING(ConfirmOnClose, Model::ConfirmOnClose, _GlobalSettings.ConfirmOnClose);
|
|
|
|
PERMANENT_OBSERVABLE_PROJECTED_SETTING(_GlobalSettings, CopyOnSelect);
|
|
PERMANENT_OBSERVABLE_PROJECTED_SETTING(_GlobalSettings, TrimBlockSelection);
|
|
PERMANENT_OBSERVABLE_PROJECTED_SETTING(_GlobalSettings, TrimPaste);
|
|
PERMANENT_OBSERVABLE_PROJECTED_SETTING(_GlobalSettings, SnapToGridOnResize);
|
|
PERMANENT_OBSERVABLE_PROJECTED_SETTING(_GlobalSettings, FocusFollowMouse);
|
|
PERMANENT_OBSERVABLE_PROJECTED_SETTING(_GlobalSettings, ScrollToZoom);
|
|
PERMANENT_OBSERVABLE_PROJECTED_SETTING(_GlobalSettings, ScrollToChangeOpacity);
|
|
PERMANENT_OBSERVABLE_PROJECTED_SETTING(_GlobalSettings, DetectURLs);
|
|
PERMANENT_OBSERVABLE_PROJECTED_SETTING(_GlobalSettings, SearchWebDefaultQueryUrl);
|
|
PERMANENT_OBSERVABLE_PROJECTED_SETTING(_GlobalSettings, WordDelimiters);
|
|
PERMANENT_OBSERVABLE_PROJECTED_SETTING(_GlobalSettings, InputServiceWarning);
|
|
PERMANENT_OBSERVABLE_PROJECTED_SETTING(_GlobalSettings, WarnAboutLargePaste);
|
|
PERMANENT_OBSERVABLE_PROJECTED_SETTING(_GlobalSettings, WarnAboutMultiLinePaste);
|
|
PERMANENT_OBSERVABLE_PROJECTED_SETTING(_GlobalSettings, EnableColorSelection);
|
|
|
|
private:
|
|
Model::GlobalAppSettings _GlobalSettings;
|
|
};
|
|
};
|
|
|
|
namespace winrt::Microsoft::Terminal::Settings::Editor::factory_implementation
|
|
{
|
|
BASIC_FACTORY(InteractionViewModel);
|
|
}
|