diff --git a/QuickLook.Plugin/QuickLook.Plugin.OfficeViewer/Plugin.cs b/QuickLook.Plugin/QuickLook.Plugin.OfficeViewer/Plugin.cs
index 63e7897..de8d32f 100644
--- a/QuickLook.Plugin/QuickLook.Plugin.OfficeViewer/Plugin.cs
+++ b/QuickLook.Plugin/QuickLook.Plugin.OfficeViewer/Plugin.cs
@@ -108,19 +108,34 @@ public class Plugin : IViewer
{
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.
+ // Check if user has previously chosen to always unblock
+ var alwaysUnblock = SettingHelper.Get("AlwaysUnblockProtectedView", false, "QuickLook.Plugin.OfficeViewer");
- Would you like OfficeViewer-Native to unblock the ZoneIdentifier of Internet?
- """,
- "PROTECTED VIEW",
- MessageBoxButton.YesNo,
- MessageBoxImage.Question
- );
+ bool shouldUnblock = alwaysUnblock;
- if (result == MessageBoxResult.Yes)
+ 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 0000000..41789c6
--- /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?
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/QuickLook.Plugin/QuickLook.Plugin.OfficeViewer/ProtectedViewDialog.xaml.cs b/QuickLook.Plugin/QuickLook.Plugin.OfficeViewer/ProtectedViewDialog.xaml.cs
new file mode 100644
index 0000000..b283e0d
--- /dev/null
+++ b/QuickLook.Plugin/QuickLook.Plugin.OfficeViewer/ProtectedViewDialog.xaml.cs
@@ -0,0 +1,45 @@
+// Copyright © 2017-2025 QL-Win Contributors
+//
+// This file is part of QuickLook program.
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see .
+
+using System.Windows;
+
+namespace QuickLook.Plugin.OfficeViewer;
+
+public partial class ProtectedViewDialog : Window
+{
+ public bool RememberChoice => RememberCheckBox.IsChecked ?? false;
+ public bool UserSelectedYes { get; private set; }
+
+ public ProtectedViewDialog()
+ {
+ InitializeComponent();
+ }
+
+ private void YesButton_Click(object sender, RoutedEventArgs e)
+ {
+ UserSelectedYes = true;
+ DialogResult = true;
+ Close();
+ }
+
+ private void NoButton_Click(object sender, RoutedEventArgs e)
+ {
+ UserSelectedYes = false;
+ DialogResult = false;
+ Close();
+ }
+}