From 31bfc7ff47c95a9fc9c23ed101a07c071d07daaa Mon Sep 17 00:00:00 2001 From: maxim_productengine Date: Wed, 30 May 2018 18:31:30 +0300 Subject: MAINT-8700 FIXED The File dialog disconnects the viewer if you do not choose upload files within the first minute --- indra/newview/llfloaterautoreplacesettings.cpp | 108 ++++++++++++------------- 1 file changed, 53 insertions(+), 55 deletions(-) (limited to 'indra/newview/llfloaterautoreplacesettings.cpp') 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 @@ -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& 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 '"<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& 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() -- cgit v1.2.3