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
ee8cfabb
Commit
ee8cfabb
authored
Jun 03, 2022
by
Carl Schwan
🚴
Committed by
Claudio Cambra
Aug 04, 2022
Browse files
Add data separator in folder list
Signed-off-by:
Carl Schwan
<
carl@carlschwan.eu
>
parent
bf4a8783
Changes
3
Hide whitespace changes
Inline
Side-by-side
src/mail/mailmodel.cpp
View file @
ee8cfabb
...
...
@@ -8,9 +8,11 @@
//#include "messageviewer/viewer.h"
#include
<Akonadi/EntityTreeModel>
#include
<K
Mime/Message
>
#include
<K
Format
>
#include
<KLocalizedString>
#include
<KMime/Message>
#include
<QQmlEngine>
#include
<kformat.h>
MailModel
::
MailModel
(
QObject
*
parent
)
:
QIdentityProxyModel
(
parent
)
...
...
@@ -20,14 +22,14 @@ MailModel::MailModel(QObject *parent)
QHash
<
int
,
QByteArray
>
MailModel
::
roleNames
()
const
{
return
{
{
Titl
eRole
,
QByteArrayLiteral
(
"
titl
e"
)},
{
Sender
Role
,
QByteArrayLiteral
(
"
sender
"
)},
{
Unread
Role
,
QByteArrayLiteral
(
"
unread
"
)},
{
Favorite
Role
,
QByteArrayLiteral
(
"
favorite
"
)},
{
TextColor
Role
,
QByteArrayLiteral
(
"
textColor
"
)},
{
Background
ColorRole
,
QByteArrayLiteral
(
"
backgroud
Color"
)}
};
return
{
{
TitleRole
,
QByteArrayLiteral
(
"title"
)},
{
Dat
eRole
,
QByteArrayLiteral
(
"
dat
e"
)},
{
DateTime
Role
,
QByteArrayLiteral
(
"
datetime
"
)},
{
Sender
Role
,
QByteArrayLiteral
(
"
sender
"
)},
{
Unread
Role
,
QByteArrayLiteral
(
"
unread
"
)},
{
Favorite
Role
,
QByteArrayLiteral
(
"
favorite
"
)},
{
Text
ColorRole
,
QByteArrayLiteral
(
"
text
Color"
)}
,
{
BackgroundColorRole
,
QByteArrayLiteral
(
"backgroudColor"
)}
};
}
QVariant
MailModel
::
data
(
const
QModelIndex
&
index
,
int
role
)
const
...
...
@@ -102,6 +104,13 @@ QVariant MailModel::data(const QModelIndex &index, int role) const
return
QString
();
}
case
DateRole
:
if
(
mail
->
date
())
{
KFormat
format
;
return
format
.
formatRelativeDate
(
mail
->
date
()
->
dateTime
().
date
(),
QLocale
::
ShortFormat
);
}
else
{
return
QString
();
}
case
DateTimeRole
:
if
(
mail
->
date
())
{
return
mail
->
date
()
->
asUnicodeString
();
}
else
{
...
...
src/mail/mailmodel.h
View file @
ee8cfabb
...
...
@@ -22,14 +22,15 @@ public:
SenderRole
,
TextColorRole
,
DateRole
,
DateTimeRole
,
BackgroundColorRole
,
UnreadRole
,
MailRole
,
FavoriteRole
,
};
// ViewerHelper *viewerHelper() const;
// void setViewerHelper(ViewerHelper *viewerHelper);
// ViewerHelper *viewerHelper() const;
// void setViewerHelper(ViewerHelper *viewerHelper);
explicit
MailModel
(
QObject
*
parent
=
nullptr
);
QHash
<
int
,
QByteArray
>
roleNames
()
const
override
;
...
...
src/mail/qml/FolderView.qml
View file @
ee8cfabb
...
...
@@ -14,6 +14,11 @@ import org.kde.kitemmodels 1.0 as KItemModels
ListView
{
id
:
mails
model
:
MailManager
.
folderModel
section.delegate
:
Kirigami.ListSectionHeader
{
required
property
string
section
label
:
section
}
section.property
:
"
date
"
delegate
:
Kirigami.BasicListItem
{
label
:
model
.
title
subtitle
:
sender
...
...
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