From ef17dc5dccf3dece3503bbbd9679798f36c5e2db Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 8 Dec 2025 02:08:39 +0000 Subject: [PATCH 1/3] Initial plan From 9a768b240181df1688d076c0358a6cdb7413ef60 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 8 Dec 2025 02:17:10 +0000 Subject: [PATCH 2/3] Add remember choice option for protected view notice Co-authored-by: emako <24737061+emako@users.noreply.github.com> --- .../QuickLook.Plugin.OfficeViewer/Plugin.cs | 41 +++++++++---- .../ProtectedViewDialog.xaml | 60 +++++++++++++++++++ .../ProtectedViewDialog.xaml.cs | 45 ++++++++++++++ 3 files changed, 133 insertions(+), 13 deletions(-) create mode 100644 QuickLook.Plugin/QuickLook.Plugin.OfficeViewer/ProtectedViewDialog.xaml create mode 100644 QuickLook.Plugin/QuickLook.Plugin.OfficeViewer/ProtectedViewDialog.xaml.cs diff --git a/QuickLook.Plugin/QuickLook.Plugin.OfficeViewer/Plugin.cs b/QuickLook.Plugin/QuickLook.Plugin.OfficeViewer/Plugin.cs index 63e78971d..de8d32f3f 100644 --- a/QuickLook.Plugin/QuickLook.Plugin.OfficeViewer/Plugin.cs +++ b/QuickLook.Plugin/QuickLook.Plugin.OfficeViewer/Plugin.cs @@ -108,19 +108,34 @@ public void View(string path, ContextObject context) { context.Title = $"[PROTECTED VIEW] {Path.GetFileName(path)}"; - MessageBoxResult result = MessageBox.Show( - """ - Be careful - files from the Internet can contain viruses. - The Office interface prevents loading in Protected View. - - Would you like OfficeViewer-Native to unblock the ZoneIdentifier of Internet? - """, - "PROTECTED VIEW", - MessageBoxButton.YesNo, - MessageBoxImage.Question - ); - - if (result == MessageBoxResult.Yes) + // Check if user has previously chosen to always unblock + var alwaysUnblock = SettingHelper.Get("AlwaysUnblockProtectedView", false, "QuickLook.Plugin.OfficeViewer"); + + bool shouldUnblock = alwaysUnblock; + + if (!alwaysUnblock) + { + // Show dialog to ask user + var dialog = new ProtectedViewDialog(); + var dialogResult = dialog.ShowDialog(); + + if (dialogResult == true) + { + shouldUnblock = true; + + // Save preference if user checked "Remember my choice" + if (dialog.RememberChoice) + { + SettingHelper.Set("AlwaysUnblockProtectedView", true, "QuickLook.Plugin.OfficeViewer"); + } + } + else + { + shouldUnblock = false; + } + } + + if (shouldUnblock) { _ = ZoneIdentifierManager.UnblockZone(path); } diff --git a/QuickLook.Plugin/QuickLook.Plugin.OfficeViewer/ProtectedViewDialog.xaml b/QuickLook.Plugin/QuickLook.Plugin.OfficeViewer/ProtectedViewDialog.xaml new file mode 100644 index 000000000..41789c66c --- /dev/null +++ b/QuickLook.Plugin/QuickLook.Plugin.OfficeViewer/ProtectedViewDialog.xaml @@ -0,0 +1,60 @@ + + + + + + + + + + + Be careful - files from the Internet can contain viruses. + + + + The Office interface prevents loading in Protected View. + + + + Would you like OfficeViewer-Native to unblock the ZoneIdentifier of Internet? + + + + + + +