More login panel changes

This commit is contained in:
Siana Gearz
2011-06-17 00:43:53 +02:00
parent 5206d36a91
commit 0d0e9bec5e
3 changed files with 26 additions and 7 deletions

View File

@@ -75,6 +75,7 @@ LLComboBox::LLComboBox( const std::string& name, const LLRect &rect, const std::
mPrearrangeCallback( NULL ),
mTextEntryCallback( NULL ),
mSuppressTentative( false ),
mSuppressAutoComplete( false ),
mLabel(label),
mListColor(LLUI::sColorsGroup->getColor("ComboBoxBg"))
{
@@ -904,6 +905,11 @@ void LLComboBox::setTextEntry(const LLStringExplicit& text)
}
}
const std::string LLComboBox::getTextEntry() const
{
return mTextEntry->getText();
}
//static
void LLComboBox::onTextEntry(LLLineEditor* line_editor, void* user_data)
{
@@ -981,6 +987,10 @@ void LLComboBox::onTextEntry(LLLineEditor* line_editor, void* user_data)
void LLComboBox::updateSelection()
{
if(mSuppressAutoComplete) {
return;
}
LLWString left_wstring = mTextEntry->getWText().substr(0, mTextEntry->getCursor());
// user-entered portion of string, based on assumption that any selected
// text was a result of auto-completion
@@ -1035,6 +1045,11 @@ void LLComboBox::setSuppressTentative(bool suppress)
if (mTextEntry && mSuppressTentative) mTextEntry->setTentative(FALSE);
}
void LLComboBox::setSuppressAutoComplete(bool suppress)
{
mSuppressAutoComplete = suppress;
}
void LLComboBox::setFocusText(BOOL b)
{

View File

@@ -110,6 +110,7 @@ public:
void setAllowTextEntry(BOOL allow, S32 max_chars = 50, BOOL make_tentative = TRUE);
void setTextEntry(const LLStringExplicit& text);
const std::string getTextEntry() const;
void setFocusText(BOOL b); // Sets focus to the text input area instead of the list
BOOL isTextDirty() const; // Returns TRUE if the user has modified the text input area
void resetTextDirty(); // Resets the dirty flag on the input field
@@ -187,6 +188,7 @@ public:
static void onTextCommit(LLUICtrl* caller, void* user_data);
void setSuppressTentative(bool suppress);
void setSuppressAutoComplete(bool suppress);
void updateSelection();
virtual void showList();
@@ -206,6 +208,7 @@ private:
BOOL mAllowTextEntry;
S32 mMaxChars;
BOOL mTextEntryTentative;
bool mSuppressAutoComplete;
bool mSuppressTentative;
void (*mPrearrangeCallback)(LLUICtrl*,void*);
void (*mTextEntryCallback)(LLLineEditor*, void*);

View File

@@ -260,6 +260,7 @@ LLPanelLogin::LLPanelLogin(const LLRect &rect,
name_combo->setFocusLostCallback(onLoginComboLostFocus);
name_combo->setPrevalidate(LLLineEditor::prevalidatePrintableNotPipe);
name_combo->setSuppressTentative(true);
name_combo->setSuppressAutoComplete(true);
childSetCommitCallback("remember_name_check", onNameCheckChanged);
childSetCommitCallback("password_edit", mungePassword);
@@ -710,11 +711,11 @@ void LLPanelLogin::setFields(const LLSavedLoginEntry& entry, bool takeFocus)
LLCheckBoxCtrl* remember_pass_check = sInstance->getChild<LLCheckBoxCtrl>("remember_check");
std::string fullname = nameJoin(entry.getFirstName(), entry.getLastName());
LLComboBox* login_combo = sInstance->getChild<LLComboBox>("name_combo");
login_combo->setLabel(fullname);
sInstance->childSetText("name_combo", fullname);
login_combo->setTextEntry(fullname);
//sInstance->childSetText("name_combo", fullname);
std::string grid = entry.getGrid();
if(!grid.empty() && gHippoGridManager->getGrid(grid)) {
if(!grid.empty() && gHippoGridManager->getGrid(grid) && grid != gHippoGridManager->getCurrentGridNick()) {
gHippoGridManager->setCurrentGrid(grid);
LLPanelLogin::refreshLoginPage();
}
@@ -749,8 +750,8 @@ void LLPanelLogin::getFields(std::string *firstname,
llwarns << "Attempted getFields with no login view shown" << llendl;
return;
}
nameSplit(sInstance->childGetText("name_combo"), *firstname, *lastname);
nameSplit(sInstance->getChild<LLComboBox>("name_combo")->getTextEntry(), *firstname, *lastname);
LLStringUtil::trim(*firstname);
LLStringUtil::trim(*lastname);
@@ -1100,8 +1101,8 @@ void LLPanelLogin::onClickConnect(void *)
// JC - Make sure the fields all get committed.
sInstance->setFocus(FALSE);
std::string first, last;
if (nameSplit(sInstance->childGetText("name_combo"), first, last))
std::string first, last, password;
if (nameSplit(sInstance->getChild<LLComboBox>("name_combo")->getTextEntry(), first, last))
{
// has both first and last name typed
sInstance->mCallback(0, sInstance->mCallbackData);