Added Retroshare links support to PostedItems (don't seem to work yet).

Enabled cancel button in CreateComment Dialog.



git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@7969 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
drbob 2015-02-24 10:31:45 +00:00
parent cf9b196b26
commit 6d26eda0f9
2 changed files with 12 additions and 3 deletions

View File

@ -193,7 +193,10 @@ void PostedItem::fill()
ui->fromLabel->setId(mPost.mMeta.mAuthorId); ui->fromLabel->setId(mPost.mMeta.mAuthorId);
// Use QUrl to check/parse our URL // Use QUrl to check/parse our URL
QUrl url(QString::fromStdString(mPost.mLink)); // The only combination that seems to work: load as EncodedUrl, extract toEncoded().
QUrl url;
QByteArray urlarray(mPost.mLink.c_str());
url.setEncodedUrl(urlarray);
QString urlstr = "Invalid Link"; QString urlstr = "Invalid Link";
QString sitestr = "Invalid Link"; QString sitestr = "Invalid Link";
bool urlOkay = url.isValid(); bool urlOkay = url.isValid();
@ -202,7 +205,8 @@ void PostedItem::fill()
QString scheme = url.scheme(); QString scheme = url.scheme();
if ((scheme != "https") if ((scheme != "https")
&& (scheme != "http") && (scheme != "http")
&& (scheme != "ftp")) && (scheme != "ftp")
&& (scheme != "retroshare"))
{ {
urlOkay = false; urlOkay = false;
sitestr = "Invalid Link Scheme"; sitestr = "Invalid Link Scheme";
@ -211,7 +215,11 @@ void PostedItem::fill()
if (urlOkay) if (urlOkay)
{ {
urlstr = QString("<a href=\"%1\" ><span style=\" text-decoration: underline; color:#2255AA;\"> %2 </span></a>").arg(url.toString()).arg(messageName()); urlstr = QString("<a href=\"");
urlstr += QString(url.toEncoded());
urlstr += QString("\" ><span style=\" text-decoration: underline; color:#2255AA;\"> ");
urlstr += messageName();
urlstr += QString(" </span></a>");
QString siteurl = url.scheme() + "://" + url.host(); QString siteurl = url.scheme() + "://" + url.host();
sitestr = QString("<a href=\"%1\" ><span style=\" text-decoration: underline; color:#2255AA;\"> %2 </span></a>").arg(siteurl).arg(siteurl); sitestr = QString("<a href=\"%1\" ><span style=\" text-decoration: underline; color:#2255AA;\"> %2 </span></a>").arg(siteurl).arg(siteurl);

View File

@ -35,6 +35,7 @@ GxsCreateCommentDialog::GxsCreateCommentDialog(TokenQueue *tokQ, RsGxsCommentSer
{ {
ui->setupUi(this); ui->setupUi(this);
connect(ui->buttonBox, SIGNAL(accepted()), this, SLOT(createComment())); connect(ui->buttonBox, SIGNAL(accepted()), this, SLOT(createComment()));
connect(ui->buttonBox, SIGNAL(rejected()), this, SLOT(close()));
/* fill in the available OwnIds for signing */ /* fill in the available OwnIds for signing */
ui->idChooser->loadIds(IDCHOOSER_ID_REQUIRED, RsGxsId()); ui->idChooser->loadIds(IDCHOOSER_ID_REQUIRED, RsGxsId());