2
Copyright (c) 2007 Till Adam <adam@kde.org>
3
Copyright (C) 2008 Omat Holding B.V. <info@omat.nl>
4
Copyright (C) 2009 Kevin Ottens <ervin@kde.org>
6
This library is free software; you can redistribute it and/or modify it
7
under the terms of the GNU Library General Public License as published by
8
the Free Software Foundation; either version 2 of the License, or (at your
9
option) any later version.
11
This library is distributed in the hope that it will be useful, but WITHOUT
12
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13
FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
14
License for more details.
16
You should have received a copy of the GNU Library General Public License
17
along with this library; see the file COPYING.LIB. If not, write to the
18
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
22
#ifndef __IMAP_RESOURCE_H__
23
#define __IMAP_RESOURCE_H__
28
#include <akonadi/resourcebase.h>
29
#include <boost/shared_ptr.hpp>
30
#include <QtCore/QStringList>
32
#include <kimap/fetchjob.h>
33
#include <kimap/listjob.h>
47
class ImapResource : public Akonadi::ResourceBase, public Akonadi::AgentBase::Observer
50
Q_CLASSINFO( "D-Bus Interface", "org.kde.Akonadi.Imap.Resource" )
53
ImapResource( const QString &id );
57
virtual void configure( WId windowId );
60
void retrieveCollections();
61
void retrieveItems( const Akonadi::Collection &col );
62
bool retrieveItem( const Akonadi::Item &item, const QSet<QByteArray> &parts );
65
virtual void itemAdded( const Akonadi::Item &item, const Akonadi::Collection &collection );
66
virtual void itemChanged( const Akonadi::Item &item, const QSet<QByteArray> &parts );
67
virtual void itemRemoved( const Akonadi::Item &item );
69
virtual void collectionAdded( const Akonadi::Collection &collection, const Akonadi::Collection &parent );
70
virtual void collectionChanged( const Akonadi::Collection &collection );
71
virtual void collectionRemoved( const Akonadi::Collection &collection );
74
void onConnectSuccess();
75
void onConnectError( int code, const QString &message );
76
void onMailBoxesReceived( const QList<KIMAP::MailBoxDescriptor> &descriptors,
77
const QList< QList<QByteArray> > &flags );
78
void onMailBoxesReceiveDone( KJob *job );
79
void onGetAclDone( KJob *job );
80
void onRightsReceived( KJob *job );
81
void onQuotasReceived( KJob *job );
82
void onGetMetaDataDone( KJob *job );
83
void onSelectDone( KJob *job );
84
void onHeadersReceived( const QString &mailBox, const QMap<qint64, qint64> &uids,
85
const QMap<qint64, qint64> &sizes, const QMap<qint64, KIMAP::MessageFlags> &flags,
86
const QMap<qint64, KIMAP::MessagePtr> &messages );
87
void onHeadersFetchDone( KJob *job );
88
void onMessagesReceived( const QString &mailBox, const QMap<qint64, qint64> &uids,
89
const QMap<qint64, KIMAP::MessagePtr> &messages );
90
void onContentFetchDone( KJob *job );
91
void onCreateMailBoxDone( KJob *job );
92
void onRenameMailBoxDone( KJob *job );
93
void onDeleteMailBoxDone( KJob *job );
94
void onAppendMessageDone( KJob *job );
95
void onStoreFlagsDone( KJob *job );
97
void startConnect( bool forceManualAuth = false );
100
QString rootRemoteId() const;
101
QString remoteIdForMailBox( const QString &path ) const;
102
QString mailBoxForRemoteId( const QString &remoteId ) const;
104
Akonadi::Collection collectionFromRemoteId( const QString &remoteId );
105
Akonadi::Item itemFromRemoteId( const Akonadi::Collection &collection, const QString &remoteId );
106
void itemsClear( const Akonadi::Collection &collection );
108
bool manualAuth( const QString& username, QString &password );
110
ImapAccount *m_account;