Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add setting to select all query text on window reopen #3065

Draft
wants to merge 1 commit into
base: dev
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion Flow.Launcher/MainWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,8 @@
Style="{DynamicResource QueryBoxStyle}"
Text="{Binding QueryText, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
Visibility="Visible"
WindowChrome.IsHitTestVisibleInChrome="True">
WindowChrome.IsHitTestVisibleInChrome="True"
Loaded="SelectAllQueryText">
<TextBox.CommandBindings>
<CommandBinding Command="ApplicationCommands.Copy" Executed="OnCopy" />
</TextBox.CommandBindings>
Expand Down
10 changes: 10 additions & 0 deletions Flow.Launcher/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -298,6 +298,11 @@ private void OnLoaded(object sender, RoutedEventArgs _)
break;
}
};

if (_settings.SelectAllQueryOnReopen)
{
SelectAllQueryText();
}
}

private void InitializePosition()
Expand Down Expand Up @@ -857,5 +862,10 @@ private void QueryTextBox_KeyUp(object sender, KeyEventArgs e)
be.UpdateSource();
}
}

private void SelectAllQueryText()
{
QueryTextBox.SelectAll();
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ public SettingsPaneGeneralViewModel(Settings settings, Updater updater, IPortabl
_updater = updater;
_portable = portable;
UpdateEnumDropdownLocalizations();
SelectAllQueryOnReopen = settings.SelectAllQueryOnReopen; // Pfa33
}

public class SearchWindowScreenData : DropdownDataGeneric<SearchWindowScreens> { }
Expand Down Expand Up @@ -54,6 +55,11 @@ public bool StartFlowLauncherOnSystemStartup
}
}

public bool SelectAllQueryOnReopen // Pbff7
{
get => Settings.SelectAllQueryOnReopen;
set => Settings.SelectAllQueryOnReopen = value;
}

public List<SearchWindowScreenData> SearchWindowScreens { get; } =
DropdownDataGeneric<SearchWindowScreens>.GetValues<SearchWindowScreenData>("SearchWindowScreen");
Expand Down
2 changes: 1 addition & 1 deletion Flow.Launcher/SettingWindow.xaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<Window
<Window
x:Class="Flow.Launcher.SettingWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Expand Down
7 changes: 7 additions & 0 deletions Flow.Launcher/SettingWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,13 @@ private void OnLoaded(object sender, RoutedEventArgs e)
hwndTarget.RenderMode = RenderMode.Default;

InitializePosition();

// Initialize the new checkbox based on the settings
var selectAllQueryOnReopenCheckbox = (System.Windows.Controls.CheckBox)FindName("SelectAllQueryOnReopenCheckbox");
if (selectAllQueryOnReopenCheckbox != null)
{
selectAllQueryOnReopenCheckbox.IsChecked = _settings.SelectAllQueryOnReopen;
}
}

private void OnClosed(object sender, EventArgs e)
Expand Down
Loading