diff options
author | maxim_productengine <mnikolenko@productengine.com> | 2018-05-30 18:31:30 +0300 |
---|---|---|
committer | maxim_productengine <mnikolenko@productengine.com> | 2018-05-30 18:31:30 +0300 |
commit | 31bfc7ff47c95a9fc9c23ed101a07c071d07daaa (patch) | |
tree | 7f0c90f10238f38c1046e620bd4a1387f3711e3e /indra/newview/llfloaterautoreplacesettings.cpp | |
parent | 177f24f56fd6a3624efa1fa311c5a79025fbfa64 (diff) |
MAINT-8700 FIXED The File dialog disconnects the viewer if you do not choose upload files within the first minute
Diffstat (limited to 'indra/newview/llfloaterautoreplacesettings.cpp')
-rw-r--r-- | indra/newview/llfloaterautoreplacesettings.cpp | 108 |
1 files changed, 53 insertions, 55 deletions
diff --git a/indra/newview/llfloaterautoreplacesettings.cpp b/indra/newview/llfloaterautoreplacesettings.cpp index 5830f2f711..ec05ba924c 100644 --- a/indra/newview/llfloaterautoreplacesettings.cpp +++ b/indra/newview/llfloaterautoreplacesettings.cpp @@ -54,6 +54,7 @@ #include "llhost.h" #include "llassetstorage.h" #include "roles_constants.h" +#include "llviewermenufile.h" // LLFilePickerReplyThread #include "llviewertexteditor.h" #include <boost/tokenizer.hpp> @@ -349,62 +350,58 @@ void LLFloaterAutoReplaceSettings::onDeleteEntry() // called when the Import List button is pressed void LLFloaterAutoReplaceSettings::onImportList() { - LLFilePicker& picker = LLFilePicker::instance(); - if( picker.getOpenFile( LLFilePicker::FFLOAD_XML) ) + (new LLFilePickerReplyThread(boost::bind(&LLFloaterAutoReplaceSettings::loadListFromFile, this, _1), LLFilePicker::FFLOAD_XML, false))->getFile(); +} + +void LLFloaterAutoReplaceSettings::loadListFromFile(const std::vector<std::string>& filenames) +{ + llifstream file; + file.open(filenames[0].c_str()); + LLSD newList; + if (file.is_open()) { - llifstream file; - file.open(picker.getFirstFile().c_str()); - LLSD newList; - if (file.is_open()) - { - LLSDSerialize::fromXMLDocument(newList, file); - } - file.close(); + LLSDSerialize::fromXMLDocument(newList, file); + } + file.close(); - switch ( mSettings.addList(newList) ) - { - case LLAutoReplaceSettings::AddListOk: - mSelectedListName = LLAutoReplaceSettings::getListName(newList); + switch ( mSettings.addList(newList) ) + { + case LLAutoReplaceSettings::AddListOk: + mSelectedListName = LLAutoReplaceSettings::getListName(newList); - updateListNames(); - updateListNamesControls(); - updateReplacementsList(); - break; + updateListNames(); + updateListNamesControls(); + updateReplacementsList(); + break; - case LLAutoReplaceSettings::AddListDuplicateName: - { - std::string newName = LLAutoReplaceSettings::getListName(newList); - LL_WARNS("AutoReplace")<<"name '"<<newName<<"' is in use; prompting for new name"<<LL_ENDL; - LLSD newPayload; - newPayload["list"] = newList; - LLSD args; - args["DUPNAME"] = newName; + case LLAutoReplaceSettings::AddListDuplicateName: + { + std::string newName = LLAutoReplaceSettings::getListName(newList); + LL_WARNS("AutoReplace")<<"name '"<<newName<<"' is in use; prompting for new name"<<LL_ENDL; + LLSD newPayload; + newPayload["list"] = newList; + LLSD args; + args["DUPNAME"] = newName; - LLNotificationsUtil::add("RenameAutoReplaceList", args, newPayload, + LLNotificationsUtil::add("RenameAutoReplaceList", args, newPayload, boost::bind(&LLFloaterAutoReplaceSettings::callbackListNameConflict, this, _1, _2)); - } - break; + } + break; - case LLAutoReplaceSettings::AddListInvalidList: - LLNotificationsUtil::add("InvalidAutoReplaceList"); - LL_WARNS("AutoReplace") << "imported list was invalid" << LL_ENDL; + case LLAutoReplaceSettings::AddListInvalidList: + LLNotificationsUtil::add("InvalidAutoReplaceList"); + LL_WARNS("AutoReplace") << "imported list was invalid" << LL_ENDL; - mSelectedListName.clear(); - updateListNames(); - updateListNamesControls(); - updateReplacementsList(); - break; + mSelectedListName.clear(); + updateListNames(); + updateListNamesControls(); + updateReplacementsList(); + break; - default: - LL_ERRS("AutoReplace") << "invalid AddListResult" << LL_ENDL; + default: + LL_ERRS("AutoReplace") << "invalid AddListResult" << LL_ENDL; - } - - } - else - { - LL_DEBUGS("AutoReplace") << "file selection failed for import list" << LL_ENDL; - } + } } void LLFloaterAutoReplaceSettings::onNewList() @@ -539,16 +536,17 @@ void LLFloaterAutoReplaceSettings::onDeleteList() void LLFloaterAutoReplaceSettings::onExportList() { std::string listName=mListNames->getFirstSelected()->getColumn(0)->getValue().asString(); - const LLSD* list = mSettings.exportList(listName); std::string listFileName = listName + ".xml"; - LLFilePicker& picker = LLFilePicker::instance(); - if( picker.getSaveFile( LLFilePicker::FFSAVE_XML, listFileName) ) - { - llofstream file; - file.open(picker.getFirstFile().c_str()); - LLSDSerialize::toPrettyXML(*list, file); - file.close(); - } + (new LLFilePickerReplyThread(boost::bind(&LLFloaterAutoReplaceSettings::saveListToFile, this, _1, listName), LLFilePicker::FFSAVE_XML, listFileName))->getFile(); +} + +void LLFloaterAutoReplaceSettings::saveListToFile(const std::vector<std::string>& filenames, std::string listName) +{ + llofstream file; + const LLSD* list = mSettings.exportList(listName); + file.open(filenames[0].c_str()); + LLSDSerialize::toPrettyXML(*list, file); + file.close(); } void LLFloaterAutoReplaceSettings::onAddEntry() |