diff -r ccd0fd43f247 -r 208a4ba3894c harvesterplugins/messaging/email/qtemailfetcher/qtemailfetcher.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/harvesterplugins/messaging/email/qtemailfetcher/qtemailfetcher.h Mon May 03 12:32:15 2010 +0300 @@ -0,0 +1,80 @@ +/* +* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Utility class for fetching email. +* +*/ + +#ifndef _QEMAILFETCHER_H +#define _QEMAILFETCHER_H + +#ifdef BUILD_DLL +#define DLL_EXPORT Q_DECL_EXPORT +#else +#define DLL_EXPORT Q_DECL_IMPORT +#endif + +//TODO: Uncomment when available. +#include +#include +#include +#include +#include +#include +#include +#include "memailitemobserver.h" + +using namespace EmailClientApi; + +//How this works: +//1. List all mail boxes. +//2. In each mail box, list the folders +//3. In each folder, list the mails +//4. Process each email +// +//We voluntarily relinquish the processor (we sleep) each time we have completed +//processing a given folder. This is to avoid 'hogging' the processor. + + +class DLL_EXPORT QEmailFetcher: public QObject + { + Q_OBJECT +public: + static QEmailFetcher* newInstance(MEmailItemObserver& aObserver); + ~QEmailFetcher(); + void StartHarvesting(); + +private: + QEmailFetcher(MEmailItemObserver& aObserver ); + static void initialize(QEmailFetcher* aThis); //helper (2nd phase constructor). + + //Private? +public slots: + void emailServiceIntialized( bool ); + void handleMailboxesListed( int ); + void mailFoldersListed( int ); + void processMessages( int ); + //Connect to messageEvent signal + void handleMessageEvent( MessageEvent aEvent, quint64 mailboxId, quint64 folderId, QList messageList ); + +private: + MEmailItemObserver& iEmailObserver; //The parent/creator. Not owned. + NmEventNotifier* iEmailEventNotifier; //owned; triggers handleMessageEvent. + NmEmailService* iEmailService; //owned. + NmMailboxListing* iMailBoxListings; //owned. + NmFolderListing* iMailFolderList; //owned. + NmEnvelopeListing* iEnvelopeListing; //owned. + NmMessageEnvelope* iMessageListing; //owned. + }; + +#endif //_QEMAILFETCHER_H