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
cdce3021
Commit
cdce3021
authored
Jun 13, 2022
by
Carl Schwan
🚴
Committed by
Claudio Cambra
Aug 04, 2022
Browse files
Add sender information and attachment handling
Signed-off-by:
Carl Schwan
<
carl@carlschwan.eu
>
parent
e038b2bb
Changes
4
Hide whitespace changes
Inline
Side-by-side
src/mail/CMakeLists.txt
View file @
cdce3021
...
...
@@ -39,6 +39,10 @@ ecm_target_qml_sources(kalendar_mail_plugin SOURCES
qml/MailViewer.qml
qml/ConversationViewer.qml
)
ecm_target_qml_sources
(
kalendar_mail_plugin
PRIVATE PATH private SOURCES
qml/private/AttachmentDelegate.qml
)
ecm_target_qml_sources
(
kalendar_mail_plugin
PRIVATE PATH mailpartview SOURCES
...
...
src/mail/qml/FolderView.qml
View file @
cdce3021
...
...
@@ -4,13 +4,58 @@
import
QtQuick
2.15
import
QtQuick
.
Layouts
1.15
import
org
.
kde
.
kirigami
2.14
as
Kirigami
import
QtQuick
.
Controls
2.15
as
Controls
import
QtQuick
.
Controls
2.15
as
QQC2
import
org
.
kde
.
kalendar
.
mail
1.0
import
org
.
kde
.
kitemmodels
1.0
as
KItemModels
Kirigami.ScrollablePage
{
id
:
folderView
title
:
MailManager
.
selectedFolderName
Component
{
id
:
contextMenu
QQC2.Menu
{
property
int
row
property
var
status
QQC2.Menu
{
title
:
i18nc
(
'
@action:menu
'
,
'
Mark Message
'
)
QQC2.MenuItem
{
text
:
i18n
(
'
Mark message as Read
'
)
}
QQC2.MenuItem
{
text
:
i18n
(
'
Mark message as Unread
'
)
}
QQC2.MenuSeparator
{}
QQC2.MenuItem
{
text
:
status
.
isImportant
?
i18n
(
"
Don't Mark as Important
"
)
:
i18n
(
'
Mark as Important
'
)
}
}
QQC2.MenuItem
{
icon.name
:
'
delete
'
text
:
i18n
(
'
Move to trash
'
)
}
QQC2.MenuItem
{
icon.name
:
'
edit-move
'
text
:
i18n
(
'
Move Message to...
'
)
}
QQC2.MenuItem
{
icon.name
:
'
edit-copy
'
text
:
i18n
(
'
Copy Message to...
'
)
}
QQC2.MenuItem
{
icon.name
:
'
edit-copy
'
text
:
i18n
(
'
Add followup reminder
'
)
}
}
}
ListView
{
id
:
mails
model
:
MailManager
.
folderModel
...
...
@@ -27,6 +72,38 @@ import org.kde.kitemmodels 1.0 as KItemModels
}
else
{
return
!
model
.
status
||
model
.
status
.
isRead
?
Kirigami
.
Theme
.
textColor
:
Kirigami
.
Theme
.
linkColor
;
}
TapHandler
{
acceptedButtons
:
Qt
.
RightButton
onTapped
:
{
const
menu
=
contextMenu
.
createObject
(
folderView
,
{
row
:
index
,
status
:
MailManager
.
folderModel
.
copyMessageStatus
(
model
.
status
),
});
menu
.
popup
();
}
}
trailing
:
RowLayout
{
QQC2.Label
{
text
:
model
.
datetime
.
toLocaleTimeString
(
Qt
.
locale
(),
Locale
.
ShortFormat
)
QQC2.ToolTip
{
text
:
model
.
datetime
.
toLocaleString
()
}
}
QQC2.ToolButton
{
icon.name
:
status
.
isImportant
?
'
starred-symbolic
'
:
'
non-starred-symbolic
'
implicitHeight
:
Kirigami
.
Units
.
gridUnit
implicitWidth
:
Kirigami
.
Units
.
gridUnit
onClicked
:
{
const
status
=
MailManager
.
folderModel
.
copyMessageStatus
(
model
.
status
);
status
.
isImportant
=
!
status
.
isImportant
;
MailManager
.
folderModel
.
updateMessageStatus
(
index
,
status
)
}
}
}
onClicked
:
{
applicationWindow
().
pageStack
.
push
(
Qt
.
resolvedUrl
(
'
ConversationViewer.qml
'
),
{
item
:
model
.
item
,
...
...
src/mail/qml/MailViewer.qml
View file @
cdce3021
...
...
@@ -9,6 +9,7 @@ import org.kde.kalendar 1.0
import
org
.
kde
.
kalendar
.
mail
1.0
import
org
.
kde
.
kitemmodels
1.0
as
KItemModels
import
'
./mailpartview
'
import
'
./private
'
QQC2.Page
{
id
:
root
...
...
@@ -57,6 +58,18 @@ QQC2.Page {
horizontalAlignment
:
Text
.
AlignRight
}
QQC2.Label
{
text
:
i18n
(
'
Sender:
'
)
visible
:
root
.
sender
.
length
>
0
&&
root
.
sender
!==
root
.
from
Layout.rightMargin
:
Kirigami
.
Units
.
largeSpacing
}
QQC2.Label
{
visible
:
root
.
sender
.
length
>
0
&&
root
.
sender
!==
root
.
from
text
:
root
.
sender
Layout.columnSpan
:
2
}
QQC2.Label
{
text
:
i18n
(
'
To:
'
)
Layout.rightMargin
:
Kirigami
.
Units
.
largeSpacing
...
...
@@ -68,8 +81,52 @@ QQC2.Page {
}
}
contentItem
:
MailPartView
{
id
:
mailPartView
item
:
root
.
item
}
footer
:
QQC2.ToolBar
{
topInset
:
1
leftInset
:
1
rightInset
:
1
bottomInset
:
1
leftPadding
:
Kirigami
.
Units
.
largeSpacing
rightPadding
:
Kirigami
.
Units
.
largeSpacing
topPadding
:
Kirigami
.
Units
.
largeSpacing
bottomPadding
:
Kirigami
.
Units
.
largeSpacing
background
:
Item
{
implicitHeight
:
40
Kirigami.Separator
{
anchors
{
left
:
parent
.
left
right
:
parent
.
right
top
:
undefined
bottom
:
parent
.
bottom
}
}
}
contentItem
:
Flow
{
spacing
:
Kirigami
.
Units
.
smallSpacing
Repeater
{
model
:
mailPartView
.
attachmentModel
delegate
:
AttachmentDelegate
{
name
:
model
.
name
type
:
model
.
type
icon.name
:
model
.
iconName
clip
:
true
actionIcon
:
'
download
'
actionTooltip
:
i18n
(
"
Save attachment
"
)
onExecute
:
mailPartView
.
attachmentModel
.
saveAttachmentToDisk
(
mailPartView
.
attachmentModel
.
index
(
index
,
0
))
onClicked
:
mailPartView
.
attachmentModel
.
openAttachment
(
mailPartView
.
attachmentModel
.
index
(
index
,
0
))
onPublicKeyImport
:
mailPartView
.
attachmentModel
.
importPublicKey
(
mailPartView
.
attachmentModel
.
index
(
index
,
0
))
}
}
}
}
Kirigami.Theme.colorSet
:
Kirigami
.
Theme
.
View
Kirigami.Theme.inherit
:
false
...
...
src/mail/qml/private/AttachmentDelegate.qml
0 → 100644
View file @
cdce3021
// SPDX-FileCopyrightText: 2021 Carl Schwan <carlschwan@kde.org>
// SPDX-FileCopyrightText: 2016 Michael Bohlender <michael.bohlender@kdemail.net>
// SPDX-License-Identifier: GPL-2.0-or-later
import
QtQuick
2.15
import
QtQuick
.
Layouts
1.15
import
org
.
kde
.
kirigami
2.14
as
Kirigami
import
QtQuick
.
Controls
2.15
as
QQC2
QQC2.AbstractButton
{
id
:
root
property
string
name
property
string
type
property
alias
actionIcon
:
actionButton
.
icon
.
name
property
alias
actionTooltip
:
actionButtonTooltip
.
text
signal
execute
;
signal
publicKeyImport
;
Kirigami.Theme.colorSet
:
Kirigami
.
Theme
.
Button
Kirigami.Theme.inherit
:
false
background
:
Rectangle
{
id
:
background
color
:
Kirigami
.
Theme
.
backgroundColor
border.color
:
Kirigami
.
Theme
.
disabledTextColor
radius
:
3
}
leftPadding
:
Kirigami
.
Units
.
smallSpacing
rightPadding
:
Kirigami
.
Units
.
smallSpacing
topPadding
:
Kirigami
.
Units
.
smallSpacing
bottomPadding
:
Kirigami
.
Units
.
smallSpacing
contentItem
:
RowLayout
{
id
:
content
spacing
:
Kirigami
.
Units
.
smallSpacing
Rectangle
{
color
:
Kirigami
.
Theme
.
backgroundColor
Layout.preferredHeight
:
Kirigami
.
Units
.
gridUnit
Layout.preferredWidth
:
Kirigami
.
Units
.
gridUnit
Kirigami.Icon
{
anchors.verticalCenter
:
parent
.
verticalCenter
height
:
Kirigami
.
Units
.
gridUnit
width
:
Kirigami
.
Units
.
gridUnit
source
:
root
.
icon
.
name
}
}
QQC2.Label
{
text
:
root
.
name
}
QQC2.ToolButton
{
visible
:
root
.
type
===
"
application/pgp-keys
"
icon.name
:
'
gpg
'
onClicked
:
root
.
publicKeyImport
()
QQC2.ToolTip
{
text
:
i18n
(
"
Import key
"
)
}
}
QQC2.ToolButton
{
id
:
actionButton
onClicked
:
root
.
execute
()
QQC2.ToolTip
{
id
:
actionButtonTooltip
}
}
}
}
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