KDE PIM support for the p≡p engine
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 

113 lines
3.2 KiB

#ifndef PEP_RESOURCE_H
#define PEP_RESOURCE_H
#include <ResourceBase>
#include <KMime/Message>
#include <KJob>
#include <AkonadiCore/AgentInstance>
#include <Akonadi/KMime/Pop3ResourceAttribute>
#include <AkonadiCore/ServerManager>
#include <AkonadiCore/CollectionFetchJob>
#include <AkonadiCore/CollectionFetchScope>
#include <AkonadiCore/AgentManager>
#include <AkonadiCore/AttributeFactory>
#include <AkonadiCore/Monitor>
#include <AkonadiCore/Session>
#include <AkonadiCore/ItemFetchScope>
#include <AkonadiCore/ChangeRecorder>
#include <AkonadiAgentBase/ResourceBase>
#include <AkonadiCore/EntityDisplayAttribute>
#include <AkonadiCore/ItemFetchJob>
#include <AkonadiCore/PartFetcher>
#include <Akonadi/KMime/MessageParts>
#include <MailCommon/MailKernel>
#include <MailCommon/SearchRule>
#include <KI18n/KLocalizedString>
#include <GrantleeTheme/GrantleeKi18nLocalizer>
#include <QDBusInterface>
#include <QSet>
#include <QTimer>
#include "pepagent_p.h"
#include "syncthread.h"
#include <pEp/pEpEngine.h>
#include <pEp/Adapter.hh>
#include <pEp/message.h>
#include <pEp/message_api.h>
#include <pEp/mime.h>
class PepAdaptor;
class pEpAgent :
public Akonadi::ResourceBase,
public Akonadi::AgentBase::ObserverV3
{
Q_OBJECT
public:
explicit pEpAgent(const QString &id);
void filterItem(qint64 item, int filterSet, const QString &resourceId);
void filter(qint64 item, const QString &filterIdentifier, const QString &resourceId);
void filterCollections(const QList<qint64> &collections, int filterSet);
~pEpAgent() = default;
protected Q_SLOTS:
void retrieveCollections() override;
void retrieveItems(const Akonadi::Collection &col) override {};
protected:
void itemsReceiviedForFiltering(const Akonadi::Item::List &items);
void itemAdded(const Akonadi::Item &item, const Akonadi::Collection &collection);
void mailCollectionAdded(const Akonadi::Collection &collection, const Akonadi::Collection &);
void mailCollectionRemoved(const Akonadi::Collection &collection);
void mailCollectionChanged(const Akonadi::Collection &collection);
void scanCollection(const Akonadi::Collection &collection);
private Q_SLOTS:
void slotInstanceRemoved(const Akonadi::AgentInstance &instance);
void slotItemChanged(const Akonadi::Item &item);
public Q_SLOTS: // pEp methods
int decrypt_message(const QString &src, QString &dst, QStringList &keylist, int &flags);
private:
Q_DECLARE_PRIVATE(pEpAgent)
pEpSyncThread *m_syncThread = nullptr;
Akonadi::Monitor *itemMonitor = nullptr;
void filterItem(const Akonadi::Item &item, const Akonadi::Collection &collection);
void initialCollectionFetchingDone(KJob *job);
void initializeCollections();
void emitProgress(int p);
void emitProgressMessage(const QString &message);
void configure(WId windowId);
void clearMessage();
void emitStatusReady();
bool isFilterableCollection(const Akonadi::Collection &collection) const;
QTimer *mProgressTimer;
PepAdaptor *m_pEpadaptor;
QDBusInterface *m_pEpEngine;
int mProgressCounter;
PEP_SESSION m_session;
static PEP_STATUS messageToSend(::message* msg);
inject_sync_event_t inject_sync_event = nullptr;
};
#endif