summaryrefslogtreecommitdiff
path: root/indra/newview
diff options
context:
space:
mode:
authorKitty Barnett <develop@catznip.com>2012-06-11 17:37:06 +0200
committerKitty Barnett <develop@catznip.com>2012-06-11 17:37:06 +0200
commitd96d3d525677ae5bebab1908394854b8fb79cdfb (patch)
treef94a953c4bea5f1249003532303d4d5951a645e5 /indra/newview
parent45b00642aa3f0b58699e20a55cb50c2d32a09a67 (diff)
STORM-276 Added the ability to remove (user-installed) dictionaries
Diffstat (limited to 'indra/newview')
-rw-r--r--indra/newview/llfloaterspellchecksettings.cpp25
-rw-r--r--indra/newview/llfloaterspellchecksettings.h2
-rw-r--r--indra/newview/skins/default/xui/en/floater_spellcheck.xml35
3 files changed, 48 insertions, 14 deletions
diff --git a/indra/newview/llfloaterspellchecksettings.cpp b/indra/newview/llfloaterspellchecksettings.cpp
index 0b4f08c327..059a28fbcd 100644
--- a/indra/newview/llfloaterspellchecksettings.cpp
+++ b/indra/newview/llfloaterspellchecksettings.cpp
@@ -46,10 +46,24 @@ LLFloaterSpellCheckerSettings::LLFloaterSpellCheckerSettings(const LLSD& key)
{
}
+void LLFloaterSpellCheckerSettings::draw()
+{
+ LLFloater::draw();
+
+ std::vector<LLScrollListItem*> sel_items = getChild<LLScrollListCtrl>("spellcheck_available_list")->getAllSelected();
+ bool enable_remove = !sel_items.empty();
+ for (std::vector<LLScrollListItem*>::const_iterator sel_it = sel_items.begin(); sel_it != sel_items.end(); ++sel_it)
+ {
+ enable_remove &= LLSpellChecker::canRemoveDictionary((*sel_it)->getValue().asString());
+ }
+ getChild<LLUICtrl>("spellcheck_remove_btn")->setEnabled(enable_remove);
+}
+
BOOL LLFloaterSpellCheckerSettings::postBuild(void)
{
gSavedSettings.getControl("SpellCheck")->getSignal()->connect(boost::bind(&LLFloaterSpellCheckerSettings::refreshDictionaries, this, false));
LLSpellChecker::setSettingsChangeCallback(boost::bind(&LLFloaterSpellCheckerSettings::onSpellCheckSettingsChange, this));
+ getChild<LLUICtrl>("spellcheck_remove_btn")->setCommitCallback(boost::bind(&LLFloaterSpellCheckerSettings::onBtnRemove, this));
getChild<LLUICtrl>("spellcheck_import_btn")->setCommitCallback(boost::bind(&LLFloaterSpellCheckerSettings::onBtnImport, this));
getChild<LLUICtrl>("spellcheck_main_combo")->setCommitCallback(boost::bind(&LLFloaterSpellCheckerSettings::refreshDictionaries, this, false));
getChild<LLUICtrl>("spellcheck_moveleft_btn")->setCommitCallback(boost::bind(&LLFloaterSpellCheckerSettings::onBtnMove, this, "spellcheck_active_list", "spellcheck_available_list"));
@@ -121,6 +135,15 @@ void LLFloaterSpellCheckerSettings::onOpen(const LLSD& key)
refreshDictionaries(true);
}
+void LLFloaterSpellCheckerSettings::onBtnRemove()
+{
+ std::vector<LLScrollListItem*> sel_items = getChild<LLScrollListCtrl>("spellcheck_available_list")->getAllSelected();
+ for (std::vector<LLScrollListItem*>::const_iterator sel_it = sel_items.begin(); sel_it != sel_items.end(); ++sel_it)
+ {
+ LLSpellChecker::instance().removeDictionary((*sel_it)->getValue().asString());
+ }
+}
+
void LLFloaterSpellCheckerSettings::onSpellCheckSettingsChange()
{
refreshDictionaries(true);
@@ -137,7 +160,7 @@ void LLFloaterSpellCheckerSettings::refreshDictionaries(bool from_settings)
std::string dict_cur = dict_combo->getSelectedItemLabel();
if ((dict_cur.empty() || from_settings) && (LLSpellChecker::getUseSpellCheck()))
{
- dict_cur = LLSpellChecker::instance().getActiveDictionary();
+ dict_cur = LLSpellChecker::instance().getPrimaryDictionary();
}
dict_combo->clearRows();
dict_combo->setEnabled(enabled);
diff --git a/indra/newview/llfloaterspellchecksettings.h b/indra/newview/llfloaterspellchecksettings.h
index da3239bca3..67bd260048 100644
--- a/indra/newview/llfloaterspellchecksettings.h
+++ b/indra/newview/llfloaterspellchecksettings.h
@@ -34,6 +34,7 @@ class LLFloaterSpellCheckerSettings : public LLFloater
public:
LLFloaterSpellCheckerSettings(const LLSD& key);
+ /*virtual*/ void draw();
/*virtual*/ BOOL postBuild();
/*virtual*/ void onOpen(const LLSD& key);
@@ -42,6 +43,7 @@ protected:
void onBtnImport();
void onBtnMove(const std::string& from, const std::string& to);
void onBtnOK();
+ void onBtnRemove();
void onSpellCheckSettingsChange();
void refreshDictionaries(bool from_settings);
};
diff --git a/indra/newview/skins/default/xui/en/floater_spellcheck.xml b/indra/newview/skins/default/xui/en/floater_spellcheck.xml
index 91639ed0da..786b830ad9 100644
--- a/indra/newview/skins/default/xui/en/floater_spellcheck.xml
+++ b/indra/newview/skins/default/xui/en/floater_spellcheck.xml
@@ -3,10 +3,10 @@
border="true"
can_close="true"
can_minimize="true"
- bottom="275"
+ bottom="300"
left="300"
can_resize="false"
- height="330"
+ height="355"
width="490"
name="spellcheck_floater"
title="Spell Checker Settings">
@@ -53,16 +53,6 @@
top_pad="-15"
width="175"
/>
- <button
- follows="left|top"
- height="23"
- label="Import"
- label_selected="Import"
- layout="topleft"
- left_pad="5"
- name="spellcheck_import_btn"
- top_delta="0"
- width="75" />
<text
enabled_control="SpellCheck"
follows="top|left"
@@ -148,6 +138,25 @@
top_pad="-105"
width="175"
/>
+ <button
+ enabled="false"
+ follows="left|top"
+ height="23"
+ label="Remove"
+ layout="topleft"
+ left="55"
+ name="spellcheck_remove_btn"
+ top_pad="5"
+ width="80" />
+ <button
+ follows="left|top"
+ height="23"
+ label="Import..."
+ layout="topleft"
+ left_pad="15"
+ name="spellcheck_import_btn"
+ top_delta="0"
+ width="80" />
<view_border
top_pad="10"
left="2"
@@ -159,7 +168,7 @@
mouse_opaque="false"
name="divisor4"/>
<button
- top_pad="10"
+ top_pad="8"
right="380"
height="22"
width="90"