Skip to content

Commit

Permalink
Notifications: Also have clickable link #6236
Browse files Browse the repository at this point in the history
  • Loading branch information
guruz committed Apr 17, 2018
1 parent fa6ac9d commit 5509cd2
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
5 changes: 3 additions & 2 deletions src/gui/activitydata.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,10 @@ class Activity
QString _file;
QUrl _link;
QDateTime _dateTime;
QString _accName;
QString _accName; /* display name of the account involved */

QVector<ActivityLink> _links;
QVector<ActivityLink> _links; /* These links are transformed into buttons that
* call links as reactions on the activity */
/**
* @brief Sort operator to sort the list youngest first.
* @param val
Expand Down
11 changes: 10 additions & 1 deletion src/gui/notificationwidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,16 @@ void NotificationWidget::setActivity(const Activity &activity)
_ui._subjectLabel->setVisible(!activity._subject.isEmpty());
_ui._messageLabel->setVisible(!activity._message.isEmpty());

_ui._subjectLabel->setText(activity._subject);
if (activity._link.isEmpty()) {
_ui._subjectLabel->setText(activity._subject);
} else {
_ui._subjectLabel->setText( QString("<a href=\"%1\">%2</a>")
.arg(activity._link.toString(QUrl::FullyEncoded),
activity._subject.toHtmlEscaped() ));
_ui._subjectLabel->setTextFormat(Qt::RichText);
_ui._subjectLabel->setOpenExternalLinks(true);
}

_ui._messageLabel->setText(activity._message);

_ui._notifIcon->setPixmap(QPixmap(":/client/resources/bell.png"));
Expand Down

0 comments on commit 5509cd2

Please sign in to comment.