@@ -23,7 +23,8 @@ namespace winrt::TerminalApp::implementation
23
23
void Close ();
24
24
winrt::Microsoft::Terminal::Settings::Model::NewTerminalArgs GetNewTerminalArgs (const bool asContent) const ;
25
25
26
- winrt::hstring Title () { return L" Scratchpad" ; }
26
+ // TODO! lots of strings here and in XAML that need RS_-ifying
27
+ winrt::hstring Title () { return L" Tasks" ; }
27
28
uint64_t TaskbarState () { return 0 ; }
28
29
uint64_t TaskbarProgress () { return 0 ; }
29
30
bool ReadOnly () { return false ; }
@@ -58,42 +59,6 @@ namespace winrt::TerminalApp::implementation
58
59
void _updateFilteredCommands ();
59
60
};
60
61
61
- struct TaskViewModel : TaskViewModelT<TaskViewModel>
62
- {
63
- TaskViewModel (const winrt::Microsoft::Terminal::Settings::Model::Command& command) :
64
- _command{ command }
65
- {
66
- // The Children() method must always return a non-null vector
67
- _children = winrt::single_threaded_observable_vector<TerminalApp::TaskViewModel>();
68
- if (_command.HasNestedCommands ())
69
- {
70
- for (const auto & [_, child] : _command.NestedCommands ())
71
- {
72
- auto vm{ winrt::make<TaskViewModel>(child) };
73
- _children.Append (vm);
74
- }
75
- }
76
- }
77
-
78
- winrt::hstring Name () { return _command.Name (); }
79
- winrt::hstring IconPath () { return _command.IconPath (); }
80
- winrt::hstring Input ()
81
- {
82
- if (const auto & sendInput{ _command.ActionAndArgs ().Args ().try_as <winrt::Microsoft::Terminal::Settings::Model::SendInputArgs>() })
83
- {
84
- return sendInput.Input ();
85
- }
86
- return L" " ;
87
- };
88
- winrt::Windows::Foundation::Collections::IObservableVector<TerminalApp::TaskViewModel> Children () { return _children; }
89
- winrt::Microsoft::Terminal::Settings::Model::Command Command () { return _command; }
90
-
91
- private:
92
- winrt::Microsoft::Terminal::Settings::Model::Command _command{ nullptr };
93
- winrt::Windows::Foundation::Collections::IObservableVector<TerminalApp::TaskViewModel> _children{ nullptr };
94
- };
95
-
96
- // struct FilteredTask : public winrt::TerminalApp::implementation::FilteredCommand, FilteredTaskT<FilteredTask, FilteredCommand>
97
62
struct FilteredTask : FilteredTaskT<FilteredTask, TerminalApp::implementation::FilteredCommand>
98
63
{
99
64
FilteredTask () = default ;
@@ -115,9 +80,6 @@ namespace winrt::TerminalApp::implementation
115
80
}
116
81
}
117
82
118
- // FilteredCommand() = default;
119
- // FilteredCommand(const winrt::TerminalApp::PaletteItem& item);
120
-
121
83
void UpdateFilter (const winrt::hstring& filter) override
122
84
{
123
85
TerminalApp::implementation::FilteredCommand::UpdateFilter (filter);
@@ -129,14 +91,6 @@ namespace winrt::TerminalApp::implementation
129
91
_PropertyChangedHandlers (*this , Windows::UI::Xaml::Data::PropertyChangedEventArgs{ L" Visibility" });
130
92
}
131
93
132
- // static int Compare(const winrt::TerminalApp::FilteredCommand& first, const winrt::TerminalApp::FilteredCommand& second);
133
-
134
- // WINRT_CALLBACK(PropertyChanged, Windows::UI::Xaml::Data::PropertyChangedEventHandler);
135
- // WINRT_OBSERVABLE_PROPERTY(winrt::TerminalApp::PaletteItem, Item, _PropertyChangedHandlers, nullptr);
136
- // WINRT_OBSERVABLE_PROPERTY(winrt::hstring, Filter, _PropertyChangedHandlers);
137
- // WINRT_OBSERVABLE_PROPERTY(winrt::TerminalApp::HighlightedText, HighlightedName, _PropertyChangedHandlers);
138
- // WINRT_OBSERVABLE_PROPERTY(int, Weight, _PropertyChangedHandlers);
139
-
140
94
winrt::hstring Input ()
141
95
{
142
96
if (const auto & actionItem{ _Item.try_as <winrt::TerminalApp::ActionPaletteItem>() })
@@ -155,12 +109,17 @@ namespace winrt::TerminalApp::implementation
155
109
winrt::Windows::Foundation::Collections::IObservableVector<TerminalApp::FilteredTask> Children () { return _children; }
156
110
winrt::Microsoft::Terminal::Settings::Model::Command Command () { return _command; }
157
111
112
+ // Used to control if this item is visible in the TreeView. Turns out,
113
+ // TreeView is in fact sane enough to remove items entirely if they're
114
+ // Collapsed.
158
115
winrt::Windows::UI::Xaml::Visibility Visibility ()
159
116
{
117
+ // Is there no filter, or do we match it?
160
118
if (_Filter.empty () || _Weight > 0 )
161
119
{
162
120
return winrt::Windows::UI::Xaml::Visibility::Visible;
163
121
}
122
+ // If we don't match, maybe one of our children does
164
123
auto totalWeight = _Weight;
165
124
for (const auto & c : _children)
166
125
{
0 commit comments