diff options
author | sidchat@google.com <sidchat@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-06-03 20:20:58 +0000 |
---|---|---|
committer | sidchat@google.com <sidchat@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-06-03 20:20:58 +0000 |
commit | 154a4338764560595dd49305a2343985f728c935 (patch) | |
tree | 4ba37d24a2f4980c27145af7c46cd5fdcf1f49a9 /chrome/browser/views/options/languages_page_view.cc | |
parent | 7822e018e5ebabeeb3e8ff46aa67a52b1b1c1cf8 (diff) | |
download | chromium_src-154a4338764560595dd49305a2343985f728c935.zip chromium_src-154a4338764560595dd49305a2343985f728c935.tar.gz chromium_src-154a4338764560595dd49305a2343985f728c935.tar.bz2 |
UI Support for Auto Spell Correct. Currently, it is still under the command line flag --auto-spell-correct, which means that this UI support will appear only when the command line flag is enabled.BUG=www.crbug.com/13102TEST=enable this feature through the command line flag --auto-spell-correct and then use the Languages Options menu check box to toggle this feature on/off - test by typing "teh" in a text box.
Review URL: http://codereview.chromium.org/119002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@17528 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/views/options/languages_page_view.cc')
-rw-r--r-- | chrome/browser/views/options/languages_page_view.cc | 33 |
1 files changed, 32 insertions, 1 deletions
diff --git a/chrome/browser/views/options/languages_page_view.cc b/chrome/browser/views/options/languages_page_view.cc index 400cb16..d402b8e 100644 --- a/chrome/browser/views/options/languages_page_view.cc +++ b/chrome/browser/views/options/languages_page_view.cc @@ -12,6 +12,7 @@ #include "app/gfx/font.h" #include "app/l10n_util.h" #include "app/resource_bundle.h" +#include "base/command_line.h" #include "base/file_util.h" #include "base/string_util.h" #include "base/gfx/native_theme.h" @@ -21,6 +22,7 @@ #include "chrome/browser/spellchecker.h" #include "chrome/browser/views/options/language_combobox_model.h" #include "chrome/browser/views/restart_message_box.h" +#include "chrome/common/chrome_switches.h" #include "chrome/common/pref_names.h" #include "chrome/common/pref_service.h" #include "grit/chromium_strings.h" @@ -477,11 +479,13 @@ LanguagesPageView::LanguagesPageView(Profile* profile) change_ui_language_combobox_(NULL), change_dictionary_language_combobox_(NULL), enable_spellchecking_checkbox_(NULL), + enable_autospellcorrect_checkbox_(NULL), dictionary_language_label_(NULL), OptionsPageView(profile), language_table_edited_(false), language_warning_shown_(false), enable_spellcheck_checkbox_clicked_(false), + enable_autospellcorrect_checkbox_clicked_(false), spellcheck_language_index_selected_(-1), ui_language_index_selected_(-1), starting_ui_language_index_(-1) { @@ -489,6 +493,8 @@ LanguagesPageView::LanguagesPageView(Profile* profile) profile->GetPrefs(), NULL); enable_spellcheck_.Init(prefs::kEnableSpellCheck, profile->GetPrefs(), NULL); + enable_autospellcorrect_.Init(prefs::kEnableAutoSpellCorrect, + profile->GetPrefs(), NULL); } LanguagesPageView::~LanguagesPageView() { @@ -513,7 +519,9 @@ void LanguagesPageView::ButtonPressed(views::Button* sender) { new AddLanguageWindowView(this, profile()))->Show(); language_table_edited_ = true; } else if (sender == enable_spellchecking_checkbox_) { - enable_spellcheck_checkbox_clicked_ = true; + enable_spellcheck_checkbox_clicked_ = true; + } else if (sender == enable_autospellcorrect_checkbox_) { + enable_autospellcorrect_checkbox_clicked_ = true; } } @@ -626,6 +634,12 @@ void LanguagesPageView::InitControlLayout() { views::Label::ALIGN_LEFT); enable_spellchecking_checkbox_ = new views::Checkbox( l10n_util::GetString(IDS_OPTIONS_ENABLE_SPELLCHECK)); + const CommandLine& command_line = *CommandLine::ForCurrentProcess(); + if (command_line.HasSwitch(switches::kAutoSpellCorrect)) { + enable_autospellcorrect_checkbox_ = new views::Checkbox( + l10n_util::GetString(IDS_OPTIONS_ENABLE_AUTO_SPELL_CORRECTION)); + enable_autospellcorrect_checkbox_->set_listener(this); + } enable_spellchecking_checkbox_->set_listener(this); enable_spellchecking_checkbox_->SetMultiLine(true); @@ -642,6 +656,11 @@ void LanguagesPageView::InitControlLayout() { layout->StartRow(0, single_column_view_set_id); layout->AddView(enable_spellchecking_checkbox_); layout->AddPaddingRow(0, kRelatedControlVerticalSpacing); + if (command_line.HasSwitch(switches::kAutoSpellCorrect)) { + layout->StartRow(0, single_column_view_set_id); + layout->AddView(enable_autospellcorrect_checkbox_); + layout->AddPaddingRow(0, kRelatedControlVerticalSpacing); + } const int double_column_view_set_2_id = 2; column_set = layout->AddColumnSet(double_column_view_set_2_id); column_set->AddColumn(GridLayout::FILL, GridLayout::FILL, 0, @@ -727,6 +746,13 @@ void LanguagesPageView::NotifyPrefChanged(const std::wstring* pref_name) { enable_spellchecking_checkbox_->SetChecked( enable_spellcheck_.GetValue()); } + if (!pref_name || *pref_name == prefs::kEnableAutoSpellCorrect) { + const CommandLine& command_line = *CommandLine::ForCurrentProcess(); + if (command_line.HasSwitch(switches::kAutoSpellCorrect)) { + enable_autospellcorrect_checkbox_->SetChecked( + enable_autospellcorrect_.GetValue()); + } + } } void LanguagesPageView::ItemChanged(views::Combobox* sender, @@ -846,4 +872,9 @@ void LanguagesPageView::SaveChanges() { if (enable_spellcheck_checkbox_clicked_) enable_spellcheck_.SetValue(enable_spellchecking_checkbox_->checked()); + + if (enable_autospellcorrect_checkbox_clicked_) { + enable_autospellcorrect_.SetValue( + enable_autospellcorrect_checkbox_->checked()); + } } |