diff --git a/retroshare-gui/src/gui/ChannelFeed.cpp b/retroshare-gui/src/gui/ChannelFeed.cpp index 71c18a529..1ec23841b 100644 --- a/retroshare-gui/src/gui/ChannelFeed.cpp +++ b/retroshare-gui/src/gui/ChannelFeed.cpp @@ -232,7 +232,7 @@ void ChannelFeed::copyChannelLink() ChannelInfo ci; if (rsChannels->getChannelInfo(mChannelId, ci)) { RetroShareLink link; - if (link.createChannel(QString::fromStdWString(ci.channelName), QString::fromStdString(ci.channelId), "")) { + if (link.createChannel(ci.channelId, "")) { std::vector urls; urls.push_back(link); RSLinkClipboard::copyLinks(urls); diff --git a/retroshare-gui/src/gui/ForumsDialog.cpp b/retroshare-gui/src/gui/ForumsDialog.cpp index 3c2f638f6..e3feef3e8 100644 --- a/retroshare-gui/src/gui/ForumsDialog.cpp +++ b/retroshare-gui/src/gui/ForumsDialog.cpp @@ -1425,7 +1425,7 @@ void ForumsDialog::copyForumLink() ForumInfo fi; if (rsForums->getForumInfo(mCurrForumId, fi)) { RetroShareLink link; - if (link.createForum(QString::fromStdWString(fi.forumName), QString::fromStdString(fi.forumId), "")) { + if (link.createForum(fi.forumId, "")) { std::vector urls; urls.push_back(link); RSLinkClipboard::copyLinks(urls); @@ -1442,7 +1442,7 @@ void ForumsDialog::copyMessageLink() ForumInfo fi; if (rsForums->getForumInfo(mCurrForumId, fi)) { RetroShareLink link; - if (link.createForum(QString::fromStdWString(fi.forumName), QString::fromStdString(mCurrForumId), QString::fromStdString(mCurrThreadId))) { + if (link.createForum(mCurrForumId, mCurrThreadId)) { std::vector urls; urls.push_back(link); RSLinkClipboard::copyLinks(urls); diff --git a/retroshare-gui/src/gui/MessengerWindow.cpp b/retroshare-gui/src/gui/MessengerWindow.cpp index 49411e44f..a42a17d30 100644 --- a/retroshare-gui/src/gui/MessengerWindow.cpp +++ b/retroshare-gui/src/gui/MessengerWindow.cpp @@ -572,11 +572,11 @@ void MessengerWindow::insertPeers() } #endif // MINIMAL_RSGUI if (sCustomString.isEmpty()) { - sslItem -> setText( COLUMN_NAME, tr("location") + " : " + QString::fromStdString(sslDetail.location) + " " + StatusDefs::connectStateString(sslDetail)); - sslItem -> setToolTip( COLUMN_NAME, tr("location") + " : " + QString::fromStdString(sslDetail.location)); + sslItem -> setText( COLUMN_NAME, tr("location") + " : " + QString::fromUtf8(sslDetail.location.c_str()) + " " + StatusDefs::connectStateString(sslDetail)); + sslItem -> setToolTip( COLUMN_NAME, tr("location") + " : " + QString::fromUtf8(sslDetail.location.c_str())); } else { - sslItem -> setText( COLUMN_NAME, tr("location") + " : " + QString::fromStdString(sslDetail.location) + " " + StatusDefs::connectStateString(sslDetail)); - sslItem -> setToolTip( COLUMN_NAME, tr("location") + " : " + QString::fromStdString(sslDetail.location) + " - " + sCustomString); + sslItem -> setText( COLUMN_NAME, tr("location") + " : " + QString::fromUtf8(sslDetail.location.c_str()) + " " + StatusDefs::connectStateString(sslDetail)); + sslItem -> setToolTip( COLUMN_NAME, tr("location") + " : " + QString::fromUtf8(sslDetail.location.c_str()) + " - " + sCustomString); /* store custom state string */ sslCustomStateStrings[sslDetail.id] = sCustomString; diff --git a/retroshare-gui/src/gui/PeersDialog.cpp b/retroshare-gui/src/gui/PeersDialog.cpp index e45854af0..20c34ae6e 100644 --- a/retroshare-gui/src/gui/PeersDialog.cpp +++ b/retroshare-gui/src/gui/PeersDialog.cpp @@ -255,7 +255,7 @@ PeersDialog::PeersDialog(QWidget *parent) if (rsPeers->getPeerDetails(rsPeers->getOwnId(),pd)) { QString titleStr("%1"); - ui.nicklabel->setText(titleStr.arg(QString::fromStdString(pd.name) + " (" + tr("me") + ") " + QString::fromStdString(pd.location))); + ui.nicklabel->setText(titleStr.arg(QString::fromStdString(pd.name) + " (" + tr("me") + ") " + QString::fromUtf8(pd.location.c_str()))); } /* Hide platform specific features */ @@ -907,7 +907,7 @@ void PeersDialog::insertPeers() if (sslDetail.state & RS_PEER_STATE_CONNECTED) { customStateString = QString::fromUtf8(rsMsgs->getCustomStateString(sslDetail.id).c_str()); } - sText = tr("location") + " : " + QString::fromStdString(sslDetail.location); + sText = tr("location") + " : " + QString::fromUtf8(sslDetail.location.c_str()); if (customStateString.isEmpty() == false) { sText += " - " + customStateString; } diff --git a/retroshare-gui/src/gui/RetroShareLink.cpp b/retroshare-gui/src/gui/RetroShareLink.cpp index c5a92a00d..548cbd015 100644 --- a/retroshare-gui/src/gui/RetroShareLink.cpp +++ b/retroshare-gui/src/gui/RetroShareLink.cpp @@ -248,35 +248,60 @@ bool RetroShareLink::createPerson(const QString& name, const QString& hash) return valid(); } -bool RetroShareLink::createForum(const QString& name, const QString& id, const QString& msgId) +bool RetroShareLink::createForum(const std::string& id, const std::string& msgId) { - clear(); + clear(); - _name = name; - _hash = id; - _msgId = msgId; + if (!id.empty()) { + _hash = QString::fromStdString(id); + _msgId = QString::fromStdString(msgId); - _type = TYPE_FORUM; + _type = TYPE_FORUM; - check(); + if (msgId.empty()) { + ForumInfo fi; + if (rsForums->getForumInfo(id, fi)) { + _name = QString::fromStdWString(fi.forumName); + } + } else { + ForumMsgInfo mi; + if (rsForums->getForumMessage(id, msgId, mi)) { + _name = QString::fromStdWString(mi.title); + } + } + } - return valid(); + check(); + + return valid(); } -bool RetroShareLink::createChannel(const QString& name, const QString& id, const QString& msgId) +bool RetroShareLink::createChannel(const std::string& id, const std::string& msgId) { - clear(); + clear(); - _name = name; - _size = 0; - _hash = id; - _msgId = msgId; + if (!id.empty()) { + _hash = QString::fromStdString(id); + _msgId = QString::fromStdString(msgId); - _type = TYPE_CHANNEL; + _type = TYPE_CHANNEL; - check(); + if (msgId.empty()) { + ChannelInfo ci; + if (rsChannels->getChannelInfo(id, ci)) { + _name = QString::fromStdWString(ci.channelName); + } + } else { + ChannelMsgInfo mi; + if (rsChannels->getChannelMessage(id, msgId, mi)) { + _name = QString::fromStdWString(mi.subject); + } + } + } - return valid(); + check(); + + return valid(); } bool RetroShareLink::createSearch(const QString& keywords) diff --git a/retroshare-gui/src/gui/RetroShareLink.h b/retroshare-gui/src/gui/RetroShareLink.h index e0ad42cd3..d49a6e3d3 100644 --- a/retroshare-gui/src/gui/RetroShareLink.h +++ b/retroshare-gui/src/gui/RetroShareLink.h @@ -56,8 +56,8 @@ class RetroShareLink bool createFile(const QString& name, uint64_t size, const QString& hash); bool createPerson(const QString& name, const QString& hash); - bool createForum(const QString& name, const QString& id, const QString& msgId); - bool createChannel(const QString& name, const QString& id, const QString& msgId); + bool createForum(const std::string& id, const std::string& msgId); + bool createChannel(const std::string& id, const std::string& msgId); bool createSearch(const QString& keywords); bool createMessage(const std::string& peerId, const QString& subject); @@ -99,7 +99,7 @@ class RetroShareLink void clear(); void check(); static bool checkHash(const QString& hash); - static bool checkName(const QString& hash); + static bool checkName(const QString& name); bool _valid; enumType _type; diff --git a/retroshare-gui/src/gui/TransfersDialog.cpp b/retroshare-gui/src/gui/TransfersDialog.cpp index 22a40e8b5..3410092d9 100644 --- a/retroshare-gui/src/gui/TransfersDialog.cpp +++ b/retroshare-gui/src/gui/TransfersDialog.cpp @@ -1116,7 +1116,7 @@ void TransfersDialog::copyLink () } RetroShareLink link; - if (link.createFile(QString::fromStdString(info.fname), info.size, QString::fromStdString(info.hash))) { + if (link.createFile(QString::fromUtf8(info.fname.c_str()), info.size, QString::fromStdString(info.hash))) { links.push_back(link) ; } } diff --git a/retroshare-gui/src/gui/chat/PopupChatDialog.cpp b/retroshare-gui/src/gui/chat/PopupChatDialog.cpp index 1d316d1a9..57dccf91e 100644 --- a/retroshare-gui/src/gui/chat/PopupChatDialog.cpp +++ b/retroshare-gui/src/gui/chat/PopupChatDialog.cpp @@ -1245,7 +1245,7 @@ void PopupChatDialog::updatePeersCustomStateString(const QString& peer_id, const ui.statusmessagelabel->hide(); } else { ui.statusmessagelabel->show(); - status_text = RsHtml::formatText(QString(status_string), RSHTML_FORMATTEXT_EMBED_SMILEYS | RSHTML_FORMATTEXT_EMBED_LINKS); + status_text = RsHtml::formatText(status_string, RSHTML_FORMATTEXT_EMBED_SMILEYS | RSHTML_FORMATTEXT_EMBED_LINKS); ui.statusmessagelabel->setText(status_text); } } diff --git a/retroshare-gui/src/gui/connect/ConfCertDialog.cpp b/retroshare-gui/src/gui/connect/ConfCertDialog.cpp index af3fd2ce2..fa1e205a5 100644 --- a/retroshare-gui/src/gui/connect/ConfCertDialog.cpp +++ b/retroshare-gui/src/gui/connect/ConfCertDialog.cpp @@ -142,7 +142,7 @@ void ConfCertDialog::load() if (!detail.isOnlyGPGdetail) { - ui.loc->setText(QString::fromStdString(detail.location)); + ui.loc->setText(QString::fromUtf8(detail.location.c_str())); // Dont Show a timestamp in RS calculate the day QDateTime date = QDateTime::fromTime_t(detail.lastConnect); QString stime = date.toString(Qt::LocalDate); diff --git a/retroshare-gui/src/gui/connect/ConnectFriendWizard.cpp b/retroshare-gui/src/gui/connect/ConnectFriendWizard.cpp index d89c8893f..0b9659b51 100755 --- a/retroshare-gui/src/gui/connect/ConnectFriendWizard.cpp +++ b/retroshare-gui/src/gui/connect/ConnectFriendWizard.cpp @@ -435,7 +435,7 @@ int TextPage::nextId() const { #endif wizard()->setField(SSL_ID_FIELD_CONNECT_FRIEND_WIZARD, QString::fromStdString(pd.id)); wizard()->setField(GPG_ID_FIELD_CONNECT_FRIEND_WIZARD, QString::fromStdString(pd.gpg_id)); - wizard()->setField(LOCATION_FIELD_CONNECT_FRIEND_WIZARD, QString::fromStdString(pd.location)); + wizard()->setField(LOCATION_FIELD_CONNECT_FRIEND_WIZARD, QString::fromUtf8(pd.location.c_str())); wizard()->setField(CERT_STRING_FIELD_CONNECT_FRIEND_WIZARD, QString::fromStdString(certstr)); wizard()->setField("ext_friend_ip", QString::fromStdString(pd.extAddr)); @@ -807,7 +807,7 @@ int CertificatePage::nextId() const #endif wizard()->setField(SSL_ID_FIELD_CONNECT_FRIEND_WIZARD, QString::fromStdString(pd.id)); wizard()->setField(GPG_ID_FIELD_CONNECT_FRIEND_WIZARD, QString::fromStdString(pd.gpg_id)); - wizard()->setField(LOCATION_FIELD_CONNECT_FRIEND_WIZARD, QString::fromStdString(pd.location)); + wizard()->setField(LOCATION_FIELD_CONNECT_FRIEND_WIZARD, QString::fromUtf8(pd.location.c_str())); wizard()->setField(CERT_STRING_FIELD_CONNECT_FRIEND_WIZARD, QString::fromStdString(certstr)); wizard()->setField("ext_friend_ip", QString::fromStdString(pd.extAddr)); @@ -1072,7 +1072,7 @@ void ConclusionPage::initializePage() { nameEdit->setText( QString::fromStdString( detail.name ) ) ; trustEdit->setText(QString::fromStdString( trustString ) ) ; emailEdit->setText(QString::fromStdString( detail.email ) ); - locEdit->setText( QString::fromStdString( detail.location ) ); + locEdit->setText( QString::fromUtf8( detail.location.c_str() ) ); signersEdit->setPlainText( ts ); std::list groupInfoList; @@ -1152,7 +1152,7 @@ int RsidPage::nextId() const { if (rsidstr.empty() == false && rsPeers->getPeerDetails(rsidstr, pd) ) { wizard()->setField(SSL_ID_FIELD_CONNECT_FRIEND_WIZARD, QString::fromStdString(pd.id)); wizard()->setField(GPG_ID_FIELD_CONNECT_FRIEND_WIZARD, QString::fromStdString(pd.gpg_id)); - wizard()->setField(LOCATION_FIELD_CONNECT_FRIEND_WIZARD, QString::fromStdString(pd.location)); + wizard()->setField(LOCATION_FIELD_CONNECT_FRIEND_WIZARD, QString::fromUtf8(pd.location.c_str())); wizard()->setField("ext_friend_ip", QString::fromStdString(pd.extAddr)); wizard()->setField("ext_friend_port", QString::number(pd.extPort)); diff --git a/retroshare-gui/src/gui/feeds/ChanMsgItem.cpp b/retroshare-gui/src/gui/feeds/ChanMsgItem.cpp index a32506e3c..1c2c4393b 100644 --- a/retroshare-gui/src/gui/feeds/ChanMsgItem.cpp +++ b/retroshare-gui/src/gui/feeds/ChanMsgItem.cpp @@ -105,11 +105,11 @@ void ChanMsgItem::updateItemStatic() { title = tr("Channel Feed") + ": "; RetroShareLink link; - link.createChannel(QString::fromStdWString(ci.channelName), QString::fromStdString(ci.channelId), ""); + link.createChannel(ci.channelId, ""); title += link.toHtml(); titleLabel->setText(title); RetroShareLink msgLink; - msgLink.createChannel(QString::fromStdWString(cmi.subject), QString::fromStdString(cmi.channelId), QString::fromStdString(cmi.msgId)); + msgLink.createChannel(cmi.channelId, cmi.msgId); subjectLabel->setText(msgLink.toHtml()); if ((ci.channelFlags & RS_DISTRIB_SUBSCRIBED) || (ci.channelFlags & RS_DISTRIB_ADMIN)) { @@ -406,7 +406,7 @@ void ChanMsgItem::copyLink() ChannelMsgInfo cmi; if (rsChannels->getChannelMessage(mChanId, mMsgId, cmi)) { RetroShareLink link; - if (link.createChannel(QString::fromStdWString(cmi.subject), QString::fromStdString(cmi.channelId), QString::fromStdString(cmi.msgId))) { + if (link.createChannel(cmi.channelId, cmi.msgId)) { std::vector urls; urls.push_back(link); RSLinkClipboard::copyLinks(urls); diff --git a/retroshare-gui/src/gui/feeds/ChanNewItem.cpp b/retroshare-gui/src/gui/feeds/ChanNewItem.cpp index 80349b54f..ecedefe66 100644 --- a/retroshare-gui/src/gui/feeds/ChanNewItem.cpp +++ b/retroshare-gui/src/gui/feeds/ChanNewItem.cpp @@ -70,7 +70,7 @@ void ChanNewItem::updateItemStatic() if (rsChannels->getChannelInfo(mChanId, ci)) { RetroShareLink link; - link.createChannel(QString::fromStdWString(ci.channelName), QString::fromStdString(ci.channelId), ""); + link.createChannel(ci.channelId, ""); nameLabel->setText(link.toHtml()); descLabel->setText(QString::fromStdWString(ci.channelDesc)); diff --git a/retroshare-gui/src/gui/feeds/ForumMsgItem.cpp b/retroshare-gui/src/gui/feeds/ForumMsgItem.cpp index b1556f475..538104d87 100644 --- a/retroshare-gui/src/gui/feeds/ForumMsgItem.cpp +++ b/retroshare-gui/src/gui/feeds/ForumMsgItem.cpp @@ -89,7 +89,7 @@ void ForumMsgItem::updateItemStatic() if (rsForums->getForumInfo(mForumId, fi)) { RetroShareLink link; - link.createForum(QString::fromStdWString(fi.forumName), QString::fromStdString(fi.forumId), ""); + link.createForum(fi.forumId, ""); QString title = tr("Forum Post") + ": "; title += link.toHtml(); @@ -138,7 +138,7 @@ void ForumMsgItem::updateItemStatic() } RetroShareLink link; - link.createForum(QString::fromStdWString(msg.title), QString::fromStdString(msg.forumId), QString::fromStdString(msg.msgId)); + link.createForum(msg.forumId, msg.msgId); if (mIsTop) { @@ -196,7 +196,7 @@ void ForumMsgItem::updateItemStatic() mGpgIdPrev = msgParent.srcId; RetroShareLink linkParent; - linkParent.createForum(QString::fromStdWString(msgParent.title), QString::fromStdString(msgParent.forumId), QString::fromStdString(msgParent.msgId)); + linkParent.createForum(msgParent.forumId, msgParent.msgId); prevSubLabel->setText(linkParent.toHtml()); prevMsgLabel->setText(RsHtml::formatText(QString::fromStdWString(msgParent.msg), RSHTML_FORMATTEXT_EMBED_SMILEYS | RSHTML_FORMATTEXT_EMBED_LINKS)); diff --git a/retroshare-gui/src/gui/feeds/ForumNewItem.cpp b/retroshare-gui/src/gui/feeds/ForumNewItem.cpp index 1c492ee58..fd76c6fa9 100644 --- a/retroshare-gui/src/gui/feeds/ForumNewItem.cpp +++ b/retroshare-gui/src/gui/feeds/ForumNewItem.cpp @@ -71,7 +71,7 @@ void ForumNewItem::updateItemStatic() if (rsForums->getForumInfo(mForumId, fi)) { RetroShareLink link; - link.createForum(QString::fromStdWString(fi.forumName), QString::fromStdString(fi.forumId), ""); + link.createForum(fi.forumId, ""); nameLabel->setText(link.toHtml()); descLabel->setText(QString::fromStdWString(fi.forumDesc)); diff --git a/retroshare-gui/src/gui/feeds/PeerItem.cpp b/retroshare-gui/src/gui/feeds/PeerItem.cpp index 7f7db821c..eef83010c 100644 --- a/retroshare-gui/src/gui/feeds/PeerItem.cpp +++ b/retroshare-gui/src/gui/feeds/PeerItem.cpp @@ -128,9 +128,9 @@ void PeerItem::updateItemStatic() lastLabel-> setText(stime); /* expanded Info */ - nameLabel->setText(QString::fromStdString(details.name)); + nameLabel->setText(QString::fromUtf8(details.name.c_str())); idLabel->setText(QString::fromStdString(details.id)); - locLabel->setText(QString::fromStdString(details.location)); + locLabel->setText(QString::fromUtf8(details.location.c_str())); } else { diff --git a/retroshare-gui/src/gui/profile/ProfileWidget.cpp b/retroshare-gui/src/gui/profile/ProfileWidget.cpp index 4149928c1..e9555f6b2 100644 --- a/retroshare-gui/src/gui/profile/ProfileWidget.cpp +++ b/retroshare-gui/src/gui/profile/ProfileWidget.cpp @@ -66,8 +66,8 @@ void ProfileWidget::showEvent ( QShowEvent * event ) if (rsPeers->getPeerDetails(rsPeers->getOwnId(),detail)) { - ui.name->setText(QString::fromStdString(detail.name)); - ui.country->setText(QString::fromStdString(detail.location)); + ui.name->setText(QString::fromUtf8(detail.name.c_str())); + ui.country->setText(QString::fromUtf8(detail.location.c_str())); ui.peerid->setText(QString::fromStdString(detail.id));