From 20b00401ec55eb97608ac26edcaae7ed83fbd52a Mon Sep 17 00:00:00 2001 From: thunder2 Date: Fri, 3 Feb 2012 13:29:16 +0000 Subject: [PATCH] Fixed handling of utf8 characters in lobby nick name. git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@4878 b45a01b8-16f6-495d-af2f-9b41ad6348cc --- retroshare-gui/src/gui/chat/CreateLobbyDialog.cpp | 4 ++-- retroshare-gui/src/gui/settings/ChatPage.cpp | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/retroshare-gui/src/gui/chat/CreateLobbyDialog.cpp b/retroshare-gui/src/gui/chat/CreateLobbyDialog.cpp index 16e0c7093..d6239232a 100644 --- a/retroshare-gui/src/gui/chat/CreateLobbyDialog.cpp +++ b/retroshare-gui/src/gui/chat/CreateLobbyDialog.cpp @@ -43,7 +43,7 @@ CreateLobbyDialog::CreateLobbyDialog(const std::list& peer_list, in ui->lobbyName_LE->setPlaceholderText(tr("Put a sensible lobby name here")) ; ui->nickName_LE->setPlaceholderText(tr("Your nickname for this lobby (Change default name in options->chat)")) ; #endif - ui->nickName_LE->setText(QString::fromStdString(default_nick)) ; + ui->nickName_LE->setText(QString::fromUtf8(default_nick.c_str())) ; connect( ui->shareButton, SIGNAL( clicked ( bool ) ), this, SLOT( createLobby( ) ) ); connect( ui->cancelButton, SIGNAL( clicked ( bool ) ), this, SLOT( cancel( ) ) ); @@ -111,7 +111,7 @@ void CreateLobbyDialog::createLobby() // set nick name ! - rsMsgs->setNickNameForChatLobby(id,ui->nickName_LE->text().toStdString()) ; + rsMsgs->setNickNameForChatLobby(id,ui->nickName_LE->text().toUtf8().constData()) ; // open chat window !! std::string vpid ; diff --git a/retroshare-gui/src/gui/settings/ChatPage.cpp b/retroshare-gui/src/gui/settings/ChatPage.cpp index 45eda072a..94ceb6953 100644 --- a/retroshare-gui/src/gui/settings/ChatPage.cpp +++ b/retroshare-gui/src/gui/settings/ChatPage.cpp @@ -116,7 +116,7 @@ ChatPage::save(QString &/*errmsg*/) rsHistory->setSaveCount(true, ui.publicChatSaveCount->value()); rsHistory->setSaveCount(false, ui.privateChatSaveCount->value()); - rsMsgs->setDefaultNickNameForChatLobby(ui.chatLobbyNick_LE->text().toStdString()) ; + rsMsgs->setDefaultNickNameForChatLobby(ui.chatLobbyNick_LE->text().toUtf8().constData()) ; ChatStyleInfo info; QListWidgetItem *item = ui.publicList->currentItem(); @@ -179,9 +179,9 @@ ChatPage::load() privateStylePath = loadStyleInfo(ChatStyle::TYPE_PRIVATE, ui.privateList, ui.privateComboBoxVariant, privateStyleVariant); historyStylePath = loadStyleInfo(ChatStyle::TYPE_HISTORY, ui.historyList, ui.historyComboBoxVariant, historyStyleVariant); - std::string nick ; - rsMsgs->getDefaultNickNameForChatLobby(nick) ; - ui.chatLobbyNick_LE->setText(QString::fromStdString(nick)) ; + std::string nick ; + rsMsgs->getDefaultNickNameForChatLobby(nick) ; + ui.chatLobbyNick_LE->setText(QString::fromUtf8(nick.c_str())) ; } void ChatPage::on_pushButtonChangeChatFont_clicked()