From 778b89d5c9a8c436aaae3dcdb4d681553b846eab Mon Sep 17 00:00:00 2001 From: Lirusaito Date: Fri, 11 Jan 2019 08:33:49 -0500 Subject: [PATCH] Feature request: When creating a new AO notecard, actually show it! --- indra/newview/floaterao.cpp | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/indra/newview/floaterao.cpp b/indra/newview/floaterao.cpp index a75b02d21..f0cfe1576 100644 --- a/indra/newview/floaterao.cpp +++ b/indra/newview/floaterao.cpp @@ -51,28 +51,32 @@ public: { if (!mFileName.empty()) { - LLPreviewNotecard* nc; - nc = (LLPreviewNotecard*)LLPreview::find(inv_item); - if(nc) + LLPreviewNotecard* nc = (LLPreviewNotecard*)LLPreview::show(inv_item); + if (!nc) { - nc->open(); - LLTextEditor *text = nc->getEditor(); - if (text) + auto item = gInventory.getItem(inv_item); + open_notecard(item, "Note: " + item->getName(), LLUUID::null, false); + nc = (LLPreviewNotecard*)LLPreview::find(inv_item); + } + + if (nc) + { + if (LLTextEditor *text = nc->getEditor()) { text->clear(); text->makePristine(); std::ifstream file(mFileName.c_str()); - + std::string line; while (!file.eof()) - { + { getline(file, line); - line = line + "\n"; + line += '\n'; text->insertText(line); } file.close(); - + nc->saveIfNeeded(); } }