diff options
author | pkasting@chromium.org <pkasting@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-11-17 21:18:33 +0000 |
---|---|---|
committer | pkasting@chromium.org <pkasting@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-11-17 21:18:33 +0000 |
commit | 1b5d7255ea798b97d3d4117cb936514a2d0d557a (patch) | |
tree | 835eb00c11451d21aed87191e034fb2909357f4d /chrome | |
parent | bb626d9f75c7c33fbcb4ca3ff0d913937b42d45e (diff) | |
download | chromium_src-1b5d7255ea798b97d3d4117cb936514a2d0d557a.zip chromium_src-1b5d7255ea798b97d3d4117cb936514a2d0d557a.tar.gz chromium_src-1b5d7255ea798b97d3d4117cb936514a2d0d557a.tar.bz2 |
Allow multiselection deletion of engines in the Manage Search Engines dialog. Original patch by Thiago Farina (see http://codereview.chromium.org/402020 ), r=me, tweaked.
BUG=16842
TEST=Select multiple engines. "Remove" should be enabled iff the selected set does not include the default engine.
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@32208 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r-- | chrome/browser/views/keyword_editor_view.cc | 24 |
1 files changed, 15 insertions, 9 deletions
diff --git a/chrome/browser/views/keyword_editor_view.cc b/chrome/browser/views/keyword_editor_view.cc index e4c676f..9e4446b 100644 --- a/chrome/browser/views/keyword_editor_view.cc +++ b/chrome/browser/views/keyword_editor_view.cc @@ -209,18 +209,24 @@ void KeywordEditorView::InitLayoutManager() { } void KeywordEditorView::OnSelectionChanged() { - const int selected_row_count = table_view_->SelectedRowCount(); - edit_button_->SetEnabled(selected_row_count == 1); - bool can_make_default = false; - bool can_remove = false; - if (selected_row_count == 1) { + if (table_view_->SelectedRowCount() == 1) { + edit_button_->SetEnabled(true); const TemplateURL* selected_url = controller_->GetTemplateURL(table_view_->FirstSelectedRow()); - can_make_default = controller_->CanMakeDefault(selected_url); - can_remove = controller_->CanRemove(selected_url); + make_default_button_->SetEnabled(controller_->CanMakeDefault(selected_url)); + remove_button_->SetEnabled(controller_->CanRemove(selected_url)); + } else { + make_default_button_->SetEnabled(false); + for (views::TableView::iterator i = table_view_->SelectionBegin(); + i != table_view_->SelectionEnd(); ++i) { + const TemplateURL* selected_url = controller_->GetTemplateURL(*i); + if (!controller_->CanRemove(selected_url)) { + remove_button_->SetEnabled(false); + return; + } + } + remove_button_->SetEnabled(true); } - remove_button_->SetEnabled(can_remove); - make_default_button_->SetEnabled(can_make_default); } void KeywordEditorView::OnDoubleClick() { |