Commit 5a9bda68 authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

Need to look at when resource status change

parent dfe53890
......@@ -36,6 +36,7 @@
#include <Akonadi/CollectionFetchScope>
#include <akonadi/kmime/specialmailcollections.h>
#include <akonadi/kmime/messagestatus.h>
#include <Akonadi/AgentManager>
#include <KLocalizedString>
#include <KMime/Message>
#include <KNotification>
......@@ -58,6 +59,12 @@ NewMailNotifierAgent::NewMailNotifierAgent( const QString &id )
this, QDBusConnection::ExportAdaptors );
DBusConnectionPool::threadConnection().registerService( QLatin1String( "org.freedesktop.Akonadi.NewMailNotifierAgent" ) );
connect( Akonadi::AgentManager::self(), SIGNAL(instanceStatusChanged(Akonadi::AgentInstance)),
this, SLOT(slotInstanceStatusChanged(Akonadi::AgentInstance)) );
connect( Akonadi::AgentManager::self(), SIGNAL(instanceRemoved(Akonadi::AgentInstance)),
this, SLOT(slotInstanceRemoved(Akonadi::AgentInstance)) );
changeRecorder()->setMimeTypeMonitored( KMime::Message::mimeType() );
changeRecorder()->itemFetchScope().setCacheOnly( true );
......@@ -205,6 +212,23 @@ void NewMailNotifierAgent::showNotifications()
mNewMails.clear();
}
void NewMailNotifierAgent::slotInstanceStatusChanged(const Akonadi::AgentInstance &instance)
{
const QString identifier(instance.identifier());
switch(instance.status()) {
case Akonadi::AgentInstance::Idle:
case Akonadi::AgentInstance::Running:
case Akonadi::AgentInstance::Broken:
case Akonadi::AgentInstance::NotConfigured:
break;
}
}
void NewMailNotifierAgent::slotInstanceRemoved(const Akonadi::AgentInstance &instance)
{
//TODO
}
AKONADI_AGENT_MAIN( NewMailNotifierAgent )
......
......@@ -27,6 +27,10 @@
#include <QtCore/QTimer>
namespace Akonadi {
class AgentInstance;
}
class NewMailNotifierAgent : public Akonadi::AgentBase, public Akonadi::AgentBase::ObserverV2
{
Q_OBJECT
......@@ -45,6 +49,8 @@ protected:
private slots:
void showNotifications();
void configure(WId windowId);
void slotInstanceStatusChanged(const Akonadi::AgentInstance &instance);
void slotInstanceRemoved(const Akonadi::AgentInstance &instance);
private:
bool excludeSpecialCollection(const Akonadi::Collection &collection) const;
......
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