Skip to content

Commit f8142e2

Browse files
committed
Add setting to disable live clipboard updates in preview dialog
Added a new setting "Disable live clipboard update" that prevents the preview and filename fields from automatically updating when the clipboard changes while the dialog is open. This allows users to safely edit filenames or copy text to use as filenames without the dialog being overwritten by new clipboard content. Changes: - Added disableLiveClipboardUpdate setting (default: false) to Settings.settings - Added property accessor in Settings.Designer.cs - Added menu item to settings context menu in Wizard.Designer.cs - Added handler menuDisableLiveClipboardUpdate_CheckedChanged in Wizard.cs - Modified ClipboardChanged in Dialog.cs to check setting and return early if enabled - Added resource strings str_disable_live_clipboard_update and tooltip The setting is accessible via the settings menu (gear icon) in the Wizard dialog. When enabled, clipboard changes are ignored while the preview/rename dialog is open, preventing the preview and filename fields from being overwritten.
1 parent b1dbace commit f8142e2

File tree

6 files changed

+42
-0
lines changed

6 files changed

+42
-0
lines changed

PasteIntoFile/Dialog.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -285,6 +285,11 @@ private bool readClipboard() {
285285

286286

287287
private void ClipboardChanged(Object sender, SharpClipboard.ClipboardChangedEventArgs e) {
288+
// Check if live clipboard updates are disabled
289+
if (Settings.Default.disableLiveClipboardUpdate) {
290+
return; // Don't update the UI when this setting is enabled
291+
}
292+
288293
var previousClipboardTimestamp = clipData.Timestamp;
289294
readClipboard();
290295

PasteIntoFile/Properties/Resources.resx

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -277,6 +277,13 @@ These setting will take effect on the next login.</value>
277277
<data name="str_clear_clipboard_tooltip" xml:space="preserve">
278278
<value>Clears the clipboard after its content has been saved.</value>
279279
</data>
280+
<data name="str_disable_live_clipboard_update" xml:space="preserve">
281+
<value>Disable live clipboard update</value>
282+
<comment>Checkbox to disable live clipboard updates in the preview/rename dialog</comment>
283+
</data>
284+
<data name="str_disable_live_clipboard_update_tooltip" xml:space="preserve">
285+
<value>When enabled, the preview and filename fields will not update automatically when the clipboard changes. This prevents the dialog from being overwritten while you are editing the filename or copying text to use as a filename.</value>
286+
</data>
280287
<data name="str_autosave_tooltip" xml:space="preserve">
281288
<value>Saves clipboard data to default filetype without prompt.
282289
Hold SHIFT to temporarly invert this setting.</value>

PasteIntoFile/Properties/Settings.Designer.cs

Lines changed: 12 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

PasteIntoFile/Properties/Settings.settings

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,9 @@
5050
<Setting Name="language" Type="System.String" Scope="User">
5151
<Value Profile="(Default)" />
5252
</Setting>
53+
<Setting Name="disableLiveClipboardUpdate" Type="System.Boolean" Scope="User">
54+
<Value Profile="(Default)">False</Value>
55+
</Setting>
5356
</Settings>
5457
</SettingsFile>
5558

PasteIntoFile/Wizard.Designer.cs

Lines changed: 7 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

PasteIntoFile/Wizard.cs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,7 @@ private void settingsButton_Click(object sender, EventArgs e) {
183183
// update
184184
settingsMenuUpdateChecks.Checked = Settings.Default.updateChecksEnabled;
185185
settingsMenuClearClipboard.Checked = Settings.Default.clrClipboard;
186+
settingsMenuDisableLiveClipboardUpdate.Checked = Settings.Default.disableLiveClipboardUpdate;
186187
// show it
187188
Point ptLowerLeft = new Point(4, settingsButton.Height);
188189
ptLowerLeft = settingsButton.PointToScreen(ptLowerLeft);
@@ -203,6 +204,13 @@ private void menuClearClipboard_CheckedChanged(object sender, EventArgs e) {
203204
}
204205
}
205206

207+
private void menuDisableLiveClipboardUpdate_CheckedChanged(object sender, EventArgs e) {
208+
if (Settings.Default.disableLiveClipboardUpdate != settingsMenuDisableLiveClipboardUpdate.Checked) {
209+
Settings.Default.disableLiveClipboardUpdate = settingsMenuDisableLiveClipboardUpdate.Checked;
210+
Settings.Default.Save();
211+
}
212+
}
213+
206214
private void finish_Click(object sender, EventArgs e) {
207215
Settings.Default.firstLaunch = false;
208216
Settings.Default.Save();

0 commit comments

Comments
 (0)