Skip to content
Snippets Groups Projects
Commit f051c509 authored by andreykproductengine's avatar andreykproductengine
Browse files

SL-12538 SL-12486 Warning about deleting shared local files and some other fiexes

parent a01388c6
No related branches found
No related tags found
No related merge requests found
...@@ -97,6 +97,7 @@ BOOL LLFloaterForgetUser::postBuild() ...@@ -97,6 +97,7 @@ BOOL LLFloaterForgetUser::postBuild()
} }
} }
mUserGridsCount.clear();
if (!show_grid_marks) if (!show_grid_marks)
{ {
// just load maingrid // just load maingrid
...@@ -129,7 +130,60 @@ BOOL LLFloaterForgetUser::postBuild() ...@@ -129,7 +130,60 @@ BOOL LLFloaterForgetUser::postBuild()
void LLFloaterForgetUser::onForgetClicked() void LLFloaterForgetUser::onForgetClicked()
{ {
mLoginPanelDirty = true; LLScrollListCtrl *scroll_list = getChild<LLScrollListCtrl>("user_list");
LLSD user_data = scroll_list->getSelectedValue();
const std::string user_id = user_data["user_id"];
LLCheckBoxCtrl *chk_box = getChild<LLCheckBoxCtrl>("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<LLCredential> 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<LLScrollListCtrl>("user_list"); LLScrollListCtrl *scroll_list = getChild<LLScrollListCtrl>("user_list");
LLCheckBoxCtrl *chk_box = getChild<LLCheckBoxCtrl>("delete_data"); LLCheckBoxCtrl *chk_box = getChild<LLCheckBoxCtrl>("delete_data");
BOOL delete_data = chk_box->getValue(); BOOL delete_data = chk_box->getValue();
...@@ -138,16 +192,26 @@ void LLFloaterForgetUser::onForgetClicked() ...@@ -138,16 +192,26 @@ void LLFloaterForgetUser::onForgetClicked()
const std::string grid = user_data["grid"]; const std::string grid = user_data["grid"];
const std::string user_name = user_data["label"]; // for favorites 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 // 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; return;
} }
// key is used for name of user's folder and in credencials // key is used for name of user's folder and in credencials
// user_name is edentical to favorite's username // user_name is edentical to favorite's username
forgetUser(user_id, user_name, grid, delete_data); 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 // Update UI
scroll_list->deleteSelectedItems(); scroll_list->deleteSelectedItems();
...@@ -187,31 +251,6 @@ void LLFloaterForgetUser::forgetUser(const std::string &userid, const std::strin ...@@ -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<LLCredential> 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) void LLFloaterForgetUser::loadGridToList(const std::string &grid, bool show_grid_name)
{ {
std::string grid_label; std::string grid_label;
...@@ -248,6 +287,17 @@ void LLFloaterForgetUser::loadGridToList(const std::string &grid, bool show_grid ...@@ -248,6 +287,17 @@ void LLFloaterForgetUser::loadGridToList(const std::string &grid, bool show_grid
.column("user") .column("user")
.font(LLFontGL::getFontSansSerifSmall()); .font(LLFontGL::getFontSansSerifSmall());
mScrollList->addRow(item_params, ADD_BOTTOM); mScrollList->addRow(item_params, ADD_BOTTOM);
// Add one to grid count
std::map<std::string, S32>::iterator found = mUserGridsCount.find(cr_iter->first);
if (found != mUserGridsCount.end())
{
found->second++;
}
else
{
mUserGridsCount[cr_iter->first] = 1;
}
} }
cr_iter++; cr_iter++;
} }
...@@ -279,6 +329,17 @@ void LLFloaterForgetUser::loadGridToList(const std::string &grid, bool show_grid ...@@ -279,6 +329,17 @@ void LLFloaterForgetUser::loadGridToList(const std::string &grid, bool show_grid
.column("user") .column("user")
.font(LLFontGL::getFontSansSerifSmall()); .font(LLFontGL::getFontSansSerifSmall());
mScrollList->addRow(item_params, ADD_BOTTOM); mScrollList->addRow(item_params, ADD_BOTTOM);
// Add one to grid count
std::map<std::string, S32>::iterator found = mUserGridsCount.find(cred->userID());
if (found != mUserGridsCount.end())
{
found->second++;
}
else
{
mUserGridsCount[cred->userID()] = 1;
}
} }
} }
} }
......
...@@ -39,15 +39,18 @@ class LLFloaterForgetUser : public LLFloater ...@@ -39,15 +39,18 @@ class LLFloaterForgetUser : public LLFloater
BOOL postBuild(); BOOL postBuild();
void onForgetClicked(); void onForgetClicked();
static void forgetUser(const std::string &userid, const std::string &fav_id, const std::string &grid, bool delete_data);
private: private:
static bool onConfirmLogout(const LLSD& notification, const LLSD& response, const std::string &favorites_id); bool onConfirmForget(const LLSD& notification, const LLSD& response);
static bool onConfirmLogout(const LLSD& notification, const LLSD& response, const std::string &favorites_id, const std::string &grid);
void processForgetUser();
static void forgetUser(const std::string &userid, const std::string &fav_id, const std::string &grid, bool delete_data);
void loadGridToList(const std::string &grid, bool show_grid_name); void loadGridToList(const std::string &grid, bool show_grid_name);
LLScrollListCtrl *mScrollList; LLScrollListCtrl *mScrollList;
bool mLoginPanelDirty; bool mLoginPanelDirty;
std::map<std::string, S32> mUserGridsCount;
}; };
#endif #endif
...@@ -3623,6 +3623,18 @@ You can either check your Internet connection and try again in a few minutes or ...@@ -3623,6 +3623,18 @@ You can either check your Internet connection and try again in a few minutes or
</form> </form>
</notification> </notification>
<notification
icon="alertmodal.tga"
name="LoginRemoveMultiGridUserData"
type="alertmodal">
<tag>confirm</tag>
Local Data you are deleting is shared between multiple grids, are you sure you want to delete it?
<usetemplate
name="okcancelbuttons"
notext="Cancel"
yestext="Confirm"/>
</notification>
<notification <notification
icon="alertmodal.tga" icon="alertmodal.tga"
name="WelcomeChooseSex" name="WelcomeChooseSex"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment