diff options
| author | Andrey Kleshchev <andreykproductengine@lindenlab.com> | 2024-05-31 17:49:01 +0300 | 
|---|---|---|
| committer | Andrey Kleshchev <117672381+akleshchev@users.noreply.github.com> | 2024-06-01 09:30:27 +0300 | 
| commit | bd9add8fc77d7f39cb7c81972f72adbc3e6b5464 (patch) | |
| tree | 1dc4b385268789d85c2a96d8343b32d48c6e7d33 /indra | |
| parent | 3f150fbcf19cdfa205da1576386edc6ef2db1bda (diff) | |
viewer#1595 Add a prompt to confirm deleting an 'auto raplace' list
But only if there is anything of value in the list
Diffstat (limited to 'indra')
| -rw-r--r-- | indra/newview/llfloaterautoreplacesettings.cpp | 43 | ||||
| -rw-r--r-- | indra/newview/llfloaterautoreplacesettings.h | 2 | ||||
| -rw-r--r-- | indra/newview/skins/default/xui/en/notifications.xml | 23 | 
3 files changed, 67 insertions, 1 deletions
| diff --git a/indra/newview/llfloaterautoreplacesettings.cpp b/indra/newview/llfloaterautoreplacesettings.cpp index f4e13f4bf7..71a7875931 100644 --- a/indra/newview/llfloaterautoreplacesettings.cpp +++ b/indra/newview/llfloaterautoreplacesettings.cpp @@ -514,12 +514,53 @@ bool LLFloaterAutoReplaceSettings::callbackListNameConflict(const LLSD& notifica      return false;  } +bool LLFloaterAutoReplaceSettings::callbackRemoveList(const LLSD& notification, const LLSD& response) +{ +    std::string listName = notification["payload"]["list"]; + +    S32 option = LLNotificationsUtil::getSelectedOption(notification, response); +    switch (option) +    { +    case 1: +        if (mSettings.removeReplacementList(listName)) +        { +            LL_INFOS("AutoReplace") << "deleted list '" << listName << "'" << LL_ENDL; +            mReplacementsList->deleteSelectedItems();   // remove from the scrolling list +            mSelectedListName.clear(); +            updateListNames(); +            updateListNamesControls(); +            updateReplacementsList(); +        } +        break; +    case 0: +        break; + +    default: +        LL_ERRS("AutoReplace") << "invalid selected option " << option << LL_ENDL; +    } + +    return false; +} +  void LLFloaterAutoReplaceSettings::onDeleteList()  {      std::string listName = mListNames->getSelectedValue().asString();      if ( ! listName.empty() )      { -        if ( mSettings.removeReplacementList(listName) ) +        const LLSD* mappings = mSettings.getListEntries(mSelectedListName); +        if (mappings->size() > 0) +        { +            LLSD payload; +            payload["list"] = listName; + +            LLSD args; +            args["MAP_SIZE"] = llformat("%d",mappings->size()); +            args["LIST_NAME"] = listName; + +            LLNotificationsUtil::add("RemoveAutoReplaceList", args, payload, +                boost::bind(&LLFloaterAutoReplaceSettings::callbackRemoveList, this, _1, _2)); +        } +        else if ( mSettings.removeReplacementList(listName) )          {              LL_INFOS("AutoReplace")<<"deleted list '"<<listName<<"'"<<LL_ENDL;              mReplacementsList->deleteSelectedItems();   // remove from the scrolling list diff --git a/indra/newview/llfloaterautoreplacesettings.h b/indra/newview/llfloaterautoreplacesettings.h index 7f1953d485..8b752a6f5a 100644 --- a/indra/newview/llfloaterautoreplacesettings.h +++ b/indra/newview/llfloaterautoreplacesettings.h @@ -107,6 +107,8 @@ private:      bool callbackNewListName(const LLSD& notification, const LLSD& response);      /// called from the RenameAutoReplaceList notification dialog      bool callbackListNameConflict(const LLSD& notification, const LLSD& response); +    /// called from the RemoveAutoReplaceList notification dialog +    bool callbackRemoveList(const LLSD& notification, const LLSD& response);      bool selectedListIsFirst();      bool selectedListIsLast(); diff --git a/indra/newview/skins/default/xui/en/notifications.xml b/indra/newview/skins/default/xui/en/notifications.xml index ed040bf50d..ffd7b41d66 100644 --- a/indra/newview/skins/default/xui/en/notifications.xml +++ b/indra/newview/skins/default/xui/en/notifications.xml @@ -3135,6 +3135,29 @@ Would you be my friend?    <notification     icon="alertmodal.tga" +   label="Rename Auto-Replace List" +   name="RemoveAutoReplaceList" +   type="alertmodal"> +'[LIST_NAME]' contains [MAP_SIZE] entries. +     +Are you sure you want to delete this list? +      <tag>confirm</tag> +    <form name="form"> +      <button +       default="true" +       index="1" +       name="DeleteList" +       text="Delete"/> +      <button +       default="false" +       index="0" +       name="Cancel" +       text="Cancel"/> +    </form> +  </notification> + +    <notification +   icon="alertmodal.tga"     name="InvalidAutoReplaceEntry"     type="alertmodal">      The keyword must be a single word, and the replacement may not be empty. | 
