Implement Unified Mailboxes agent
ClosedPublic

Authored by dvratil on Aug 24 2018, 10:44 PM.

Details

Summary

The agent (which in reality is a Resource in order to be able to own
Collections) creates Inbox, Sent and Drafts virtual Collections and links
all Items from real special Collections into them. It listens for changes
in the source collections and updates the virtual Collections accordingly.

Uses can also customize the default unified mailboxes and create their
own.

The agent can be enabled or disalbed from KMail's Plugins settings like
other agents. By default the agent is off, however, if KMail detects that
user has more than one account set up it will ask the user if they want
to enable the feature. User is only ever asked once, the purpose is to
make the feature easier to discover without bothering users with only
one email account.

It appears that the virtual collections are slower to open than regular
collections, but that's a problem on Akonadi side as querying Items from
virtual collections requires some extra queries. Other than that it works
pretty well.

Some screenshots for @ngraham :)

Test Plan

Have been using this for a while + there's some test coverage.

Diff Detail

Repository
R206 KMail
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
dvratil created this revision.Aug 24 2018, 10:44 PM
Restricted Application added a project: KDE PIM. · View Herald TranscriptAug 24 2018, 10:44 PM
Restricted Application added a subscriber: kde-pim. · View Herald Transcript
dvratil requested review of this revision.Aug 24 2018, 10:44 PM
mlaurent requested changes to this revision.Aug 28 2018, 5:45 AM
mlaurent added a subscriber: mlaurent.
mlaurent added inline comments.
agents/unifiedmailboxagent/CMakeLists.txt
19

please add this info in kmail.categories too

agents/unifiedmailboxagent/unifiedmailbox.h
33

coding style \n before {

agents/unifiedmailboxagent/unifiedmailboxeditor.cpp
94

it's better to make this dialog able to save/load size (as other dialog)

agents/unifiedmailboxagent/unifiedmailboxmanager.cpp
289

remove space after *

This revision now requires changes to proceed.Aug 28 2018, 5:45 AM

A screenshot for the Usability & Productivity post would be nice. :)

lueck added a subscriber: lueck.Aug 30 2018, 7:59 AM

missing Messages.sh to extract the translations to the catalog akonadi_unifiedmailbox_agent

dvratil updated this revision to Diff 40935.Sep 3 2018, 8:40 PM
  • Save and restore dialog sizes from config file
  • Add org.kde.pim.unifiedmailboxagent logging category to kmail.categories
  • Add Messages.sh
  • Coding style fixes
dvratil edited the summary of this revision. (Show Details)Sep 3 2018, 8:43 PM
mlaurent requested changes to this revision.Sep 4 2018, 3:17 PM
mlaurent added inline comments.
agents/unifiedmailboxagent/unifiedmailbox.cpp
127

const'ref ?

142

const'ref ?

147

same ?

agents/unifiedmailboxagent/unifiedmailboxeditor.h
30

const'ref

31

const'ref

agents/unifiedmailboxagent/unifiedmailboxmanager.cpp
428

qCDebug

agents/unifiedmailboxagent/unifiedmailboxmanager.h
47

const'ref

This revision now requires changes to proceed.Sep 4 2018, 3:17 PM
dvratil marked 7 inline comments as done.Sep 4 2018, 7:44 PM
dvratil added inline comments.
agents/unifiedmailboxagent/unifiedmailbox.cpp
127

source is a qint64, there's no gain in constref here

142

source is qint64

147

same :)

dvratil updated this revision to Diff 41005.Sep 4 2018, 7:53 PM
dvratil marked 3 inline comments as done.
  • Address review comments
dvratil marked 4 inline comments as done.Sep 4 2018, 7:54 PM
mlaurent added inline comments.Sep 5 2018, 5:33 AM
agents/unifiedmailboxagent/unifiedmailbox.cpp
142

the problem when we use all the time "auto" we don't know directly what is the type... :)

dvratil added inline comments.Sep 5 2018, 11:18 AM
agents/unifiedmailboxagent/unifiedmailbox.cpp
142

True, but it's easy to check the type of mSources if you are not sure :)

@mlaurent any more issues, or can this go in? :)

mlaurent requested changes to this revision.Sep 9 2018, 12:39 PM
mlaurent added inline comments.
agents/unifiedmailboxagent/mailkernel.cpp
33

const'ref

agents/unifiedmailboxagent/mailkernel.h
42

const'ref here too

agents/unifiedmailboxagent/settingsdialog.cpp
43

it's better to use "UnifedMailBoxAgentSettingDialog" as name so we can know which settings to remove in settings file when we want to reset to default.

53

auto l = new QVBoxLayout(this);

> you can remove the next line setLayout(l)

agents/unifiedmailboxagent/settingsdialog.h
37

const KSharedConfigPtr &

agents/unifiedmailboxagent/unifiedmailboxeditor.cpp
43

UnifiedMailboxEditorDialog as name

98

auto l = new QVBoxLayout(this);
Remove next line 'setLayout(l);

167

!nameEdit->text().trimmed().isEmpty(); otherwise we can name a folder as <space> :)

same for setEnabled(...) in previous line

kmail.categories
7

I think you need to rebase against master as in this file I use new syntax

> add IDENTIFIER [....]

This revision now requires changes to proceed.Sep 9 2018, 12:39 PM
dvratil updated this revision to Diff 41288.Sep 9 2018, 7:19 PM
  • Address review comments
dvratil marked 8 inline comments as done.Sep 9 2018, 7:21 PM
dvratil added inline comments.
kmail.categories
7

I'll fix that during merge (I'll definitely get a merge conflict there), I don't want to rebase the branch (would have to force-push).

mlaurent accepted this revision.Sep 9 2018, 7:43 PM

Seems ok now for me.
I didn't test it but it seems ok.

This revision is now accepted and ready to land.Sep 9 2018, 7:43 PM
This revision was automatically updated to reflect the committed changes.