From e7813892bc7e375aba0c08eeb9e97eefc23214a3 Mon Sep 17 00:00:00 2001 From: thunder2 Date: Wed, 24 Nov 2010 19:25:53 +0000 Subject: [PATCH] Unicode support for status message. git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@3867 b45a01b8-16f6-495d-af2f-9b41ad6348cc --- retroshare-gui/src/gui/MessengerWindow.cpp | 6 +++--- retroshare-gui/src/gui/PeersDialog.cpp | 10 +++++----- retroshare-gui/src/gui/chat/PopupChatDialog.cpp | 2 +- retroshare-gui/src/gui/profile/StatusMessage.cpp | 5 ++--- 4 files changed, 11 insertions(+), 12 deletions(-) diff --git a/retroshare-gui/src/gui/MessengerWindow.cpp b/retroshare-gui/src/gui/MessengerWindow.cpp index c96c67898..cf1d552f0 100644 --- a/retroshare-gui/src/gui/MessengerWindow.cpp +++ b/retroshare-gui/src/gui/MessengerWindow.cpp @@ -567,7 +567,7 @@ void MessengerWindow::insertPeers() QString sCustomString; #ifndef MINIMAL_RSGUI if (sslDetail.state & RS_PEER_STATE_CONNECTED) { - sCustomString = QString::fromStdString(rsMsgs->getCustomStateString(sslDetail.id)); + sCustomString = QString::fromUtf8(rsMsgs->getCustomStateString(sslDetail.id).c_str()); } #endif // MINIMAL_RSGUI if (sCustomString.isEmpty()) { @@ -1129,13 +1129,13 @@ void MessengerWindow::getAvatar() /** Loads own personal status message */ void MessengerWindow::loadmystatusmessage() { - ui.messagelineEdit->setEditText( QString::fromStdString(rsMsgs->getCustomStateString())); + ui.messagelineEdit->setEditText( QString::fromUtf8(rsMsgs->getCustomStateString().c_str())); } /** Save own status message */ void MessengerWindow::savestatusmessage() { - rsMsgs->setCustomStateString(ui.messagelineEdit->currentText().toStdString()); + rsMsgs->setCustomStateString(ui.messagelineEdit->currentText().toUtf8().constData()); } void MessengerWindow::updateOwnStatus(const QString &peer_id, int status) diff --git a/retroshare-gui/src/gui/PeersDialog.cpp b/retroshare-gui/src/gui/PeersDialog.cpp index 39be3b30e..010e37ac5 100644 --- a/retroshare-gui/src/gui/PeersDialog.cpp +++ b/retroshare-gui/src/gui/PeersDialog.cpp @@ -875,13 +875,13 @@ void PeersDialog::insertPeers() sslItem->setData(COLUMN_DATA, ROLE_ID, QString::fromStdString(sslDetail.id)); QString sText; - std::string customStateString; + QString customStateString; if (sslDetail.state & RS_PEER_STATE_CONNECTED) { - customStateString = rsMsgs->getCustomStateString(sslDetail.id); + customStateString = QString::fromUtf8(rsMsgs->getCustomStateString(sslDetail.id).c_str()); } sText = tr("location") + " : " + QString::fromStdString(sslDetail.location); - if (customStateString.empty() == false) { - sText += " - " + QString::fromStdString(customStateString); + if (customStateString.isEmpty() == false) { + sText += " - " + customStateString; } sslItem->setText( COLUMN_NAME, sText); sslItem->setToolTip( COLUMN_NAME, sText); @@ -1780,7 +1780,7 @@ void PeersDialog::on_actionCreate_New_Channel_activated() /** Loads own personal status */ void PeersDialog::loadmypersonalstatus() { - ui.mypersonalstatuslabel->setText(QString::fromStdString(rsMsgs->getCustomStateString())); + ui.mypersonalstatuslabel->setText(QString::fromUtf8(rsMsgs->getCustomStateString().c_str())); } void PeersDialog::statusmessage() diff --git a/retroshare-gui/src/gui/chat/PopupChatDialog.cpp b/retroshare-gui/src/gui/chat/PopupChatDialog.cpp index c41cd899c..22e4f4af7 100644 --- a/retroshare-gui/src/gui/chat/PopupChatDialog.cpp +++ b/retroshare-gui/src/gui/chat/PopupChatDialog.cpp @@ -180,7 +180,7 @@ PopupChatDialog::PopupChatDialog(const std::string &id, const QString &name, QWi } // initialize first custom state string - QString customStateString = QString::fromStdString(rsMsgs->getCustomStateString(dialogId)); + QString customStateString = QString::fromUtf8(rsMsgs->getCustomStateString(dialogId).c_str()); updatePeersCustomStateString(QString::fromStdString(dialogId), customStateString); if (Settings->valueFromGroup("Chat", QString::fromUtf8("PrivateChat_History"), true).toBool()) { diff --git a/retroshare-gui/src/gui/profile/StatusMessage.cpp b/retroshare-gui/src/gui/profile/StatusMessage.cpp index e9ed4679d..38db3ac35 100644 --- a/retroshare-gui/src/gui/profile/StatusMessage.cpp +++ b/retroshare-gui/src/gui/profile/StatusMessage.cpp @@ -55,16 +55,15 @@ StatusMessage::~StatusMessage() /** Saves the changes on this page */ void StatusMessage::save() { - rsMsgs->setCustomStateString(ui.txt_StatusMessage->text().toStdString()); + rsMsgs->setCustomStateString(ui.txt_StatusMessage->text().toUtf8().constData()); close(); } - /** Loads the settings for this page */ void StatusMessage::load() { - ui.txt_StatusMessage->setText(QString::fromStdString(rsMsgs->getCustomStateString())); + ui.txt_StatusMessage->setText(QString::fromUtf8(rsMsgs->getCustomStateString().c_str())); }