From 99a4bd23dadbdaf8e82ceca26af531c93d5fd4a6 Mon Sep 17 00:00:00 2001 From: andreykproductengine Date: Fri, 9 Aug 2019 21:34:12 +0300 Subject: SL-9699 Login selection --- indra/newview/llfloaterforgetuser.cpp | 154 ++++++++++++++++++++++++++++++++++ 1 file changed, 154 insertions(+) create mode 100644 indra/newview/llfloaterforgetuser.cpp (limited to 'indra/newview/llfloaterforgetuser.cpp') diff --git a/indra/newview/llfloaterforgetuser.cpp b/indra/newview/llfloaterforgetuser.cpp new file mode 100644 index 0000000000..5659cb2f79 --- /dev/null +++ b/indra/newview/llfloaterforgetuser.cpp @@ -0,0 +1,154 @@ +/** + * @file llfloaterforgetuser.cpp + * @brief LLFloaterForgetUser class definition. + * + * $LicenseInfo:firstyear=2019&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2019, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA + * $/LicenseInfo$ + */ + + +#include "llviewerprecompiledheaders.h" + +#include "llfloaterforgetuser.h" + +#include "llcheckboxctrl.h" +#include "llfavoritesbar.h" +#include "llpanellogin.h" // for helper function getUserName() and to repopulate list if nessesary +#include "llscrolllistctrl.h" +#include "llsecapi.h" +#include "llviewernetwork.h" + + +LLFloaterForgetUser::LLFloaterForgetUser(const LLSD &key) + : LLFloater("floater_forget_user"), + mLoginPanelDirty(false) +{ + +} + +LLFloaterForgetUser::~LLFloaterForgetUser() +{ + if (mLoginPanelDirty) + { + LLPanelLogin::resetFields(); + } +} + +BOOL LLFloaterForgetUser::postBuild() +{ + // Note, storage works per grid, watever is selected currently in login screen or logged in. + // Since login screen can change grid, store the value. + mGrid = LLGridManager::getInstance()->getGrid(); + + LLScrollListCtrl *scroll_list = getChild("user_list"); + if (gSecAPIHandler->hasCredentialMap("login_list", mGrid)) + { + LLSecAPIHandler::credential_map_t credencials; + gSecAPIHandler->loadCredentialMap("login_list", mGrid, credencials); + + LLSecAPIHandler::credential_map_t::iterator cr_iter = credencials.begin(); + LLSecAPIHandler::credential_map_t::iterator cr_end = credencials.end(); + while (cr_iter != cr_end) + { + if (cr_iter->second.notNull()) // basic safety + { + LLScrollListItem::Params item_params; + item_params.value(cr_iter->first); + item_params.columns.add() + .value(LLPanelLogin::getUserName(cr_iter->second)) + .column("user") + .font(LLFontGL::getFontSansSerifSmall()); + scroll_list->addRow(item_params, ADD_BOTTOM); + } + cr_iter++; + } + scroll_list->selectFirstItem(); + } + else + { + LLPointer cred = gSecAPIHandler->loadCredential(mGrid); + if (cred.notNull()) + { + LLScrollListItem::Params item_params; + item_params.value(cred->userID()); + item_params.columns.add() + .value(LLPanelLogin::getUserName(cred)) + .column("user") + .font(LLFontGL::getFontSansSerifSmall()); + scroll_list->addRow(item_params, ADD_BOTTOM); + scroll_list->selectFirstItem(); + } + } + + bool enable_button = scroll_list->getFirstSelectedIndex() != -1; + getChild("delete_data")->setEnabled(enable_button); + LLButton *button = getChild("forget"); + button->setEnabled(enable_button); + button->setCommitCallback(boost::bind(&LLFloaterForgetUser::onForgetClicked, this)); + + return TRUE; +} + +void LLFloaterForgetUser::onForgetClicked() +{ + mLoginPanelDirty = true; + LLScrollListCtrl *scroll_list = getChild("user_list"); + std::string user_key = scroll_list->getSelectedValue(); + + // remove creds + gSecAPIHandler->removeFromCredentialMap("login_list", mGrid, user_key); + + LLPointer cred = gSecAPIHandler->loadCredential(mGrid); + if (cred.notNull() && cred->userID() == user_key) + { + gSecAPIHandler->deleteCredential(cred); + } + + // Clean data + LLCheckBoxCtrl *chk_box = getChild("delete_data"); + BOOL delete_data = chk_box->getValue(); + if (delete_data) + { + // key is edentical to one we use for name of user's folder + std::string user_path = gDirUtilp->getOSUserAppDir() + gDirUtilp->getDirDelimiter() + user_key; + gDirUtilp->deleteDirAndContents(user_path); + + // Clean favorites, label is edentical to username + LLFavoritesOrderStorage::removeFavoritesRecordOfUser(scroll_list->getSelectedItemLabel(), mGrid); + + // Note: we do not clean user-related files from cache because there are id dependent (inventory) + // files and cache has separate cleaning mechanism either way. + // Also this only cleans user from current grid, not all of them. + } + + + // Update UI + scroll_list->deleteSelectedItems(); + scroll_list->selectFirstItem(); + if (scroll_list->getFirstSelectedIndex() == -1) + { + LLButton *button = getChild("forget"); + button->setEnabled(false); + chk_box->setEnabled(false); + } +} + + -- cgit v1.2.3 From ac0bbba7a554834f763a0ffcd03fd25897bc374e Mon Sep 17 00:00:00 2001 From: andreykproductengine Date: Tue, 12 Nov 2019 11:45:39 +0200 Subject: SL-9699 Updated tooltip and initial checkbox value --- indra/newview/llfloaterforgetuser.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'indra/newview/llfloaterforgetuser.cpp') diff --git a/indra/newview/llfloaterforgetuser.cpp b/indra/newview/llfloaterforgetuser.cpp index 5659cb2f79..55e25ace9a 100644 --- a/indra/newview/llfloaterforgetuser.cpp +++ b/indra/newview/llfloaterforgetuser.cpp @@ -99,7 +99,9 @@ BOOL LLFloaterForgetUser::postBuild() } bool enable_button = scroll_list->getFirstSelectedIndex() != -1; - getChild("delete_data")->setEnabled(enable_button); + LLCheckBoxCtrl *chk_box = getChild("delete_data"); + chk_box->setEnabled(enable_button); + chk_box->set(FALSE); LLButton *button = getChild("forget"); button->setEnabled(enable_button); button->setCommitCallback(boost::bind(&LLFloaterForgetUser::onForgetClicked, this)); -- cgit v1.2.3 From fed4d3391cf704fb080cf95e15cd992351ba0575 Mon Sep 17 00:00:00 2001 From: andreykproductengine Date: Mon, 18 Nov 2019 21:46:19 +0200 Subject: SL-9699 Fixed processing of placeholder #2 --- indra/newview/llfloaterforgetuser.cpp | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) (limited to 'indra/newview/llfloaterforgetuser.cpp') diff --git a/indra/newview/llfloaterforgetuser.cpp b/indra/newview/llfloaterforgetuser.cpp index 55e25ace9a..363951041a 100644 --- a/indra/newview/llfloaterforgetuser.cpp +++ b/indra/newview/llfloaterforgetuser.cpp @@ -54,7 +54,7 @@ LLFloaterForgetUser::~LLFloaterForgetUser() BOOL LLFloaterForgetUser::postBuild() { - // Note, storage works per grid, watever is selected currently in login screen or logged in. + // Note, storage works per grid, whatever is selected currently in login screen or logged in. // Since login screen can change grid, store the value. mGrid = LLGridManager::getInstance()->getGrid(); @@ -87,14 +87,18 @@ BOOL LLFloaterForgetUser::postBuild() LLPointer cred = gSecAPIHandler->loadCredential(mGrid); if (cred.notNull()) { - LLScrollListItem::Params item_params; - item_params.value(cred->userID()); - item_params.columns.add() - .value(LLPanelLogin::getUserName(cred)) - .column("user") - .font(LLFontGL::getFontSansSerifSmall()); - scroll_list->addRow(item_params, ADD_BOTTOM); - scroll_list->selectFirstItem(); + const LLSD &ident = cred->getIdentifier(); + if (ident.isMap() && ident.has("type")) + { + LLScrollListItem::Params item_params; + item_params.value(cred->userID()); + item_params.columns.add() + .value(LLPanelLogin::getUserName(cred)) + .column("user") + .font(LLFontGL::getFontSansSerifSmall()); + scroll_list->addRow(item_params, ADD_BOTTOM); + scroll_list->selectFirstItem(); + } } } -- cgit v1.2.3 From 19caca91e98e41187f76c9925c31b8fba33c2902 Mon Sep 17 00:00:00 2001 From: andreykproductengine Date: Tue, 7 Jan 2020 00:52:04 +0200 Subject: SL-12486 Better data deletion --- indra/newview/llfloaterforgetuser.cpp | 231 ++++++++++++++++++++++++++-------- 1 file changed, 179 insertions(+), 52 deletions(-) (limited to 'indra/newview/llfloaterforgetuser.cpp') diff --git a/indra/newview/llfloaterforgetuser.cpp b/indra/newview/llfloaterforgetuser.cpp index 363951041a..6271ccfa18 100644 --- a/indra/newview/llfloaterforgetuser.cpp +++ b/indra/newview/llfloaterforgetuser.cpp @@ -29,11 +29,15 @@ #include "llfloaterforgetuser.h" +#include "llappviewer.h" #include "llcheckboxctrl.h" #include "llfavoritesbar.h" +#include "llnotificationsutil.h" #include "llpanellogin.h" // for helper function getUserName() and to repopulate list if nessesary #include "llscrolllistctrl.h" #include "llsecapi.h" +#include "llstartup.h" +#include "llviewercontrol.h" #include "llviewernetwork.h" @@ -54,55 +58,65 @@ LLFloaterForgetUser::~LLFloaterForgetUser() BOOL LLFloaterForgetUser::postBuild() { - // Note, storage works per grid, whatever is selected currently in login screen or logged in. - // Since login screen can change grid, store the value. - mGrid = LLGridManager::getInstance()->getGrid(); + mScrollList = getChild("user_list"); - LLScrollListCtrl *scroll_list = getChild("user_list"); - if (gSecAPIHandler->hasCredentialMap("login_list", mGrid)) - { - LLSecAPIHandler::credential_map_t credencials; - gSecAPIHandler->loadCredentialMap("login_list", mGrid, credencials); - LLSecAPIHandler::credential_map_t::iterator cr_iter = credencials.begin(); - LLSecAPIHandler::credential_map_t::iterator cr_end = credencials.end(); - while (cr_iter != cr_end) + bool show_grid_marks = gSavedSettings.getBOOL("ForceShowGrid"); + show_grid_marks |= !LLGridManager::getInstance()->isInProductionGrid(); + + std::map known_grids = LLGridManager::getInstance()->getKnownGrids(); + + if (!show_grid_marks) + { + // Figure out if there are records for more than one grid in storage + for (std::map::iterator grid_iter = known_grids.begin(); + grid_iter != known_grids.end(); + grid_iter++) { - if (cr_iter->second.notNull()) // basic safety + if (!grid_iter->first.empty() + && grid_iter->first != MAINGRID) // a workaround since 'mIsInProductionGrid' might not be set { - LLScrollListItem::Params item_params; - item_params.value(cr_iter->first); - item_params.columns.add() - .value(LLPanelLogin::getUserName(cr_iter->second)) - .column("user") - .font(LLFontGL::getFontSansSerifSmall()); - scroll_list->addRow(item_params, ADD_BOTTOM); + if (!gSecAPIHandler->emptyCredentialMap("login_list", grid_iter->first)) + { + show_grid_marks = true; + break; + } + + // "Legacy" viewer support + LLPointer cred = gSecAPIHandler->loadCredential(grid_iter->first); + if (cred.notNull()) + { + const LLSD &ident = cred->getIdentifier(); + if (ident.isMap() && ident.has("type")) + { + show_grid_marks = true; + break; + } + } } - cr_iter++; } - scroll_list->selectFirstItem(); + } + + if (!show_grid_marks) + { + // just load maingrid + loadGridToList(MAINGRID, false); } else { - LLPointer cred = gSecAPIHandler->loadCredential(mGrid); - if (cred.notNull()) + for (std::map::iterator grid_iter = known_grids.begin(); + grid_iter != known_grids.end(); + grid_iter++) { - const LLSD &ident = cred->getIdentifier(); - if (ident.isMap() && ident.has("type")) + if (!grid_iter->first.empty()) { - LLScrollListItem::Params item_params; - item_params.value(cred->userID()); - item_params.columns.add() - .value(LLPanelLogin::getUserName(cred)) - .column("user") - .font(LLFontGL::getFontSansSerifSmall()); - scroll_list->addRow(item_params, ADD_BOTTOM); - scroll_list->selectFirstItem(); + loadGridToList(grid_iter->first, true); } } } - bool enable_button = scroll_list->getFirstSelectedIndex() != -1; + mScrollList->selectFirstItem(); + bool enable_button = mScrollList->getFirstSelectedIndex() != -1; LLCheckBoxCtrl *chk_box = getChild("delete_data"); chk_box->setEnabled(enable_button); chk_box->set(FALSE); @@ -117,43 +131,156 @@ void LLFloaterForgetUser::onForgetClicked() { mLoginPanelDirty = true; LLScrollListCtrl *scroll_list = getChild("user_list"); - std::string user_key = scroll_list->getSelectedValue(); + LLCheckBoxCtrl *chk_box = getChild("delete_data"); + BOOL delete_data = chk_box->getValue(); + LLSD user_data = scroll_list->getSelectedValue(); + const std::string user_id = user_data["user_id"]; + const std::string grid = user_data["grid"]; + const std::string user_name = user_data["label"]; // for favorites - // remove creds - gSecAPIHandler->removeFromCredentialMap("login_list", mGrid, user_key); + if (delete_data && user_id == LLStartUp::getUserId() && grid == LLGridManager::getInstance()->getGrid()) + { + // we can't delete data for user that is currently logged in + LLNotificationsUtil::add("LoginCantRemoveCurUsername", LLSD(), LLSD(), boost::bind(onConfirmLogout, _1, _2, user_name)); + return; + } + + // key is used for name of user's folder and in credencials + // user_name is edentical to favorite's username + forgetUser(user_id, user_name, grid, delete_data); - LLPointer cred = gSecAPIHandler->loadCredential(mGrid); - if (cred.notNull() && cred->userID() == user_key) + // Update UI + scroll_list->deleteSelectedItems(); + scroll_list->selectFirstItem(); + if (scroll_list->getFirstSelectedIndex() == -1) + { + LLButton *button = getChild("forget"); + button->setEnabled(false); + chk_box->setEnabled(false); + } +} + +//static +void LLFloaterForgetUser::forgetUser(const std::string &userid, const std::string &fav_id, const std::string &grid, bool delete_data) +{ + // Remove creds + gSecAPIHandler->removeFromCredentialMap("login_list", grid, userid); + + LLPointer cred = gSecAPIHandler->loadCredential(grid); + if (cred.notNull() && cred->userID() == userid) { gSecAPIHandler->deleteCredential(cred); } // Clean data - LLCheckBoxCtrl *chk_box = getChild("delete_data"); - BOOL delete_data = chk_box->getValue(); if (delete_data) { - // key is edentical to one we use for name of user's folder - std::string user_path = gDirUtilp->getOSUserAppDir() + gDirUtilp->getDirDelimiter() + user_key; + std::string user_path = gDirUtilp->getOSUserAppDir() + gDirUtilp->getDirDelimiter() + userid; gDirUtilp->deleteDirAndContents(user_path); - // Clean favorites, label is edentical to username - LLFavoritesOrderStorage::removeFavoritesRecordOfUser(scroll_list->getSelectedItemLabel(), mGrid); + // Clean favorites + LLFavoritesOrderStorage::removeFavoritesRecordOfUser(fav_id, grid); // Note: we do not clean user-related files from cache because there are id dependent (inventory) // files and cache has separate cleaning mechanism either way. // Also this only cleans user from current grid, not all of them. } +} +// static +bool LLFloaterForgetUser::onConfirmLogout(const LLSD& notification, const LLSD& response, const std::string &fav_id) +{ + S32 option = LLNotificationsUtil::getSelectedOption(notification, response); + if (option == 0) + { + // Remove creds + gSecAPIHandler->removeFromCredentialMap("login_list", LLGridManager::getInstance()->getGrid(), LLStartUp::getUserId()); - // Update UI - scroll_list->deleteSelectedItems(); - scroll_list->selectFirstItem(); - if (scroll_list->getFirstSelectedIndex() == -1) + LLPointer cred = gSecAPIHandler->loadCredential(LLGridManager::getInstance()->getGrid()); + if (cred.notNull() && cred->userID() == LLStartUp::getUserId()) + { + gSecAPIHandler->deleteCredential(cred); + } + + // Clean favorites + LLFavoritesOrderStorage::removeFavoritesRecordOfUser(fav_id, LLGridManager::getInstance()->getGrid()); + + // mark data for removal + LLAppViewer::instance()->purgeUserDataOnExit(); + LLAppViewer::instance()->requestQuit(); + } + return false; +} + +void LLFloaterForgetUser::loadGridToList(const std::string &grid, bool show_grid_name) +{ + std::string grid_label; + if (show_grid_name) { - LLButton *button = getChild("forget"); - button->setEnabled(false); - chk_box->setEnabled(false); + grid_label = LLGridManager::getInstance()->getGridId(grid); //login id (shortened label) + } + if (gSecAPIHandler->hasCredentialMap("login_list", grid)) + { + LLSecAPIHandler::credential_map_t credencials; + gSecAPIHandler->loadCredentialMap("login_list", grid, credencials); + + LLSecAPIHandler::credential_map_t::iterator cr_iter = credencials.begin(); + LLSecAPIHandler::credential_map_t::iterator cr_end = credencials.end(); + while (cr_iter != cr_end) + { + if (cr_iter->second.notNull()) // basic safety + { + std::string user_label = LLPanelLogin::getUserName(cr_iter->second); + LLSD user_data; + user_data["user_id"] = cr_iter->first; + user_data["label"] = user_label; + user_data["grid"] = grid; + + if (show_grid_name) + { + user_label += " (" + grid_label + ")"; + } + + LLScrollListItem::Params item_params; + item_params.value(user_data); + item_params.columns.add() + .value(user_label) + .column("user") + .font(LLFontGL::getFontSansSerifSmall()); + mScrollList->addRow(item_params, ADD_BOTTOM); + } + cr_iter++; + } + } + else + { + // "Legacy" viewer support + LLPointer cred = gSecAPIHandler->loadCredential(grid); + if (cred.notNull()) + { + const LLSD &ident = cred->getIdentifier(); + if (ident.isMap() && ident.has("type")) + { + std::string user_label = LLPanelLogin::getUserName(cred); + LLSD user_data; + user_data["user_id"] = cred->userID(); + user_data["label"] = user_label; + user_data["grid"] = grid; + + if (show_grid_name) + { + user_label += " (" + grid_label + ")"; + } + + LLScrollListItem::Params item_params; + item_params.value(user_data); + item_params.columns.add() + .value(user_label) + .column("user") + .font(LLFontGL::getFontSansSerifSmall()); + mScrollList->addRow(item_params, ADD_BOTTOM); + } + } } } -- cgit v1.2.3 From d012628c8c1a41a4ffeb7e533c8f24db6d6c54cb Mon Sep 17 00:00:00 2001 From: andreykproductengine Date: Tue, 7 Jan 2020 01:13:36 +0200 Subject: SL-12486 Grids share folders and some data, so don't compare grids. --- indra/newview/llfloaterforgetuser.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/newview/llfloaterforgetuser.cpp') diff --git a/indra/newview/llfloaterforgetuser.cpp b/indra/newview/llfloaterforgetuser.cpp index 6271ccfa18..79aa0d31cc 100644 --- a/indra/newview/llfloaterforgetuser.cpp +++ b/indra/newview/llfloaterforgetuser.cpp @@ -138,7 +138,7 @@ void LLFloaterForgetUser::onForgetClicked() const std::string grid = user_data["grid"]; const std::string user_name = user_data["label"]; // for favorites - if (delete_data && user_id == LLStartUp::getUserId() && grid == LLGridManager::getInstance()->getGrid()) + if (delete_data && user_id == LLStartUp::getUserId()) { // we can't delete data for user that is currently logged in LLNotificationsUtil::add("LoginCantRemoveCurUsername", LLSD(), LLSD(), boost::bind(onConfirmLogout, _1, _2, user_name)); -- cgit v1.2.3 From f051c50943527f49f6b9d5a7ca253c1a630c59af Mon Sep 17 00:00:00 2001 From: andreykproductengine Date: Thu, 9 Jan 2020 22:22:40 +0200 Subject: SL-12538 SL-12486 Warning about deleting shared local files and some other fiexes --- indra/newview/llfloaterforgetuser.cpp | 117 ++++++++++++++++++++++++++-------- 1 file changed, 89 insertions(+), 28 deletions(-) (limited to 'indra/newview/llfloaterforgetuser.cpp') diff --git a/indra/newview/llfloaterforgetuser.cpp b/indra/newview/llfloaterforgetuser.cpp index 79aa0d31cc..97b022699f 100644 --- a/indra/newview/llfloaterforgetuser.cpp +++ b/indra/newview/llfloaterforgetuser.cpp @@ -97,6 +97,7 @@ BOOL LLFloaterForgetUser::postBuild() } } + mUserGridsCount.clear(); if (!show_grid_marks) { // just load maingrid @@ -129,7 +130,60 @@ BOOL LLFloaterForgetUser::postBuild() void LLFloaterForgetUser::onForgetClicked() { - mLoginPanelDirty = true; + LLScrollListCtrl *scroll_list = getChild("user_list"); + LLSD user_data = scroll_list->getSelectedValue(); + const std::string user_id = user_data["user_id"]; + + LLCheckBoxCtrl *chk_box = getChild("delete_data"); + BOOL delete_data = chk_box->getValue(); + + if (delete_data && mUserGridsCount[user_id] > 1) + { + // more than 1 grid uses this id + LLNotificationsUtil::add("LoginRemoveMultiGridUserData", LLSD(), LLSD(), boost::bind(&LLFloaterForgetUser::onConfirmForget, this, _1, _2)); + return; + } + + processForgetUser(); +} + +bool LLFloaterForgetUser::onConfirmForget(const LLSD& notification, const LLSD& response) +{ + S32 option = LLNotificationsUtil::getSelectedOption(notification, response); + if (option == 0) + { + processForgetUser(); + } + return false; +} + +// static +bool LLFloaterForgetUser::onConfirmLogout(const LLSD& notification, const LLSD& response, const std::string &fav_id, const std::string &grid) +{ + S32 option = LLNotificationsUtil::getSelectedOption(notification, response); + if (option == 0) + { + // Remove creds + gSecAPIHandler->removeFromCredentialMap("login_list", grid, LLStartUp::getUserId()); + + LLPointer cred = gSecAPIHandler->loadCredential(grid); + if (cred.notNull() && cred->userID() == LLStartUp::getUserId()) + { + gSecAPIHandler->deleteCredential(cred); + } + + // Clean favorites + LLFavoritesOrderStorage::removeFavoritesRecordOfUser(fav_id, grid); + + // mark data for removal + LLAppViewer::instance()->purgeUserDataOnExit(); + LLAppViewer::instance()->requestQuit(); + } + return false; +} + +void LLFloaterForgetUser::processForgetUser() +{ LLScrollListCtrl *scroll_list = getChild("user_list"); LLCheckBoxCtrl *chk_box = getChild("delete_data"); BOOL delete_data = chk_box->getValue(); @@ -138,16 +192,26 @@ void LLFloaterForgetUser::onForgetClicked() const std::string grid = user_data["grid"]; const std::string user_name = user_data["label"]; // for favorites - if (delete_data && user_id == LLStartUp::getUserId()) + if (delete_data && user_id == LLStartUp::getUserId() && LLStartUp::getStartupState() > STATE_LOGIN_WAIT) { // we can't delete data for user that is currently logged in - LLNotificationsUtil::add("LoginCantRemoveCurUsername", LLSD(), LLSD(), boost::bind(onConfirmLogout, _1, _2, user_name)); + // we need to pass grid because we are deleting data universal to grids, but specific grid's user + LLNotificationsUtil::add("LoginCantRemoveCurUsername", LLSD(), LLSD(), boost::bind(onConfirmLogout, _1, _2, user_name, grid)); return; } // key is used for name of user's folder and in credencials // user_name is edentical to favorite's username forgetUser(user_id, user_name, grid, delete_data); + mLoginPanelDirty = true; + if (delete_data) + { + mUserGridsCount[user_id] = 0; //no data left to care about + } + else + { + mUserGridsCount[user_id]--; + } // Update UI scroll_list->deleteSelectedItems(); @@ -187,31 +251,6 @@ void LLFloaterForgetUser::forgetUser(const std::string &userid, const std::strin } } -// static -bool LLFloaterForgetUser::onConfirmLogout(const LLSD& notification, const LLSD& response, const std::string &fav_id) -{ - S32 option = LLNotificationsUtil::getSelectedOption(notification, response); - if (option == 0) - { - // Remove creds - gSecAPIHandler->removeFromCredentialMap("login_list", LLGridManager::getInstance()->getGrid(), LLStartUp::getUserId()); - - LLPointer cred = gSecAPIHandler->loadCredential(LLGridManager::getInstance()->getGrid()); - if (cred.notNull() && cred->userID() == LLStartUp::getUserId()) - { - gSecAPIHandler->deleteCredential(cred); - } - - // Clean favorites - LLFavoritesOrderStorage::removeFavoritesRecordOfUser(fav_id, LLGridManager::getInstance()->getGrid()); - - // mark data for removal - LLAppViewer::instance()->purgeUserDataOnExit(); - LLAppViewer::instance()->requestQuit(); - } - return false; -} - void LLFloaterForgetUser::loadGridToList(const std::string &grid, bool show_grid_name) { std::string grid_label; @@ -248,6 +287,17 @@ void LLFloaterForgetUser::loadGridToList(const std::string &grid, bool show_grid .column("user") .font(LLFontGL::getFontSansSerifSmall()); mScrollList->addRow(item_params, ADD_BOTTOM); + + // Add one to grid count + std::map::iterator found = mUserGridsCount.find(cr_iter->first); + if (found != mUserGridsCount.end()) + { + found->second++; + } + else + { + mUserGridsCount[cr_iter->first] = 1; + } } cr_iter++; } @@ -279,6 +329,17 @@ void LLFloaterForgetUser::loadGridToList(const std::string &grid, bool show_grid .column("user") .font(LLFontGL::getFontSansSerifSmall()); mScrollList->addRow(item_params, ADD_BOTTOM); + + // Add one to grid count + std::map::iterator found = mUserGridsCount.find(cred->userID()); + if (found != mUserGridsCount.end()) + { + found->second++; + } + else + { + mUserGridsCount[cred->userID()] = 1; + } } } } -- cgit v1.2.3