Commit 8d49ac02 authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

Show new message in all folder (exclude outbox,draft template sentmail). So we...

Show new message in all folder (exclude outbox,draft template sentmail). So we can see them in all imap folder)
parent b35fead0
......@@ -53,15 +53,26 @@ NewMailNotifierAgent::NewMailNotifierAgent( const QString &id )
m_timer.setSingleShot( true );
}
bool NewMailNotifierAgent::excludeSpecialCollection(const Akonadi::Collection &collection) const
{
SpecialMailCollections::Type type = SpecialMailCollections::self()->specialCollectionType(collection);
switch(type) {
case SpecialMailCollections::Invalid: //Not a special collection
case SpecialMailCollections::Inbox:
return false;
default:
return true;
}
}
void NewMailNotifierAgent::itemAdded( const Akonadi::Item &item, const Akonadi::Collection &collection )
{
if ( collection.hasAttribute<Akonadi::EntityHiddenAttribute>() )
return;
if ( SpecialMailCollections::self()->specialCollectionType(collection) != SpecialMailCollections::Inbox ) {
if ( excludeSpecialCollection(collection) ) {
return; // outbox, sent-mail, trash, drafts or templates.
}
Akonadi::MessageStatus status;
status.setStatusFromFlags( item.flags() );
if ( status.isRead() || status.isSpam() || status.isIgnored() )
......
......@@ -27,16 +27,17 @@
class NewMailNotifierAgent : public Akonadi::AgentBase, public Akonadi::AgentBase::ObserverV2
{
Q_OBJECT
Q_OBJECT
public:
public:
explicit NewMailNotifierAgent( const QString &id );
void itemAdded( const Akonadi::Item &item, const Akonadi::Collection &collection );
private slots:
private slots:
void showNotifications();
private:
private:
bool excludeSpecialCollection(const Akonadi::Collection &collection) const;
QHash<Akonadi::Collection, int> m_newMails;
QTimer m_timer;
};
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment