Unicode support for status message.

git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@3867 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
thunder2 2010-11-24 19:25:53 +00:00
parent 6c9e429215
commit e7813892bc
4 changed files with 11 additions and 12 deletions

View File

@ -567,7 +567,7 @@ void MessengerWindow::insertPeers()
QString sCustomString; QString sCustomString;
#ifndef MINIMAL_RSGUI #ifndef MINIMAL_RSGUI
if (sslDetail.state & RS_PEER_STATE_CONNECTED) { 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 #endif // MINIMAL_RSGUI
if (sCustomString.isEmpty()) { if (sCustomString.isEmpty()) {
@ -1129,13 +1129,13 @@ void MessengerWindow::getAvatar()
/** Loads own personal status message */ /** Loads own personal status message */
void MessengerWindow::loadmystatusmessage() void MessengerWindow::loadmystatusmessage()
{ {
ui.messagelineEdit->setEditText( QString::fromStdString(rsMsgs->getCustomStateString())); ui.messagelineEdit->setEditText( QString::fromUtf8(rsMsgs->getCustomStateString().c_str()));
} }
/** Save own status message */ /** Save own status message */
void MessengerWindow::savestatusmessage() 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) void MessengerWindow::updateOwnStatus(const QString &peer_id, int status)

View File

@ -875,13 +875,13 @@ void PeersDialog::insertPeers()
sslItem->setData(COLUMN_DATA, ROLE_ID, QString::fromStdString(sslDetail.id)); sslItem->setData(COLUMN_DATA, ROLE_ID, QString::fromStdString(sslDetail.id));
QString sText; QString sText;
std::string customStateString; QString customStateString;
if (sslDetail.state & RS_PEER_STATE_CONNECTED) { 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); sText = tr("location") + " : " + QString::fromStdString(sslDetail.location);
if (customStateString.empty() == false) { if (customStateString.isEmpty() == false) {
sText += " - " + QString::fromStdString(customStateString); sText += " - " + customStateString;
} }
sslItem->setText( COLUMN_NAME, sText); sslItem->setText( COLUMN_NAME, sText);
sslItem->setToolTip( COLUMN_NAME, sText); sslItem->setToolTip( COLUMN_NAME, sText);
@ -1780,7 +1780,7 @@ void PeersDialog::on_actionCreate_New_Channel_activated()
/** Loads own personal status */ /** Loads own personal status */
void PeersDialog::loadmypersonalstatus() void PeersDialog::loadmypersonalstatus()
{ {
ui.mypersonalstatuslabel->setText(QString::fromStdString(rsMsgs->getCustomStateString())); ui.mypersonalstatuslabel->setText(QString::fromUtf8(rsMsgs->getCustomStateString().c_str()));
} }
void PeersDialog::statusmessage() void PeersDialog::statusmessage()

View File

@ -180,7 +180,7 @@ PopupChatDialog::PopupChatDialog(const std::string &id, const QString &name, QWi
} }
// initialize first custom state string // 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); updatePeersCustomStateString(QString::fromStdString(dialogId), customStateString);
if (Settings->valueFromGroup("Chat", QString::fromUtf8("PrivateChat_History"), true).toBool()) { if (Settings->valueFromGroup("Chat", QString::fromUtf8("PrivateChat_History"), true).toBool()) {

View File

@ -55,16 +55,15 @@ StatusMessage::~StatusMessage()
/** Saves the changes on this page */ /** Saves the changes on this page */
void StatusMessage::save() void StatusMessage::save()
{ {
rsMsgs->setCustomStateString(ui.txt_StatusMessage->text().toStdString()); rsMsgs->setCustomStateString(ui.txt_StatusMessage->text().toUtf8().constData());
close(); close();
} }
/** Loads the settings for this page */ /** Loads the settings for this page */
void StatusMessage::load() void StatusMessage::load()
{ {
ui.txt_StatusMessage->setText(QString::fromStdString(rsMsgs->getCustomStateString())); ui.txt_StatusMessage->setText(QString::fromUtf8(rsMsgs->getCustomStateString().c_str()));
} }