@ -48,6 +48,7 @@ ColumnLayout {
property int jobState
property int percentage
property int jobError: 0
property int urgency
property bool suspendable
property bool killable
@ -145,116 +146,147 @@ ColumnLayout {
RowLayout {
id: bodyRow
Layout.fillWidth: true
/ / W h e n t h e u r g e n t n o t i f i c a t i o n l i n e i s v i s i b l e , r e m o v e m a r g i n s t o a l l o w
/ / i t t o t o u c h t h e e d g e s o f t h e p o p u p
Layout.topMargin: urgentNotificationLine . visible ? notificationItem . thumbnailTopPadding + PlasmaCore.Units.devicePixelRatio : - 1
Layout.leftMargin: urgentNotificationLine . visible ? notificationItem.thumbnailLeftPadding : - 1
Layout.bottomMargin: urgentNotificationLine . visible ? notificationItem.thumbnailBottomPadding : - 1
spacing: PlasmaCore . Units . smallSpacing
ColumnLayout {
/ / V i s u a l f l o u r i s h f o r u r g e n t n o t i f i c a t i o n s t o m a k e t h e m s t a n d o u t m o r e
Rectangle {
id: urgentNotificationLine
Layout.fillHeight: true
Layout.alignment: Qt . AlignVCenter
implicitWidth: Math . round ( PlasmaCore . Units . gridUnit / 4 )
color: PlasmaCore . Theme . neutralTextColor
visible: notificationItem . urgency == NotificationManager . Notifications . CriticalUrgency
}
RowLayout {
Layout.fillWidth: true
spacing: 0
/ / R e - a d d m a r g i n s t o t h i s i t e m i f t h e y w e r e r e m o v e d i n t h e p a r e n t i t e m
/ / t o l e t t h e u r g e n t n o t i f i c a t i o n l i n e t o u c h t h e e d g e s ; w e d o w a n t
/ / e v e r y t h i n g e l s e t o h a v e n o r m a l m a r g i n s
Layout.topMargin: urgentNotificationLine . visible ? - notificationItem.thumbnailTopPadding : - 1
Layout.leftMargin: urgentNotificationLine . visible ? - notificationItem.thumbnailLeftPadding : - 1
Layout.bottomMargin: urgentNotificationLine . visible ? - notificationItem.thumbnailBottomPadding : - 1
RowLayout {
id: summaryRow
spacing: PlasmaCore . Units . smallSpacing
ColumnLayout {
Layout.fillWidth: true
visible: summaryLabel . text !== ""
spacing: 0
PlasmaExtras . Heading {
id: summaryLabel
RowLayout {
id: summaryRow
Layout.fillWidth: true
Layout.preferredHeight: implicitHeight
textFormat: Text . PlainText
maximumLineCount: 3
wrapMode: Text . WordWrap
elide: Text . ElideRight
level: 4
/ / G i v e i t a b i t m o r e v i s u a l p r o m i n e n c e t h a n t h e a p p n a m e i n t h e h e a d e r
type: PlasmaExtras . Heading . Type . Primary
text: {
if ( notificationItem . notificationType === NotificationManager . Notifications . JobType ) {
if ( notificationItem . jobState === NotificationManager . Notifications . JobStateSuspended ) {
if ( notificationItem . summary ) {
return i18ndc ( "plasma_applet_org.kde.plasma.notifications" , "Job name, e.g. Copying is paused" , "%1 (Paused)" , notificationItem . summary ) ;
}
} else if ( notificationItem . jobStat e === NotificationManager . Notifications . JobStateStopped ) {
if ( notificationItem . jobError ) {
visible: summaryLabel . text !== ""
PlasmaExtras . Heading {
id: summaryLabel
Layout.fillWidth: true
Layout.preferredHeight: implicitHeight
textFormat: Text . PlainText
maximumLineCount: 3
wrapMode: Text . WordWrap
elide: Text . ElideRight
level: 4
/ / G i v e i t a b i t m o r e v i s u a l p r o m i n e n c e t h a n t h e a p p n a m e i n t h e h e a d e r
type: PlasmaExtras . Heading . Type . Primary
text: {
if ( notificationItem . notificationTyp e === NotificationManager . Notifications . JobType ) {
if ( notificationItem . jobState === NotificationManager . Notifications . JobStateSuspended ) {
if ( notificationItem . summary ) {
return i18ndc ( "plasma_applet_org.kde.plasma.notifications" , "Job name, e.g. Copying has failed" , "%1 (Failed)" , notificationItem . summary ) ;
} else {
return i18nd ( "plasma_applet_org.kde.plasma.notifications" , "Job Failed" ) ;
return i18ndc ( "plasma_applet_org.kde.plasma.notifications" , "Job name, e.g. Copying is paused" , "%1 (Paused)" , notificationItem . summary ) ;
}
} else {
if ( notificationItem . summary ) {
return i18ndc ( "plasma_applet_org.kde.plasma.notifications" , "Job name, e.g. Copying has finished" , "%1 (Finished)" , notificationItem . summary ) ;
} else if ( notificationItem . jobState === NotificationManager . Notifications . JobStateStopped ) {
if ( notificationItem . jobError ) {
if ( notificationItem . summary ) {
return i18ndc ( "plasma_applet_org.kde.plasma.notifications" , "Job name, e.g. Copying has failed" , "%1 (Failed)" , notificationItem . summary ) ;
} else {
return i18nd ( "plasma_applet_org.kde.plasma.notifications" , "Job Failed" ) ;
}
} else {
return i18nd ( "plasma_applet_org.kde.plasma.notifications" , "Job Finished" ) ;
if ( notificationItem . summary ) {
return i18ndc ( "plasma_applet_org.kde.plasma.notifications" , "Job name, e.g. Copying has finished" , "%1 (Finished)" , notificationItem . summary ) ;
} else {
return i18nd ( "plasma_applet_org.kde.plasma.notifications" , "Job Finished" ) ;
}
}
}
}
/ / s o m e a p p s u s e t h e i r a p p n a m e a s s u m m a r y , a v o i d s h o w i n g t h e s a m e t e x t t w i c e
/ / t r y v e r y h a r d t o m a t c h t h e t w o
if ( notificationItem . summary && notificationItem . summary . toLocaleLowerCase ( ) . trim ( ) != notificationItem . applicationName . toLocaleLowerCase ( ) . trim ( ) ) {
return notificationItem . summary ;
}
return "" ;
}
/ / s o m e a p p s u s e t h e i r a p p n a m e a s s u m m a r y , a v o i d s h o w i n g t h e s a m e t e x t t w i c e
/ / t r y v e r y h a r d t o m a t c h t h e t w o
if ( notificationItem . summary && notificationItem . summary . toLocaleLowerCase ( ) . trim ( ) != notificationItem . applicationName . toLocaleLowerCase ( ) . trim ( ) ) {
return notificationItem . summary ;
}
return "" ;
visible: text !== ""
}
visible: text !== ""
}
/ / i n G r o u p h e a d e r I t e m i s r e p a r e n t e d h e r e
}
/ / i n G r o u p h e a d e r I t e m i s r e p a r e n t e d h e r e
}
RowLayout {
id: bodyTextRow
RowLayout {
id: bodyTextRow
Layout.fillWidth: true
spacing: PlasmaCore . Units . smallSpacing
SelectableLabel {
id: bodyLabel
/ / F I X M E h o w t o a s s i g n t h i s v i a S t a t e ? t a r g e t : b o d y L a b e l . L a y o u t d o e s n ' t w o r k a n d j u s t a s s i g n i n g t h e p r o p e r t y d o e s n ' t e i t h e r
Layout.alignment: notificationItem . inGroup ? Qt.AlignTop : Qt . AlignVCenter
Layout.fillWidth: true
spacing: PlasmaCore . Units . smallSpacing
SelectableLabel {
id: bodyLabel
/ / F I X M E h o w t o a s s i g n t h i s v i a S t a t e ? t a r g e t : b o d y L a b e l . L a y o u t d o e s n ' t w o r k a n d j u s t a s s i g n i n g t h e p r o p e r t y d o e s n ' t e i t h e r
Layout.alignment: notificationItem . inGroup ? Qt.AlignTop : Qt . AlignVCenter
Layout.fillWidth: true
Layout.maximumHeight: notificationItem . maximumLineCount > 0
? ( theme . mSize ( font ) . height * notificationItem . maximumLineCount ) : - 1
/ / H A C K R i c h T e x t d o e s n o t a l l o w t o s p e c i f y l i n k c o l o r a n d s i n c e L i n e E d i t
/ / d o e s n o t s u p p o r t S t y l e d T e x t , w e h a v e t o i n j e c t s o m e C S S t o f o r c e t h e c o l o r ,
/ / c f . Q T B U G - 8 1 4 6 3 a n d t o s o m e e x t e n t Q T B U G - 8 0 3 5 4
text: "<style>a { color: " + PlasmaCore . Theme . linkColor + "; }</style>" + notificationItem . body
/ / C a n n o t d o t e x t ! = = " " b e c a u s e R i c h T e x t a d d s s o m e H T M L t a g s e v e n w h e n e m p t y
visible: notificationItem . body !== ""
onClicked: notificationItem . bodyClicked ( mouse )
onLinkActivated: Qt . openUrlExternally ( link )
}
Layout.maximumHeight: notificationItem . maximumLineCount > 0
? ( theme . mSize ( font ) . height * notificationItem . maximumLineCount ) : - 1
/ / H A C K R i c h T e x t d o e s n o t a l l o w t o s p e c i f y l i n k c o l o r a n d s i n c e L i n e E d i t
/ / d o e s n o t s u p p o r t S t y l e d T e x t , w e h a v e t o i n j e c t s o m e C S S t o f o r c e t h e c o l o r ,
/ / c f . Q T B U G - 8 1 4 6 3 a n d t o s o m e e x t e n t Q T B U G - 8 0 3 5 4
text: "<style>a { color: " + PlasmaCore . Theme . linkColor + "; }</style>" + notificationItem . body
/ / C a n n o t d o t e x t ! = = " " b e c a u s e R i c h T e x t a d d s s o m e H T M L t a g s e v e n w h e n e m p t y
visible: notificationItem . body !== ""
onClicked: notificationItem . bodyClicked ( mouse )
onLinkActivated: Qt . openUrlExternally ( link )
/ / i n G r o u p i c o n C o n t a i n e r i s r e p a r e n t e d h e r e
}
/ / i n G r o u p i c o n C o n t a i n e r i s r e p a r e n t e d h e r e
}
}
Item {
id: iconContainer
Layout.preferredWidth: PlasmaCore . Units . iconSizes . large
Layout.preferredHeight: PlasmaCore . Units . iconSizes . large
Layout.topMargin: PlasmaCore . Units . smallSpacing
Layout.bottomMargin: PlasmaCore . Units . smallSpacing
visible: iconItem . active
PlasmaCore . IconItem {
id: iconItem
/ / d o n ' t s h o w t w o i d e n t i c a l i c o n s
readonly property bool active: valid && source != notificationItem . applicationIconSource
anchors.fill: parent
usesPlasmaTheme: false
smooth: true
/ / d o n ' t s h o w a g e n e r i c " i n f o " i c o n s i n c e t h i s i s a n o t i f i c a t i o n a l r e a d y
source: notificationItem . icon !== "dialog-information" ? notificationItem.icon : ""
visible: active
}
Item {
id: iconContainer
Layout.preferredWidth: PlasmaCore . Units . iconSizes . large
Layout.preferredHeight: PlasmaCore . Units . iconSizes . large
Layout.topMargin: PlasmaCore . Units . smallSpacing
Layout.bottomMargin: PlasmaCore . Units . smallSpacing
visible: iconItem . active
PlasmaCore . IconItem {
id: iconItem
/ / d o n ' t s h o w t w o i d e n t i c a l i c o n s
readonly property bool active: valid && source != notificationItem . applicationIconSource
anchors.fill: parent
usesPlasmaTheme: false
smooth: true
/ / d o n ' t s h o w a g e n e r i c " i n f o " i c o n s i n c e t h i s i s a n o t i f i c a t i o n a l r e a d y
source: notificationItem . icon !== "dialog-information" ? notificationItem.icon : ""
visible: active
}
/ / J o b I t e m r e p a r e n t s a f i l e i c o n h e r e f o r f i n i s h e d j o b s w i t h o n e t o t a l f i l e
/ / J o b I t e m r e p a r e n t s a f i l e i c o n h e r e f o r f i n i s h e d j o b s w i t h o n e t o t a l f i l e
}
}
}