Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
PIM
Kalendar
Commits
f04ea460
Commit
f04ea460
authored
Sep 06, 2022
by
Claudio Cambra
Browse files
Fix delegate backgrounds in all calendar views
Signed-off-by:
Claudio Cambra
<
claudio.cambra@gmail.com
>
parent
83ceca96
Pipeline
#228149
passed with stage
in 3 minutes and 4 seconds
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
src/contents/ui/Delegates/DayGridViewIncidenceDelegate.qml
View file @
f04ea460
...
...
@@ -96,59 +96,60 @@ Item {
IncidenceDelegateBackground
{
id
:
incidenceDelegateBackground
isInDayGridView
:
true
isOpenOccurrence
:
parent
.
isOpenOccurrence
reactToCurrentMonth
:
parent
.
reactToCurrentMonth
isInCurrentMonth
:
parent
.
isInCurrentMonth
isDark
:
parent
.
isDark
allDay
:
modelData
.
allDay
allDay
:
modelData
.
allDay
}
RowLayout
{
id
:
incidenceContents
clip
:
true
readonly
property
bool
spaceRestricted
:
parent
.
width
<
Kirigami
.
Units
.
gridUnit
*
5
readonly
property
color
textColor
:
incidenceDelegateBackground
.
opacity
>
0
?
LabelUtils
.
getIncidenceLabelColor
(
modelData
.
color
,
incidenceDelegate
.
isDark
)
:
Kirigami
.
Theme
.
textColor
readonly
property
color
otherMonthTextColor
:
{
if
(
incidenceDelegateBackground
.
visible
&&
incidenceDelegateBackground
.
opacity
>
0
)
{
if
(
incidenceDelegate
.
isDark
)
{
return
LabelUtils
.
getDarkness
(
modelData
.
color
)
>=
0.5
?
Qt
.
lighter
(
modelData
.
color
,
2
)
:
Qt
.
lighter
(
modelData
.
color
,
1.5
);
}
return
Qt
.
darker
(
modelData
.
color
,
3
);
}
return
Kirigami
.
Theme
.
textColor
;
}
readonly
property
color
selectedContentColor
:
LabelUtils
.
isDarkColor
(
modelData
.
color
)
?
"
white
"
:
"
black
"
readonly
property
color
contentColor
:
incidenceDelegate
.
isOpenOccurrence
?
selectedContentColor
:
incidenceDelegate
.
isInCurrentMonth
?
textColor
:
otherMonthTextColor
readonly
property
int
leadingIconSize
:
Kirigami
.
Units
.
gridUnit
/
2
LabelUtils
.
getIncidenceLabelColor
(
modelData
.
color
,
incidenceDelegate
.
isDark
)
:
Kirigami
.
Theme
.
textColor
readonly
property
color
otherMonthTextColor
:
{
if
(
incidenceDelegateBackground
.
visible
&&
incidenceDelegateBackground
.
opacity
>
0
)
{
if
(
incidenceDelegate
.
isDark
)
{
return
LabelUtils
.
getDarkness
(
modelData
.
color
)
>=
0.5
?
Qt
.
lighter
(
modelData
.
color
,
2
)
:
Qt
.
lighter
(
modelData
.
color
,
1.5
);
}
return
Qt
.
darker
(
modelData
.
color
,
3
);
}
return
Kirigami
.
Theme
.
textColor
;
}
readonly
property
color
selectedContentColor
:
LabelUtils
.
isDarkColor
(
modelData
.
color
)
?
"
white
"
:
"
black
"
readonly
property
color
contentColor
:
incidenceDelegate
.
isOpenOccurrence
?
selectedContentColor
:
incidenceDelegate
.
isInCurrentMonth
?
textColor
:
otherMonthTextColor
readonly
property
int
leadingIconSize
:
Kirigami
.
Units
.
gridUnit
/
2
anchors
{
fill
:
parent
leftMargin
:
spaceRestricted
?
Kirigami
.
Units
.
smallSpacing
/
2
:
Kirigami
.
Units
.
smallSpacing
rightMargin
:
spaceRestricted
?
Kirigami
.
Units
.
smallSpacing
/
2
:
Kirigami
.
Units
.
smallSpacing
}
Rectangle
{
id
:
dotRectangle
width
:
incidenceContents
.
leadingIconSize
height
:
width
radius
:
width
/
2
// We want equal alignment for items that both have a dot, don't have a dot because they are all-day, and
// items that don't have a dot because they represent todos. Hidden items are compressed to a size of 0 so
// instead we set the color to transparent.
color
:
modelData
.
allDay
?
"
transparent
"
:
incidenceDelegate
.
isOpenOccurrence
?
incidenceContents
.
selectedContentColor
:
modelData
.
color
Behavior
on
color
{
ColorAnimation
{
duration
:
Kirigami
.
Units
.
shortDuration
;
easing.type
:
Easing
.
OutCubic
}
}
}
Rectangle
{
id
:
dotRectangle
width
:
incidenceContents
.
leadingIconSize
height
:
width
radius
:
width
/
2
// We want equal alignment for items that both have a dot, don't have a dot because they are all-day, and
// items that don't have a dot because they represent todos. Hidden items are compressed to a size of 0 so
// instead we set the color to transparent.
color
:
modelData
.
allDay
?
"
transparent
"
:
incidenceDelegate
.
isOpenOccurrence
?
incidenceContents
.
selectedContentColor
:
modelData
.
color
Behavior
on
color
{
ColorAnimation
{
duration
:
Kirigami
.
Units
.
shortDuration
;
easing.type
:
Easing
.
OutCubic
}
}
}
QQC2.Label
{
Layout.fillWidth
:
true
...
...
@@ -163,7 +164,7 @@ Item {
Behavior
on
color
{
ColorAnimation
{
duration
:
Kirigami
.
Units
.
shortDuration
;
easing.type
:
Easing
.
OutCubic
}
}
}
QQC2.Label
{
QQC2.Label
{
text
:
modelData
.
incidenceType
===
Kalendar
.
IncidenceWrapper
.
TypeTodo
?
modelData
.
endTime
.
toLocaleTimeString
(
Qt
.
locale
(),
Locale
.
NarrowFormat
)
:
modelData
.
startTime
.
toLocaleTimeString
(
Qt
.
locale
(),
Locale
.
NarrowFormat
)
...
...
src/contents/ui/Delegates/IncidenceDelegateBackground.qml
View file @
f04ea460
...
...
@@ -11,7 +11,7 @@ import "labelutils.js" as LabelUtils
Kirigami.ShadowedRectangle
{
id
:
incidenceDelegateBackground
property
bool
isIn
Hourly
View
:
false
property
bool
isIn
DayGrid
View
:
false
property
bool
isOpenOccurrence
:
false
property
bool
reactToCurrentMonth
:
false
property
bool
isInCurrentMonth
:
true
...
...
@@ -19,14 +19,10 @@ Kirigami.ShadowedRectangle {
property
bool
allDay
:
false
anchors.fill
:
parent
color
:
isOpenOccurrence
||
isInHourlyView
?
modelData
.
color
:
color
:
isOpenOccurrence
?
modelData
.
color
:
LabelUtils
.
getIncidenceDelegateBackgroundColor
(
modelData
.
color
,
root
.
isDark
,
modelData
.
endTime
,
Kalendar
.
Config
.
pastEventsTransparencyLevel
)
Behavior
on
color
{
ColorAnimation
{
duration
:
Kirigami
.
Units
.
shortDuration
;
easing.type
:
Easing
.
OutCubic
}
}
opacity
:
if
(
isInHourlyView
)
{
return
isOpenOccurrence
?
0.5
:
0.1
}
else
{
return
isOpenOccurrence
||
(
isInCurrentMonth
&&
allDay
)
?
1
:
0
}
opacity
:
!
isInDayGridView
||
isOpenOccurrence
||
(
isInCurrentMonth
&&
allDay
)
?
1
:
0
Behavior
on
opacity
{
NumberAnimation
{
duration
:
Kirigami
.
Units
.
shortDuration
;
easing.type
:
Easing
.
OutCubic
}
}
radius
:
Kirigami
.
Units
.
smallSpacing
...
...
src/contents/ui/MainViews/HourlyView.qml
View file @
f04ea460
...
...
@@ -1004,7 +1004,6 @@ Kirigami.Page {
id
:
incidenceDelegateBackground
isOpenOccurrence
:
parent
.
isOpenOccurrence
isDark
:
root
.
isDark
isInHourlyView
:
true
}
ColumnLayout
{
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment