mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-09 12:46:47 +02:00
[PowerRename] Cleanup and fix for renaming to empty string (#19691)
* Add UI items using OnItemAdded callback * Simplify ToggleAll() logic * Simplify items' Checkbox logic * Do not allow renaming to empty string * Simplify ShowAll/ShowRenamed logic * Simplify rename button logic
This commit is contained in:
@@ -121,9 +121,7 @@
|
|||||||
Height="28"
|
Height="28"
|
||||||
Grid.Column="1"
|
Grid.Column="1"
|
||||||
XYFocusKeyboardNavigation="Enabled"
|
XYFocusKeyboardNavigation="Enabled"
|
||||||
Checked="Checked_ids"
|
|
||||||
IsTabStop="True"
|
IsTabStop="True"
|
||||||
Unchecked="Checked_ids"
|
|
||||||
Content=""
|
Content=""
|
||||||
Name="{x:Bind IdStr}"
|
Name="{x:Bind IdStr}"
|
||||||
AutomationProperties.Name="{x:Bind Original}"
|
AutomationProperties.Name="{x:Bind Original}"
|
||||||
@@ -355,7 +353,7 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
<muxc:SplitButton Grid.Row="2" Style="{StaticResource SplitAccentButtonStyle}" Grid.Column="0" Margin="0,0,12,1" x:Name="button_rename" x:Uid="ButtonApply" Click="button_rename_Click" HorizontalAlignment="Right" VerticalAlignment="Bottom" IsEnabled="{x:Bind UIUpdatesItem.ButtonRenameEnabled, Mode=OneWay}">
|
<muxc:SplitButton Grid.Row="2" Style="{StaticResource SplitAccentButtonStyle}" Grid.Column="0" Margin="0,0,12,1" x:Name="button_rename" x:Uid="ButtonApply" Click="button_rename_Click" HorizontalAlignment="Right" VerticalAlignment="Bottom">
|
||||||
<muxc:SplitButton.KeyboardAccelerators>
|
<muxc:SplitButton.KeyboardAccelerators>
|
||||||
<KeyboardAccelerator Key="Enter" />
|
<KeyboardAccelerator Key="Enter" />
|
||||||
<KeyboardAccelerator Key="Enter" Modifiers="Control" />
|
<KeyboardAccelerator Key="Enter" Modifiers="Control" />
|
||||||
|
|||||||
@@ -185,7 +185,6 @@ namespace winrt::PowerRenameUI::implementation
|
|||||||
}
|
}
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
PopulateExplorerItems();
|
|
||||||
UpdateCounts();
|
UpdateCounts();
|
||||||
SetHandlers();
|
SetHandlers();
|
||||||
ReadSettings();
|
ReadSettings();
|
||||||
@@ -195,7 +194,7 @@ namespace winrt::PowerRenameUI::implementation
|
|||||||
Logger::error("Exception thrown during explorer items population: {}", std::string{ e.what() });
|
Logger::error("Exception thrown during explorer items population: {}", std::string{ e.what() });
|
||||||
}
|
}
|
||||||
|
|
||||||
m_uiUpdatesItem.ButtonRenameEnabled(false);
|
button_rename().IsEnabled(false);
|
||||||
InitAutoComplete();
|
InitAutoComplete();
|
||||||
SearchReplaceChanged();
|
SearchReplaceChanged();
|
||||||
}
|
}
|
||||||
@@ -203,6 +202,15 @@ namespace winrt::PowerRenameUI::implementation
|
|||||||
void MainWindow::AddExplorerItem(int32_t id, hstring const& original, hstring const& renamed, int32_t type, uint32_t depth, bool checked)
|
void MainWindow::AddExplorerItem(int32_t id, hstring const& original, hstring const& renamed, int32_t type, uint32_t depth, bool checked)
|
||||||
{
|
{
|
||||||
auto newItem = winrt::make<PowerRenameUI::implementation::ExplorerItem>(id, original, renamed, type, depth, checked);
|
auto newItem = winrt::make<PowerRenameUI::implementation::ExplorerItem>(id, original, renamed, type, depth, checked);
|
||||||
|
newItem.PropertyChanged([this](Windows::Foundation::IInspectable const& sender, Microsoft::UI::Xaml::Data::PropertyChangedEventArgs const& e) {
|
||||||
|
auto item = sender.as<ExplorerItem>();
|
||||||
|
std::wstring property{ e.PropertyName() };
|
||||||
|
|
||||||
|
if (item && property == L"Checked")
|
||||||
|
{
|
||||||
|
ToggleItem(item->Id(), item->Checked());
|
||||||
|
}
|
||||||
|
});
|
||||||
m_explorerItems.Append(newItem);
|
m_explorerItems.Append(newItem);
|
||||||
m_explorerItemsMap[id] = newItem;
|
m_explorerItemsMap[id] = newItem;
|
||||||
}
|
}
|
||||||
@@ -241,29 +249,11 @@ namespace winrt::PowerRenameUI::implementation
|
|||||||
return m_explorerItemsMap.contains(id) ? m_explorerItemsMap[id] : NULL;
|
return m_explorerItemsMap.contains(id) ? m_explorerItemsMap[id] : NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::ToggleAll(bool checked)
|
|
||||||
{
|
|
||||||
std::for_each(m_explorerItems.begin(), m_explorerItems.end(), [checked](auto item) { item.Checked(checked); });
|
|
||||||
}
|
|
||||||
|
|
||||||
void MainWindow::Checked_ids(winrt::Windows::Foundation::IInspectable const& sender, winrt::Microsoft::UI::Xaml::RoutedEventArgs const&)
|
|
||||||
{
|
|
||||||
auto checkbox = sender.as<Microsoft::UI::Xaml::Controls::CheckBox>();
|
|
||||||
auto id = std::stoi(std::wstring{ checkbox.Name() });
|
|
||||||
auto item = FindById(id);
|
|
||||||
if (item != NULL && checkbox.IsChecked().GetBoolean() != item.Checked())
|
|
||||||
{
|
|
||||||
m_uiUpdatesItem.Checked(checkbox.IsChecked().GetBoolean());
|
|
||||||
m_uiUpdatesItem.ChangedExplorerItemId(id);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void MainWindow::SelectAll(winrt::Windows::Foundation::IInspectable const&, winrt::Microsoft::UI::Xaml::RoutedEventArgs const&)
|
void MainWindow::SelectAll(winrt::Windows::Foundation::IInspectable const&, winrt::Microsoft::UI::Xaml::RoutedEventArgs const&)
|
||||||
{
|
{
|
||||||
if (checkBox_selectAll().IsChecked().GetBoolean() != m_allSelected)
|
if (checkBox_selectAll().IsChecked().GetBoolean() != m_allSelected)
|
||||||
{
|
{
|
||||||
ToggleAll(checkBox_selectAll().IsChecked().GetBoolean());
|
ToggleAll();
|
||||||
m_uiUpdatesItem.ToggleAll();
|
|
||||||
m_allSelected = !m_allSelected;
|
m_allSelected = !m_allSelected;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -272,11 +262,16 @@ namespace winrt::PowerRenameUI::implementation
|
|||||||
{
|
{
|
||||||
button_showAll().IsChecked(true);
|
button_showAll().IsChecked(true);
|
||||||
button_showRenamed().IsChecked(false);
|
button_showRenamed().IsChecked(false);
|
||||||
if (!m_uiUpdatesItem.ShowAll())
|
|
||||||
|
DWORD filter = 0;
|
||||||
|
m_prManager->GetFilter(&filter);
|
||||||
|
if (filter != PowerRenameFilters::None)
|
||||||
{
|
{
|
||||||
m_explorerItems.Clear();
|
m_explorerItems.Clear();
|
||||||
m_explorerItemsMap.clear();
|
m_explorerItemsMap.clear();
|
||||||
m_uiUpdatesItem.ShowAll(true);
|
m_prManager->SwitchFilter(0);
|
||||||
|
PopulateExplorerItems();
|
||||||
|
UpdateCounts();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -284,11 +279,16 @@ namespace winrt::PowerRenameUI::implementation
|
|||||||
{
|
{
|
||||||
button_showRenamed().IsChecked(true);
|
button_showRenamed().IsChecked(true);
|
||||||
button_showAll().IsChecked(false);
|
button_showAll().IsChecked(false);
|
||||||
if (m_uiUpdatesItem.ShowAll())
|
|
||||||
|
DWORD filter = 0;
|
||||||
|
m_prManager->GetFilter(&filter);
|
||||||
|
if (filter != PowerRenameFilters::ShouldRename)
|
||||||
{
|
{
|
||||||
m_explorerItems.Clear();
|
m_explorerItems.Clear();
|
||||||
m_explorerItemsMap.clear();
|
m_explorerItemsMap.clear();
|
||||||
m_uiUpdatesItem.ShowAll(false);
|
m_prManager->SwitchFilter(0);
|
||||||
|
PopulateExplorerItems();
|
||||||
|
UpdateCounts();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -308,14 +308,12 @@ namespace winrt::PowerRenameUI::implementation
|
|||||||
|
|
||||||
void MainWindow::button_rename_Click(winrt::Microsoft::UI::Xaml::Controls::SplitButton const&, winrt::Microsoft::UI::Xaml::Controls::SplitButtonClickEventArgs const&)
|
void MainWindow::button_rename_Click(winrt::Microsoft::UI::Xaml::Controls::SplitButton const&, winrt::Microsoft::UI::Xaml::Controls::SplitButtonClickEventArgs const&)
|
||||||
{
|
{
|
||||||
m_uiUpdatesItem.CloseUIWindow(false);
|
Rename(false);
|
||||||
m_uiUpdatesItem.Rename();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::MenuFlyoutItem_Click(winrt::Windows::Foundation::IInspectable const&, winrt::Microsoft::UI::Xaml::RoutedEventArgs const&)
|
void MainWindow::MenuFlyoutItem_Click(winrt::Windows::Foundation::IInspectable const&, winrt::Microsoft::UI::Xaml::RoutedEventArgs const&)
|
||||||
{
|
{
|
||||||
m_uiUpdatesItem.CloseUIWindow(true);
|
Rename(true);
|
||||||
m_uiUpdatesItem.Rename();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::OpenDocs(winrt::Windows::Foundation::IInspectable const&, winrt::Microsoft::UI::Xaml::RoutedEventArgs const&)
|
void MainWindow::OpenDocs(winrt::Windows::Foundation::IInspectable const&, winrt::Microsoft::UI::Xaml::RoutedEventArgs const&)
|
||||||
@@ -556,26 +554,6 @@ namespace winrt::PowerRenameUI::implementation
|
|||||||
{
|
{
|
||||||
_TRACER_;
|
_TRACER_;
|
||||||
|
|
||||||
m_uiUpdatesItem.PropertyChanged([&](auto const&, auto const& e) {
|
|
||||||
std::wstring property{ e.PropertyName() };
|
|
||||||
if (property == L"ShowAll")
|
|
||||||
{
|
|
||||||
SwitchView();
|
|
||||||
}
|
|
||||||
else if (property == L"ChangedItemId")
|
|
||||||
{
|
|
||||||
ToggleItem(m_uiUpdatesItem.ChangedExplorerItemId(), m_uiUpdatesItem.Checked());
|
|
||||||
}
|
|
||||||
else if (property == L"ToggleAll")
|
|
||||||
{
|
|
||||||
ToggleAll();
|
|
||||||
}
|
|
||||||
else if (property == L"Rename")
|
|
||||||
{
|
|
||||||
Rename(m_uiUpdatesItem.CloseUIWindow());
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
// AutoSuggestBox Search
|
// AutoSuggestBox Search
|
||||||
textBox_search().TextChanged([&](auto const&, auto const&) {
|
textBox_search().TextChanged([&](auto const&, auto const&) {
|
||||||
SearchReplaceChanged();
|
SearchReplaceChanged();
|
||||||
@@ -739,6 +717,10 @@ namespace winrt::PowerRenameUI::implementation
|
|||||||
if (SUCCEEDED(m_prManager->GetItemByIndex(i, &spItem)))
|
if (SUCCEEDED(m_prManager->GetItemByIndex(i, &spItem)))
|
||||||
{
|
{
|
||||||
spItem->PutSelected(selected);
|
spItem->PutSelected(selected);
|
||||||
|
int id = 0;
|
||||||
|
spItem->GetId(&id);
|
||||||
|
auto item = FindById(id);
|
||||||
|
item.Checked(selected);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
UpdateCounts();
|
UpdateCounts();
|
||||||
@@ -965,15 +947,35 @@ namespace winrt::PowerRenameUI::implementation
|
|||||||
m_renamingCount = renamingCount;
|
m_renamingCount = renamingCount;
|
||||||
|
|
||||||
// Update Rename button state
|
// Update Rename button state
|
||||||
m_uiUpdatesItem.ButtonRenameEnabled(renamingCount > 0);
|
button_rename().IsEnabled(renamingCount > 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
m_uiUpdatesItem.OriginalCount(std::to_wstring(m_explorerItems.Size()));
|
m_uiUpdatesItem.OriginalCount(std::to_wstring(m_explorerItems.Size()));
|
||||||
m_uiUpdatesItem.RenamedCount(std::to_wstring(m_renamingCount));
|
m_uiUpdatesItem.RenamedCount(std::to_wstring(m_renamingCount));
|
||||||
}
|
}
|
||||||
|
|
||||||
HRESULT MainWindow::OnItemAdded(_In_ IPowerRenameItem*)
|
HRESULT MainWindow::OnItemAdded(_In_ IPowerRenameItem* renameItem)
|
||||||
{
|
{
|
||||||
|
int id = 0;
|
||||||
|
renameItem->GetId(&id);
|
||||||
|
|
||||||
|
PWSTR originalName = nullptr;
|
||||||
|
renameItem->GetOriginalName(&originalName);
|
||||||
|
PWSTR newName = nullptr;
|
||||||
|
renameItem->GetNewName(&newName);
|
||||||
|
|
||||||
|
bool selected;
|
||||||
|
renameItem->GetSelected(&selected);
|
||||||
|
|
||||||
|
UINT depth = 0;
|
||||||
|
renameItem->GetDepth(&depth);
|
||||||
|
|
||||||
|
bool isFolder = false;
|
||||||
|
winrt::check_hresult(renameItem->GetIsFolder(&isFolder));
|
||||||
|
|
||||||
|
AddExplorerItem(
|
||||||
|
id, originalName, newName == nullptr ? hstring{} : hstring{ newName }, isFolder ? 0 : 1, depth, selected);
|
||||||
|
|
||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -88,7 +88,6 @@ namespace winrt::PowerRenameUI::implementation
|
|||||||
void AppendSearchMRU(hstring const& value);
|
void AppendSearchMRU(hstring const& value);
|
||||||
void AppendReplaceMRU(hstring const& value);
|
void AppendReplaceMRU(hstring const& value);
|
||||||
|
|
||||||
void Checked_ids(winrt::Windows::Foundation::IInspectable const& sender, winrt::Microsoft::UI::Xaml::RoutedEventArgs const& e);
|
|
||||||
void SelectAll(winrt::Windows::Foundation::IInspectable const& sender, winrt::Microsoft::UI::Xaml::RoutedEventArgs const& e);
|
void SelectAll(winrt::Windows::Foundation::IInspectable const& sender, winrt::Microsoft::UI::Xaml::RoutedEventArgs const& e);
|
||||||
void ShowAll(winrt::Windows::Foundation::IInspectable const& sender, winrt::Microsoft::UI::Xaml::RoutedEventArgs const& e);
|
void ShowAll(winrt::Windows::Foundation::IInspectable const& sender, winrt::Microsoft::UI::Xaml::RoutedEventArgs const& e);
|
||||||
void ShowRenamed(winrt::Windows::Foundation::IInspectable const& sender, winrt::Microsoft::UI::Xaml::RoutedEventArgs const& e);
|
void ShowRenamed(winrt::Windows::Foundation::IInspectable const& sender, winrt::Microsoft::UI::Xaml::RoutedEventArgs const& e);
|
||||||
@@ -97,7 +96,6 @@ namespace winrt::PowerRenameUI::implementation
|
|||||||
bool m_allSelected;
|
bool m_allSelected;
|
||||||
PowerRenameUI::UIUpdates m_uiUpdatesItem;
|
PowerRenameUI::UIUpdates m_uiUpdatesItem;
|
||||||
inline PowerRenameUI::ExplorerItem FindById(int32_t id);
|
inline PowerRenameUI::ExplorerItem FindById(int32_t id);
|
||||||
void ToggleAll(bool checked);
|
|
||||||
|
|
||||||
winrt::Windows::Foundation::Collections::IObservableVector<hstring> m_searchMRUList;
|
winrt::Windows::Foundation::Collections::IObservableVector<hstring> m_searchMRUList;
|
||||||
winrt::Windows::Foundation::Collections::IObservableVector<hstring> m_replaceMRUList;
|
winrt::Windows::Foundation::Collections::IObservableVector<hstring> m_replaceMRUList;
|
||||||
|
|||||||
@@ -4,46 +4,10 @@
|
|||||||
|
|
||||||
namespace winrt::PowerRenameUI::implementation
|
namespace winrt::PowerRenameUI::implementation
|
||||||
{
|
{
|
||||||
UIUpdates::UIUpdates() :
|
UIUpdates::UIUpdates()
|
||||||
m_showAll{ true }, m_changedItemId{ -1 }, m_checked{ true }, m_closeUIWindow{ false }, m_buttonRenameEnabled{ false }
|
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
bool UIUpdates::ShowAll()
|
|
||||||
{
|
|
||||||
return m_showAll;
|
|
||||||
}
|
|
||||||
|
|
||||||
void UIUpdates::ShowAll(bool value)
|
|
||||||
{
|
|
||||||
if (m_showAll != value)
|
|
||||||
{
|
|
||||||
m_showAll = value;
|
|
||||||
m_propertyChanged(*this, Microsoft::UI::Xaml::Data::PropertyChangedEventArgs{ L"ShowAll" });
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
int32_t UIUpdates::ChangedExplorerItemId()
|
|
||||||
{
|
|
||||||
return m_changedItemId;
|
|
||||||
}
|
|
||||||
|
|
||||||
void UIUpdates::ChangedExplorerItemId(int32_t value)
|
|
||||||
{
|
|
||||||
m_changedItemId = value;
|
|
||||||
m_propertyChanged(*this, Microsoft::UI::Xaml::Data::PropertyChangedEventArgs{ L"ChangedItemId" });
|
|
||||||
}
|
|
||||||
|
|
||||||
bool UIUpdates::Checked()
|
|
||||||
{
|
|
||||||
return m_checked;
|
|
||||||
}
|
|
||||||
|
|
||||||
void UIUpdates::Checked(bool value)
|
|
||||||
{
|
|
||||||
m_checked = value;
|
|
||||||
}
|
|
||||||
|
|
||||||
winrt::event_token UIUpdates::PropertyChanged(Microsoft::UI::Xaml::Data::PropertyChangedEventHandler const& handler)
|
winrt::event_token UIUpdates::PropertyChanged(Microsoft::UI::Xaml::Data::PropertyChangedEventHandler const& handler)
|
||||||
{
|
{
|
||||||
return m_propertyChanged.add(handler);
|
return m_propertyChanged.add(handler);
|
||||||
@@ -54,16 +18,6 @@ namespace winrt::PowerRenameUI::implementation
|
|||||||
m_propertyChanged.remove(token);
|
m_propertyChanged.remove(token);
|
||||||
}
|
}
|
||||||
|
|
||||||
void UIUpdates::ToggleAll()
|
|
||||||
{
|
|
||||||
m_propertyChanged(*this, Microsoft::UI::Xaml::Data::PropertyChangedEventArgs{ L"ToggleAll" });
|
|
||||||
}
|
|
||||||
|
|
||||||
void UIUpdates::Rename()
|
|
||||||
{
|
|
||||||
m_propertyChanged(*this, Microsoft::UI::Xaml::Data::PropertyChangedEventArgs{ L"Rename" });
|
|
||||||
}
|
|
||||||
|
|
||||||
hstring UIUpdates::OriginalCount()
|
hstring UIUpdates::OriginalCount()
|
||||||
{
|
{
|
||||||
return m_originalCount;
|
return m_originalCount;
|
||||||
@@ -91,28 +45,4 @@ namespace winrt::PowerRenameUI::implementation
|
|||||||
m_propertyChanged(*this, Microsoft::UI::Xaml::Data::PropertyChangedEventArgs{ L"RenamedCount" });
|
m_propertyChanged(*this, Microsoft::UI::Xaml::Data::PropertyChangedEventArgs{ L"RenamedCount" });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool UIUpdates::CloseUIWindow()
|
|
||||||
{
|
|
||||||
return m_closeUIWindow;
|
|
||||||
}
|
|
||||||
|
|
||||||
void UIUpdates::CloseUIWindow(bool closeUIWindow)
|
|
||||||
{
|
|
||||||
m_closeUIWindow = closeUIWindow;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool UIUpdates::ButtonRenameEnabled()
|
|
||||||
{
|
|
||||||
return m_buttonRenameEnabled;
|
|
||||||
}
|
|
||||||
|
|
||||||
void UIUpdates::ButtonRenameEnabled(bool value)
|
|
||||||
{
|
|
||||||
if (m_buttonRenameEnabled != value)
|
|
||||||
{
|
|
||||||
m_buttonRenameEnabled = value;
|
|
||||||
m_propertyChanged(*this, Microsoft::UI::Xaml::Data::PropertyChangedEventArgs{ L"ButtonRenameEnabled" });
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,31 +7,14 @@ namespace winrt::PowerRenameUI::implementation
|
|||||||
{
|
{
|
||||||
UIUpdates();
|
UIUpdates();
|
||||||
|
|
||||||
bool ShowAll();
|
|
||||||
void ShowAll(bool value);
|
|
||||||
int32_t ChangedExplorerItemId();
|
|
||||||
void ChangedExplorerItemId(int32_t value);
|
|
||||||
bool Checked();
|
|
||||||
void Checked(bool value);
|
|
||||||
winrt::event_token PropertyChanged(winrt::Microsoft::UI::Xaml::Data::PropertyChangedEventHandler const& handler);
|
winrt::event_token PropertyChanged(winrt::Microsoft::UI::Xaml::Data::PropertyChangedEventHandler const& handler);
|
||||||
void PropertyChanged(winrt::event_token const& token) noexcept;
|
void PropertyChanged(winrt::event_token const& token) noexcept;
|
||||||
void ToggleAll();
|
|
||||||
bool CloseUIWindow();
|
|
||||||
void CloseUIWindow(bool closeUIWindow);
|
|
||||||
bool ButtonRenameEnabled();
|
|
||||||
void ButtonRenameEnabled(bool value);
|
|
||||||
void Rename();
|
|
||||||
hstring OriginalCount();
|
hstring OriginalCount();
|
||||||
void OriginalCount(hstring value);
|
void OriginalCount(hstring value);
|
||||||
hstring RenamedCount();
|
hstring RenamedCount();
|
||||||
void RenamedCount(hstring value);
|
void RenamedCount(hstring value);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool m_showAll;
|
|
||||||
int32_t m_changedItemId;
|
|
||||||
bool m_checked;
|
|
||||||
bool m_closeUIWindow;
|
|
||||||
bool m_buttonRenameEnabled;
|
|
||||||
hstring m_originalCount;
|
hstring m_originalCount;
|
||||||
hstring m_renamedCount;
|
hstring m_renamedCount;
|
||||||
winrt::event<Microsoft::UI::Xaml::Data::PropertyChangedEventHandler> m_propertyChanged;
|
winrt::event<Microsoft::UI::Xaml::Data::PropertyChangedEventHandler> m_propertyChanged;
|
||||||
|
|||||||
@@ -3,14 +3,6 @@ namespace PowerRenameUI
|
|||||||
runtimeclass UIUpdates : Microsoft.UI.Xaml.Data.INotifyPropertyChanged
|
runtimeclass UIUpdates : Microsoft.UI.Xaml.Data.INotifyPropertyChanged
|
||||||
{
|
{
|
||||||
UIUpdates();
|
UIUpdates();
|
||||||
Boolean ShowAll;
|
|
||||||
Int32 ChangedExplorerItemId;
|
|
||||||
Boolean Checked;
|
|
||||||
void ToggleAll();
|
|
||||||
Boolean CloseUIWindow();
|
|
||||||
void CloseUIWindow(Boolean closeUIWindow);
|
|
||||||
Boolean ButtonRenameEnabled;
|
|
||||||
void Rename();
|
|
||||||
String OriginalCount;
|
String OriginalCount;
|
||||||
String RenamedCount;
|
String RenamedCount;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -195,7 +195,7 @@ IFACEMETHODIMP CPowerRenameItem::ShouldRenameItem(_In_ DWORD flags, _Out_ bool*
|
|||||||
{
|
{
|
||||||
// Should we perform a rename on this item given its
|
// Should we perform a rename on this item given its
|
||||||
// state and the options that were set?
|
// state and the options that were set?
|
||||||
bool hasChanged = m_newName != nullptr && (lstrcmp(m_originalName, m_newName) != 0);
|
bool hasChanged = m_newName != nullptr && (lstrcmp(m_originalName, m_newName) != 0) && (lstrcmp(L"", m_newName) != 0);
|
||||||
bool excludeBecauseFolder = (m_isFolder && (flags & PowerRenameFlags::ExcludeFolders));
|
bool excludeBecauseFolder = (m_isFolder && (flags & PowerRenameFlags::ExcludeFolders));
|
||||||
bool excludeBecauseFile = (!m_isFolder && (flags & PowerRenameFlags::ExcludeFiles));
|
bool excludeBecauseFile = (!m_isFolder && (flags & PowerRenameFlags::ExcludeFiles));
|
||||||
bool excludeBecauseSubFolderContent = (m_depth > 0 && (flags & PowerRenameFlags::ExcludeSubfolders));
|
bool excludeBecauseSubFolderContent = (m_depth > 0 && (flags & PowerRenameFlags::ExcludeSubfolders));
|
||||||
|
|||||||
Reference in New Issue
Block a user