Improved URL handling in Posted Item.

git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@7968 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
drbob 2015-02-23 12:28:20 +00:00
parent 5e9acac013
commit cf9b196b26
2 changed files with 31 additions and 9 deletions

View File

@ -188,15 +188,37 @@ void PostedItem::fill()
QDateTime qtime;
qtime.setTime_t(mPost.mMeta.mPublishTs);
QString timestamp = qtime.toString("dd.MMMM yyyy hh:mm");
QString timestamp = qtime.toString("hh:mm dd-MMM-yyyy");
ui->dateLabel->setText(timestamp);
ui->fromLabel->setId(mPost.mMeta.mAuthorId);
ui->titleLabel->setText("<a href=" + QString::fromStdString(mPost.mLink) +
"><span style=\" text-decoration: underline; color:#2255AA;\">" +
messageName() + "</span></a>");
ui->siteLabel->setText("<a href=" + QString::fromStdString(mPost.mLink) +
"><span style=\" text-decoration: underline; color:#2255AA;\">" +
QString::fromStdString(mPost.mLink) + "</span></a>");
// Use QUrl to check/parse our URL
QUrl url(QString::fromStdString(mPost.mLink));
QString urlstr = "Invalid Link";
QString sitestr = "Invalid Link";
bool urlOkay = url.isValid();
if (urlOkay)
{
QString scheme = url.scheme();
if ((scheme != "https")
&& (scheme != "http")
&& (scheme != "ftp"))
{
urlOkay = false;
sitestr = "Invalid Link Scheme";
}
}
if (urlOkay)
{
urlstr = QString("<a href=\"%1\" ><span style=\" text-decoration: underline; color:#2255AA;\"> %2 </span></a>").arg(url.toString()).arg(messageName());
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);
}
ui->titleLabel->setText(urlstr);
ui->siteLabel->setText(sitestr);
//QString score = "Hot" + QString::number(post.mHotScore);
//score += " Top" + QString::number(post.mTopScore);

View File

@ -51,12 +51,12 @@ SecurityItem QLabel#peerNameLabel, SecurityItem QLabel#requestLabel
PostedItem QLabel#titleLabel
{
qproperty-fontSizeFactor: 150;
qproperty-fontSizeFactor: 120;
}
PostedItem QLabel#scoreLabel
{
qproperty-fontSizeFactor: 250;
qproperty-fontSizeFactor: 140;
}
GxsChannelPostItem QLabel#titleLabel