From 6b3f51c6262ebf60a02f234fe892e8b9af9831d2 Mon Sep 17 00:00:00 2001 From: thunder2 Date: Tue, 11 May 2010 20:53:21 +0000 Subject: [PATCH] Bugfix: Attach a file in message dialog inserts the link at current cursor position and does not overwrite the whole message text git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@2887 b45a01b8-16f6-495d-af2f-9b41ad6348cc --- retroshare-gui/src/gui/msgs/ChanMsgDialog.cpp | 19 +------------------ 1 file changed, 1 insertion(+), 18 deletions(-) diff --git a/retroshare-gui/src/gui/msgs/ChanMsgDialog.cpp b/retroshare-gui/src/gui/msgs/ChanMsgDialog.cpp index 3acac56f4..77c25dd68 100644 --- a/retroshare-gui/src/gui/msgs/ChanMsgDialog.cpp +++ b/retroshare-gui/src/gui/msgs/ChanMsgDialog.cpp @@ -1242,25 +1242,8 @@ void ChanMsgDialog::fileHashingFinished(AttachFileItem* file) { std::cerr << "ChanMsgDialog::anchorClicked mesgString : " << mesgString << std::endl; #endif - const char * messageString = mesgString.c_str (); - - //convert char massageString to w_char - wchar_t* message; - size_t requiredSize = mbstowcs(NULL, messageString, 0); // C4996 - /* Add one to leave room for the NULL terminator */ - message = (wchar_t *)malloc( (requiredSize + 1) * sizeof( wchar_t )); - if (! message) { - std::cerr << ("Memory allocation failure.\n"); - } - size_t size = mbstowcs( message, messageString, requiredSize + 1); // C4996 - if (size == (size_t) (-1)) { - printf("Couldn't convert string--invalid multibyte character.\n"); - } - - ui.msgText->setHtml(QString::fromStdWString(message)); + ui.msgText->textCursor().insertHtml(QString::fromStdString(mesgString)); ui.msgText->setFocus( Qt::OtherFocusReason ); - - } void ChanMsgDialog::checkAttachmentReady()