mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-10-01 02:35:48 -04:00
fixed utf8 issues in sending cert by email (patch from asamK #3393826)
git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@4615 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
ad4b0153b2
commit
4111740cb6
@ -354,7 +354,7 @@ void TextPage::updateOwnCert()
|
||||
//============================================================================
|
||||
//
|
||||
|
||||
static void sendMail (std::string sAddress, std::string sSubject, std::string sBody)
|
||||
static void sendMail (QString sAddress, QString sSubject, QString sBody)
|
||||
{
|
||||
#ifdef Q_WS_WIN
|
||||
/* search and replace the end of lines with: "%0D%0A" */
|
||||
@ -364,20 +364,20 @@ static void sendMail (std::string sAddress, std::string sSubject, std::string sB
|
||||
}
|
||||
#endif
|
||||
|
||||
std::string mailstr = "mailto:" + sAddress;
|
||||
mailstr += "?subject=" + sSubject;
|
||||
mailstr += "&body=" + sBody;
|
||||
QUrl url = QUrl("mailto:" + sAddress);
|
||||
url.addEncodedQueryItem("subject", QUrl::toPercentEncoding(sSubject));
|
||||
url.addEncodedQueryItem("body", QUrl::toPercentEncoding(sBody));
|
||||
|
||||
std::cerr << "MAIL STRING:" << mailstr.c_str() << std::endl;
|
||||
std::cerr << "MAIL STRING:" << (std::string)url.toEncoded().constData() << std::endl;
|
||||
|
||||
/* pass the url directly to QDesktopServices::openUrl */
|
||||
QDesktopServices::openUrl (QUrl (QString::fromUtf8(mailstr.c_str())));
|
||||
QDesktopServices::openUrl (url);
|
||||
}
|
||||
|
||||
void
|
||||
TextPage::runEmailClient()
|
||||
{
|
||||
sendMail ("", tr("RetroShare Invite").toStdString(), userCertEdit->toPlainText().toStdString());
|
||||
sendMail ("", tr("RetroShare Invite"), userCertEdit->toPlainText());
|
||||
}
|
||||
|
||||
void TextPage::cleanFriendCert()
|
||||
@ -1300,10 +1300,10 @@ bool EmailPage::validatePage()
|
||||
|
||||
if (mailaddresses.isEmpty() == false)
|
||||
{
|
||||
std::string body = inviteTextEdit->toPlainText().toStdString();
|
||||
body += "\n\n" + rsPeers->GetRetroshareInvite(false);
|
||||
QString body = inviteTextEdit->toPlainText();
|
||||
body += "\n\n" + QString::fromUtf8(rsPeers->GetRetroshareInvite(false).c_str());
|
||||
|
||||
sendMail (mailaddresses.toStdString(), subjectEdit->text().toStdString(), body);
|
||||
sendMail (mailaddresses, subjectEdit->text(), body);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user