mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-02-17 13:24:15 -05:00
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:
parent
5e9acac013
commit
cf9b196b26
@ -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);
|
||||
|
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user