mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-10-01 02:35:48 -04:00
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
This commit is contained in:
parent
0c46da0dd2
commit
6b3f51c626
@ -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()
|
||||
|
Loading…
Reference in New Issue
Block a user