use point size and open urls directly

This commit is contained in:
Patrick von Reth 2014-07-04 12:25:06 +02:00
parent 4c5f916b30
commit f333e04334
3 changed files with 6 additions and 15 deletions

View File

@ -2,7 +2,6 @@ import QtQuick 1.1
Rectangle { Rectangle {
objectName: "qmlNotification" objectName: "qmlNotification"
id: root id: root
@ -12,12 +11,12 @@ Rectangle {
signal dismissed() signal dismissed()
signal linkClicked(string link)
signal invoked() signal invoked()
function update(nTitle, bBody, nImage, nAppIcon, color, textColor) function update(nTitle, bBody, nImage, nAppIcon, color, textColor)
{ {
title.text = nTitle title.text = nTitle
@ -50,8 +49,8 @@ Rectangle {
color: "#000000" color: "#000000"
text: qsTr("Title") text: qsTr("Title")
font.pointSize: 10
font.bold: true font.bold: true
font.pixelSize: 12
anchors.right: closeButton.left anchors.right: closeButton.left
anchors.rightMargin: 22 anchors.rightMargin: 22
anchors.top: parent.top anchors.top: parent.top
@ -65,7 +64,7 @@ Rectangle {
id: body id: body
color: "#000000" color: "#000000"
text: qsTr("Body") text: qsTr("Body")
font.pixelSize: 12 font.pointSize: 10
anchors.right: appIcon.left anchors.right: appIcon.left
anchors.rightMargin: 6 anchors.rightMargin: 6
anchors.top: title.bottom anchors.top: title.bottom
@ -75,7 +74,7 @@ Rectangle {
anchors.left: image.right anchors.left: image.right
anchors.leftMargin: 6 anchors.leftMargin: 6
wrapMode: Text.WordWrap wrapMode: Text.WordWrap
onLinkActivated: root.linkClicked(link) onLinkActivated: Qt.openUrlExternally(link)
} }

View File

@ -71,7 +71,6 @@ NotifyWidget::NotifyWidget(int pos,QWidget *parent) :
connect(qmlNotification, SIGNAL(invoked()),this, SLOT(slotInvoked())); connect(qmlNotification, SIGNAL(invoked()),this, SLOT(slotInvoked()));
connect(qmlNotification, SIGNAL(dismissed()),this, SLOT(slotDismissed())); connect(qmlNotification, SIGNAL(dismissed()),this, SLOT(slotDismissed()));
connect(qmlNotification, SIGNAL(linkClicked(QString)),this, SLOT(slotLinkClicked(QString)));
} }
NotifyWidget::~NotifyWidget() NotifyWidget::~NotifyWidget()
@ -120,7 +119,7 @@ void NotifyWidget::update(const Notification &notification)
Q_ARG( QVariant, QUrl::fromLocalFile(notification.icon().localUrl())), Q_ARG( QVariant, QUrl::fromLocalFile(notification.icon().localUrl())),
Q_ARG( QVariant, QUrl::fromLocalFile(notification.application().icon().localUrl())), Q_ARG( QVariant, QUrl::fromLocalFile(notification.application().icon().localUrl())),
Q_ARG( QVariant, color), Q_ARG( QVariant, color),
Q_ARG( QVariant, textColor )); Q_ARG( QVariant, textColor));
} }
@ -215,11 +214,6 @@ QColor NotifyWidget::computeBackgrondColor(const QImage &img)
} }
void NotifyWidget::slotLinkClicked(QString link)
{
QDesktopServices::openUrl( QUrl(link));
}
QSize NotifyWidget::computeSize() QSize NotifyWidget::computeSize()
{ {
int width = 365; int width = 365;

View File

@ -60,8 +60,6 @@ private slots:
void slotInvoked(); void slotInvoked();
void slotLinkClicked(QString link);
protected: protected:
QSize computeSize(); QSize computeSize();