Use AIFilePicker everywhere.

Also upgrade the file picker filters with the new extensions found
in the orginal file picker code of Singularity.

Also improve AIFilePicker a bit: added hasFilename() and now
deleting the statemachine automatically by default: it's no longer
needed to call deleteMe from the callback.
This commit is contained in:
Aleric Inglewood
2011-05-10 04:27:57 +02:00
parent 81550aa6de
commit e0b0fa4f58
49 changed files with 1097 additions and 564 deletions

View File

@@ -61,7 +61,7 @@
#include "lllineeditor.h"
#include "lluictrlfactory.h"
// <edit>
#include "llfilepicker.h"
#include "statemachine/aifilepicker.h"
// </edit>
///----------------------------------------------------------------------------
@@ -717,17 +717,18 @@ void LLPreviewNotecard::saveAs()
if(item)
{
// gAssetStorage->getAssetData(item->getAssetUUID(), LLAssetType::AT_NOTECARD, LLPreviewNotecard::gotAssetForSave, this, TRUE);
default_filename = LLDir::getScrubbedFileName(item->getName());
default_filename = LLDir::getScrubbedFileName(item->getName()) + ".notecard";
}
LLFilePicker& file_picker = LLFilePicker::instance();
if( !file_picker.getSaveFile( LLFilePicker::FFSAVE_NOTECARD, default_filename ) )
{
// User canceled or we failed to acquire save file.
AIFilePicker* filepicker = new AIFilePicker;
filepicker->open(default_filename, FFSAVE_NOTECARD);
filepicker->run(boost::bind(&LLPreviewNotecard::saveAs_continued, this, filepicker));
}
void LLPreviewNotecard::saveAs_continued(AIFilePicker* filepicker)
{
if (!filepicker->hasFilename())
return;
}
// remember the user-approved/edited file name.
std::string filename = file_picker.getFirstFile();
LLViewerTextEditor* editor = getChild<LLViewerTextEditor>("Notecard Editor");
@@ -738,8 +739,9 @@ void LLPreviewNotecard::saveAs()
return;
}
S32 size = buffer.length() + 1;
S32 size = buffer.length();
std::string filename = filepicker->getFilename();
std::ofstream export_file(filename.c_str(), std::ofstream::binary);
export_file.write(buffer.c_str(), size);
export_file.close();