Skip to content

Commit

Permalink
Fix issues from review
Browse files Browse the repository at this point in the history
  • Loading branch information
Greg Depoire--Ferrer committed Jun 22, 2020
1 parent 21b163b commit e4ccf28
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 3 deletions.
22 changes: 21 additions & 1 deletion src/cascadia/TerminalApp/TerminalPage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,7 @@ namespace winrt::TerminalApp::implementation
// when this is called, nothing happens. See _ShowDialog for details
void TerminalPage::_ShowLargePasteWarningDialog()
{
_showDialogHandlers(*this, FindName(L"BigPasteDialog").try_as<WUX::Controls::ContentDialog>());
_showDialogHandlers(*this, FindName(L"LargePasteDialog").try_as<WUX::Controls::ContentDialog>());
}

// Method Description:
Expand Down Expand Up @@ -1765,6 +1765,13 @@ namespace winrt::TerminalApp::implementation
_CloseAllTabs();
}

// Method Description:
// - Called when the user wants to paste the text anyway after a paste
// warning.
// - Sends the clipboard's text to the `TermControl`.
// Arguments:
// - sender: unused
// - ContentDialogButtonClickEventArgs: unused
void TerminalPage::_AcceptPasteButtonOnClick(WUX::Controls::ContentDialog /* sender */,
WUX::Controls::ContentDialogButtonClickEventArgs /* eventArgs*/)
{
Expand All @@ -1775,6 +1782,19 @@ namespace winrt::TerminalApp::implementation
}
}

// Method Description:
// - Called when the user closes a warning dialog about pasting text.
// - Destroys the callback to send the clipboard's text to the
// `TermControl` because the user cancelled the paste operation.
// Arguments:
// - sender: unused
// - ContentDialogButtonClickEventArgs: unused
void TerminalPage::_RejectPasteButtonOnClick(WUX::Controls::ContentDialog /* sender */,
WUX::Controls::ContentDialogButtonClickEventArgs /* eventArgs*/)
{
_acceptPaste = nullptr;
}

// Method Description:
// - Hook up keybindings, and refresh the UI of the terminal.
// This includes update the settings of all the tabs according
Expand Down
1 change: 1 addition & 0 deletions src/cascadia/TerminalApp/TerminalPage.h
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ namespace winrt::TerminalApp::implementation
void _AboutButtonOnClick(const IInspectable& sender, const Windows::UI::Xaml::RoutedEventArgs& eventArgs);
void _CloseWarningPrimaryButtonOnClick(Windows::UI::Xaml::Controls::ContentDialog sender, Windows::UI::Xaml::Controls::ContentDialogButtonClickEventArgs eventArgs);
void _AcceptPasteButtonOnClick(Windows::UI::Xaml::Controls::ContentDialog sender, Windows::UI::Xaml::Controls::ContentDialogButtonClickEventArgs eventArgs);
void _RejectPasteButtonOnClick(Windows::UI::Xaml::Controls::ContentDialog sender, Windows::UI::Xaml::Controls::ContentDialogButtonClickEventArgs eventArgs);
void _ThirdPartyNoticesOnClick(const IInspectable& sender, const Windows::UI::Xaml::RoutedEventArgs& eventArgs);

void _HookupKeyBindings(TerminalApp::AppKeyBindings bindings) noexcept;
Expand Down
6 changes: 4 additions & 2 deletions src/cascadia/TerminalApp/TerminalPage.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -59,15 +59,17 @@ the MIT License. See LICENSE in the project root for license information. -->
x:Name="MultiLinePasteDialog"
x:Uid="MultiLinePasteDialog"
DefaultButton="Primary"
PrimaryButtonClick="_AcceptPasteButtonOnClick">
PrimaryButtonClick="_AcceptPasteButtonOnClick"
CloseButtonClick="_RejectPasteButtonOnClick">
</ContentDialog>

<ContentDialog
x:Load="False"
x:Name="LargePasteDialog"
x:Uid="LargePasteDialog"
DefaultButton="Primary"
PrimaryButtonClick="_AcceptPasteButtonOnClick">
PrimaryButtonClick="_AcceptPasteButtonOnClick"
CloseButtonClick="_RejectPasteButtonOnClick">
</ContentDialog>
</Grid>
</Page>

0 comments on commit e4ccf28

Please sign in to comment.