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
b32a10d3
Commit
b32a10d3
authored
Sep 28, 2022
by
Claudio Cambra
Browse files
Make the collection sidebar view more generic and reusable
Signed-off-by:
Claudio Cambra
<
claudio.cambra@gmail.com
>
parent
3c92ef7f
Pipeline
#238058
passed with stage
in 3 minutes and 23 seconds
Changes
4
Pipelines
2
Hide whitespace changes
Inline
Side-by-side
src/contents/ui/Controls/C
alendarAddressbookSidebar
.qml
→
src/contents/ui/Controls/C
heckableCollectionNavigationView
.qml
View file @
b32a10d3
...
...
@@ -16,9 +16,9 @@ import org.kde.kitemmodels 1.0
QQC2.ScrollView
{
id
:
root
signal
c
alendar
CheckChanged
signal
c
ollection
CheckChanged
signal
closeParentDrawer
signal
deleteC
alendar
(
int
collectionId
,
var
collectionDetails
)
signal
deleteC
ollection
(
int
collectionId
,
var
collectionDetails
)
readonly
property
AgentConfiguration
agentConfiguration
:
AgentConfiguration
{}
readonly
property
var
activeTags
:
Filter
.
tags
...
...
@@ -106,8 +106,9 @@ QQC2.ScrollView {
}
Kirigami.BasicListItem
{
id
:
calendarHeadingItem
property
bool
expanded
:
Config
.
calendarsSectionExpanded
id
:
collectionHeadingItem
readonly
property
bool
expanded
:
Config
.
collectionsSectionExpanded
separatorVisible
:
false
hoverEnabled
:
false
...
...
@@ -116,9 +117,13 @@ QQC2.ScrollView {
leading
:
Kirigami.Icon
{
implicitWidth
:
Kirigami
.
Units
.
iconSizes
.
smallMedium
implicitHeight
:
Kirigami
.
Units
.
iconSizes
.
smallMedium
source
:
"
view-calendar
"
source
:
if
(
mode
===
KalendarApplication
.
Contact
)
{
return
"
view-pim-contacts
"
;
}
else
{
return
"
view-calendar
"
;
}
isMask
:
true
color
:
c
alendar
HeadingItem
.
labelItem
.
color
color
:
c
ollection
HeadingItem
.
labelItem
.
color
}
text
:
if
(
mode
===
KalendarApplication
.
Contact
)
{
return
i18n
(
"
Contacts
"
);
...
...
@@ -131,20 +136,20 @@ QQC2.ScrollView {
trailing
:
Kirigami.Icon
{
implicitWidth
:
Kirigami
.
Units
.
iconSizes
.
small
implicitHeight
:
Kirigami
.
Units
.
iconSizes
.
small
source
:
c
alendar
HeadingItem
.
expanded
?
'
arrow-up
'
:
'
arrow-down
'
source
:
c
ollection
HeadingItem
.
expanded
?
'
arrow-up
'
:
'
arrow-down
'
isMask
:
true
color
:
c
alendar
HeadingItem
.
labelItem
.
color
color
:
c
ollection
HeadingItem
.
labelItem
.
color
}
onClicked
:
{
Config
.
c
alendar
sSectionExpanded
=
!
Config
.
c
alendar
sSectionExpanded
;
Config
.
c
ollection
sSectionExpanded
=
!
Config
.
c
ollection
sSectionExpanded
;
Config
.
save
();
}
}
Repeater
{
id
:
c
alendar
List
id
:
c
ollection
List
property
var
c
alendar
Model
:
KDescendantsProxyModel
{
property
var
c
ollection
Model
:
KDescendantsProxyModel
{
model
:
switch
(
root
.
mode
)
{
case
KalendarApplication.Todo
:
return
CalendarManager
.
todoCollections
;
...
...
@@ -155,7 +160,7 @@ QQC2.ScrollView {
}
}
model
:
c
alendar
HeadingItem
.
expanded
?
c
alendar
Model
:
[]
model
:
c
ollection
HeadingItem
.
expanded
?
c
ollection
Model
:
[]
delegate
:
DelegateChooser
{
role
:
'
kDescendantExpandable
'
...
...
@@ -163,7 +168,7 @@ QQC2.ScrollView {
roleValue
:
true
Kirigami.BasicListItem
{
id
:
c
alendar
SourceItem
id
:
c
ollection
SourceItem
label
:
display
highlighted
:
visualFocus
||
incidenceDropArea
.
containsDrag
labelItem.color
:
visualFocus
?
Kirigami
.
Theme
.
textColor
:
Kirigami
.
Theme
.
disabledTextColor
...
...
@@ -180,7 +185,7 @@ QQC2.ScrollView {
leading
:
Kirigami.Icon
{
implicitWidth
:
Kirigami
.
Units
.
iconSizes
.
smallMedium
implicitHeight
:
Kirigami
.
Units
.
iconSizes
.
smallMedium
color
:
c
alendar
SourceItem
.
labelItem
.
color
color
:
c
ollection
SourceItem
.
labelItem
.
color
isMask
:
true
source
:
model
.
decoration
}
...
...
@@ -214,25 +219,25 @@ QQC2.ScrollView {
implicitWidth
:
Kirigami
.
Units
.
iconSizes
.
small
implicitHeight
:
Kirigami
.
Units
.
iconSizes
.
small
source
:
model
.
kDescendantExpanded
?
'
arrow-up
'
:
'
arrow-down
'
color
:
c
alendar
SourceItem
.
labelItem
.
color
color
:
c
ollection
SourceItem
.
labelItem
.
color
isMask
:
true
}
ColoredCheckbox
{
id
:
c
alendar
Checkbox
id
:
c
ollection
Checkbox
Layout.fillHeight
:
true
visible
:
model
.
checkState
!=
null
color
:
model
.
collectionColor
??
Kirigami
.
Theme
.
highlightedTextColor
checked
:
model
.
checkState
===
2
onCheckedChanged
:
root
.
c
alendar
CheckChanged
()
onCheckedChanged
:
root
.
c
ollection
CheckChanged
()
onClicked
:
{
model
.
checkState
=
model
.
checkState
===
0
?
2
:
0
calendar
CheckChanged
()
root
.
collection
CheckChanged
()
}
}
}
onClicked
:
c
alendar
List
.
model
.
toggleChildren
(
index
)
onClicked
:
c
ollection
List
.
model
.
toggleChildren
(
index
)
CalendarItemTapHandler
{
collectionId
:
model
.
collectionId
...
...
@@ -244,12 +249,12 @@ QQC2.ScrollView {
DropArea
{
id
:
incidenceDropArea
property
var
collectionDetails
:
CalendarManager
.
getCollectionDetails
(
model
.
collectionId
)
parent
:
c
alendar
SourceItem
.
contentItem
// Otherwise label elide breaks
parent
:
c
ollection
SourceItem
.
contentItem
// Otherwise label elide breaks
anchors.fill
:
parent
z
:
9999
enabled
:
collectionDetails
.
canCreate
onDropped
:
if
(
drop
.
source
.
objectName
===
"
taskDelegate
"
)
{
CalendarManager
.
changeIncidenceCollection
(
drop
.
source
.
incidencePtr
,
calendarSourceItemMouseArea
.
collectionId
);
CalendarManager
.
changeIncidenceCollection
(
drop
.
source
.
incidencePtr
,
model
.
collectionId
);
const
pos
=
mapToItem
(
applicationWindow
().
contentItem
,
x
,
y
);
drop
.
source
.
caughtX
=
pos
.
x
;
...
...
@@ -263,7 +268,7 @@ QQC2.ScrollView {
DelegateChoice
{
roleValue
:
false
Kirigami.BasicListItem
{
id
:
c
alendar
Item
id
:
c
ollection
Item
label
:
display
labelItem.color
:
Kirigami
.
Theme
.
textColor
leftPadding
:
Kirigami
.
Settings
.
isMobile
?
...
...
@@ -281,15 +286,15 @@ QQC2.ScrollView {
leadingPadding
:
Kirigami
.
Settings
.
isMobile
?
Kirigami
.
Units
.
largeSpacing
*
2
:
Kirigami
.
Units
.
largeSpacing
trailing
:
ColoredCheckbox
{
id
:
c
alendar
Checkbox
id
:
c
ollection
Checkbox
visible
:
model
.
checkState
!=
null
color
:
model
.
collectionColor
checked
:
model
.
checkState
===
2
onCheckedChanged
:
root
.
c
alendar
CheckChanged
()
onCheckedChanged
:
root
.
c
ollection
CheckChanged
()
onClicked
:
{
model
.
checkState
=
model
.
checkState
===
0
?
2
:
0
calendar
CheckChanged
()
root
.
collection
CheckChanged
()
}
}
...
...
@@ -305,18 +310,18 @@ QQC2.ScrollView {
collectionDetails
:
CalendarManager
.
getCollectionDetails
(
collectionId
)
agentConfiguration
:
root
.
agentConfiguration
enabled
:
mode
!==
KalendarApplication
.
Contact
onDeleteCalendar
:
root
.
deleteC
alendar
(
collectionId
,
collectionDetails
)
onDeleteCalendar
:
root
.
deleteC
ollection
(
collectionId
,
collectionDetails
)
}
DropArea
{
id
:
incidenceDropArea
property
var
collectionDetails
:
CalendarManager
.
getCollectionDetails
(
model
.
collectionId
)
parent
:
c
alendar
Item
.
contentItem
// Otherwise label elide breaks
parent
:
c
ollection
Item
.
contentItem
// Otherwise label elide breaks
anchors.fill
:
parent
z
:
9999
enabled
:
collectionDetails
.
canCreate
onDropped
:
if
(
drop
.
source
.
objectName
===
"
taskDelegate
"
)
{
CalendarManager
.
changeIncidenceCollection
(
drop
.
source
.
incidencePtr
,
calendarItemMouseArea
.
collectionId
);
CalendarManager
.
changeIncidenceCollection
(
drop
.
source
.
incidencePtr
,
model
.
collectionId
);
const
pos
=
mapToItem
(
applicationWindow
().
contentItem
,
x
,
y
);
drop
.
source
.
caughtX
=
pos
.
x
;
...
...
src/contents/ui/Drawers/MainDrawer.qml
View file @
b32a10d3
...
...
@@ -353,10 +353,10 @@ Kirigami.OverlayDrawer {
Component
{
id
:
calendarAddressBookComponent
C
alendarAddressbookSidebar
{
onC
alendar
CheckChanged
:
mainDrawer
.
c
alendar
CheckChanged
()
C
heckableCollectionNavigationView
{
onC
ollection
CheckChanged
:
mainDrawer
.
c
ollection
CheckChanged
()
onCloseParentDrawer
:
mainDrawer
.
close
()
onDeleteC
alendar
:
mainDrawer
.
deleteC
alendar
(
collectionId
,
collectionDetails
)
onDeleteC
ollection
:
mainDrawer
.
deleteC
ollection
(
collectionId
,
collectionDetails
)
mode
:
mainDrawer
.
mode
parentDrawerModal
:
mainDrawer
.
modal
...
...
@@ -394,7 +394,7 @@ Kirigami.OverlayDrawer {
}
}
function
c
alendar
CheckChanged
()
{
function
c
ollection
CheckChanged
()
{
if
(
mode
&
(
KalendarApplication
.
Event
|
KalendarApplication
.
Todo
))
{
CalendarManager
.
save
();
}
...
...
src/kalendarconfig.kcfg
View file @
b32a10d3
...
...
@@ -61,11 +61,11 @@ SPDX-License-Identifier: LGPL-2.0-or-later
<group
name=
"MainDrawer"
>
<entry
name=
"tagsSectionExpanded"
type=
"Bool"
>
<label>
Whether the "Tags" section of the mainDrawer
.
is expanded.
</label>
<label>
Whether the "Tags" section of the mainDrawer
is expanded.
</label>
<default>
true
</default>
</entry>
<entry
name=
"c
alendar
sSectionExpanded"
type=
"Bool"
>
<label>
Whether the "
Tag
s" section of the mainDrawer
.
is expanded.
</label>
<entry
name=
"c
ollection
sSectionExpanded"
type=
"Bool"
>
<label>
Whether the "
Calendar" or "Contact
s" section of the mainDrawer
is expanded.
</label>
<default>
true
</default>
</entry>
</group>
...
...
src/resources.qrc
View file @
b32a10d3
...
...
@@ -56,7 +56,7 @@ SPDX-License-Identifier: CC0-1.0
<file alias="TodoCheckBox.qml">contents/ui/Controls/TodoCheckBox.qml</file>
<file alias="IncidenceInfoContents.qml">contents/ui/Controls/IncidenceInfoContents.qml</file>
<file alias="IncidenceInfoPopup.qml">contents/ui/Controls/IncidenceInfoPopup.qml</file>
<file alias="C
alendarAddressbookSidebar.qml">contents/ui/Controls/CalendarAddressbookSidebar
.qml</file>
<file alias="C
heckableCollectionNavigationView.qml">contents/ui/Controls/CheckableCollectionNavigationView
.qml</file>
<file alias="LocationMap.qml">contents/ui/Location/LocationMap.qml</file>
...
...
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