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
a5c74430
Commit
a5c74430
authored
Aug 03, 2022
by
Claudio Cambra
Browse files
Port CalendarItemMouseArea to CalendarItemTapHandler
Signed-off-by:
Claudio Cambra
<
claudio.cambra@gmail.com
>
parent
4c15ec89
Pipeline
#212263
passed with stage
in 5 minutes and 18 seconds
Changes
4
Pipelines
2
Hide whitespace changes
Inline
Side-by-side
src/contents/ui/Controls/CalendarItem
MouseArea
.qml
→
src/contents/ui/Controls/CalendarItem
TapHandler
.qml
View file @
a5c74430
// SPDX-FileCopyrightText: 2021 Claudio Cambra <claudio.cambra@gmail.com>
// SPDX-License-Identifier: GPL-2.0-or-later
import
QtQuick
2.
4
import
QtQuick
2.
15
import
QtQuick
.
Layouts
1.15
import
QtQuick
.
Dialogs
1.0
import
QtQuick
.
Controls
2.15
as
QQC2
import
org
.
kde
.
kirigami
2.14
as
Kirigami
import
org
.
kde
.
kalendar
1.0
as
Kalendar
MouseArea
{
id
:
calendar
MouseArea
TapHandler
{
id
:
calendar
TapHandler
signal
deleteCalendar
(
int
collectionId
,
var
collectionDetails
)
property
double
clickX
property
double
clickY
property
var
collectionId
property
var
collectionDetails
anchors.fill
:
parent
hoverEnabled
:
true
acceptedButtons
:
Qt
.
RightButton
onClicked
:
{
if
(
mouse
.
button
==
Qt
.
RightButton
)
{
clickX
=
mouseX
;
clickY
=
mouseY
;
calendarActions
.
createObject
(
calendarMouseArea
,
{}).
open
();
}
acceptedButtons
:
Kirigami
.
Settings
.
isMobile
?
Qt
.
LeftButton
|
Qt
.
RightButton
:
Qt
.
RightButton
onTapped
:
if
(
!
Kirigami
.
Settings
.
isMobile
)
{
calendarActions
.
createObject
(
calendarTapHandler
,
{}).
open
();
}
onPressAndHold
:
if
(
Kirigami
.
Settings
.
isMobile
)
{
clickX
=
mouseX
;
clickY
=
mouseY
;
calendarActions
.
createObject
(
calendarMouseArea
,
{}).
open
();
onLongPressed
:
if
(
Kirigami
.
Settings
.
isMobile
)
{
calendarActions
.
createObject
(
calendarTapHandler
,
{}).
open
();
}
Loader
{
property
Loader
colorDialogLoader
:
Loader
{
id
:
colorDialogLoader
active
:
false
sourceComponent
:
ColorDialog
{
id
:
colorDialog
title
:
i18nc
(
"
@title:window
"
,
"
Choose Calendar Color
"
)
color
:
calendar
MouseArea
.
collectionDetails
.
color
onAccepted
:
Kalendar
.
CalendarManager
.
setCollectionColor
(
calendar
MouseArea
.
collectionId
,
color
)
color
:
calendar
TapHandler
.
collectionDetails
.
color
onAccepted
:
Kalendar
.
CalendarManager
.
setCollectionColor
(
calendar
TapHandler
.
collectionId
,
color
)
onRejected
:
{
close
();
colorDialogLoader
.
active
=
false
;
...
...
@@ -49,15 +41,15 @@ MouseArea {
}
}
Component
{
id
:
calendarActions
property
Component
calendarActions
:
Component
{
CalendarItemMenu
{
y
:
calendarMouseArea
.
clickY
x
:
calendarMouseArea
.
clickX
collectionId
:
calendarMouseArea
.
collectionId
collectionDetails
:
calendarMouseArea
.
collectionDetails
Component.onCompleted
:
if
(
calendarMouseArea
.
collectionId
&&
!
calendarMouseArea
.
collectionDetails
)
calendarMouseArea
.
collectionDetails
=
Kalendar
.
CalendarManager
.
getCollectionDetails
(
calendarMouseArea
.
collectionId
)
parent
:
calendarTapHandler
.
parent
collectionId
:
calendarTapHandler
.
collectionId
collectionDetails
:
calendarTapHandler
.
collectionDetails
Component.onCompleted
:
if
(
calendarTapHandler
.
collectionId
&&
!
calendarTapHandler
.
collectionDetails
)
{
calendarTapHandler
.
collectionDetails
=
Kalendar
.
CalendarManager
.
getCollectionDetails
(
calendarTapHandler
.
collectionId
)
}
}
}
}
src/contents/ui/Drawers/MainDrawer.qml
View file @
a5c74430
...
...
@@ -496,13 +496,15 @@ Kirigami.OverlayDrawer {
leadingPadding
:
Kirigami
.
Settings
.
isMobile
?
Kirigami
.
Units
.
largeSpacing
*
2
:
Kirigami
.
Units
.
largeSpacing
Connections
{
property
var
collectionDetails
:
CalendarManager
.
getCollectionDetails
(
collectionId
)
target
:
AgentConfiguration
function
onAgentProgressChanged
(
agentData
)
{
if
(
agentData
.
instanceId
===
calendarSourceItemMouseArea
.
collectionDetails
.
resource
&&
if
(
agentData
.
instanceId
===
collectionDetails
.
resource
&&
agentData
.
status
===
AgentConfiguration
.
Running
)
{
loadingIndicator
.
visible
=
true
;
}
else
if
(
agentData
.
instanceId
===
calendarSourceItemMouseArea
.
collectionDetails
.
resource
)
{
}
else
if
(
agentData
.
instanceId
===
collectionDetails
.
resource
)
{
loadingIndicator
.
visible
=
false
;
}
}
...
...
@@ -547,28 +549,28 @@ Kirigami.OverlayDrawer {
enabled
:
mainDrawer
.
mode
===
KalendarApplication
.
Contact
}
// TODO port to TapHanlder
CalendarItemMouseArea
{
id
:
calendarSourceItemMouseArea
parent
:
calendarSourceItem
.
contentItem
// Otherwise label elide breaks
CalendarItemTapHandler
{
collectionId
:
model
.
collectionId
collectionDetails
:
CalendarManager
.
getCollectionDetails
(
collectionId
)
anchors.fill
:
parent
enabled
:
mode
!==
KalendarApplication
.
Contact
}
DropArea
{
id
:
incidenceDropArea
anchors.fill
:
parent
z
:
9999
enabled
:
calendarSourceItemMouseArea
.
collectionDetails
.
canCreate
onDropped
:
if
(
drop
.
source
.
objectName
===
"
taskDelegate
"
)
{
CalendarManager
.
changeIncidenceCollection
(
drop
.
source
.
incidencePtr
,
calendarSourceItemMouseArea
.
collectionId
);
const
pos
=
mapToItem
(
applicationWindow
().
contentItem
,
x
,
y
);
drop
.
source
.
caughtX
=
pos
.
x
;
drop
.
source
.
caughtY
=
pos
.
y
;
drop
.
source
.
caught
=
true
;
}
DropArea
{
id
:
incidenceDropArea
property
var
collectionDetails
:
CalendarManager
.
getCollectionDetails
(
model
.
collectionId
)
parent
:
calendarSourceItem
.
contentItem
// Otherwise label elide breaks
anchors.fill
:
parent
z
:
9999
enabled
:
collectionDetails
.
canCreate
onDropped
:
if
(
drop
.
source
.
objectName
===
"
taskDelegate
"
)
{
CalendarManager
.
changeIncidenceCollection
(
drop
.
source
.
incidencePtr
,
model
.
collectionId
);
const
pos
=
mapToItem
(
applicationWindow
().
contentItem
,
x
,
y
);
drop
.
source
.
caughtX
=
pos
.
x
;
drop
.
source
.
caughtY
=
pos
.
y
;
drop
.
source
.
caught
=
true
;
}
}
}
...
...
@@ -618,29 +620,29 @@ Kirigami.OverlayDrawer {
enabled
:
mainDrawer
.
mode
===
KalendarApplication
.
Contact
}
CalendarItemMouseArea
{
id
:
calendarItemMouseArea
parent
:
calendarItem
.
contentItem
// Otherwise label elide breaks
CalendarItemTapHandler
{
collectionId
:
model
.
collectionId
collectionDetails
:
CalendarManager
.
getCollectionDetails
(
collectionId
)
anchors.fill
:
parent
enabled
:
mode
!==
KalendarApplication
.
Contact
onDeleteCalendar
:
mainDrawer
.
deleteCalendar
(
collectionId
,
collectionDetails
)
}
DropArea
{
id
:
incidenceDropArea
anchors.fill
:
parent
z
:
9999
enabled
:
calendarItemMouseArea
.
collectionDetails
.
canCreate
onDropped
:
if
(
drop
.
source
.
objectName
===
"
taskDelegate
"
)
{
CalendarManager
.
changeIncidenceCollection
(
drop
.
source
.
incidencePtr
,
calendarItemMouseArea
.
collectionId
);
const
pos
=
mapToItem
(
applicationWindow
().
contentItem
,
x
,
y
);
drop
.
source
.
caughtX
=
pos
.
x
;
drop
.
source
.
caughtY
=
pos
.
y
;
drop
.
source
.
caught
=
true
;
}
DropArea
{
id
:
incidenceDropArea
property
var
collectionDetails
:
CalendarManager
.
getCollectionDetails
(
model
.
collectionId
)
parent
:
calendarItem
.
contentItem
// Otherwise label elide breaks
anchors.fill
:
parent
z
:
9999
enabled
:
collectionDetails
.
canCreate
onDropped
:
if
(
drop
.
source
.
objectName
===
"
taskDelegate
"
)
{
CalendarManager
.
changeIncidenceCollection
(
drop
.
source
.
incidencePtr
,
model
.
collectionId
);
const
pos
=
mapToItem
(
applicationWindow
().
contentItem
,
x
,
y
);
drop
.
source
.
caughtX
=
pos
.
x
;
drop
.
source
.
caughtY
=
pos
.
y
;
drop
.
source
.
caught
=
true
;
}
}
}
...
...
src/contents/ui/Settings/CalendarSettingsPage.qml
View file @
a5c74430
...
...
@@ -72,11 +72,8 @@ Kirigami.Page {
onClicked
:
collectionsList
.
model
.
toggleChildren
(
index
)
CalendarItemMouseArea
{
id
:
calendarItemMouseArea
parent
:
calendarSourceItem
.
contentItem
// Otherwise label elide breaks
CalendarItemTapHandler
{
collectionId
:
model
.
collectionId
anchors.fill
:
parent
}
}
}
...
...
@@ -101,14 +98,10 @@ Kirigami.Page {
onClicked
:
model
.
checkState
=
model
.
checkState
===
0
?
2
:
0
}
CalendarItemMouseArea
{
id
:
calendarItemMouseArea
parent
:
calendarItem
.
contentItem
// Otherwise label elide breaks
CalendarItemTapHandler
{
collectionId
:
model
.
collectionId
anchors.fill
:
parent
Component
{
id
:
deleteCalendarPageComponent
property
Component
deleteCalendarPageComponent
:
Component
{
DeleteCalendarPage
{
id
:
deletePage
onDeleteCollection
:
{
...
...
@@ -118,10 +111,11 @@ Kirigami.Page {
onCancel
:
closeDialog
()
}
}
onDeleteCalendar
:
{
const
openDialogWindow
=
pageStack
.
pushDialogLayer
(
deleteCalendarPageComponent
,
{
collectionId
:
collectionId
,
collectionDetails
:
collectionDetails
,
collectionId
:
model
.
collectionId
,
collectionDetails
:
CalendarManager
.
getCollectionDetails
(
model
.
collectionId
)
,
},
{
width
:
Kirigami
.
Units
.
gridUnit
*
30
,
height
:
Kirigami
.
Units
.
gridUnit
*
6
...
...
src/resources.qrc
View file @
a5c74430
...
...
@@ -44,7 +44,7 @@ SPDX-License-Identifier: CC0-1.0
<file alias="TodoCheckBox.qml">contents/ui/Controls/TodoCheckBox.qml</file>
<file alias="Tag.qml">contents/ui/Controls/Tag.qml</file>
<file alias="ResizerSeparator.qml">contents/ui/Controls/ResizerSeparator.qml</file>
<file alias="CalendarItem
MouseArea
.qml">contents/ui/Controls/CalendarItem
MouseArea
.qml</file>
<file alias="CalendarItem
TapHandler
.qml">contents/ui/Controls/CalendarItem
TapHandler
.qml</file>
<file alias="LocationMap.qml">contents/ui/Location/LocationMap.qml</file>
<file alias="SettingsPage.qml">contents/ui/Settings/SettingsPage.qml</file>
<file alias="AboutPage.qml">contents/ui/Settings/AboutPage.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