# HG changeset patch # User hgs # Date 1287066823 -10800 # Node ID 38bf5461e270361d566231006452f43ec5c79ee5 # Parent 6c59112cfd31883a7622949457905b4e76107f6a 201041 diff -r 6c59112cfd31 -r 38bf5461e270 email_plat/contact_history_model_api/inc/nmcontacthistorymodel.h --- a/email_plat/contact_history_model_api/inc/nmcontacthistorymodel.h Thu Sep 30 11:43:07 2010 +0300 +++ b/email_plat/contact_history_model_api/inc/nmcontacthistorymodel.h Thu Oct 14 17:33:43 2010 +0300 @@ -70,7 +70,7 @@ private: // - QSharedDataPointer d; + QSharedDataPointer mItemData; }; Q_DECLARE_METATYPE(NmContactHistoryModelItem) @@ -120,7 +120,6 @@ public slots: - // TODO: query could keep previous query in order to check if results will only get narrowed (a char is appended) void query(const QString &query); private slots: diff -r 6c59112cfd31 -r 38bf5461e270 email_plat/nmail_client_api/inc/nmapiemailaddress.h --- a/email_plat/nmail_client_api/inc/nmapiemailaddress.h Thu Sep 30 11:43:07 2010 +0300 +++ b/email_plat/nmail_client_api/inc/nmapiemailaddress.h Thu Oct 14 17:33:43 2010 +0300 @@ -35,45 +35,15 @@ class NMAPI_EXPORT NmApiEmailAddress { public: - /*! - Constructor for NmApiEmailAddress class - */ + NmApiEmailAddress(); virtual ~NmApiEmailAddress(); - - /*! - copying constructor for NmApiEmailAddress - */ NmApiEmailAddress(const NmApiEmailAddress &addr); - - /*! - Assignment operator - */ NmApiEmailAddress &operator=(const NmApiEmailAddress &addr); - - /*! - Compares data from \a addr - */ bool operator==(const NmApiEmailAddress &addr); - - /* - getter for displayname - */ QString displayName() const; - - /*! - getter for address - */ QString address() const; - - /*! - setter for displayname - */ void setDisplayName(const QString &displayName); - - /*! - setter for address - */ void setAddress(const QString &address); private: QExplicitlySharedDataPointer d; diff -r 6c59112cfd31 -r 38bf5461e270 email_plat/nmail_client_api/inc/nmapiemailservice.h --- a/email_plat/nmail_client_api/inc/nmapiemailservice.h Thu Sep 30 11:43:07 2010 +0300 +++ b/email_plat/nmail_client_api/inc/nmapiemailservice.h Thu Oct 14 17:33:43 2010 +0300 @@ -21,7 +21,6 @@ #include #include -class NmApiEngine; /*! Client that wants to access mailboxes, messages and receive related events @@ -30,7 +29,7 @@ namespace EmailClientApi { - +class NmApiEngine; class NmApiFolder; class NmApiMessageEnvelope; class NmApiMailbox; diff -r 6c59112cfd31 -r 38bf5461e270 email_plat/nmail_client_api/inc/nmapienvelopelisting.h --- a/email_plat/nmail_client_api/inc/nmapienvelopelisting.h Thu Sep 30 11:43:07 2010 +0300 +++ b/email_plat/nmail_client_api/inc/nmapienvelopelisting.h Thu Oct 14 17:33:43 2010 +0300 @@ -25,11 +25,11 @@ class QObject; -class NmApiEngine; // list messages in particular folder. namespace EmailClientApi { +class NmApiEngine; class NmApiEnvelopeListingPrivate; class NmApiMessageEnvelope; diff -r 6c59112cfd31 -r 38bf5461e270 email_plat/nmail_client_api/inc/nmapieventnotifier.h --- a/email_plat/nmail_client_api/inc/nmapieventnotifier.h Thu Sep 30 11:43:07 2010 +0300 +++ b/email_plat/nmail_client_api/inc/nmapieventnotifier.h Thu Oct 14 17:33:43 2010 +0300 @@ -22,8 +22,6 @@ #include #include -struct NmApiEvent; - namespace EmailClientApi { class NmApiEventNotifierPrivate; @@ -35,8 +33,8 @@ \code NmApiEventNotifier *notifier = new NmApiEventNotifier(this); notifier->start(); - connect(notifier,SIGNAL(messageEvent(MessageEvent,quint64,quint64,QList)),this, - SLOT(processMessage(MessageEvent,quint64,quint64,QList)),Qt::QueuedConnection); + connect(notifier,SIGNAL(messageEvent(EmailClientApi::MessageEvent,quint64,quint64,QList)),this, + SLOT(processMessage(EmailClientApi::MessageEvent,quint64,quint64,QList)),Qt::QueuedConnection); \endcode And then when want to end need to do: \code @@ -48,70 +46,20 @@ { Q_OBJECT public: - /*! - Constructor - */ + NmApiEventNotifier(QObject *parent); - - /*! - Destructor - */ virtual ~NmApiEventNotifier(); - - /*! - Start monitoring email events - - Return value informs if monitoring system is up - */ virtual bool start(); - - /*! - Cancels monitoring. - - In user responsibility is to cancel monitoring. - On end it clear buffer events and emits \sa NmApiMessageTask::canceled() signal. - */ virtual void cancel(); - - /*! - Checks if event notifier is running. - */ bool isRunning() const; - signals: - /*! - This signal is emited when buffer of mailbox events is ready to send. Buffer is list of mailbox events with id. - - - It emits signals grouped by events. So there will be as much signals as much there are events. - For safety when connect it need to use \sa Qt::QueuedConnection. - After that use \sa EmailClientApi::NmEmailService::getMailbox to get object. - \param event Event of mailbox - \param id List of mailbox ids where event occur. - */ +signals: + void mailboxEvent(EmailClientApi::NmApiMailboxEvent event, QList id); - - /*! - This signal is emited when buffer of messages events is ready to send. Buffer is list of messages events with id. - * - It emits signals grouped by events, mailbox and folder. So there will be as much signals as much there are events. - For safety when connect it need to use \sa Qt::QueuedConnection. - After that use \sa EmailClientApi::NmApiEmailService::getEnvelope to get object. - - \param event Event of messages - \param mailboxId Message mailbox - \param folderId Message folder - \param envelopeIdList List of messages ids where event occur - */ void messageEvent(EmailClientApi::NmApiMessageEvent event, quint64 mailboxId, quint64 folderId, QList envelopeIdList); public slots: - /*! - It check each object in buffer and emit signal with it. - - After end of work of this function buffer is empty. - It is called by timeout signal from timer. - */ + void sendEventsFromBuffer(); private: diff -r 6c59112cfd31 -r 38bf5461e270 email_plat/nmail_client_api/inc/nmapifolder.h --- a/email_plat/nmail_client_api/inc/nmapifolder.h Thu Sep 30 11:43:07 2010 +0300 +++ b/email_plat/nmail_client_api/inc/nmapifolder.h Thu Oct 14 17:33:43 2010 +0300 @@ -23,9 +23,6 @@ #include #include -/*! - Mailbox metadata class - */ namespace EmailClientApi { @@ -34,81 +31,21 @@ class NMAPI_EXPORT NmApiFolder { public: - /*! - constructor for NmApiFolder class - */ + NmApiFolder(); - - /*! - Copy constructor for NmApiFolder - */ NmApiFolder(const NmApiFolder &nmApiFolder); - - /*! - destructor for NmApiFolder class - */ virtual ~NmApiFolder(); - - /*! - Assigns data from \a folder - */ NmApiFolder &operator=(const NmApiFolder &folder); - - /*! - Compares data from \a folder - */ bool operator==(const NmApiFolder &folder); - - /*! - getter for id - */ quint64 id() const; - - /*! - getter for name - */ QString name() const; - - /*! - getter for foldertype - */ EmailClientApi::NmApiEmailFolderType folderType() const; - - /*! - setter for id - */ void setId(quint64 id); - - /*! - setter for name - */ void setName(const QString &name); - - /*! - setter for foldertype - */ void setFolderType(EmailClientApi::NmApiEmailFolderType folderType); - - /*! - setter for childfolder ids - */ void setChildFolderIds(QList &childFolderIds); - - /*! - setter for childfolder ids - */ void setParentFolderId(quint64 parentId); - - /*! - returns child folder ids. - to be implemented later when nmail functionality is available - */ void getChildFolderIds(QList &childFolderIds); - - /*! - returns parent folder id. - - */ quint64 parentFolderId() const; private: diff -r 6c59112cfd31 -r 38bf5461e270 email_plat/nmail_client_api/inc/nmapifolderlisting.h --- a/email_plat/nmail_client_api/inc/nmapifolderlisting.h Thu Sep 30 11:43:07 2010 +0300 +++ b/email_plat/nmail_client_api/inc/nmapifolderlisting.h Thu Oct 14 17:33:43 2010 +0300 @@ -21,77 +21,34 @@ #include #include -class NmApiEngine; namespace EmailClientApi { - +class NmApiEngine; class NmApiFolderListingPrivate; class NmApiMailbox; class NmApiFolder; -/*! - \class Class for creating list of all folders - */ + class NMAPI_EXPORT NmApiFolderListing : public NmApiMessageTask { Q_OBJECT public: - /*! - Constructor of class. - */ + NmApiFolderListing(QObject *parent, const quint64 &mailboxId); - /*! - Destructor of class. - */ - ~NmApiFolderListing(); + virtual ~NmApiFolderListing(); enum {FolderListingFailed = -1}; - /*! - \brief Returns results after foldersListed signal is received. - - Before calling this method, cancel and start should be called, - because after second call it returns empty list.. - It also at start clear inputlist of NmFolder. - */ bool getFolders(QList &folders); - - /*! - \brief Returns info if listing is running - */ bool isRunning() const; - signals: - /*! - emitted when listing is available, count is number of folders found - or FolderListingFailed if listing failed - */ +signals: + void foldersListed(qint32 count); public slots: - /*! - \brief Starts gathering folders list. - - In first turn it will get whole folderlist. - \todo After that it will wait for folder events. - If start works, it do nothing. - - To asynchronous operation ce be used \sa QTimer::singleShot on this method. - Example: - - QTimer::singleShot(0,nmFolderListing,SLOT(start()); - - - */ + bool start(); - - /*! - \brief Stops gathering folder list. - - In first it change state of listing. - Then it release engine. - On end it clears list of folders and emits \sa NmApiMessageTask::canceled() signal. - */ void cancel(); private: diff -r 6c59112cfd31 -r 38bf5461e270 email_plat/nmail_client_api/inc/nmapimailbox.h --- a/email_plat/nmail_client_api/inc/nmapimailbox.h Thu Sep 30 11:43:07 2010 +0300 +++ b/email_plat/nmail_client_api/inc/nmapimailbox.h Thu Oct 14 17:33:43 2010 +0300 @@ -43,7 +43,7 @@ /*! Copy constructor for NmApiMailbox */ - NmApiMailbox(const NmApiMailbox &nmApiMailbox); + NmApiMailbox(const NmApiMailbox &nmApiMailbox); /*! destructor for NmApiMailbox diff -r 6c59112cfd31 -r 38bf5461e270 email_plat/nmail_client_api/inc/nmapimailboxlisting.h --- a/email_plat/nmail_client_api/inc/nmapimailboxlisting.h Thu Sep 30 11:43:07 2010 +0300 +++ b/email_plat/nmail_client_api/inc/nmapimailboxlisting.h Thu Oct 14 17:33:43 2010 +0300 @@ -36,72 +36,21 @@ { Q_OBJECT public: - /*! - Constructor of class. It set start values. - */ + NmApiMailboxListing(QObject *parent); - /*! - Destructor of class. It release engine to be safe if manual releasing won't work. - */ - ~NmApiMailboxListing(); + virtual ~NmApiMailboxListing(); + bool getMailboxes(QList &mailboxes); + bool isRunning() const; + enum {MailboxListingFailed = -1}; - /*! - \brief Returns results after mailboxesListed signal is received. - - Caller gets ownership of mailboxes. Returns true if results were available. - Before calling this method, cancel and start should be called, - because after second call it returns empty list. - At start it clear inputlist of mailboxes. - - \return Return true if results were avaible - \param mailboxes List of mailboxes to filled. On start is cleared. - */ - bool getMailboxes(QList &mailboxes); +signals: - /*! - \brief Return info if listing is running - - \return Return true if listing is running - */ - bool isRunning() const; - - signals: - /*! - - emitted when listing is available, count is number of mailboxes found - or MailboxListingFailed if listing failed - - \param count Count of mailboxes inside class. - */ void mailboxesListed(qint32 count); public slots: - /*! - \brief Starts gathering mailbox list. - - In first turn it will get whole mailboxlist. - Then it initialize core arguments and emits signal when ready. - - To asynchronous operation can be used \sa QTimer::singleShot on this method. - Example: - - QTimer::singleShot(0,nmMailboxListing,SLOT(start()); - - - \return Return true if everything go good and core of listing works good. - - */ bool start(); - - /*! - \brief Stop gathering mailbox list. - - In first it change state of listing. - Then it release engine. - On end it clears list of mailboxes and emits \sa NmApiMessageTask::canceled() signal. - */ void cancel(); private: diff -r 6c59112cfd31 -r 38bf5461e270 email_plat/nmail_client_api/inc/nmapimessage.h --- a/email_plat/nmail_client_api/inc/nmapimessage.h Thu Sep 30 11:43:07 2010 +0300 +++ b/email_plat/nmail_client_api/inc/nmapimessage.h Thu Oct 14 17:33:43 2010 +0300 @@ -58,4 +58,5 @@ Q_DECLARE_METATYPE(EmailClientApi::NmApiMessage) + #endif /* NMAPIMESSAGE_H_ */ diff -r 6c59112cfd31 -r 38bf5461e270 email_plat/nmail_client_api/inc/nmapimessagesearch.h --- a/email_plat/nmail_client_api/inc/nmapimessagesearch.h Thu Sep 30 11:43:07 2010 +0300 +++ b/email_plat/nmail_client_api/inc/nmapimessagesearch.h Thu Oct 14 17:33:43 2010 +0300 @@ -23,10 +23,10 @@ #include #include -class NmApiMessageSearchPrivate; namespace EmailClientApi { +class NmApiMessageSearchPrivate; class NMAPI_EXPORT NmApiMessageSearch : public NmApiMessageTask { @@ -38,7 +38,7 @@ bool isRunning() const; - bool initialise(const QList &searchStrings, EmailClientApi::NmApiMailSortCriteria sortCriteria); + bool initialise(const QList &searchStrings, NmApiMailSortCriteria sortCriteria); public slots: diff -r 6c59112cfd31 -r 38bf5461e270 emailservices/emailclientapi/inc/emailclientapiimpl.h --- a/emailservices/emailclientapi/inc/emailclientapiimpl.h Thu Sep 30 11:43:07 2010 +0300 +++ b/emailservices/emailclientapi/inc/emailclientapiimpl.h Thu Oct 14 17:33:43 2010 +0300 @@ -197,8 +197,6 @@ // Mailbox ids are cached when first time listed. Related plugin uid // is include in the cache. CEmailMailboxCache* iMailboxCache; - - CFSMailClient* iMailClient; }; diff -r 6c59112cfd31 -r 38bf5461e270 emailservices/emailclientapi/src/emailclientapiimpl.cpp --- a/emailservices/emailclientapi/src/emailclientapiimpl.cpp Thu Sep 30 11:43:07 2010 +0300 +++ b/emailservices/emailclientapi/src/emailclientapiimpl.cpp Thu Oct 14 17:33:43 2010 +0300 @@ -242,7 +242,6 @@ count = 0; } } - iMailClient = CFSMailClient::NewL(); CleanupStack::PopAndDestroy( &implInfoArray ); User::LeaveIfError( err ); } diff -r 6c59112cfd31 -r 38bf5461e270 emailservices/emailclientapi/src/emailcontent.cpp --- a/emailservices/emailclientapi/src/emailcontent.cpp Thu Sep 30 11:43:07 2010 +0300 +++ b/emailservices/emailclientapi/src/emailcontent.cpp Thu Oct 14 17:33:43 2010 +0300 @@ -79,6 +79,7 @@ iPluginData.ReleaseInstance(); delete iPart; delete iBuf; + delete iFetchObserver; } // --------------------------------------------------------------------------- diff -r 6c59112cfd31 -r 38bf5461e270 emailservices/emailclientapi/src/emailfolder.cpp --- a/emailservices/emailclientapi/src/emailfolder.cpp Thu Sep 30 11:43:07 2010 +0300 +++ b/emailservices/emailclientapi/src/emailfolder.cpp Thu Oct 14 17:33:43 2010 +0300 @@ -184,7 +184,9 @@ const TEntryId id = fsfolder->GetFolderId().Id(); const TFolderId folderId( id, iFolderId.iMailboxId.iId ); MEmailFolder* folder = CEmailFolder::NewL( iPluginData, folderId, folders[i] ); + CleanupStack::PushL(folder); aSubfolders.AppendL( folder ); + CleanupStack::Pop(folder); } CleanupStack::Pop( &folders ); folders.Close(); diff -r 6c59112cfd31 -r 38bf5461e270 emailservices/emailclientapi/src/emailmessage.cpp --- a/emailservices/emailclientapi/src/emailmessage.cpp Thu Sep 30 11:43:07 2010 +0300 +++ b/emailservices/emailclientapi/src/emailmessage.cpp Thu Oct 14 17:33:43 2010 +0300 @@ -668,8 +668,9 @@ CEmailAttachment* att = CEmailAttachment::NewL( iPluginData, msgContentId, attachments[i], EClientOwns ); - + CleanupStack::PushL(att); aAttachments.AppendL( att ); + CleanupStack::Pop(att); } CleanupStack::Pop( &attachments ); return count; diff -r 6c59112cfd31 -r 38bf5461e270 emailservices/emailclientapi/src/messageiterator.cpp --- a/emailservices/emailclientapi/src/messageiterator.cpp Thu Sep 30 11:43:07 2010 +0300 +++ b/emailservices/emailclientapi/src/messageiterator.cpp Thu Oct 14 17:33:43 2010 +0300 @@ -259,7 +259,9 @@ void CMessageIterator::AddToCacheL( CFSMailMessage* aFsMsg ) { CEmailMessage* message = CEmailMessage::NewL( iPluginData, aFsMsg, EAPIOwns ); + CleanupStack::PushL(message); iMessageArray.AppendL( message ); + CleanupStack::Pop(message); } // ----------------------------------------------------------------------------- diff -r 6c59112cfd31 -r 38bf5461e270 emailservices/emailcommon/bwins/fsfwcommonlibu.def --- a/emailservices/emailcommon/bwins/fsfwcommonlibu.def Thu Sep 30 11:43:07 2010 +0300 +++ b/emailservices/emailcommon/bwins/fsfwcommonlibu.def Thu Oct 14 17:33:43 2010 +0300 @@ -109,7 +109,7 @@ ?ChildPartL@CFSMailMessagePart@@QAEPAV1@VTFSMailMsgId@@@Z @ 108 NONAME ; class CFSMailMessagePart * CFSMailMessagePart::ChildPartL(class TFSMailMsgId) ?GetId@CFSMailBoxBase@@QBE?AVTFSMailMsgId@@XZ @ 109 NONAME ; class TFSMailMsgId CFSMailBoxBase::GetId(void) const ?PreviousL@CFSMailIterator@@UAEHVTFSMailMsgId@@IAAV?$RPointerArray@VCFSMailMessage@@@@@Z @ 110 NONAME ; int CFSMailIterator::PreviousL(class TFSMailMsgId, unsigned int, class RPointerArray &) - ?RefreshNowL@CFSMailBox@@QAEHXZ @ 111 NONAME ; int CFSMailBox::RefreshNowL(void) + ?RefreshNowL@CFSMailBox@@QAEHH@Z @ 111 NONAME ; int CFSMailBox::RefreshNowL(int) ?ContentDispositionParameters@CFSMailMessagePart@@QAEAAVCDesC16Array@@XZ @ 112 NONAME ; class CDesC16Array & CFSMailMessagePart::ContentDispositionParameters(void) ?ListFolders@CFSMailBox@@QAEAAV?$RPointerArray@VCFSMailFolder@@@@XZ @ 113 NONAME ; class RPointerArray & CFSMailBox::ListFolders(void) ??1CFSMailMessage@@UAE@XZ @ 114 NONAME ; CFSMailMessage::~CFSMailMessage(void) @@ -209,7 +209,7 @@ ?GetMessageId@CFSMailMessageBase@@QBE?AVTFSMailMsgId@@XZ @ 208 NONAME ; class TFSMailMsgId CFSMailMessageBase::GetMessageId(void) const ?GetSubject@CFSMailMessageBase@@QBEAAVTDesC16@@XZ @ 209 NONAME ; class TDesC16 & CFSMailMessageBase::GetSubject(void) const ?NewL@CFSMailIterator@@SAPAV1@AAVMFSMailIterator@@PAVCFSMailRequestHandler@@@Z @ 210 NONAME ; class CFSMailIterator * CFSMailIterator::NewL(class MFSMailIterator &, class CFSMailRequestHandler *) - ?RefreshNowL@CFSMailBox@@QAEHAAVMFSMailRequestObserver@@@Z @ 211 NONAME ; int CFSMailBox::RefreshNowL(class MFSMailRequestObserver &) + ?RefreshNowL@CFSMailBox@@QAEHAAVMFSMailRequestObserver@@H@Z @ 211 NONAME ; int CFSMailBox::RefreshNowL(class MFSMailRequestObserver &, int) ?Extension@TEmailExtensions@@QBEPAVCEmailExtension@@H@Z @ 212 NONAME ; class CEmailExtension * TEmailExtensions::Extension(int) const ??1CFSMailRequestHandler@@UAE@XZ @ 213 NONAME ; CFSMailRequestHandler::~CFSMailRequestHandler(void) ?DecRef@CEmailExtension@@QAEIXZ @ 214 NONAME ; unsigned int CEmailExtension::DecRef(void) diff -r 6c59112cfd31 -r 38bf5461e270 emailservices/emailcommon/eabi/fsfwcommonlibu.def --- a/emailservices/emailcommon/eabi/fsfwcommonlibu.def Thu Sep 30 11:43:07 2010 +0300 +++ b/emailservices/emailcommon/eabi/fsfwcommonlibu.def Thu Oct 14 17:33:43 2010 +0300 @@ -3,8 +3,8 @@ _ZN10CFSMailBox10GoOfflineLEv @ 2 NONAME _ZN10CFSMailBox11ListFoldersE12TFSMailMsgIdR13RPointerArrayI13CFSMailFolderE @ 3 NONAME _ZN10CFSMailBox11ListFoldersEv @ 4 NONAME - _ZN10CFSMailBox11RefreshNowLER22MFSMailRequestObserver @ 5 NONAME - _ZN10CFSMailBox11RefreshNowLEv @ 6 NONAME + _ZN10CFSMailBox11RefreshNowLER22MFSMailRequestObserveri @ 5 NONAME + _ZN10CFSMailBox11RefreshNowLEi @ 6 NONAME _ZN10CFSMailBox12CancelSearchEv @ 7 NONAME _ZN10CFSMailBox12SendMessageLER14CFSMailMessage @ 8 NONAME _ZN10CFSMailBox12SendMessageLER14CFSMailMessageR22MFSMailRequestObserver @ 9 NONAME diff -r 6c59112cfd31 -r 38bf5461e270 emailservices/emailcommon/inc/CFSMailBox.h --- a/emailservices/emailcommon/inc/CFSMailBox.h Thu Sep 30 11:43:07 2010 +0300 +++ b/emailservices/emailcommon/inc/CFSMailBox.h Thu Oct 14 17:33:43 2010 +0300 @@ -125,9 +125,11 @@ * * @return asynchronous request id */ - IMPORT_C TInt RefreshNowL( MFSMailRequestObserver& aOperationObserver ); + IMPORT_C TInt RefreshNowL( + MFSMailRequestObserver& aOperationObserver, + TBool aSilentConnection = EFalse ); - IMPORT_C TInt RefreshNowL( ); + IMPORT_C TInt RefreshNowL( TBool aSilentConnection = EFalse ); /** * creates into this mailbox new draft email diff -r 6c59112cfd31 -r 38bf5461e270 emailservices/emailcommon/src/CFSMailBox.cpp --- a/emailservices/emailcommon/src/CFSMailBox.cpp Thu Sep 30 11:43:07 2010 +0300 +++ b/emailservices/emailcommon/src/CFSMailBox.cpp Thu Oct 14 17:33:43 2010 +0300 @@ -127,7 +127,8 @@ // CFSMailBox::RefreshNowL // ----------------------------------------------------------------------------- EXPORT_C TInt CFSMailBox::RefreshNowL( - MFSMailRequestObserver& aOperationObserver ) + MFSMailRequestObserver& aOperationObserver, + TBool aSilentConnection /*=EFalse*/ ) { NM_FUNCTION; @@ -139,7 +140,8 @@ request = iRequestHandler->InitAsyncRequestL( GetId().PluginId(), aOperationObserver ); MFSMailRequestObserver* observer = request.iObserver; - TRAPD(err,plugin->RefreshNowL( GetId(), *observer, request.iRequestId)); + TRAPD(err,plugin->RefreshNowL( + GetId(), *observer, request.iRequestId, aSilentConnection )); if(err != KErrNone) { iRequestHandler->CompleteRequest(request.iRequestId); @@ -152,7 +154,7 @@ // ----------------------------------------------------------------------------- // CFSMailBox::RefreshNowL // ----------------------------------------------------------------------------- -EXPORT_C TInt CFSMailBox::RefreshNowL( ) +EXPORT_C TInt CFSMailBox::RefreshNowL( TBool aSilentConnection /*=EFalse*/) { NM_FUNCTION; @@ -165,7 +167,8 @@ request = iRequestHandler->InitAsyncRequestL( GetId().PluginId(), *observer ); observer = request.iObserver; - TRAPD(err,plugin->RefreshNowL( GetId(), *observer, request.iRequestId)); + TRAPD(err,plugin->RefreshNowL( + GetId(), *observer, request.iRequestId, aSilentConnection )); if(err != KErrNone) { iRequestHandler->CompleteRequest(request.iRequestId); diff -r 6c59112cfd31 -r 38bf5461e270 emailservices/emailcommon/src/CFSMailRequestHandler.cpp --- a/emailservices/emailcommon/src/CFSMailRequestHandler.cpp Thu Sep 30 11:43:07 2010 +0300 +++ b/emailservices/emailcommon/src/CFSMailRequestHandler.cpp Thu Oct 14 17:33:43 2010 +0300 @@ -231,9 +231,11 @@ NM_FUNCTION; CFSMailPluginData* pluginData = new (ELeave) CFSMailPluginData; + CleanupStack::PushL(pluginData); pluginData->iPluginId = aPluginId; pluginData->iPlugin = aPlugin; iPluginList.AppendL(pluginData); + CleanupStack::Pop(pluginData); } // ----------------------------------------------------------------------------- diff -r 6c59112cfd31 -r 38bf5461e270 emailservices/emailstore/base_plugin/bwins/basepluginu.def --- a/emailservices/emailstore/base_plugin/bwins/basepluginu.def Thu Sep 30 11:43:07 2010 +0300 +++ b/emailservices/emailstore/base_plugin/bwins/basepluginu.def Thu Oct 14 17:33:43 2010 +0300 @@ -107,7 +107,7 @@ ?SetEndTimeInUtcL@CBaseMrInfoObject@@UAEXVTTime@@@Z @ 106 NONAME ; void CBaseMrInfoObject::SetEndTimeInUtcL(class TTime) ?SetRecurrenceTypeL@CBaseMrRecurrenceRule@@UAEXW4TMRRecurrenceType@MRRecurrenceRule@@@Z @ 107 NONAME ; void CBaseMrRecurrenceRule::SetRecurrenceTypeL(enum MRRecurrenceRule::TMRRecurrenceType) ?TranslateEmailFwMessageL@CBasePlugin@@MAEXAAVCFSMailMessagePart@@AAVCMsgStoreMessagePart@@H@Z @ 108 NONAME ; void CBasePlugin::TranslateEmailFwMessageL(class CFSMailMessagePart &, class CMsgStoreMessagePart &, int) - ?GetPluginId@CBasePlugin@@MBEIXZ @ 109 NONAME ; unsigned int CBasePlugin::GetPluginId(void) const + ?GetPluginId@CBasePlugin@@MBEIXZ @ 109 NONAME ; unsigned int CBasePlugin::GetPluginId(void) const ?CreateForwardReplyMessageL@CBasePlugin@@IAEPAVCFSMailMessage@@ABVTFSMailMsgId@@0HABVTDesC16@@HH@Z @ 110 NONAME ; class CFSMailMessage * CBasePlugin::CreateForwardReplyMessageL(class TFSMailMsgId const &, class TFSMailMsgId const &, int, class TDesC16 const &, int, int) ?SetCommonNameL@CBaseMrAttendee@@UAEXABVTDesC16@@@Z @ 111 NONAME ; void CBaseMrAttendee::SetCommonNameL(class TDesC16 const &) ?CreateMessageToSendL@CBasePlugin@@UAEPAVCFSMailMessage@@ABVTFSMailMsgId@@@Z @ 112 NONAME ; class CFSMailMessage * CBasePlugin::CreateMessageToSendL(class TFSMailMsgId const &) @@ -222,5 +222,6 @@ ?ExtensionL@CBaseMrInfoObject@@UAEPAXVTUid@@@Z @ 221 NONAME ; void * CBaseMrInfoObject::ExtensionL(class TUid) ?TranslateMsgStorePropsL@CBasePlugin@@MAEXABVTFSMailMsgId@@AAVCMsgStorePropertyContainer@@AAVCFSMailMessagePart@@W4TFSMailDetails@@@Z @ 222 NONAME ; void CBasePlugin::TranslateMsgStorePropsL(class TFSMailMsgId const &, class CMsgStorePropertyContainer &, class CFSMailMessagePart &, enum TFSMailDetails) ?GetMailboxDisplayNameL@CBasePlugin@@IAEXIAAVRBuf16@@@Z @ 223 NONAME ; void CBasePlugin::GetMailboxDisplayNameL(unsigned int, class RBuf16 &) - ?Id@CBasePlugin@@UBE?AVTUid@@XZ @ 224 NONAME ; class TUid CBasePlugin::Id(void) const + ?Id@CBasePlugin@@UBE?AVTUid@@XZ @ 224 NONAME ; class TUid CBasePlugin::Id(void) const + ?CancelL@CBasePlugin@@UAEXHH@Z @ 225 NONAME ; void CBasePlugin::CancelL(int, int) diff -r 6c59112cfd31 -r 38bf5461e270 emailservices/emailstore/base_plugin/eabi/basepluginu.def --- a/emailservices/emailstore/base_plugin/eabi/basepluginu.def Thu Sep 30 11:43:07 2010 +0300 +++ b/emailservices/emailstore/base_plugin/eabi/basepluginu.def Thu Oct 14 17:33:43 2010 +0300 @@ -309,5 +309,6 @@ _ZThn4_NK21CBaseMrRecurrenceRule19RecurrenceStartTimeEv @ 308 NONAME _ZThn4_NK21CBaseMrRecurrenceRule20RecurrentDaysofMonthEv @ 309 NONAME _ZThn4_NK21CBaseMrRecurrenceRule4TypeEv @ 310 NONAME - _ZNK11CBasePlugin2IdEv @ 311 NONAME + _ZNK11CBasePlugin2IdEv @ 311 NONAME + _ZN11CBasePlugin7CancelLEii @ 312 NONAME diff -r 6c59112cfd31 -r 38bf5461e270 emailservices/emailstore/base_plugin/inc/BasePlugin.h --- a/emailservices/emailstore/base_plugin/inc/BasePlugin.h Thu Sep 30 11:43:07 2010 +0300 +++ b/emailservices/emailstore/base_plugin/inc/BasePlugin.h Thu Oct 14 17:33:43 2010 +0300 @@ -390,8 +390,10 @@ virtual TFSProgress StatusL( TInt aRequestId ); - virtual void CancelL( - TInt aRequestId ); + virtual void CancelL( const TInt aRequestId ); + + virtual void CancelL( const TInt aRequestId, + const TInt aError ); virtual void SubscribeMailboxEventsL( const TFSMailMsgId& aMailboxId, diff -r 6c59112cfd31 -r 38bf5461e270 emailservices/emailstore/base_plugin/src/BaseMrInfoObject.cpp --- a/emailservices/emailstore/base_plugin/src/BaseMrInfoObject.cpp Thu Sep 30 11:43:07 2010 +0300 +++ b/emailservices/emailstore/base_plugin/src/BaseMrInfoObject.cpp Thu Oct 14 17:33:43 2010 +0300 @@ -1128,7 +1128,7 @@ { mrInfo->SetMethod( MMRInfoObject::EMRMethodResponse ); } - + //ownership of mrInfo given to reply reply->SetMRInfo( mrInfo ); iPlugin.SendMessageL( *reply ); diff -r 6c59112cfd31 -r 38bf5461e270 emailservices/emailstore/base_plugin/src/basepluginmisc.cpp --- a/emailservices/emailstore/base_plugin/src/basepluginmisc.cpp Thu Sep 30 11:43:07 2010 +0300 +++ b/emailservices/emailstore/base_plugin/src/basepluginmisc.cpp Thu Oct 14 17:33:43 2010 +0300 @@ -289,24 +289,39 @@ /** - * Concrete plugins need to call the base plugin's implementation. + * Cancels pending requests. Concrete plugins need to call the base plugin's + * implementation. + * From CFSMailPlugin. + * * @param aRequestId */ -void CBasePlugin::CancelL( TInt aRequestId ) +void CBasePlugin::CancelL( const TInt aRequestId ) +{ + CancelL( aRequestId, KErrNone ); +} + + +/** + * Cancels pending requests. + * + * @param aRequestId + * @param aError An error code defining the reason why operation was cancelled. + */ +void CBasePlugin::CancelL( const TInt aRequestId, const TInt aError ) + { //find the fetch request and notify the observer. TInt count = iReqs.Count(); + for ( TInt i = 0; i < count; i++ ) { if ( iReqs[i]->iRequestId == aRequestId ) { CFetchRequester* request = iReqs[i]; -// TFSProgress progress = TFSProgress(); -// progress.iProgressStatus = TFSProgress::EFSStatus_RequestCancelled; progress.iCounter = progress.iMaxCount = 1; - progress.iError = KErrNone; + progress.iError = aError; request->iObserver.RequestResponseL( progress, aRequestId ); iReqs.Remove( i ); @@ -314,8 +329,9 @@ break; } } -// + count = iDelayedOpReqs.Count(); + for ( TInt i = 0; i < count; i++ ) { if ( iDelayedOpReqs[i]->iRequestId == aRequestId ) @@ -332,7 +348,6 @@ break; } } -// } diff -r 6c59112cfd31 -r 38bf5461e270 emailservices/emailstore/message_store/client/src/RMessageStoreSession.cpp --- a/emailservices/emailstore/message_store/client/src/RMessageStoreSession.cpp Thu Sep 30 11:43:07 2010 +0300 +++ b/emailservices/emailstore/message_store/client/src/RMessageStoreSession.cpp Thu Oct 14 17:33:43 2010 +0300 @@ -450,7 +450,9 @@ for ( int i = 0 ; i < count ; i++ ) { CMsgStoreAccount* account = CMsgStoreAccount::NewL( ownerIds[i], *(names[i]) ); + CleanupStack::PushL( account ); aAccounts.AppendL( account ); + CleanupStack::Pop( account ); } CleanupStack::PopAndDestroy( serializer ); CleanupStack::PopAndDestroy( &resultBuf ); @@ -1718,7 +1720,9 @@ //create the address object and add it to the output array CMsgStoreAddress *address = CMsgStoreAddress::NewL( addrDes16, nameDes16 ); - aAddressArray.AppendL( address ); + CleanupStack::PushL( address ); + aAddressArray.AppendL( address ); + CleanupStack::Pop( address ); } // end while CleanupStack::PopAndDestroy( &serializedBuf ); diff -r 6c59112cfd31 -r 38bf5461e270 emailservices/emailstore/message_store/common/src/AccountsSerializer.cpp --- a/emailservices/emailstore/message_store/common/src/AccountsSerializer.cpp Thu Sep 30 11:43:07 2010 +0300 +++ b/emailservices/emailstore/message_store/common/src/AccountsSerializer.cpp Thu Oct 14 17:33:43 2010 +0300 @@ -46,7 +46,9 @@ void CAccountsSerializer::AddAccountL( TInt32 aOwnerId, const TDesC& aName ) { HBufC* nameCopy = aName.AllocL(); + CleanupStack::PushL( nameCopy ); iNameBufArray.AppendL( nameCopy ); + CleanupStack::Pop( nameCopy ); iOwnerIdArray.AppendL( aOwnerId ); iCount++; } diff -r 6c59112cfd31 -r 38bf5461e270 emailservices/emailstore/message_store/debuglog/src/DebugLog.cpp --- a/emailservices/emailstore/message_store/debuglog/src/DebugLog.cpp Thu Sep 30 11:43:07 2010 +0300 +++ b/emailservices/emailstore/message_store/debuglog/src/DebugLog.cpp Thu Oct 14 17:33:43 2010 +0300 @@ -402,7 +402,7 @@ TRefByValue< const TDesC16 > aFmt, ... ) const { - // coverity[UNINIT] + //coverity[var_decl] VA_LIST list; VA_START(list,aFmt); @@ -446,7 +446,7 @@ TRefByValue< const TDesC8 > aFmt, ... ) const { - // coverity[UNINIT] + //coverity[var_decl] VA_LIST list; VA_START(list,aFmt); diff -r 6c59112cfd31 -r 38bf5461e270 emailservices/emailstore/message_store/server/src/ContainerStoreAccountTable.cpp --- a/emailservices/emailstore/message_store/server/src/ContainerStoreAccountTable.cpp Thu Sep 30 11:43:07 2010 +0300 +++ b/emailservices/emailstore/message_store/server/src/ContainerStoreAccountTable.cpp Thu Oct 14 17:33:43 2010 +0300 @@ -208,6 +208,8 @@ TContainerId mbId = KMsgStoreInvalidId; + //this is checked right below using AtEnd() + //coverity[check_return] iTable.FirstL(); while( !iTable.AtEnd() ) @@ -225,6 +227,8 @@ } } + //this is checked right using AtEnd() in loop condition + //coverity[check_return] iTable.NextL(); } @@ -300,6 +304,8 @@ CAccountsSerializer* serializer = new (ELeave) CAccountsSerializer(); CleanupStack::PushL( serializer ); + //this is checked right below using AtEnd() + //coverity[check_return] iTable.FirstL(); while( !iTable.AtEnd() ) @@ -319,6 +325,8 @@ serializer->AddAccountL( ownerId, name16 ); + //this is checked using AtEnd() in the loop condition + //coverity[check_return] iTable.NextL(); } diff -r 6c59112cfd31 -r 38bf5461e270 emailservices/emailstore/message_store/server/src/ContainerStoreContainersTable.cpp --- a/emailservices/emailstore/message_store/server/src/ContainerStoreContainersTable.cpp Thu Sep 30 11:43:07 2010 +0300 +++ b/emailservices/emailstore/message_store/server/src/ContainerStoreContainersTable.cpp Thu Oct 14 17:33:43 2010 +0300 @@ -227,20 +227,20 @@ __LOG_ENTER_SUPPRESS( "FindL" ) __LOG_WRITE_FORMAT1_DEBUG3( "query=%S", &aSqlQuery ) - TContainerId returnValue; - - iTable.FirstL(); + TContainerId returnValue = KContainerInvalidId; - if( iTable.FindL( RDbRowSet::EForwards, aSqlQuery ) == KErrNotFound ) - { - __LOG_WRITE_INFO( "No match found" ) - returnValue = KContainerInvalidId; - } - else - { - iTable.GetL(); - returnValue = iTable.ColUint32( iIdColNum ); - } // end if + if(iTable.FirstL()){ + if( iTable.FindL( RDbRowSet::EForwards, aSqlQuery ) == KErrNotFound ) + { + __LOG_WRITE_INFO( "No match found" ) + returnValue = KContainerInvalidId; + } + else + { + iTable.GetL(); + returnValue = iTable.ColUint32( iIdColNum ); + } // end if + } return returnValue; diff -r 6c59112cfd31 -r 38bf5461e270 emailservices/emailstore/message_store/server/src/ContainerStoreContentManager.cpp --- a/emailservices/emailstore/message_store/server/src/ContainerStoreContentManager.cpp Thu Sep 30 11:43:07 2010 +0300 +++ b/emailservices/emailstore/message_store/server/src/ContainerStoreContentManager.cpp Thu Oct 14 17:33:43 2010 +0300 @@ -325,9 +325,10 @@ if( result == KErrNone ) { - TInt fileSize; + CleanupClosePushL( file ); + TInt fileSize; User::LeaveIfError( file.Size( fileSize ) ); - file.Close(); + CleanupStack::PopAndDestroy( &file ); iUtils.LeaveIfLowDiskSpaceL( fileSize ); diff -r 6c59112cfd31 -r 38bf5461e270 emailservices/emailstore/message_store/server/src/ContainerStoreGeneralTable.cpp --- a/emailservices/emailstore/message_store/server/src/ContainerStoreGeneralTable.cpp Thu Sep 30 11:43:07 2010 +0300 +++ b/emailservices/emailstore/message_store/server/src/ContainerStoreGeneralTable.cpp Thu Oct 14 17:33:43 2010 +0300 @@ -204,16 +204,19 @@ { // Read and increment the next folder ID from the general table. - iTable.FirstL(); - PrepareRowForUpdateLC(); - - TContainerId id = iTable.ColUint32( iNextIdColNum ); - - iTable.SetColL( iNextIdColNum, id+1 ); - - PutRowUpdatesL(); - - //iTable.FirstL(); + TContainerId id=0; + + if(iTable.FirstL()){ + PrepareRowForUpdateLC(); + + id = iTable.ColUint32( iNextIdColNum ); + + iTable.SetColL( iNextIdColNum, id+1 ); + + PutRowUpdatesL(); + + //iTable.FirstL(); + } return id; } // end AssignNextIdL @@ -223,10 +226,13 @@ // ========================================================================== TBool CContainerStoreGeneralTable::IsEncryptionOnL() { - iTable.FirstL(); - iTable.GetL(); - - return iTable.ColUint8( iEncryptionFlagColNum ); + TBool ret = EFalse; + + if(iTable.FirstL()){ + iTable.GetL(); + ret = iTable.ColUint8( iEncryptionFlagColNum ); + } + return ret; } // ========================================================================== @@ -237,12 +243,13 @@ TBool curFlag = IsEncryptionOnL(); if ( curFlag != aNewFlag ) { - iTable.FirstL(); - PrepareRowForUpdateLC(); + if(iTable.FirstL()){ + PrepareRowForUpdateLC(); - iTable.SetColL( iEncryptionFlagColNum, aNewFlag ); + iTable.SetColL( iEncryptionFlagColNum, aNewFlag ); - PutRowUpdatesL(); + PutRowUpdatesL(); + } //iTable.FirstL(); } @@ -253,9 +260,12 @@ // ========================================================================== TBool CContainerStoreGeneralTable::AuthenticationDataPresentL() { - iTable.FirstL(); - iTable.GetL(); - TInt authenticationDataLength = iTable.ColLength( iAuthenticationDataColNum ); + TInt authenticationDataLength = 0; + + if(iTable.FirstL()){ + iTable.GetL(); + authenticationDataLength = iTable.ColLength( iAuthenticationDataColNum ); + } return ( authenticationDataLength > 0 ); } // end AuthenticationDataPresentL @@ -265,12 +275,13 @@ // ========================================================================== void CContainerStoreGeneralTable::SetAuthenticationDataL( const TDesC8& aBuffer ) { - iTable.FirstL(); - PrepareRowForUpdateLC(); + if(iTable.FirstL()){ + PrepareRowForUpdateLC(); - iTable.SetColL( iAuthenticationDataColNum, aBuffer ); + iTable.SetColL( iAuthenticationDataColNum, aBuffer ); - PutRowUpdatesL(); + PutRowUpdatesL(); + } //iTable.FirstL(); } // end SetAuthenticationDataL @@ -280,10 +291,10 @@ // ========================================================================== void CContainerStoreGeneralTable::GetAuthenticationDataL( RBuf8& aBuffer ) { - iTable.FirstL(); - iTable.GetL(); - - aBuffer.CreateL( iTable.ColDes8( iAuthenticationDataColNum ) ); + if(iTable.FirstL()){ + iTable.GetL(); + aBuffer.CreateL( iTable.ColDes8( iAuthenticationDataColNum ) ); + } } // end GetAuthenticationDataL // ========================================================================== @@ -291,10 +302,12 @@ // ========================================================================== TEncryptionState CContainerStoreGeneralTable::EncryptionStateL() { - iTable.FirstL(); - iTable.GetL(); + TEncryptionState encryptionState = EMsgStoreESIdle; - TEncryptionState encryptionState = static_cast(iTable.ColUint8( iEncryptionStateColNum )); + if(iTable.FirstL()){ + iTable.GetL(); + encryptionState = static_cast(iTable.ColUint8( iEncryptionStateColNum )); + } return encryptionState; } // end EncryptionStateL @@ -304,12 +317,13 @@ // ========================================================================== void CContainerStoreGeneralTable::SetEncryptionStateL( TEncryptionState aEncryptionState ) { - iTable.FirstL(); - PrepareRowForUpdateLC(); + if(iTable.FirstL()){ + PrepareRowForUpdateLC(); - iTable.SetColL( iEncryptionStateColNum, static_cast(aEncryptionState) ); + iTable.SetColL( iEncryptionStateColNum, static_cast(aEncryptionState) ); - PutRowUpdatesL(); + PutRowUpdatesL(); + } //iTable.FirstL(); } // end SetEncryptionStateL @@ -319,10 +333,12 @@ // ========================================================================== TBool CContainerStoreGeneralTable::IsAuthenticateRequiredL() { - iTable.FirstL(); - iTable.GetL(); - - return iTable.ColUint8( iAuthenticationRequiredColNum ); + TBool ret = EFalse; + if(iTable.FirstL()){ + iTable.GetL(); + ret = iTable.ColUint8( iAuthenticationRequiredColNum ); + } + return ret; } // ========================================================================== @@ -330,12 +346,13 @@ // ========================================================================== void CContainerStoreGeneralTable::SetAuthenticationRequiredL( TBool aFlag ) { - iTable.FirstL(); - PrepareRowForUpdateLC(); + if(iTable.FirstL()){ + PrepareRowForUpdateLC(); - iTable.SetColL( iAuthenticationRequiredColNum, static_cast(aFlag) ); + iTable.SetColL( iAuthenticationRequiredColNum, static_cast(aFlag) ); - PutRowUpdatesL(); + PutRowUpdatesL(); + } //iTable.FirstL(); } @@ -345,10 +362,14 @@ // ========================================================================== TUint CContainerStoreGeneralTable::MaxMruCountL() { - iTable.FirstL(); - iTable.GetL(); - - return iTable.ColUint( iMaxMruCountColNum ); + TUint ret = 0; + + if(iTable.FirstL()){ + iTable.GetL(); + ret = iTable.ColUint( iMaxMruCountColNum ); + } + + return ret; } // ========================================================================== @@ -356,32 +377,37 @@ // ========================================================================== void CContainerStoreGeneralTable::SetMaxMruCountL( TUint aCount ) { - iTable.FirstL(); - PrepareRowForUpdateLC(); + if(iTable.FirstL()){ + PrepareRowForUpdateLC(); - iTable.SetColL( iMaxMruCountColNum, aCount ); + iTable.SetColL( iMaxMruCountColNum, aCount ); - PutRowUpdatesL(); + PutRowUpdatesL(); - //iTable.FirstL(); + //iTable.FirstL(); + } } TUint CContainerStoreGeneralTable::CurMruNumberL() { - iTable.FirstL(); - iTable.GetL(); + int ret = 0; + if(iTable.FirstL()){ + iTable.GetL(); + ret = iTable.ColUint( iCurMruNumberColNum ); + } - return iTable.ColUint( iCurMruNumberColNum ); + return ret; } void CContainerStoreGeneralTable::SetCurMruNumberL( TUint aNum ) { - iTable.FirstL(); - PrepareRowForUpdateLC(); + if(iTable.FirstL()){ + PrepareRowForUpdateLC(); - iTable.SetColL( iCurMruNumberColNum, aNum ); + iTable.SetColL( iCurMruNumberColNum, aNum ); - PutRowUpdatesL(); + PutRowUpdatesL(); + } //iTable.FirstL(); } diff -r 6c59112cfd31 -r 38bf5461e270 emailservices/emailstore/message_store/server/src/ContainerStoreMRUAddressTable.cpp --- a/emailservices/emailstore/message_store/server/src/ContainerStoreMRUAddressTable.cpp Thu Sep 30 11:43:07 2010 +0300 +++ b/emailservices/emailstore/message_store/server/src/ContainerStoreMRUAddressTable.cpp Thu Oct 14 17:33:43 2010 +0300 @@ -461,7 +461,9 @@ } CMruAddressList* list = new(ELeave) CMruAddressList( aMailboxId ); + CleanupStack::PushL( list ); iAddressLists.AppendL( list ); + CleanupStack::Pop( list ); __LOG_EXIT } @@ -619,7 +621,9 @@ { TContainerId mailboxId = aMailboxIds[i]; CMruAddressList* list = new(ELeave) CMruAddressList( mailboxId ); + CleanupStack::PushL( list ); iAddressLists.AppendL( list ); + CleanupStack::Pop( list ); const TUint bufSize = 100; TBuf sqlString; diff -r 6c59112cfd31 -r 38bf5461e270 emailservices/emailstore/message_store/server/src/ContainerStoreSearchHandler.cpp --- a/emailservices/emailstore/message_store/server/src/ContainerStoreSearchHandler.cpp Thu Sep 30 11:43:07 2010 +0300 +++ b/emailservices/emailstore/message_store/server/src/ContainerStoreSearchHandler.cpp Thu Oct 14 17:33:43 2010 +0300 @@ -466,7 +466,9 @@ __LOG_WRITE_FORMAT1_INFO( "search string =%S", &searchStringPtr ); HBufC* pattern = HBufC::NewL( searchString->Length() + 2 ); + CleanupStack::PushL( pattern ); aSearchPatterns.AppendL( pattern ); + CleanupStack::Pop( pattern ); TPtr seartStringPrt( pattern->Des() ); //we are using MatchC(), so we need to add * to the start and end of the search pattern diff -r 6c59112cfd31 -r 38bf5461e270 emailservices/emailstore/message_store/server/src/ContainerStoreUtils.cpp --- a/emailservices/emailstore/message_store/server/src/ContainerStoreUtils.cpp Thu Sep 30 11:43:07 2010 +0300 +++ b/emailservices/emailstore/message_store/server/src/ContainerStoreUtils.cpp Thu Oct 14 17:33:43 2010 +0300 @@ -339,9 +339,10 @@ // ========================================================================== void CContainerStoreUtils::OpenTableL( RDbTable& aTable, const TDesC& aTableName ) { + iTables.ReserveL( iTables.Count() + 1 ); // pre-allocate space User::LeaveIfError( aTable.Open( iDatabase, aTableName ) ); - iTables.AppendL( &aTable ); + iTables.Append( &aTable ); // cannot fail because space is pre-allocated } // end OpenTableL diff -r 6c59112cfd31 -r 38bf5461e270 emailservices/emailstore/message_store/server/src/MessageStoreSession.cpp --- a/emailservices/emailstore/message_store/server/src/MessageStoreSession.cpp Thu Sep 30 11:43:07 2010 +0300 +++ b/emailservices/emailstore/message_store/server/src/MessageStoreSession.cpp Thu Oct 14 17:33:43 2010 +0300 @@ -1081,7 +1081,9 @@ void CMessageStoreSession::DoMatchFoundL( TContainerId aMessageId, TContainerId aFolderId, const TDesC8& aPropertyBuf ) { CSearchResult* result = CSearchResult::NewL( aMessageId, aFolderId, aPropertyBuf ); + CleanupStack::PushL( result ); iMatchMessages.AppendL( result ); + CleanupStack::Pop( result ); SendMatchesToClient(); } // end MatchFound diff -r 6c59112cfd31 -r 38bf5461e270 emailservices/emailstore/message_store/server/src/MsgStoreInMemorySortRowSet.cpp --- a/emailservices/emailstore/message_store/server/src/MsgStoreInMemorySortRowSet.cpp Thu Sep 30 11:43:07 2010 +0300 +++ b/emailservices/emailstore/message_store/server/src/MsgStoreInMemorySortRowSet.cpp Thu Oct 14 17:33:43 2010 +0300 @@ -669,7 +669,9 @@ void CMsgStoreInMemorySortRowSet::AddRowL( TContainerId aMessageId, TInt64 aDate, TInt32 aValue ) { CIntegerRow* row = new(ELeave) CIntegerRow( aMessageId, aDate, aValue ); + CleanupStack::PushL( row ); InsertInOrderL( row ); + CleanupStack::Pop( row ); TInt64 groupValue = GetGroupValue( *row ); UpdateGroupListL( groupValue ); diff -r 6c59112cfd31 -r 38bf5461e270 emailservices/emailstore/message_store/server/src/MsgStoreSortResultRowSet.cpp --- a/emailservices/emailstore/message_store/server/src/MsgStoreSortResultRowSet.cpp Thu Sep 30 11:43:07 2010 +0300 +++ b/emailservices/emailstore/message_store/server/src/MsgStoreSortResultRowSet.cpp Thu Oct 14 17:33:43 2010 +0300 @@ -128,6 +128,9 @@ hasMorePrevious = EFalse; } //move it back + + //no need to check here + //coverity[check_return] iDbView.NextL(); } return hasMorePrevious; @@ -157,6 +160,8 @@ // ========================================================================== TMsgStoreId CMsgStoreSortResultRowSet::NextL() { + //checked using AtEnd() below + //coverity[check_return] iDbView.NextL(); if ( iDbView.AtEnd() ) { @@ -204,13 +209,17 @@ query.Append( KEqual ); query.AppendNum( aMessageId ); - iDbView.FirstL(); + if(iDbView.FirstL()){ - TInt rc = iDbView.FindL( RDbRowSet::EForwards, query ); - if ( rc < 0 ) - { - User::Leave( rc ); + TInt rc = iDbView.FindL( RDbRowSet::EForwards, query ); + if ( rc < 0 ) + { + User::Leave( rc ); + } } + else{ + User::Leave(KErrNotFound); + } } } @@ -423,6 +432,8 @@ iDbView.BeginningL(); for ( TInt i = 0 ; i < count ; i++ ) { + //no need to check return here + //coverity[check_return] iDbView.NextL(); aIdArray.AppendL( GetRowL() ); } @@ -433,6 +444,7 @@ // ========================================================================== TInt CMsgStoreSortResultRowSet::IndexOfL( TContainerId aMessageId ) { + TInt ret = -1; //have to search it from the begining const TUint bufSize = 200; TBuf query; @@ -440,9 +452,10 @@ query.Append( KEqual ); query.AppendNum( aMessageId ); - iDbView.FirstL(); - - return iDbView.FindL( RDbRowSet::EForwards, query ); + if(iDbView.FirstL()){ + ret = iDbView.FindL( RDbRowSet::EForwards, query ); + } + return ret; } // ========================================================================== diff -r 6c59112cfd31 -r 38bf5461e270 emailservices/emailstore/message_store/server/src/MsgStoreStringSortResultRowSet.cpp --- a/emailservices/emailstore/message_store/server/src/MsgStoreStringSortResultRowSet.cpp Thu Sep 30 11:43:07 2010 +0300 +++ b/emailservices/emailstore/message_store/server/src/MsgStoreStringSortResultRowSet.cpp Thu Oct 14 17:33:43 2010 +0300 @@ -889,9 +889,10 @@ void CMsgStoreStringSortResultRowSet::AddRowL( TContainerId aMessageId, const TDesC& aString, TInt64 aDate ) { CStringRow* row = CStringRow::NewL( aMessageId, aDate, aString ); + CleanupStack::PushL( row ); row->SetGroupId( iCurGroupId++ ); InsertInOrderL( row ); - + CleanupStack::Pop( row ); //we need to find out where is the newly added row, if it is the first or //the last element in the sorted array, than it's position MAY NOT be accurate, //because we DON'T have the entire table in memory, in this case, we have to either diff -r 6c59112cfd31 -r 38bf5461e270 emailservices/emailstore/message_store/server/src/bufferedmessagecreator.cpp --- a/emailservices/emailstore/message_store/server/src/bufferedmessagecreator.cpp Thu Sep 30 11:43:07 2010 +0300 +++ b/emailservices/emailstore/message_store/server/src/bufferedmessagecreator.cpp Thu Oct 14 17:33:43 2010 +0300 @@ -96,7 +96,9 @@ ContainerDescriptor* part = new (ELeave) ContainerDescriptor( aParams, aProperties ); + CleanupStack::PushL( part ); iContainers.AppendL( part ); + CleanupStack::Pop( part ); } /** diff -r 6c59112cfd31 -r 38bf5461e270 emailservices/nmailagent/src/nmmailagent.cpp --- a/emailservices/nmailagent/src/nmmailagent.cpp Thu Sep 30 11:43:07 2010 +0300 +++ b/emailservices/nmailagent/src/nmmailagent.cpp Thu Oct 14 17:33:43 2010 +0300 @@ -310,8 +310,10 @@ // get list of messages in inbox QList messageList; - plugin->listMessages(mailboxId, inboxId, messageList); - + int err = plugin->listMessages(mailboxId, inboxId, messageList); + if (err != KErrNone) { + return false; + } QList newMessageIdList; int unreadCount(0); @@ -425,7 +427,7 @@ NmMailboxInfo *mailboxInfo = getMailboxInfo(mailboxId); bool shown = false; - if( mailboxInfo->mActive && + if( mailboxInfo && mailboxInfo->mActive && (mailboxInfo->mNewUnreadMailIdList.count() > 0 || mailboxInfo->mOutboxMails>0)) { shown = true; @@ -450,8 +452,8 @@ NmMailboxInfo *mailboxInfo = getMailboxInfo(mailboxId); bool changed = false; - if (mailboxInfo->mActive != active || - refreshAlways) { + if (mailboxInfo && (mailboxInfo->mActive != active || + refreshAlways) ) { // store the new state to permanent storage storeMailboxActive(mailboxId, active); @@ -588,62 +590,64 @@ // Check the new messages to make the indicator appear earlier NmMailboxInfo *mailboxInfo = getMailboxInfo(mailboxId); - // Inbox folder ID may be still unknown - if (mailboxInfo->mInboxFolderId.id() == 0) { - NmDataPluginInterface *plugin = - mPluginFactory->interfaceInstance(mailboxId); - - if (plugin) { - mailboxInfo->mInboxFolderId = - plugin->getStandardFolderId(mailboxId, NmFolderInbox); + if(mailboxInfo){ + // Inbox folder ID may be still unknown + if (mailboxInfo->mInboxFolderId.id() == 0) { + NmDataPluginInterface *plugin = + mPluginFactory->interfaceInstance(mailboxId); + + if (plugin) { + mailboxInfo->mInboxFolderId = + plugin->getStandardFolderId(mailboxId, NmFolderInbox); + } } - } - - if (folderId == mailboxInfo->mInboxFolderId) { - mailboxInfo->mInboxCreatedMessages += messageIds.count(); - - foreach (NmId messageId, messageIds) { - bool messageUnread = false; - mailboxInfo->mMailIdList.append(messageId); - - // double check that the message ID is really new - bool newMessage = true; - if (mailboxInfo->mNewUnreadMailIdList.indexOf(messageId)>=0) { - newMessage = false; - } - - // If it is a new message, update the mailbox status - if (newMessage) { - if (getMessageUnreadInfo(folderId, messageId, mailboxId, messageUnread)) { - if (messageUnread) { - mailboxInfo->mNewUnreadMailIdList.append(messageId); - NM_COMMENT(QString(" new unread messages: count=%1"). - arg(mailboxInfo->mNewUnreadMailIdList.count())); - - if (!mUnreadIndicatorActive) { - // make the "@" appear immediatelly - updateUnreadIndicator(true); + + if (folderId == mailboxInfo->mInboxFolderId) { + mailboxInfo->mInboxCreatedMessages += messageIds.count(); + + foreach (NmId messageId, messageIds) { + bool messageUnread = false; + mailboxInfo->mMailIdList.append(messageId); + + // double check that the message ID is really new + bool newMessage = true; + if (mailboxInfo->mNewUnreadMailIdList.indexOf(messageId)>=0) { + newMessage = false; + } + + // If it is a new message, update the mailbox status + if (newMessage) { + if (getMessageUnreadInfo(folderId, messageId, mailboxId, messageUnread)) { + if (messageUnread) { + mailboxInfo->mNewUnreadMailIdList.append(messageId); + NM_COMMENT(QString(" new unread messages: count=%1"). + arg(mailboxInfo->mNewUnreadMailIdList.count())); + + if (!mUnreadIndicatorActive) { + // make the "@" appear immediatelly + updateUnreadIndicator(true); + } + updateMailboxState(mailboxId, true, false); + + // Play the tone as well + playAlertTone(); } - updateMailboxState(mailboxId, true, false); - - // Play the tone as well - playAlertTone(); } } } } - } - - // When created a new mail in the outbox, we are in sending state - if (mailboxInfo->mOutboxFolderId == folderId) { - // The first mail created in the outbox - if (mailboxInfo->mOutboxMails <= 0) { - NM_COMMENT("NmMailAgent: first mail in outbox"); + + // When created a new mail in the outbox, we are in sending state + if (mailboxInfo->mOutboxFolderId == folderId) { + // The first mail created in the outbox + if (mailboxInfo->mOutboxMails <= 0) { + NM_COMMENT("NmMailAgent: first mail in outbox"); + } + mailboxInfo->mOutboxMails += messageIds.count(); + + updateMailboxState(mailboxId,true,true); + updateSendIndicator(); } - mailboxInfo->mOutboxMails += messageIds.count(); - - updateMailboxState(mailboxId,true,true); - updateSendIndicator(); } } diff -r 6c59112cfd31 -r 38bf5461e270 emailservices/nmailbase/src/nmmessageenvelope.cpp --- a/emailservices/nmailbase/src/nmmessageenvelope.cpp Thu Sep 30 11:43:07 2010 +0300 +++ b/emailservices/nmailbase/src/nmmessageenvelope.cpp Thu Oct 14 17:33:43 2010 +0300 @@ -153,7 +153,10 @@ && sentTime() == envelope.sentTime() && flags() == envelope.flags() && mailboxId() == envelope.mailboxId() - && folderId() == envelope.folderId()) { + && folderId() == envelope.folderId() + && toRecipients() == envelope.toRecipients() + && ccRecipients() == envelope.ccRecipients() + && bccRecipients() == envelope.bccRecipients()) { ret = true; } return ret; diff -r 6c59112cfd31 -r 38bf5461e270 emailservices/nmclientapi/inc/nmapidatapluginfactory.h --- a/emailservices/nmclientapi/inc/nmapidatapluginfactory.h Thu Sep 30 11:43:07 2010 +0300 +++ b/emailservices/nmclientapi/inc/nmapidatapluginfactory.h Thu Oct 14 17:33:43 2010 +0300 @@ -20,13 +20,15 @@ #include -class NmDataPluginInterface; +class NmId; class QDir; class QPluginLoader; class QObject; +class NmDataPluginInterface; -class NmId; +namespace EmailClientApi +{ /*! \class NmApiDataPluginFactory @@ -52,5 +54,6 @@ static QObject *mPlugin; static QPluginLoader *mPluginLoader; }; +} #endif /* NMAPIDATAPLUGINFACTORY_H */ diff -r 6c59112cfd31 -r 38bf5461e270 emailservices/nmclientapi/inc/nmapiengine.h --- a/emailservices/nmclientapi/inc/nmapiengine.h Thu Sep 30 11:43:07 2010 +0300 +++ b/emailservices/nmclientapi/inc/nmapiengine.h Thu Oct 14 17:33:43 2010 +0300 @@ -24,16 +24,14 @@ #include "nmcommon.h" #include "nmapiprivateclasses.h" -class NmApiDataPluginFactory; namespace EmailClientApi { - +class NmApiDataPluginFactory; class NmApiFolder; class NmApiMailbox; class NmApiMessageEnvelope; class NmApiMessage; -} class NmApiEngine : public QObject { @@ -42,30 +40,30 @@ static NmApiEngine* instance(); static void releaseInstance(NmApiEngine *&engine); - void listMailboxes(QList &mailboxList); + void listMailboxes(QList &mailboxList); - void listFolders(const quint64 mailboxId, QList &folderList); + void listFolders(const quint64 mailboxId, QList &folderList); void listEnvelopes(const quint64 mailboxId, const quint64 folderId, - QList &messageEnvelopeList); + QList &messageEnvelopeList); bool getEnvelopeById( const quint64 mailboxId, const quint64 folderId, const quint64 envelopeId, - EmailClientApi::NmApiMessageEnvelope &envelope); + NmApiMessageEnvelope &envelope); bool getFolderById( const quint64 mailboxId, const quint64 folderId, - EmailClientApi::NmApiFolder &mailboxFolder); + NmApiFolder &mailboxFolder); - bool getMailboxById(const quint64 mailboxId, EmailClientApi::NmApiMailbox &mailbox); + bool getMailboxById(const quint64 mailboxId, NmApiMailbox &mailbox); bool getMessageById( const quint64 mailboxId, const quint64 folderId, const quint64 messageId, - EmailClientApi::NmApiMessage &message); + NmApiMessage &message); void startCollectingEvents(); @@ -77,7 +75,7 @@ \arg Contains info about event and related object (message or mailbox list) */ - void emailStoreEvent(NmApiEvent event); + void emailStoreEvent(EmailClientApi::NmApiEvent event); private slots: void mailboxChangedArrived(NmMailboxEvent, const QList &mailboxIds); @@ -100,5 +98,7 @@ NmApiDataPluginFactory *mFactory;//! mMailPlugins; }; +} + #endif /* NMAPIENGINE_H */ diff -r 6c59112cfd31 -r 38bf5461e270 emailservices/nmclientapi/inc/nmapienvelopelisting_p.h --- a/emailservices/nmclientapi/inc/nmapienvelopelisting_p.h Thu Sep 30 11:43:07 2010 +0300 +++ b/emailservices/nmclientapi/inc/nmapienvelopelisting_p.h Thu Oct 14 17:33:43 2010 +0300 @@ -20,11 +20,9 @@ #include -class NmApiEngine; - - namespace EmailClientApi { +class NmApiEngine; class NmApiMessageEnvelope; class NmApiEnvelopeListingPrivate : public QObject @@ -32,9 +30,9 @@ Q_OBJECT public: - NmApiEnvelopeListingPrivate(const quint64 folderId, const quint64 mailboxId, QObject *parent = 0); + NmApiEnvelopeListingPrivate(const quint64 folderId, const quint64 mailboxId, QObject *parent = NULL); virtual ~NmApiEnvelopeListingPrivate(); - bool envelopes(QList &envelopes); + bool envelopes(QList &envelopes); qint32 listEnvelopes(); bool isRunning() const; void cancel(); @@ -44,7 +42,7 @@ quint64 mMailboxId; bool mIsRunning; NmApiEngine *mEngine; - QList mEnvelopes; + QList mEnvelopes; }; } #endif /* NMAPIENVELOPELISTINGPRIVATE_H */ diff -r 6c59112cfd31 -r 38bf5461e270 emailservices/nmclientapi/inc/nmapieventnotifier_p.h --- a/emailservices/nmclientapi/inc/nmapieventnotifier_p.h Thu Sep 30 11:43:07 2010 +0300 +++ b/emailservices/nmclientapi/inc/nmapieventnotifier_p.h Thu Oct 14 17:33:43 2010 +0300 @@ -24,15 +24,15 @@ class QTimer; -class NmApiEngine; - namespace EmailClientApi { +class NmApiEngine; + class NmApiEventNotifierPrivate : public QObject { Q_OBJECT public: - NmApiEventNotifierPrivate(QObject *parent = 0); + NmApiEventNotifierPrivate(QObject *parent = NULL); virtual ~NmApiEventNotifierPrivate(); void cancel(); @@ -41,7 +41,7 @@ void stop(); void events(QList &events); public slots: - void emailStoreEvent(const NmApiEvent &events); + void emailStoreEvent(const EmailClientApi::NmApiEvent event); signals: void timedOut(); diff -r 6c59112cfd31 -r 38bf5461e270 emailservices/nmclientapi/inc/nmapifolder_p.h --- a/emailservices/nmclientapi/inc/nmapifolder_p.h Thu Sep 30 11:43:07 2010 +0300 +++ b/emailservices/nmclientapi/inc/nmapifolder_p.h Thu Oct 14 17:33:43 2010 +0300 @@ -38,7 +38,7 @@ quint64 id; QString name; - EmailClientApi::NmApiEmailFolderType folderType; + NmApiEmailFolderType folderType; quint64 parentId; QList childFolderIds; }; diff -r 6c59112cfd31 -r 38bf5461e270 emailservices/nmclientapi/inc/nmapifolderlisting_p.h --- a/emailservices/nmclientapi/inc/nmapifolderlisting_p.h Thu Sep 30 11:43:07 2010 +0300 +++ b/emailservices/nmclientapi/inc/nmapifolderlisting_p.h Thu Oct 14 17:33:43 2010 +0300 @@ -19,11 +19,10 @@ #include -class NmApiEngine; namespace EmailClientApi { - +class NmApiEngine; class NmApiFolder; class NmApiFolderListingPrivate : public QObject @@ -32,17 +31,17 @@ public: - NmApiFolderListingPrivate(quint64 mailboxId, QObject *parent = 0); + NmApiFolderListingPrivate(quint64 mailboxId, QObject *parent = NULL); virtual ~NmApiFolderListingPrivate(); qint32 listFolders(); - bool folders(QList &folders); + bool folders(QList &folders); void cancel(); bool isRunning() const; private: quint64 mMailboxId; NmApiEngine *mEngine; bool mIsRunning; - QList mFolders; + QList mFolders; }; } #endif /* NMAPIFOLDERLISTINGPRIVATE_H */ diff -r 6c59112cfd31 -r 38bf5461e270 emailservices/nmclientapi/inc/nmapimailboxlisting_p.h --- a/emailservices/nmclientapi/inc/nmapimailboxlisting_p.h Thu Sep 30 11:43:07 2010 +0300 +++ b/emailservices/nmclientapi/inc/nmapimailboxlisting_p.h Thu Oct 14 17:33:43 2010 +0300 @@ -17,29 +17,26 @@ #ifndef NMAPIMAILBOXLISTINGPRIVATE_H #define NMAPIMAILBOXLISTINGPRIVATE_H -class NmApiEngine; namespace EmailClientApi { - +class NmApiEngine; class NmApiMailbox; class NmApiMailboxListingPrivate : public QObject { public: - NmApiMailboxListingPrivate(QObject *parent = 0); + NmApiMailboxListingPrivate(QObject *parent = NULL); virtual ~NmApiMailboxListingPrivate(); - - bool initializeEngine(); - - void releaseEngine(); - - qint32 grabMailboxes(); - - QList mMailboxes;//! &mailboxes); + bool isRunning() const; + void cancel(); +private: + QList mMailboxes; + NmApiEngine *mEngine; + bool mIsRunning; }; } diff -r 6c59112cfd31 -r 38bf5461e270 emailservices/nmclientapi/inc/nmapimailboxsettings_p.h --- a/emailservices/nmclientapi/inc/nmapimailboxsettings_p.h Thu Sep 30 11:43:07 2010 +0300 +++ b/emailservices/nmclientapi/inc/nmapimailboxsettings_p.h Thu Oct 14 17:33:43 2010 +0300 @@ -23,19 +23,19 @@ #include #include -class NmApiDataPluginFactory; class NmOperation; namespace EmailClientApi { +class NmApiDataPluginFactory; class NmApiMailboxSettingsData; class NmApiMailboxSettingsPrivate : public QObject { Q_OBJECT public: - NmApiMailboxSettingsPrivate(QObject *parent = 0); - ~NmApiMailboxSettingsPrivate(); + NmApiMailboxSettingsPrivate(QObject *parent = NULL); + virtual ~NmApiMailboxSettingsPrivate(); bool listMailboxIds(QList &idList); QString getMailboxType(quint64 mailboxId); diff -r 6c59112cfd31 -r 38bf5461e270 emailservices/nmclientapi/inc/nmapimessageenvelope_p.h --- a/emailservices/nmclientapi/inc/nmapimessageenvelope_p.h Thu Sep 30 11:43:07 2010 +0300 +++ b/emailservices/nmclientapi/inc/nmapimessageenvelope_p.h Thu Oct 14 17:33:43 2010 +0300 @@ -43,9 +43,9 @@ bool forwarded; bool replied; - QList toRecipients; - QList ccRecipients; - QList bccRecipients; + QList toRecipients; + QList ccRecipients; + QList bccRecipients; quint64 id; quint64 parentFolder; diff -r 6c59112cfd31 -r 38bf5461e270 emailservices/nmclientapi/inc/nmapimessagemanager_p.h --- a/emailservices/nmclientapi/inc/nmapimessagemanager_p.h Thu Sep 30 11:43:07 2010 +0300 +++ b/emailservices/nmclientapi/inc/nmapimessagemanager_p.h Thu Oct 14 17:33:43 2010 +0300 @@ -24,12 +24,12 @@ #include #include -class NmApiEngine; class CFSMailBox; class CFSMailPlugin; namespace EmailClientApi { +class NmApiEngine; class NmApiMessageManagerPrivate : public QObject { diff -r 6c59112cfd31 -r 38bf5461e270 emailservices/nmclientapi/inc/nmapimessagesearch_p.h --- a/emailservices/nmclientapi/inc/nmapimessagesearch_p.h Thu Sep 30 11:43:07 2010 +0300 +++ b/emailservices/nmclientapi/inc/nmapimessagesearch_p.h Thu Oct 14 17:33:43 2010 +0300 @@ -19,25 +19,27 @@ #define NMAPIMESSAGESEARCHPRIVATE_H_ #include -#include #include #include + +class CFSMailBox; +namespace EmailClientApi +{ class NmApiEngine; -class CFSMailBox; class NmApiMessageSearchPrivate : public QObject, - public MFSMailBoxSearchObserver + public MFSMailBoxSearchObserver { Q_OBJECT public: - NmApiMessageSearchPrivate(const quint64 mailboxId, QObject *parent = 0); + NmApiMessageSearchPrivate(const quint64 mailboxId, QObject *parent = NULL); - ~NmApiMessageSearchPrivate(); + virtual ~NmApiMessageSearchPrivate(); - bool initialise(const QList &searchStrings, EmailClientApi::NmApiMailSortCriteria sortCriteria); + bool initialise(const QList &searchStrings, NmApiMailSortCriteria sortCriteria); bool isRunning() const; @@ -75,5 +77,6 @@ NmApiEngine *mEngine; }; +} #endif /* NMAPIMESSAGESEARCHPRIVATE_H_ */ diff -r 6c59112cfd31 -r 38bf5461e270 emailservices/nmclientapi/inc/nmapioperationcreatedraftmessage.h --- a/emailservices/nmclientapi/inc/nmapioperationcreatedraftmessage.h Thu Sep 30 11:43:07 2010 +0300 +++ b/emailservices/nmclientapi/inc/nmapioperationcreatedraftmessage.h Thu Oct 14 17:33:43 2010 +0300 @@ -25,7 +25,8 @@ class CFSMailBox; -using namespace EmailClientApi; +namespace EmailClientApi +{ class NmApiOperationCreateDraftMessage : public NmApiOperation, public MFSMailRequestObserver @@ -34,7 +35,7 @@ public: NmApiOperationCreateDraftMessage(const QVariant *initData, CFSMailBox &mailBox, - QObject *parent = 0); + QObject *parent = NULL); virtual ~NmApiOperationCreateDraftMessage(); // from MFSMailRequestObserver @@ -52,6 +53,6 @@ TInt mRequestId; }; - +} #endif /* NMAPIOPERATIONCREATEDRAFTMESSAGE_H_ */ diff -r 6c59112cfd31 -r 38bf5461e270 emailservices/nmclientapi/inc/nmapioperationsendmessage.h --- a/emailservices/nmclientapi/inc/nmapioperationsendmessage.h Thu Sep 30 11:43:07 2010 +0300 +++ b/emailservices/nmclientapi/inc/nmapioperationsendmessage.h Thu Oct 14 17:33:43 2010 +0300 @@ -33,10 +33,10 @@ { Q_OBJECT public: - NmApiOperationSendMessage(const NmApiMessage &message, CFSMailBox &mailBox, QObject *parent = 0); + NmApiOperationSendMessage(const NmApiMessage &message, CFSMailBox &mailBox, QObject *parent = NULL); virtual ~NmApiOperationSendMessage(); - void RequestResponseL( TFSProgress aEvent, TInt aRequestId ); + void RequestResponseL(TFSProgress aEvent, TInt aRequestId); private slots: void start(); diff -r 6c59112cfd31 -r 38bf5461e270 emailservices/nmclientapi/inc/nmapipopimapsettingsmanager.h --- a/emailservices/nmclientapi/inc/nmapipopimapsettingsmanager.h Thu Sep 30 11:43:07 2010 +0300 +++ b/emailservices/nmclientapi/inc/nmapipopimapsettingsmanager.h Thu Oct 14 17:33:43 2010 +0300 @@ -19,13 +19,14 @@ #define NMAPIPOPIMAPSETTINGSMANAGER_H -namespace EmailClientApi { +namespace EmailClientApi +{ class NmApiMailboxSettingsData; class NmApiPopImapSettingsManager { public: NmApiPopImapSettingsManager(); - ~NmApiPopImapSettingsManager(); + virtual ~NmApiPopImapSettingsManager(); bool populateDefaults(const QString &mailboxType, NmApiMailboxSettingsData &data); private: diff -r 6c59112cfd31 -r 38bf5461e270 emailservices/nmclientapi/inc/nmapiprivateclasses.h --- a/emailservices/nmclientapi/inc/nmapiprivateclasses.h Thu Sep 30 11:43:07 2010 +0300 +++ b/emailservices/nmclientapi/inc/nmapiprivateclasses.h Thu Oct 14 17:33:43 2010 +0300 @@ -18,10 +18,11 @@ #ifndef NMAPIPRIVATECLASSES_H #define NMAPIPRIVATECLASSES_H -#include #include #include +namespace EmailClientApi +{ /*! Enum for internal info about changes in emial store */ @@ -55,6 +56,6 @@ quint64 folderId; }; -Q_DECLARE_METATYPE(NmApiEvent) - +} // namespace +Q_DECLARE_METATYPE(EmailClientApi::NmApiEvent) #endif /* NMAPIPRIVATECLASSES_H */ diff -r 6c59112cfd31 -r 38bf5461e270 emailservices/nmclientapi/inc/nmapitypesconverter.h --- a/emailservices/nmclientapi/inc/nmapitypesconverter.h Thu Sep 30 11:43:07 2010 +0300 +++ b/emailservices/nmclientapi/inc/nmapitypesconverter.h Thu Oct 14 17:33:43 2010 +0300 @@ -26,9 +26,8 @@ class NmAddress; class NmMessage; class NmMessagePart; -/*! - - */ + + namespace EmailClientApi { class NmApiMailbox; @@ -37,20 +36,18 @@ class NmApiEmailAddress; class NmApiMessage; class NmApiAttachment; -} - class NmToApiConverter { public: - static EmailClientApi::NmApiMailbox NmMailbox2NmApiMailbox(const NmMailbox &mailbox); - static EmailClientApi::NmApiFolder NmFolder2NmApiFolder(const NmFolder &folder); - static EmailClientApi::NmApiMessageEnvelope NmMessageEnvelope2NmApiMessageEnvelope( + static NmApiMailbox NmMailbox2NmApiMailbox(const NmMailbox &mailbox); + static NmApiFolder NmFolder2NmApiFolder(const NmFolder &folder); + static NmApiMessageEnvelope NmMessageEnvelope2NmApiMessageEnvelope( const NmMessageEnvelope &envelope); - static QList NmAddress2QString( + static QList NmAddress2QString( const QList &addresses); - static EmailClientApi::NmApiMessage NmMessage2NmApiMessage(NmMessage &message); + static NmApiMessage NmMessage2NmApiMessage(NmMessage &message); }; - +} #endif /* NMTOAPICONVERTER_H_ */ diff -r 6c59112cfd31 -r 38bf5461e270 emailservices/nmclientapi/nmclientapi.pro --- a/emailservices/nmclientapi/nmclientapi.pro Thu Sep 30 11:43:07 2010 +0300 +++ b/emailservices/nmclientapi/nmclientapi.pro Thu Oct 14 17:33:43 2010 +0300 @@ -26,11 +26,11 @@ INCLUDEPATH += inc \ ../../email_plat/nmail_client_api/inc \ ../../email_plat/nmail_settings_api/inc \ - ../../inc + ../../inc \ + $$APP_LAYER_SYSTEMINCLUDE DEPENDPATH += ../../email_plat/nmail_client_api/inc \ - ../../email_plat/nmail_settings_api/inc \ - $$APP_LAYER_SYSTEMINCLUDE + ../../email_plat/nmail_settings_api/inc MOC_DIR = tmp @@ -127,9 +127,6 @@ src/nmapioperationcreatedraftmessage.cpp \ src/nmapioperationsendmessage.cpp - - - symbian*: { TARGET.EPOCALLOWDLLDATA = 1 TARGET.CAPABILITY = ALL \ @@ -138,9 +135,6 @@ TARGET.UID2 = 0x1000008D TARGET.UID3 = 0x2002C366 - - INCLUDEPATH += $$APP_LAYER_SYSTEMINCLUDE - MMP_RULES += "SYSTEMINCLUDE /epoc32/include/ecom" LIBS += -lnmailbase \ diff -r 6c59112cfd31 -r 38bf5461e270 emailservices/nmclientapi/src/nmapiattachment.cpp --- a/emailservices/nmclientapi/src/nmapiattachment.cpp Thu Sep 30 11:43:07 2010 +0300 +++ b/emailservices/nmclientapi/src/nmapiattachment.cpp Thu Oct 14 17:33:43 2010 +0300 @@ -19,7 +19,6 @@ namespace EmailClientApi { - /*! Class constructor. */ @@ -82,5 +81,7 @@ NM_FUNCTION; d->setFileName(fileName); } +} -} + + diff -r 6c59112cfd31 -r 38bf5461e270 emailservices/nmclientapi/src/nmapidatapluginfactory.cpp --- a/emailservices/nmclientapi/src/nmapidatapluginfactory.cpp Thu Sep 30 11:43:07 2010 +0300 +++ b/emailservices/nmclientapi/src/nmapidatapluginfactory.cpp Thu Oct 14 17:33:43 2010 +0300 @@ -17,8 +17,8 @@ #include "nmapiheaders.h" - - +namespace EmailClientApi +{ /*! \class NmApiDataPluginFactory \brief The NmApiDataPluginFactory class creates NmDataPlugin instance. @@ -138,3 +138,5 @@ } return mPlugin; } +} + diff -r 6c59112cfd31 -r 38bf5461e270 emailservices/nmclientapi/src/nmapiemailaddress.cpp --- a/emailservices/nmclientapi/src/nmapiemailaddress.cpp Thu Sep 30 11:43:07 2010 +0300 +++ b/emailservices/nmclientapi/src/nmapiemailaddress.cpp Thu Oct 14 17:33:43 2010 +0300 @@ -67,7 +67,7 @@ { NM_FUNCTION; - bool retVal = false; + bool retVal(false); if (this->d == addr.d) { retVal = true; } diff -r 6c59112cfd31 -r 38bf5461e270 emailservices/nmclientapi/src/nmapiemailservice.cpp --- a/emailservices/nmclientapi/src/nmapiemailservice.cpp Thu Sep 30 11:43:07 2010 +0300 +++ b/emailservices/nmclientapi/src/nmapiemailservice.cpp Thu Oct 14 17:33:43 2010 +0300 @@ -49,7 +49,7 @@ const quint64 mailboxId, const quint64 folderId, const quint64 envelopeId, - EmailClientApi::NmApiMessageEnvelope &envelope) + NmApiMessageEnvelope &envelope) { NM_FUNCTION; @@ -65,7 +65,7 @@ bool NmApiEmailService::getFolder( const quint64 mailboxId, const quint64 folderId, - EmailClientApi::NmApiFolder &mailboxFolder) + NmApiFolder &mailboxFolder) { NM_FUNCTION; @@ -81,7 +81,7 @@ /*! gets mailbox info by id (see also NmEventNotifier) */ -bool NmApiEmailService::getMailbox(const quint64 mailboxId, EmailClientApi::NmApiMailbox &mailboxInfo) +bool NmApiEmailService::getMailbox(const quint64 mailboxId, NmApiMailbox &mailboxInfo) { NM_FUNCTION; @@ -98,7 +98,7 @@ const quint64 mailboxId, const quint64 folderId, const quint64 messageId, - EmailClientApi::NmApiMessage &message) + NmApiMessage &message) { NM_FUNCTION; diff -r 6c59112cfd31 -r 38bf5461e270 emailservices/nmclientapi/src/nmapiengine.cpp --- a/emailservices/nmclientapi/src/nmapiengine.cpp Thu Sep 30 11:43:07 2010 +0300 +++ b/emailservices/nmclientapi/src/nmapiengine.cpp Thu Oct 14 17:33:43 2010 +0300 @@ -17,6 +17,9 @@ #include "nmapiheaders.h" + +namespace EmailClientApi +{ NmApiEngine *NmApiEngine::mInstance = NULL; quint32 NmApiEngine::mReferenceCount = 0; @@ -216,10 +219,10 @@ /*! It get all mailboxes from email store - \sa EmailClientApi::NmMailbox + \sa NmMailbox \param mailboxList List of mailboxes to be filled. */ -void NmApiEngine::listMailboxes(QList &mailboxList) +void NmApiEngine::listMailboxes(QList &mailboxList) { NM_FUNCTION; @@ -246,11 +249,11 @@ /*! It get all folders from email store for given mailbox - \sa EmailClientApi::NmApiFolder + \sa NmApiFolder \param mailboxId Mailbox id from where folders should be returned \param folderList of folders to be filled. */ -void NmApiEngine::listFolders(const quint64 mailboxId, QList &folderList) +void NmApiEngine::listFolders(const quint64 mailboxId, QList &folderList) { NM_FUNCTION; @@ -270,13 +273,13 @@ /*! It get all envelopes from email store for given mailbox and folder - \sa EmailClientApi::NmApiMessageEnvelope + \sa NmApiMessageEnvelope \param mailboxId Mailbox id from where envelope should be returned \param folderId Folder id from where envelope should be returned \param messageEnvelopeList List of envelopes to be filled. */ void NmApiEngine::listEnvelopes(const quint64 mailboxId, const quint64 folderId, - QList &messageEnvelopeList) + QList &messageEnvelopeList) { NM_FUNCTION; @@ -289,7 +292,7 @@ while (!messages.isEmpty()) { NmMessage* message = messages.takeFirst(); - EmailClientApi::NmApiMessageEnvelope nmEnvelope = + NmApiMessageEnvelope nmEnvelope = NmToApiConverter::NmMessageEnvelope2NmApiMessageEnvelope(message->envelope()); NmMessagePart *plainTextPart = message->plainTextBodyPart(); @@ -322,7 +325,7 @@ const quint64 mailboxId, const quint64 folderId, const quint64 envelopeId, - EmailClientApi::NmApiMessageEnvelope &envelope) + NmApiMessageEnvelope &envelope) { NM_FUNCTION; @@ -367,7 +370,7 @@ bool NmApiEngine::getFolderById( const quint64 mailboxId, const quint64 folderId, - EmailClientApi::NmApiFolder &mailboxFolder) + NmApiFolder &mailboxFolder) { NM_FUNCTION; @@ -389,7 +392,7 @@ } if (fsFolder) { NmFolder *nmFolder = fsFolder->GetNmFolder(); - EmailClientApi::NmApiFolder apiFolder = NmToApiConverter::NmFolder2NmApiFolder(*nmFolder); + NmApiFolder apiFolder = NmToApiConverter::NmFolder2NmApiFolder(*nmFolder); mailboxFolder = apiFolder; found = true; delete nmFolder; @@ -412,7 +415,7 @@ const quint64 mailboxId, const quint64 folderId, const quint64 messageId, - EmailClientApi::NmApiMessage &message) + NmApiMessage &message) { NM_FUNCTION; @@ -438,7 +441,7 @@ } if (fsMessage) { NmMessage *nmMessage = fsMessage->GetNmMessage(); - EmailClientApi::NmApiMessage apiMessage = NmToApiConverter::NmMessage2NmApiMessage(*nmMessage); + NmApiMessage apiMessage = NmToApiConverter::NmMessage2NmApiMessage(*nmMessage); message = apiMessage; found = true; delete nmMessage; @@ -456,7 +459,7 @@ \return Return true if it will find any envelope */ -bool NmApiEngine::getMailboxById(const quint64 mailboxId, EmailClientApi::NmApiMailbox &mailbox) +bool NmApiEngine::getMailboxById(const quint64 mailboxId, NmApiMailbox &mailbox) { NM_FUNCTION; @@ -538,4 +541,5 @@ } CleanupStack::Pop(&implInfo); } +} diff -r 6c59112cfd31 -r 38bf5461e270 emailservices/nmclientapi/src/nmapienvelopelisting.cpp --- a/emailservices/nmclientapi/src/nmapienvelopelisting.cpp Thu Sep 30 11:43:07 2010 +0300 +++ b/emailservices/nmclientapi/src/nmapienvelopelisting.cpp Thu Oct 14 17:33:43 2010 +0300 @@ -81,7 +81,7 @@ Before calling start should be called, otherwise will return empty list. It also clears inputlist of NmMessageEnvelope. */ -bool NmApiEnvelopeListing::getEnvelopes(QList &envelopes) +bool NmApiEnvelopeListing::getEnvelopes(QList &envelopes) { NM_FUNCTION; return mListingPrivate->envelopes(envelopes); diff -r 6c59112cfd31 -r 38bf5461e270 emailservices/nmclientapi/src/nmapienvelopelisting_p.cpp --- a/emailservices/nmclientapi/src/nmapienvelopelisting_p.cpp Thu Sep 30 11:43:07 2010 +0300 +++ b/emailservices/nmclientapi/src/nmapienvelopelisting_p.cpp Thu Oct 14 17:33:43 2010 +0300 @@ -44,7 +44,7 @@ Caller gets ownership of envelopes. Returns true if results were available. */ -bool NmApiEnvelopeListingPrivate::envelopes(QList &envelopes) +bool NmApiEnvelopeListingPrivate::envelopes(QList &envelopes) { NM_FUNCTION; bool ret(mIsRunning); diff -r 6c59112cfd31 -r 38bf5461e270 emailservices/nmclientapi/src/nmapieventnotifier_p.cpp --- a/emailservices/nmclientapi/src/nmapieventnotifier_p.cpp Thu Sep 30 11:43:07 2010 +0300 +++ b/emailservices/nmclientapi/src/nmapieventnotifier_p.cpp Thu Oct 14 17:33:43 2010 +0300 @@ -30,6 +30,7 @@ NM_FUNCTION; mEmitSignals = new QTimer(this); mEmitSignals->setInterval(IntervalEmitingSignals); + mEmitSignals->setSingleShot(true); connect(mEmitSignals, SIGNAL(timeout()), this, SIGNAL( timedOut())); mEngine = NmApiEngine::instance(); @@ -69,14 +70,13 @@ } else { qRegisterMetaType > ("QList"); - qRegisterMetaType ("NmApiEvent"); + qRegisterMetaType ("EmailClientApi::NmApiEvent"); - connect(mEngine, SIGNAL(emailStoreEvent(NmApiEvent)), this, - SLOT(emailStoreEvent(NmApiEvent))); + connect(mEngine, SIGNAL(emailStoreEvent(EmailClientApi::NmApiEvent)), this, + SLOT(emailStoreEvent(EmailClientApi::NmApiEvent))); mEngine->startCollectingEvents(); - mEmitSignals->start(); mIsRunning = true; result = true; } @@ -89,8 +89,8 @@ { mIsRunning = false; mEmitSignals->stop(); - disconnect(mEngine, SIGNAL(emailStoreEvent(NmApiEvent)), this, - SLOT(emailStoreEvent(NmApiEvent))); + disconnect(mEngine, SIGNAL(emailStoreEvent(EmailClientApi::NmApiEvent)), this, + SLOT(emailStoreEvent(EmailClientApi::NmApiEvent))); } /*! @@ -110,10 +110,13 @@ \sa NmApiEvent \param events It contains full info about object and it event. */ -void NmApiEventNotifierPrivate::emailStoreEvent(const NmApiEvent &events) +void NmApiEventNotifierPrivate::emailStoreEvent(const EmailClientApi::NmApiEvent event) { NM_FUNCTION; - mBufferOfEvents << events; + mBufferOfEvents << event; + if (!mEmitSignals->isActive()) { + mEmitSignals->start(); + } } void NmApiEventNotifierPrivate::cancel() @@ -127,8 +130,8 @@ mIsRunning = false; mEmitSignals->stop(); - disconnect(mEngine, SIGNAL(emailStoreEvent(NmApiEvent)), this, - SLOT(emailStoreEvent(NmApiEvent))); + disconnect(mEngine, SIGNAL(emailStoreEvent(EmailClientApi::NmApiEvent)), this, + SLOT(emailStoreEvent(EmailClientApi::NmApiEvent))); mBufferOfEvents.clear(); } diff -r 6c59112cfd31 -r 38bf5461e270 emailservices/nmclientapi/src/nmapifolder.cpp --- a/emailservices/nmclientapi/src/nmapifolder.cpp Thu Sep 30 11:43:07 2010 +0300 +++ b/emailservices/nmclientapi/src/nmapifolder.cpp Thu Oct 14 17:33:43 2010 +0300 @@ -68,7 +68,7 @@ { NM_FUNCTION; - bool returnValue = false; + bool returnValue(false); if (d == folder.d) { returnValue = true; } @@ -98,7 +98,7 @@ /*! getter for foldertype */ -EmailClientApi::NmApiEmailFolderType NmApiFolder::folderType() const +NmApiEmailFolderType NmApiFolder::folderType() const { NM_FUNCTION; @@ -128,7 +128,7 @@ /*! setter for foldertype */ -void NmApiFolder::setFolderType(EmailClientApi::NmApiEmailFolderType folderType) +void NmApiFolder::setFolderType(NmApiEmailFolderType folderType) { NM_FUNCTION; diff -r 6c59112cfd31 -r 38bf5461e270 emailservices/nmclientapi/src/nmapifolderlisting.cpp --- a/emailservices/nmclientapi/src/nmapifolderlisting.cpp Thu Sep 30 11:43:07 2010 +0300 +++ b/emailservices/nmclientapi/src/nmapifolderlisting.cpp Thu Oct 14 17:33:43 2010 +0300 @@ -50,7 +50,7 @@ It clears list of folders after be called. It also at start clear inputlist of NmFolder. */ -bool NmApiFolderListing::getFolders(QList &folders) +bool NmApiFolderListing::getFolders(QList &folders) { NM_FUNCTION; return mFolderListing->folders(folders); diff -r 6c59112cfd31 -r 38bf5461e270 emailservices/nmclientapi/src/nmapifolderlisting_p.cpp --- a/emailservices/nmclientapi/src/nmapifolderlisting_p.cpp Thu Sep 30 11:43:07 2010 +0300 +++ b/emailservices/nmclientapi/src/nmapifolderlisting_p.cpp Thu Oct 14 17:33:43 2010 +0300 @@ -65,9 +65,9 @@ Caller gets ownership of messages. Returns true if results were available. It clears list of folders after be called. - It also at start clear inputlist of NmFolder. + It also at start clear inputlist of NmApiFolder. */ -bool NmApiFolderListingPrivate::folders(QList &folders) +bool NmApiFolderListingPrivate::folders(QList &folders) { NM_FUNCTION; bool ret(mIsRunning); diff -r 6c59112cfd31 -r 38bf5461e270 emailservices/nmclientapi/src/nmapimailbox.cpp --- a/emailservices/nmclientapi/src/nmapimailbox.cpp Thu Sep 30 11:43:07 2010 +0300 +++ b/emailservices/nmclientapi/src/nmapimailbox.cpp Thu Oct 14 17:33:43 2010 +0300 @@ -67,7 +67,7 @@ { NM_FUNCTION; - bool returnValue = false; + bool returnValue(false); if (d == mailbox.d) { returnValue = true; } diff -r 6c59112cfd31 -r 38bf5461e270 emailservices/nmclientapi/src/nmapimailboxlisting.cpp --- a/emailservices/nmclientapi/src/nmapimailboxlisting.cpp Thu Sep 30 11:43:07 2010 +0300 +++ b/emailservices/nmclientapi/src/nmapimailboxlisting.cpp Thu Oct 14 17:33:43 2010 +0300 @@ -19,7 +19,6 @@ namespace EmailClientApi { - /*! \class Class for creating list of all mailboxes */ @@ -33,7 +32,6 @@ NM_FUNCTION; mNmApiMailboxListingPrivate = new NmApiMailboxListingPrivate(this); - mNmApiMailboxListingPrivate->mIsRunning = false; } /*! @@ -42,10 +40,6 @@ NmApiMailboxListing::~NmApiMailboxListing() { NM_FUNCTION; - - if (mNmApiMailboxListingPrivate->mIsRunning) { - mNmApiMailboxListingPrivate->releaseEngine(); - } } /*! @@ -58,29 +52,10 @@ \return Return true if results were avaible \param mailboxes List of mailboxes to filled. On start is cleared. */ -bool NmApiMailboxListing::getMailboxes(QList &mailboxes) +bool NmApiMailboxListing::getMailboxes(QList &mailboxes) { NM_FUNCTION; - - mailboxes.clear(); - - bool result = false; - - if (!mNmApiMailboxListingPrivate->mIsRunning) { - result = false; - } - else - if (mNmApiMailboxListingPrivate->mMailboxes.isEmpty()) { - result = false; - } - else { - mailboxes = mNmApiMailboxListingPrivate->mMailboxes; - - mNmApiMailboxListingPrivate->mMailboxes.clear(); - - result = true; - } - return result; + return mNmApiMailboxListingPrivate->mailboxes(mailboxes); } /*! @@ -101,28 +76,11 @@ bool NmApiMailboxListing::start() { NM_FUNCTION; - - bool result = false; - if (mNmApiMailboxListingPrivate->mIsRunning) { - result = true; - } - else - if (!mNmApiMailboxListingPrivate->initializeEngine()) { - QMetaObject::invokeMethod(this, "mailboxesListed", Qt::QueuedConnection, Q_ARG(qint32, - (qint32) MailboxListingFailed)); - result = false; - } - else { - qint32 mailboxCount = mNmApiMailboxListingPrivate->grabMailboxes(); + qint32 mailboxCount = mNmApiMailboxListingPrivate->listMailboxes(); + QMetaObject::invokeMethod(this, "mailboxesListed", Qt::QueuedConnection, + Q_ARG(qint32, mailboxCount)); - mNmApiMailboxListingPrivate->mIsRunning = true; - - QMetaObject::invokeMethod(this, "mailboxesListed", Qt::QueuedConnection, Q_ARG(qint32, - mailboxCount)); - - result = true; - } - return result; + return true; } /*! @@ -136,14 +94,8 @@ { NM_FUNCTION; - if (mNmApiMailboxListingPrivate->mIsRunning) { - - mNmApiMailboxListingPrivate->mIsRunning = false; - mNmApiMailboxListingPrivate->releaseEngine(); - mNmApiMailboxListingPrivate->mMailboxes.clear(); - - QMetaObject::invokeMethod(this, "canceled", Qt::QueuedConnection); - } + mNmApiMailboxListingPrivate->cancel(); + emit canceled(); } /*! @@ -154,9 +106,8 @@ bool NmApiMailboxListing::isRunning() const { NM_FUNCTION; - - return mNmApiMailboxListingPrivate->mIsRunning; + return mNmApiMailboxListingPrivate->isRunning(); +} } -} diff -r 6c59112cfd31 -r 38bf5461e270 emailservices/nmclientapi/src/nmapimailboxlisting_p.cpp --- a/emailservices/nmclientapi/src/nmapimailboxlisting_p.cpp Thu Sep 30 11:43:07 2010 +0300 +++ b/emailservices/nmclientapi/src/nmapimailboxlisting_p.cpp Thu Oct 14 17:33:43 2010 +0300 @@ -17,70 +17,74 @@ #include "nmapiheaders.h" - namespace EmailClientApi { -NmApiMailboxListingPrivate::NmApiMailboxListingPrivate(QObject *parent) : - QObject(parent), mNmApiEngine(NULL) +NmApiMailboxListingPrivate::NmApiMailboxListingPrivate(QObject *parent) +:QObject(parent), +mEngine(NULL), +mIsRunning(false) { NM_FUNCTION; + mEngine = NmApiEngine::instance(); } NmApiMailboxListingPrivate::~NmApiMailboxListingPrivate() { NM_FUNCTION; -} - -/*! - \brief It initialize engine for email operations. - - When use initializeEngine need to remember release it. - It return value if initialization go good. - \sa releaseEngine - \return Return true if engine is good initilialized. - */ -bool NmApiMailboxListingPrivate::initializeEngine() -{ - NM_FUNCTION; - - if (!mNmApiEngine) { - mNmApiEngine = NmApiEngine::instance(); - } - - return mNmApiEngine ? true : false; + NmApiEngine::releaseInstance(mEngine); } /*! - \brief It release engine for email operations. - - \sa initializeEngine + \brief Get mailboxes from engine. + \return Count of mailboxes */ -void NmApiMailboxListingPrivate::releaseEngine() +qint32 NmApiMailboxListingPrivate::listMailboxes() { NM_FUNCTION; + mIsRunning = true; + mMailboxes.clear(); + mEngine->listMailboxes(mMailboxes); + return mMailboxes.count(); +} + +/*! + \brief Returns results after mailboxesListed signal is received. + + Caller gets ownership of mailboxes. Returns true if results were available. + It clears list of mailboxes (in private members) after be called. + It also at start clear inputlist of NmApiMailbox. - NmApiEngine::releaseInstance(mNmApiEngine); + \return Return true if results were avaible + \param mailboxes List of mailboxes to filled. On start is cleared. + */ +bool NmApiMailboxListingPrivate::mailboxes(QList &mailboxes) +{ + mailboxes.clear(); + + + bool ret(mIsRunning); + mailboxes.clear(); + while (!mMailboxes.isEmpty()) { + mailboxes << mMailboxes.takeFirst(); + } + mIsRunning = false; + return ret; +} +/*! + \brief Return info if listing is running + */ +bool NmApiMailboxListingPrivate::isRunning() const +{ + NM_FUNCTION; + return mIsRunning; } /*! - \brief It grab mailboxes from engine. - - When it start grabing, it release all old. - Because it uses NmApiMailbox with sharedData we don't need care about release memory. - - \return Count of mailboxes or "-1" if there is no engine + \brief Clears list of mailboxes. */ -qint32 NmApiMailboxListingPrivate::grabMailboxes() +void NmApiMailboxListingPrivate::cancel() { - NM_FUNCTION; - - if (!mNmApiEngine) { - return -1; - } - + mIsRunning = false; mMailboxes.clear(); - - mNmApiEngine->listMailboxes(mMailboxes); - return mMailboxes.count(); } } diff -r 6c59112cfd31 -r 38bf5461e270 emailservices/nmclientapi/src/nmapimessage.cpp --- a/emailservices/nmclientapi/src/nmapimessage.cpp Thu Sep 30 11:43:07 2010 +0300 +++ b/emailservices/nmclientapi/src/nmapimessage.cpp Thu Oct 14 17:33:43 2010 +0300 @@ -48,9 +48,9 @@ NmApiMessage& NmApiMessage::operator=(const NmApiMessage &other) { - if (this == &other) + if (this == &other) { return *this; - + } d = other.d; return *this; diff -r 6c59112cfd31 -r 38bf5461e270 emailservices/nmclientapi/src/nmapimessagebody.cpp --- a/emailservices/nmclientapi/src/nmapimessagebody.cpp Thu Sep 30 11:43:07 2010 +0300 +++ b/emailservices/nmclientapi/src/nmapimessagebody.cpp Thu Oct 14 17:33:43 2010 +0300 @@ -46,8 +46,7 @@ { NM_FUNCTION; - if (this != &apiMessageBody) - { + if (this != &apiMessageBody) { d = apiMessageBody.d; } return *this; @@ -61,8 +60,7 @@ NM_FUNCTION; bool retVal = false; - if (this->d == apiMessageBody.d) - { + if (this->d == apiMessageBody.d) { retVal = true; } return retVal; diff -r 6c59112cfd31 -r 38bf5461e270 emailservices/nmclientapi/src/nmapimessageenvelope.cpp --- a/emailservices/nmclientapi/src/nmapimessageenvelope.cpp Thu Sep 30 11:43:07 2010 +0300 +++ b/emailservices/nmclientapi/src/nmapimessageenvelope.cpp Thu Oct 14 17:33:43 2010 +0300 @@ -17,8 +17,6 @@ #include "nmapiheaders.h" - - namespace EmailClientApi { @@ -177,7 +175,7 @@ /*! getter for to recipients */ -void NmApiMessageEnvelope::getToRecipients(QList &toRecipients) +void NmApiMessageEnvelope::getToRecipients(QList &toRecipients) { NM_FUNCTION; @@ -187,7 +185,7 @@ /*! getter for cc recipients */ -void NmApiMessageEnvelope::getCcRecipients(QList &ccRecipients) +void NmApiMessageEnvelope::getCcRecipients(QList &ccRecipients) { NM_FUNCTION; @@ -197,7 +195,7 @@ /*! getter for bcc recipients */ -void NmApiMessageEnvelope::getBccRecipients(QList &bccRecipients) +void NmApiMessageEnvelope::getBccRecipients(QList &bccRecipients) { NM_FUNCTION; @@ -267,7 +265,7 @@ /*! getter for plaintext body */ -void NmApiMessageEnvelope::getPlainTextBody(EmailClientApi::NmApiMessageBody &body) +void NmApiMessageEnvelope::getPlainTextBody(NmApiMessageBody &body) { NM_FUNCTION; @@ -330,7 +328,7 @@ setter for to recipients */ void NmApiMessageEnvelope::setToRecipients( - const QList &toRecipients) + const QList &toRecipients) { NM_FUNCTION; @@ -341,7 +339,7 @@ setter for cc recipients */ void NmApiMessageEnvelope::setCcRecipients( - const QList &ccRecipients) + const QList &ccRecipients) { NM_FUNCTION; @@ -352,7 +350,7 @@ setter for bcc recipients */ void NmApiMessageEnvelope::setBccRecipients( - const QList &bccRecipients) + const QList &bccRecipients) { NM_FUNCTION; diff -r 6c59112cfd31 -r 38bf5461e270 emailservices/nmclientapi/src/nmapimessagemanager_p.cpp --- a/emailservices/nmclientapi/src/nmapimessagemanager_p.cpp Thu Sep 30 11:43:07 2010 +0300 +++ b/emailservices/nmclientapi/src/nmapimessagemanager_p.cpp Thu Oct 14 17:33:43 2010 +0300 @@ -96,6 +96,7 @@ */ QPointer NmApiMessageManagerPrivate::saveMessage(const NmApiMessage &message) { + Q_UNUSED(message); return NULL; } diff -r 6c59112cfd31 -r 38bf5461e270 emailservices/nmclientapi/src/nmapimessagesearch.cpp --- a/emailservices/nmclientapi/src/nmapimessagesearch.cpp Thu Sep 30 11:43:07 2010 +0300 +++ b/emailservices/nmclientapi/src/nmapimessagesearch.cpp Thu Oct 14 17:33:43 2010 +0300 @@ -25,7 +25,7 @@ { NM_FUNCTION; d = new NmApiMessageSearchPrivate(mailboxId, this); - qRegisterMetaType ("EmailClientApi::NmApiMessage"); + qRegisterMetaType("EmailClientApi::NmApiMessage"); connect(d, SIGNAL(messageFound(EmailClientApi::NmApiMessage&)), this, SIGNAL(messageFound(EmailClientApi::NmApiMessage&))); connect(d, SIGNAL(searchComplete(int)), this, SIGNAL(searchComplete(int))); connect(d, SIGNAL(canceled()), this, SIGNAL(canceled())); diff -r 6c59112cfd31 -r 38bf5461e270 emailservices/nmclientapi/src/nmapimessagesearch_p.cpp --- a/emailservices/nmclientapi/src/nmapimessagesearch_p.cpp Thu Sep 30 11:43:07 2010 +0300 +++ b/emailservices/nmclientapi/src/nmapimessagesearch_p.cpp Thu Oct 14 17:33:43 2010 +0300 @@ -17,6 +17,9 @@ #include "nmapiheaders.h" +namespace EmailClientApi +{ + /*! \class NmApiMessageSearchPrivate \brief A Qt wrapper class for MFSMailBoxSearchObserver. @@ -115,7 +118,7 @@ if (aMatchMessage) { NmMessage *nmmessage = aMatchMessage->GetNmMessage(); - EmailClientApi::NmApiMessage message = NmToApiConverter::NmMessage2NmApiMessage(*nmmessage); + NmApiMessage message = NmToApiConverter::NmMessage2NmApiMessage(*nmmessage); emit messageFound(message); delete nmmessage; @@ -135,7 +138,7 @@ { NM_FUNCTION; mIsRunning = false; - emit searchComplete(EmailClientApi::NmApiNoError); + emit searchComplete(NmApiNoError); } @@ -180,7 +183,7 @@ Initialize search criterias. */ -bool NmApiMessageSearchPrivate::initialise(const QList &searchStrings, EmailClientApi::NmApiMailSortCriteria sortCriteria) +bool NmApiMessageSearchPrivate::initialise(const QList &searchStrings, NmApiMailSortCriteria sortCriteria) { NM_FUNCTION; bool ret = false; @@ -231,4 +234,5 @@ } } } +} // End of file. diff -r 6c59112cfd31 -r 38bf5461e270 emailservices/nmclientapi/src/nmapioperationcreatedraftmessage.cpp --- a/emailservices/nmclientapi/src/nmapioperationcreatedraftmessage.cpp Thu Sep 30 11:43:07 2010 +0300 +++ b/emailservices/nmclientapi/src/nmapioperationcreatedraftmessage.cpp Thu Oct 14 17:33:43 2010 +0300 @@ -16,8 +16,8 @@ */ #include "nmapiheaders.h" - - +namespace EmailClientApi +{ /*! Class constructor. */ @@ -87,7 +87,7 @@ if (status == TFSProgress::EFSStatus_RequestComplete && aEvent.iParam) { CFSMailMessage *fsMessage = static_cast(aEvent.iParam); NmMessage *nmmessage = fsMessage->GetNmMessage(); - EmailClientApi::NmApiMessage apimessage = NmToApiConverter::NmMessage2NmApiMessage(*nmmessage); + NmApiMessage apimessage = NmToApiConverter::NmMessage2NmApiMessage(*nmmessage); QVariant qmessage; qmessage.setValue(apimessage); mStatus = Succeeded; @@ -109,4 +109,5 @@ } } } +} diff -r 6c59112cfd31 -r 38bf5461e270 emailservices/nmclientapi/src/nmapipopimapsettingsmanager.cpp --- a/emailservices/nmclientapi/src/nmapipopimapsettingsmanager.cpp Thu Sep 30 11:43:07 2010 +0300 +++ b/emailservices/nmclientapi/src/nmapipopimapsettingsmanager.cpp Thu Oct 14 17:33:43 2010 +0300 @@ -25,8 +25,8 @@ static const unsigned int DefaultImapPortSsl = 993; static const unsigned int DefaultSmtpPortSsl = 465; -using namespace EmailClientApi; - +namespace EmailClientApi +{ NmApiPopImapSettingsManager::NmApiPopImapSettingsManager() { NM_FUNCTION; @@ -283,7 +283,7 @@ NM_FUNCTION; data.setValue(DownloadPictures, int(0)); data.setValue(MessageDivider, int(0)); - data.setValue(ReceptionActiveProfile, EmailClientApi::EmailProfileOffsetSE); + data.setValue(ReceptionActiveProfile, EmailProfileOffsetSE); data.setValue(ReceptionUserDefinedProfile, int(0)); // 0, because default profile is save energy data.setValue(ReceptionInboxSyncWindow, IpsServices::DefaultValueSaveEnergyInboxSyncWindow); data.setValue(ReceptionGenericSyncWindowInMessages, int(0)); // all messages @@ -294,3 +294,5 @@ data.setValue(ReceptionRefreshPeriodDayTime, IpsServices::DefaultValueSaveEnergyReceptionRefreshPeriodDayTime); data.setValue(UserNameHidden, int(0)); } +} + diff -r 6c59112cfd31 -r 38bf5461e270 emailservices/nmclientapi/src/nmapisettingsmanager_p.cpp --- a/emailservices/nmclientapi/src/nmapisettingsmanager_p.cpp Thu Sep 30 11:43:07 2010 +0300 +++ b/emailservices/nmclientapi/src/nmapisettingsmanager_p.cpp Thu Oct 14 17:33:43 2010 +0300 @@ -187,19 +187,19 @@ if (!activeProfileSetting.isNull()) { switch (activeProfileSetting.toInt()) { case IpsServices::EmailSyncProfileKeepUpToDate: - data.setValue(ReceptionActiveProfile, EmailClientApi::EmailProfileOffsetKUTD); + data.setValue(ReceptionActiveProfile, EmailProfileOffsetKUTD); break; case IpsServices::EmailSyncProfileSaveEnergy: - data.setValue(ReceptionActiveProfile, EmailClientApi::EmailProfileOffsetSE); + data.setValue(ReceptionActiveProfile, EmailProfileOffsetSE); break; case IpsServices::EmailSyncProfileManualFetch: - data.setValue(ReceptionActiveProfile, EmailClientApi::EmailProfileOffsetMF); + data.setValue(ReceptionActiveProfile, EmailProfileOffsetMF); break; case IpsServices::EmailSyncProfileUserDefined: - data.setValue(ReceptionActiveProfile, EmailClientApi::EmailProfileOffsetUD); + data.setValue(ReceptionActiveProfile, EmailProfileOffsetUD); break; default: - data.setValue(ReceptionActiveProfile, EmailClientApi::EmailProfileOffsetKUTD); + data.setValue(ReceptionActiveProfile, EmailProfileOffsetKUTD); break; } } @@ -341,6 +341,7 @@ void NmApiSettingsManagerPrivate::fillSmtpSettingDataL(const NmApiMailboxSettingsData &data, const QVariant settingValue, const int key) { + Q_UNUSED(data); switch (key) { case EmailAddress: mSmtpSettings->SetEmailAddressL(StringToS60TPtrC(settingValue.toString())); @@ -421,13 +422,13 @@ if (data.getValue(ReceptionActiveProfile, settingValue) && !settingValue.isNull()) { QVariant profileOffset = 0; - if(settingValue.toString() == EmailClientApi::EmailProfileOffsetKUTD) { + if(settingValue.toString() == EmailProfileOffsetKUTD) { profileOffset = 0; - } else if(settingValue.toString() == EmailClientApi::EmailProfileOffsetSE){ + } else if(settingValue.toString() == EmailProfileOffsetSE){ profileOffset = 1; - } else if (settingValue.toString() == EmailClientApi::EmailProfileOffsetMF){ + } else if (settingValue.toString() == EmailProfileOffsetMF){ profileOffset = 2; - } else if (settingValue.toString() == EmailClientApi::EmailProfileOffsetUD) { + } else if (settingValue.toString() == EmailProfileOffsetUD) { profileOffset = 3; } ret = writeToCenRep(IpsServices::EmailKeyReceptionActiveProfile, profileOffset); diff -r 6c59112cfd31 -r 38bf5461e270 emailservices/nmclientapi/src/nmapitypesconverter.cpp --- a/emailservices/nmclientapi/src/nmapitypesconverter.cpp Thu Sep 30 11:43:07 2010 +0300 +++ b/emailservices/nmclientapi/src/nmapitypesconverter.cpp Thu Oct 14 17:33:43 2010 +0300 @@ -17,86 +17,110 @@ #include "nmapiheaders.h" +namespace EmailClientApi +{ /*! converts nmmailbox to client api NmApiMailbox */ -EmailClientApi::NmApiMailbox NmToApiConverter::NmMailbox2NmApiMailbox(const NmMailbox &mailbox) +NmApiMailbox NmToApiConverter::NmMailbox2NmApiMailbox(const NmMailbox &mailbox) { NM_FUNCTION; - EmailClientApi::NmApiMailbox api_mailbox; - api_mailbox.setId(mailbox.id().id()); - api_mailbox.setName(mailbox.name()); + NmApiMailbox apiMailbox; + apiMailbox.setId(mailbox.id().id()); + apiMailbox.setName(mailbox.name()); NmMailbox tmp(mailbox); - api_mailbox.setAddress(tmp.address().address()); - return api_mailbox; + apiMailbox.setAddress(tmp.address().address()); + return apiMailbox; } /*! converts NmFolder to client api NmFolder */ -EmailClientApi::NmApiFolder NmToApiConverter::NmFolder2NmApiFolder(const NmFolder &folder) +NmApiFolder NmToApiConverter::NmFolder2NmApiFolder(const NmFolder &folder) { NM_FUNCTION; - EmailClientApi::NmApiFolder api_folder; + NmApiFolder apiFolder; + + apiFolder.setParentFolderId(folder.parentId().id()); + apiFolder.setId(folder.folderId().id()); + apiFolder.setName(folder.name()); - api_folder.setParentFolderId(folder.parentId().id()); - api_folder.setId(folder.folderId().id()); - api_folder.setName(folder.name()); - api_folder.setFolderType((EmailClientApi::NmApiEmailFolderType) folder.folderType()); - return api_folder; + switch ( folder.folderType() ) + { + case NmFolderInbox: + apiFolder.setFolderType(EmailClientApi::Inbox); + break; + case NmFolderOutbox: + apiFolder.setFolderType(EmailClientApi::Outbox); + break; + case NmFolderDrafts: + apiFolder.setFolderType(EmailClientApi::Drafts); + break; + case NmFolderSent: + apiFolder.setFolderType(EmailClientApi::Sent); + break; + case NmFolderDeleted: + apiFolder.setFolderType(EmailClientApi::Deleted); + break; + case NmFolderOther: + default: + apiFolder.setFolderType(EmailClientApi::EOther); + break; + } + return apiFolder; } /*! converts NmMessageEnvelope to client api NmApiMessageEnvelope */ -EmailClientApi::NmApiMessageEnvelope NmToApiConverter::NmMessageEnvelope2NmApiMessageEnvelope( +NmApiMessageEnvelope NmToApiConverter::NmMessageEnvelope2NmApiMessageEnvelope( const NmMessageEnvelope &envelope) { NM_FUNCTION; - EmailClientApi::NmApiMessageEnvelope api_env; + NmApiMessageEnvelope apiEnv; QList to = envelope.toRecipients(); QList cc = envelope.ccRecipients(); QList bcc = envelope.bccRecipients(); - QList to_api = NmAddress2QString(to); - QList cc_api = NmAddress2QString(cc); - QList bcc_api = NmAddress2QString(bcc); + QList to_api = NmAddress2QString(to); + QList cc_api = NmAddress2QString(cc); + QList bcc_api = NmAddress2QString(bcc); - api_env.setToRecipients(to_api); - api_env.setCcRecipients(cc_api); - api_env.setBccRecipients(bcc_api); + apiEnv.setToRecipients(to_api); + apiEnv.setCcRecipients(cc_api); + apiEnv.setBccRecipients(bcc_api); - api_env.setHasAttachments(envelope.hasAttachments()); - api_env.setId(envelope.messageId().id()); - api_env.setIsForwarded(envelope.isForwarded()); - api_env.setIsRead(envelope.isRead()); - api_env.setIsReplied(envelope.isReplied()); - api_env.setParentFolder(envelope.folderId().id()); + apiEnv.setHasAttachments(envelope.hasAttachments()); + apiEnv.setId(envelope.messageId().id()); + apiEnv.setIsForwarded(envelope.isForwarded()); + apiEnv.setIsRead(envelope.isRead()); + apiEnv.setIsReplied(envelope.isReplied()); + apiEnv.setParentFolder(envelope.folderId().id()); - api_env.setSender(envelope.sender().address()); - api_env.setSentTime(envelope.sentTime()); - api_env.setSubject(envelope.subject()); + apiEnv.setSender(envelope.sender().address()); + apiEnv.setSentTime(envelope.sentTime()); + apiEnv.setSubject(envelope.subject()); NmId mailboxId(envelope.mailboxId()); - api_env.setMailboxId(mailboxId.id()); - api_env.setFlags(static_cast(static_cast(envelope.flags())), true); + apiEnv.setMailboxId(mailboxId.id()); + apiEnv.setFlags(static_cast(static_cast(envelope.flags())), true); - return api_env; + return apiEnv; } /*! converts QList of NmAddresses to Qlist of email client apis NmApiEmailAddresses */ -QList NmToApiConverter::NmAddress2QString( +QList NmToApiConverter::NmAddress2QString( const QList &addresses) { NM_FUNCTION; - QList nmAddresses; + QList nmAddresses; for (int i = 0; i < addresses.count(); i++) { - EmailClientApi::NmApiEmailAddress addr; + NmApiEmailAddress addr; addr.setAddress(addresses[i].address()); addr.setDisplayName(addresses[i].displayName()); @@ -109,52 +133,56 @@ /*! converts nmmessage to client api NmApiMessage */ -EmailClientApi::NmApiMessage NmToApiConverter::NmMessage2NmApiMessage(NmMessage &message) +NmApiMessage NmToApiConverter::NmMessage2NmApiMessage(NmMessage &message) { NM_FUNCTION; - EmailClientApi::NmApiMessage api_message; + NmApiMessage apiMessage; QList attachments; message.attachmentList(attachments); if (attachments.size() > 0){ - QList api_attachments; + QList apiAttachments; for (int i = 0; i < attachments.size(); i++){ NmMessagePart *part = attachments.at(i); - if (part->contentType().compare(EmailClientApi::NmApiContentTypeTextPlain) != 0 && - part->contentType().compare(EmailClientApi::NmApiContentTypeTextHtml) != 0) { - EmailClientApi::NmApiAttachment api_attachment; - api_attachment.setFileName(part->attachmentName()); - api_attachment.setId(part->partId().id()); - api_attachment.setContentType(part->contentType()); - api_attachment.setSize(part->size()); - api_attachments.append(api_attachment); + if (part->contentType().compare(NmApiContentTypeTextPlain) != 0 && + part->contentType().compare(NmApiContentTypeTextHtml) != 0) { + NmApiAttachment apiAttachment; + apiAttachment.setFileName(part->attachmentName()); + apiAttachment.setId(part->partId().id()); + apiAttachment.setContentType(part->contentType()); + apiAttachment.setSize(part->size()); + apiAttachments.append(apiAttachment); } } - api_message.setAttachments(api_attachments); + apiMessage.setAttachments(apiAttachments); } - EmailClientApi::NmApiMessageEnvelope api_envelope = NmMessageEnvelope2NmApiMessageEnvelope(message.envelope()); - api_message.setEnvelope(api_envelope); + NmApiMessageEnvelope apiEnvelope = NmMessageEnvelope2NmApiMessageEnvelope(message.envelope()); + apiMessage.setEnvelope(apiEnvelope); const NmMessagePart *plaintext = message.plainTextBodyPart(); if (plaintext) { - EmailClientApi::NmApiTextContent api_plaintext; - api_plaintext.setContent(plaintext->textContent()); - api_plaintext.setId(plaintext->partId().id()); - api_plaintext.setContentType(plaintext->contentType()); - api_plaintext.setSize(plaintext->size()); - api_message.setPlainTextContent(api_plaintext); + NmApiTextContent apiPlainText; + apiPlainText.setContent(plaintext->textContent()); + apiPlainText.setId(plaintext->partId().id()); + apiPlainText.setContentType(plaintext->contentType()); + apiPlainText.setSize(plaintext->size()); + apiMessage.setPlainTextContent(apiPlainText); } const NmMessagePart *htmlcontent = message.htmlBodyPart(); if (htmlcontent) { - EmailClientApi::NmApiTextContent api_htmlcontent; - api_htmlcontent.setContent(htmlcontent->textContent()); - api_htmlcontent.setId(htmlcontent->partId().id()); - api_htmlcontent.setContentType(htmlcontent->contentType()); - api_htmlcontent.setSize(htmlcontent->size()); - api_message.setHtmlContent(api_htmlcontent); + NmApiTextContent apiHtmlContent; + apiHtmlContent.setContent(htmlcontent->textContent()); + apiHtmlContent.setId(htmlcontent->partId().id()); + apiHtmlContent.setContentType(htmlcontent->contentType()); + apiHtmlContent.setSize(htmlcontent->size()); + apiMessage.setHtmlContent(apiHtmlContent); } - return api_message; + return apiMessage; +} } + + + diff -r 6c59112cfd31 -r 38bf5461e270 emailservices/nmutilities/bwins/nmutilitiesu.def --- a/emailservices/nmutilities/bwins/nmutilitiesu.def Thu Sep 30 11:43:07 2010 +0300 +++ b/emailservices/nmutilities/bwins/nmutilitiesu.def Thu Oct 14 17:33:43 2010 +0300 @@ -1,78 +1,78 @@ EXPORTS - ?entryIndex@EmailMRU@@CAHH@Z @ 1 NONAME ; int EmailMRU::entryIndex(int) - ??0NmContactHistoryModel@@QAE@W4NmContactHistoryModelType@@@Z @ 2 NONAME ; NmContactHistoryModel::NmContactHistoryModel(enum NmContactHistoryModelType) - ?tr@NmUiEventsNotifier@@SA?AVQString@@PBD0@Z @ 3 NONAME ; class QString NmUiEventsNotifier::tr(char const *, char const *) - ??0NmUriParser@@QAE@XZ @ 4 NONAME ; NmUriParser::NmUriParser(void) - ?writeCenRep@EmailMRU@@AAE_NHVQString@@@Z @ 5 NONAME ; bool EmailMRU::writeCenRep(int, class QString) - ?contactId@NmContactHistoryModelItem@@QBEIXZ @ 6 NONAME ; unsigned int NmContactHistoryModelItem::contactId(void) const - ?qt_metacall@NmUiEventsNotifier@@UAEHW4Call@QMetaObject@@HPAPAX@Z @ 7 NONAME ; int NmUiEventsNotifier::qt_metacall(enum QMetaObject::Call, int, void * *) - ?appendSubItem@NmContactHistoryModelItem@@QAEXVNmContactHistoryModelSubItem@@@Z @ 8 NONAME ; void NmContactHistoryModelItem::appendSubItem(class NmContactHistoryModelSubItem) - ?staticMetaObject@NmContactHistoryModel@@2UQMetaObject@@B @ 9 NONAME ; struct QMetaObject const NmContactHistoryModel::staticMetaObject - ?toAddresses@NmUriParser@@QBE?AVQStringList@@XZ @ 10 NONAME ; class QStringList NmUriParser::toAddresses(void) const - ?bodyText@NmUriParser@@QBE?AVQString@@XZ @ 11 NONAME ; class QString NmUriParser::bodyText(void) const - ?entryCount@EmailMRU@@QBEIXZ @ 12 NONAME ; unsigned int EmailMRU::entryCount(void) const - ?qt_metacall@NmContactHistoryModel@@UAEHW4Call@QMetaObject@@HPAPAX@Z @ 13 NONAME ; int NmContactHistoryModel::qt_metacall(enum QMetaObject::Call, int, void * *) - ??0NmContactHistoryModelItem@@QAE@XZ @ 14 NONAME ; NmContactHistoryModelItem::NmContactHistoryModelItem(void) - ?keysEqual@NmUiEventsNotifier@@ABE_NABVXQSettingsKey@@ABVXQPublishAndSubscribeSettingsKey@@@Z @ 15 NONAME ; bool NmUiEventsNotifier::keysEqual(class XQSettingsKey const &, class XQPublishAndSubscribeSettingsKey const &) const - ?getNextEntryIndex@EmailMRU@@AAEIXZ @ 16 NONAME ; unsigned int EmailMRU::getNextEntryIndex(void) - ??_ENmContactHistoryModelItem@@UAE@I@Z @ 17 NONAME ; NmContactHistoryModelItem::~NmContactHistoryModelItem(unsigned int) - ??1EmailMRU@@UAE@XZ @ 18 NONAME ; EmailMRU::~EmailMRU(void) - ?writeEntry@EmailMRU@@AAE_NHVQString@@0@Z @ 19 NONAME ; bool EmailMRU::writeEntry(int, class QString, class QString) - ?viewStateChanged@NmUiEventsNotifier@@IAEXW4NmUiEventType@1@W4NmUiViewId@@VNmId@@@Z @ 20 NONAME ; void NmUiEventsNotifier::viewStateChanged(enum NmUiEventsNotifier::NmUiEventType, enum NmUiViewId, class NmId) - ?trUtf8@NmUiEventsNotifier@@SA?AVQString@@PBD0@Z @ 21 NONAME ; class QString NmUiEventsNotifier::trUtf8(char const *, char const *) - ?reset@EmailMRU@@QAEXXZ @ 22 NONAME ; void EmailMRU::reset(void) - ?qt_metacast@NmContactHistoryModel@@UAEPAXPBD@Z @ 23 NONAME ; void * NmContactHistoryModel::qt_metacast(char const *) - ?parseKeyValue@NmUiEventsNotifier@@ABE_NABVQByteArray@@AAW4NmUiEventType@1@AAW4NmUiViewId@@AAVNmId@@@Z @ 24 NONAME ; bool NmUiEventsNotifier::parseKeyValue(class QByteArray const &, enum NmUiEventsNotifier::NmUiEventType &, enum NmUiViewId &, class NmId &) const - ??_EEmailMRU@@UAE@I@Z @ 25 NONAME ; EmailMRU::~EmailMRU(unsigned int) - ?addressKeyByEntryIndex@EmailMRU@@CAHH@Z @ 26 NONAME ; int EmailMRU::addressKeyByEntryIndex(int) - ?metaObject@NmContactHistoryModel@@UBEPBUQMetaObject@@XZ @ 27 NONAME ; struct QMetaObject const * NmContactHistoryModel::metaObject(void) const - ??0NmUiEventsNotifier@@QAE@PAVQObject@@@Z @ 28 NONAME ; NmUiEventsNotifier::NmUiEventsNotifier(class QObject *) + ?extractData@NmUriParser@@QAE_NABVQString@@@Z @ 1 NONAME ; bool NmUriParser::extractData(class QString const &) + ??0NmUiEventsNotifier@@QAE@PAVQObject@@@Z @ 2 NONAME ; NmUiEventsNotifier::NmUiEventsNotifier(class QObject *) + ?handleQueryCompleted@NmContactHistoryModel@@AAEXH@Z @ 3 NONAME ; void NmContactHistoryModel::handleQueryCompleted(int) + ?tr@NmContactHistoryModel@@SA?AVQString@@PBD0H@Z @ 4 NONAME ; class QString NmContactHistoryModel::tr(char const *, char const *, int) + ?trUtf8@NmUiEventsNotifier@@SA?AVQString@@PBD0@Z @ 5 NONAME ; class QString NmUiEventsNotifier::trUtf8(char const *, char const *) + ??0EmailMRU@@QAE@XZ @ 6 NONAME ; EmailMRU::EmailMRU(void) + ?subItemAt@NmContactHistoryModelItem@@QBE?AVNmContactHistoryModelSubItem@@H@Z @ 7 NONAME ; class NmContactHistoryModelSubItem NmContactHistoryModelItem::subItemAt(int) const + ??1NmContactHistoryModelItem@@UAE@XZ @ 8 NONAME ; NmContactHistoryModelItem::~NmContactHistoryModelItem(void) + ?addAddressesToList@NmUriParser@@AAEXAAVQString@@AAVQStringList@@@Z @ 9 NONAME ; void NmUriParser::addAddressesToList(class QString &, class QStringList &) + ??1EmailMailboxInfo@@QAE@XZ @ 10 NONAME ; EmailMailboxInfo::~EmailMailboxInfo(void) + ?staticMetaObject@NmContactHistoryModel@@2UQMetaObject@@B @ 11 NONAME ; struct QMetaObject const NmContactHistoryModel::staticMetaObject + ?qt_metacall@NmUiEventsNotifier@@UAEHW4Call@QMetaObject@@HPAPAX@Z @ 12 NONAME ; int NmUiEventsNotifier::qt_metacall(enum QMetaObject::Call, int, void * *) + ?notifyViewStateChanged@NmUiEventsNotifier@@SA_NW4NmUiEventType@1@W4NmUiViewId@@ABVNmId@@@Z @ 13 NONAME ; bool NmUiEventsNotifier::notifyViewStateChanged(enum NmUiEventsNotifier::NmUiEventType, enum NmUiViewId, class NmId const &) + ??1EmailMRU@@UAE@XZ @ 14 NONAME ; EmailMRU::~EmailMRU(void) + ?addressKeyByEntryIndex@EmailMRU@@CAHH@Z @ 15 NONAME ; int EmailMRU::addressKeyByEntryIndex(int) + ??1NmUriParser@@QAE@XZ @ 16 NONAME ; NmUriParser::~NmUriParser(void) + ?trUtf8@NmContactHistoryModel@@SA?AVQString@@PBD0H@Z @ 17 NONAME ; class QString NmContactHistoryModel::trUtf8(char const *, char const *, int) + ?reset@EmailMRU@@QAEXXZ @ 18 NONAME ; void EmailMRU::reset(void) + ?valueChanged@NmUiEventsNotifier@@AAEXABVXQSettingsKey@@ABVQVariant@@@Z @ 19 NONAME ; void NmUiEventsNotifier::valueChanged(class XQSettingsKey const &, class QVariant const &) + ?appendSubItem@NmContactHistoryModelItem@@QAEXVNmContactHistoryModelSubItem@@@Z @ 20 NONAME ; void NmContactHistoryModelItem::appendSubItem(class NmContactHistoryModelSubItem) + ?getEntry@EmailMRU@@QAE_NHAAVQString@@0@Z @ 21 NONAME ; bool EmailMRU::getEntry(int, class QString &, class QString &) + ?getStaticMetaObject@NmUiEventsNotifier@@SAABUQMetaObject@@XZ @ 22 NONAME ; struct QMetaObject const & NmUiEventsNotifier::getStaticMetaObject(void) + ?writeEntry@EmailMRU@@AAE_NHABVQString@@0@Z @ 23 NONAME ; bool EmailMRU::writeEntry(int, class QString const &, class QString const &) + ??_ENmUiEventsNotifier@@UAE@I@Z @ 24 NONAME ; NmUiEventsNotifier::~NmUiEventsNotifier(unsigned int) + ?readCenRep@EmailMRU@@AAE?AVQString@@H@Z @ 25 NONAME ; class QString EmailMRU::readCenRep(int) + ?subEntries@NmContactHistoryModelItem@@QBE?AV?$QList@VNmContactHistoryModelSubItem@@@@XZ @ 26 NONAME ; class QList NmContactHistoryModelItem::subEntries(void) const + ??1NmContactHistoryModel@@UAE@XZ @ 27 NONAME ; NmContactHistoryModel::~NmContactHistoryModel(void) + ??0NmContactHistoryModelItem@@QAE@ABV0@@Z @ 28 NONAME ; NmContactHistoryModelItem::NmContactHistoryModelItem(class NmContactHistoryModelItem const &) ?bccAddresses@NmUriParser@@QBE?AVQStringList@@XZ @ 29 NONAME ; class QStringList NmUriParser::bccAddresses(void) const - ?trUtf8@NmUiEventsNotifier@@SA?AVQString@@PBD0H@Z @ 30 NONAME ; class QString NmUiEventsNotifier::trUtf8(char const *, char const *, int) - ?nameOrder@EmailMRU@@SAHXZ @ 31 NONAME ; int EmailMRU::nameOrder(void) - ??1NmContactHistoryModel@@UAE@XZ @ 32 NONAME ; NmContactHistoryModel::~NmContactHistoryModel(void) - ?rowCount@NmContactHistoryModel@@UBEHABVQModelIndex@@@Z @ 33 NONAME ; int NmContactHistoryModel::rowCount(class QModelIndex const &) const - ?mailboxIcon@EmailMailboxInfo@@QBE?AVQString@@ABV2@@Z @ 34 NONAME ; class QString EmailMailboxInfo::mailboxIcon(class QString const &) const - ?data@NmContactHistoryModel@@UBE?AVQVariant@@ABVQModelIndex@@H@Z @ 35 NONAME ; class QVariant NmContactHistoryModel::data(class QModelIndex const &, int) const - ?getStaticMetaObject@NmContactHistoryModel@@SAABUQMetaObject@@XZ @ 36 NONAME ; struct QMetaObject const & NmContactHistoryModel::getStaticMetaObject(void) - ??1NmUiEventsNotifier@@UAE@XZ @ 37 NONAME ; NmUiEventsNotifier::~NmUiEventsNotifier(void) - ?getEntry@EmailMRU@@QAE_NHAAVQString@@0@Z @ 38 NONAME ; bool EmailMRU::getEntry(int, class QString &, class QString &) - ?getStaticMetaObject@NmUiEventsNotifier@@SAABUQMetaObject@@XZ @ 39 NONAME ; struct QMetaObject const & NmUiEventsNotifier::getStaticMetaObject(void) - ?resetData@NmUriParser@@QAEXXZ @ 40 NONAME ; void NmUriParser::resetData(void) - ?metaObject@NmUiEventsNotifier@@UBEPBUQMetaObject@@XZ @ 41 NONAME ; struct QMetaObject const * NmUiEventsNotifier::metaObject(void) const - ?searchForAddress@EmailMRU@@AAEHVQString@@@Z @ 42 NONAME ; int EmailMRU::searchForAddress(class QString) - ?subItemCount@NmContactHistoryModelItem@@QBEHXZ @ 43 NONAME ; int NmContactHistoryModelItem::subItemCount(void) const - ?setContactId@NmContactHistoryModelItem@@QAEXI@Z @ 44 NONAME ; void NmContactHistoryModelItem::setContactId(unsigned int) - ?tr@NmUiEventsNotifier@@SA?AVQString@@PBD0H@Z @ 45 NONAME ; class QString NmUiEventsNotifier::tr(char const *, char const *, int) - ?mailboxName@EmailMailboxInfo@@QBE?AVQString@@ABV2@@Z @ 46 NONAME ; class QString EmailMailboxInfo::mailboxName(class QString const &) const - ?addAddressesToList@NmUriParser@@AAEXAAVQString@@AAVQStringList@@@Z @ 47 NONAME ; void NmUriParser::addAddressesToList(class QString &, class QStringList &) - ??_ENmContactHistoryModel@@UAE@I@Z @ 48 NONAME ; NmContactHistoryModel::~NmContactHistoryModel(unsigned int) - ?tr@NmContactHistoryModel@@SA?AVQString@@PBD0@Z @ 49 NONAME ; class QString NmContactHistoryModel::tr(char const *, char const *) - ??1NmUriParser@@QAE@XZ @ 50 NONAME ; NmUriParser::~NmUriParser(void) - ?valueChanged@NmUiEventsNotifier@@AAEXABVXQSettingsKey@@ABVQVariant@@@Z @ 51 NONAME ; void NmUiEventsNotifier::valueChanged(class XQSettingsKey const &, class QVariant const &) - ?handleQueryCompleted@NmContactHistoryModel@@AAEXH@Z @ 52 NONAME ; void NmContactHistoryModel::handleQueryCompleted(int) - ?subItemAt@NmContactHistoryModelItem@@QBE?AVNmContactHistoryModelSubItem@@H@Z @ 53 NONAME ; class NmContactHistoryModelSubItem NmContactHistoryModelItem::subItemAt(int) const - ?subject@NmUriParser@@QBE?AVQString@@XZ @ 54 NONAME ; class QString NmUriParser::subject(void) const - ?trUtf8@NmContactHistoryModel@@SA?AVQString@@PBD0@Z @ 55 NONAME ; class QString NmContactHistoryModel::trUtf8(char const *, char const *) - ??0NmContactHistoryModelItem@@QAE@ABV0@@Z @ 56 NONAME ; NmContactHistoryModelItem::NmContactHistoryModelItem(class NmContactHistoryModelItem const &) - ?moveEntry@EmailMRU@@AAEXHH@Z @ 57 NONAME ; void EmailMRU::moveEntry(int, int) - ?readCenRep@EmailMRU@@AAE?AVQString@@H@Z @ 58 NONAME ; class QString EmailMRU::readCenRep(int) - ?staticMetaObject@NmUiEventsNotifier@@2UQMetaObject@@B @ 59 NONAME ; struct QMetaObject const NmUiEventsNotifier::staticMetaObject - ?trUtf8@NmContactHistoryModel@@SA?AVQString@@PBD0H@Z @ 60 NONAME ; class QString NmContactHistoryModel::trUtf8(char const *, char const *, int) - ??1NmContactHistoryModelItem@@UAE@XZ @ 61 NONAME ; NmContactHistoryModelItem::~NmContactHistoryModelItem(void) - ??0EmailMailboxInfo@@QAE@XZ @ 62 NONAME ; EmailMailboxInfo::EmailMailboxInfo(void) - ??0EmailMRU@@QAE@XZ @ 63 NONAME ; EmailMRU::EmailMRU(void) - ?query@NmContactHistoryModel@@QAEXABVQString@@@Z @ 64 NONAME ; void NmContactHistoryModel::query(class QString const &) - ?nameKeyByEntryIndex@EmailMRU@@CAHH@Z @ 65 NONAME ; int EmailMRU::nameKeyByEntryIndex(int) - ?updateEntry@EmailMRU@@AAE_NHVQString@@@Z @ 66 NONAME ; bool EmailMRU::updateEntry(int, class QString) - ?qt_metacast@NmUiEventsNotifier@@UAEPAXPBD@Z @ 67 NONAME ; void * NmUiEventsNotifier::qt_metacast(char const *) - ?modelCompleted@NmContactHistoryModel@@IAEXH@Z @ 68 NONAME ; void NmContactHistoryModel::modelCompleted(int) - ?updateMRU@EmailMRU@@QAE_NVQString@@0@Z @ 69 NONAME ; bool EmailMRU::updateMRU(class QString, class QString) - ?notifyViewStateChanged@NmUiEventsNotifier@@SA_NW4NmUiEventType@1@W4NmUiViewId@@ABVNmId@@@Z @ 70 NONAME ; bool NmUiEventsNotifier::notifyViewStateChanged(enum NmUiEventsNotifier::NmUiEventType, enum NmUiViewId, class NmId const &) - ?tr@NmContactHistoryModel@@SA?AVQString@@PBD0H@Z @ 71 NONAME ; class QString NmContactHistoryModel::tr(char const *, char const *, int) - ?extractData@NmUriParser@@QAE_NABVQString@@@Z @ 72 NONAME ; bool NmUriParser::extractData(class QString const &) - ??_ENmUiEventsNotifier@@UAE@I@Z @ 73 NONAME ; NmUiEventsNotifier::~NmUiEventsNotifier(unsigned int) - ?ccAddresses@NmUriParser@@QBE?AVQStringList@@XZ @ 74 NONAME ; class QStringList NmUriParser::ccAddresses(void) const - ?subEntries@NmContactHistoryModelItem@@QBE?AV?$QList@VNmContactHistoryModelSubItem@@@@XZ @ 75 NONAME ; class QList NmContactHistoryModelItem::subEntries(void) const - ??1EmailMailboxInfo@@QAE@XZ @ 76 NONAME ; EmailMailboxInfo::~EmailMailboxInfo(void) + ?nameKeyByEntryIndex@EmailMRU@@CAHH@Z @ 30 NONAME ; int EmailMRU::nameKeyByEntryIndex(int) + ?tr@NmUiEventsNotifier@@SA?AVQString@@PBD0@Z @ 31 NONAME ; class QString NmUiEventsNotifier::tr(char const *, char const *) + ?setContactId@NmContactHistoryModelItem@@QAEXI@Z @ 32 NONAME ; void NmContactHistoryModelItem::setContactId(unsigned int) + ?data@NmContactHistoryModel@@UBE?AVQVariant@@ABVQModelIndex@@H@Z @ 33 NONAME ; class QVariant NmContactHistoryModel::data(class QModelIndex const &, int) const + ??_EEmailMRU@@UAE@I@Z @ 34 NONAME ; EmailMRU::~EmailMRU(unsigned int) + ?subItemCount@NmContactHistoryModelItem@@QBEHXZ @ 35 NONAME ; int NmContactHistoryModelItem::subItemCount(void) const + ??0NmContactHistoryModel@@QAE@W4NmContactHistoryModelType@@@Z @ 36 NONAME ; NmContactHistoryModel::NmContactHistoryModel(enum NmContactHistoryModelType) + ?ccAddresses@NmUriParser@@QBE?AVQStringList@@XZ @ 37 NONAME ; class QStringList NmUriParser::ccAddresses(void) const + ?tr@NmContactHistoryModel@@SA?AVQString@@PBD0@Z @ 38 NONAME ; class QString NmContactHistoryModel::tr(char const *, char const *) + ?viewStateChanged@NmUiEventsNotifier@@IAEXW4NmUiEventType@1@W4NmUiViewId@@VNmId@@@Z @ 39 NONAME ; void NmUiEventsNotifier::viewStateChanged(enum NmUiEventsNotifier::NmUiEventType, enum NmUiViewId, class NmId) + ?qt_metacall@NmContactHistoryModel@@UAEHW4Call@QMetaObject@@HPAPAX@Z @ 40 NONAME ; int NmContactHistoryModel::qt_metacall(enum QMetaObject::Call, int, void * *) + ?qt_metacast@NmUiEventsNotifier@@UAEPAXPBD@Z @ 41 NONAME ; void * NmUiEventsNotifier::qt_metacast(char const *) + ?resetData@NmUriParser@@QAEXXZ @ 42 NONAME ; void NmUriParser::resetData(void) + ?getStaticMetaObject@NmContactHistoryModel@@SAABUQMetaObject@@XZ @ 43 NONAME ; struct QMetaObject const & NmContactHistoryModel::getStaticMetaObject(void) + ?bodyText@NmUriParser@@QBE?AVQString@@XZ @ 44 NONAME ; class QString NmUriParser::bodyText(void) const + ??0EmailMailboxInfo@@QAE@XZ @ 45 NONAME ; EmailMailboxInfo::EmailMailboxInfo(void) + ?staticMetaObject@NmUiEventsNotifier@@2UQMetaObject@@B @ 46 NONAME ; struct QMetaObject const NmUiEventsNotifier::staticMetaObject + ?contactId@NmContactHistoryModelItem@@QBEIXZ @ 47 NONAME ; unsigned int NmContactHistoryModelItem::contactId(void) const + ?metaObject@NmUiEventsNotifier@@UBEPBUQMetaObject@@XZ @ 48 NONAME ; struct QMetaObject const * NmUiEventsNotifier::metaObject(void) const + ?moveEntry@EmailMRU@@AAEXHH@Z @ 49 NONAME ; void EmailMRU::moveEntry(int, int) + ?query@NmContactHistoryModel@@QAEXABVQString@@@Z @ 50 NONAME ; void NmContactHistoryModel::query(class QString const &) + ?keysEqual@NmUiEventsNotifier@@ABE_NABVXQSettingsKey@@ABVXQPublishAndSubscribeSettingsKey@@@Z @ 51 NONAME ; bool NmUiEventsNotifier::keysEqual(class XQSettingsKey const &, class XQPublishAndSubscribeSettingsKey const &) const + ?searchForAddress@EmailMRU@@AAEHABVQString@@@Z @ 52 NONAME ; int EmailMRU::searchForAddress(class QString const &) + ?updateEntry@EmailMRU@@AAE_NHABVQString@@@Z @ 53 NONAME ; bool EmailMRU::updateEntry(int, class QString const &) + ?metaObject@NmContactHistoryModel@@UBEPBUQMetaObject@@XZ @ 54 NONAME ; struct QMetaObject const * NmContactHistoryModel::metaObject(void) const + ??_ENmContactHistoryModel@@UAE@I@Z @ 55 NONAME ; NmContactHistoryModel::~NmContactHistoryModel(unsigned int) + ?mailboxIcon@EmailMailboxInfo@@QBE?AVQString@@ABV2@@Z @ 56 NONAME ; class QString EmailMailboxInfo::mailboxIcon(class QString const &) const + ??0NmUriParser@@QAE@XZ @ 57 NONAME ; NmUriParser::NmUriParser(void) + ?tr@NmUiEventsNotifier@@SA?AVQString@@PBD0H@Z @ 58 NONAME ; class QString NmUiEventsNotifier::tr(char const *, char const *, int) + ?writeCenRep@EmailMRU@@AAE_NHABVQString@@@Z @ 59 NONAME ; bool EmailMRU::writeCenRep(int, class QString const &) + ??1NmUiEventsNotifier@@UAE@XZ @ 60 NONAME ; NmUiEventsNotifier::~NmUiEventsNotifier(void) + ?trUtf8@NmUiEventsNotifier@@SA?AVQString@@PBD0H@Z @ 61 NONAME ; class QString NmUiEventsNotifier::trUtf8(char const *, char const *, int) + ?getNextEntryIndex@EmailMRU@@AAEIXZ @ 62 NONAME ; unsigned int EmailMRU::getNextEntryIndex(void) + ??_ENmContactHistoryModelItem@@UAE@I@Z @ 63 NONAME ; NmContactHistoryModelItem::~NmContactHistoryModelItem(unsigned int) + ?trUtf8@NmContactHistoryModel@@SA?AVQString@@PBD0@Z @ 64 NONAME ; class QString NmContactHistoryModel::trUtf8(char const *, char const *) + ?entryCount@EmailMRU@@QBEIXZ @ 65 NONAME ; unsigned int EmailMRU::entryCount(void) const + ??0NmContactHistoryModelItem@@QAE@XZ @ 66 NONAME ; NmContactHistoryModelItem::NmContactHistoryModelItem(void) + ?entryIndex@EmailMRU@@CAHH@Z @ 67 NONAME ; int EmailMRU::entryIndex(int) + ?rowCount@NmContactHistoryModel@@UBEHABVQModelIndex@@@Z @ 68 NONAME ; int NmContactHistoryModel::rowCount(class QModelIndex const &) const + ?qt_metacast@NmContactHistoryModel@@UAEPAXPBD@Z @ 69 NONAME ; void * NmContactHistoryModel::qt_metacast(char const *) + ?parseKeyValue@NmUiEventsNotifier@@ABE_NABVQByteArray@@AAW4NmUiEventType@1@AAW4NmUiViewId@@AAVNmId@@@Z @ 70 NONAME ; bool NmUiEventsNotifier::parseKeyValue(class QByteArray const &, enum NmUiEventsNotifier::NmUiEventType &, enum NmUiViewId &, class NmId &) const + ?toAddresses@NmUriParser@@QBE?AVQStringList@@XZ @ 71 NONAME ; class QStringList NmUriParser::toAddresses(void) const + ?subject@NmUriParser@@QBE?AVQString@@XZ @ 72 NONAME ; class QString NmUriParser::subject(void) const + ?mailboxName@EmailMailboxInfo@@QBE?AVQString@@ABV2@@Z @ 73 NONAME ; class QString EmailMailboxInfo::mailboxName(class QString const &) const + ?modelCompleted@NmContactHistoryModel@@IAEXH@Z @ 74 NONAME ; void NmContactHistoryModel::modelCompleted(int) + ?nameOrder@EmailMRU@@SAHXZ @ 75 NONAME ; int EmailMRU::nameOrder(void) + ?updateMRU@EmailMRU@@QAE_NABVQString@@0@Z @ 76 NONAME ; bool EmailMRU::updateMRU(class QString const &, class QString const &) diff -r 6c59112cfd31 -r 38bf5461e270 emailservices/nmutilities/eabi/nmutilitiesu.def --- a/emailservices/nmutilities/eabi/nmutilitiesu.def Thu Sep 30 11:43:07 2010 +0300 +++ b/emailservices/nmutilities/eabi/nmutilitiesu.def Thu Oct 14 17:33:43 2010 +0300 @@ -45,10 +45,10 @@ _ZN25NmContactHistoryModelItemD2Ev @ 44 NONAME _ZN8EmailMRU10entryIndexEi @ 45 NONAME _ZN8EmailMRU10readCenRepEi @ 46 NONAME - _ZN8EmailMRU10writeEntryEi7QStringS0_ @ 47 NONAME - _ZN8EmailMRU11updateEntryEi7QString @ 48 NONAME - _ZN8EmailMRU11writeCenRepEi7QString @ 49 NONAME - _ZN8EmailMRU16searchForAddressE7QString @ 50 NONAME + _ZN8EmailMRU10writeEntryEiRK7QStringS2_ @ 47 NONAME + _ZN8EmailMRU11updateEntryEiRK7QString @ 48 NONAME + _ZN8EmailMRU11writeCenRepEiRK7QString @ 49 NONAME + _ZN8EmailMRU16searchForAddressERK7QString @ 50 NONAME _ZN8EmailMRU17getNextEntryIndexEv @ 51 NONAME _ZN8EmailMRU19nameKeyByEntryIndexEi @ 52 NONAME _ZN8EmailMRU22addressKeyByEntryIndexEi @ 53 NONAME @@ -56,7 +56,7 @@ _ZN8EmailMRU8getEntryEiR7QStringS1_ @ 55 NONAME _ZN8EmailMRU9moveEntryEii @ 56 NONAME _ZN8EmailMRU9nameOrderEv @ 57 NONAME - _ZN8EmailMRU9updateMRUE7QStringS0_ @ 58 NONAME + _ZN8EmailMRU9updateMRUERK7QStringS2_ @ 58 NONAME _ZN8EmailMRUC1Ev @ 59 NONAME _ZN8EmailMRUC2Ev @ 60 NONAME _ZN8EmailMRUD0Ev @ 61 NONAME diff -r 6c59112cfd31 -r 38bf5461e270 emailservices/nmutilities/inc/emailmru.h --- a/emailservices/nmutilities/inc/emailmru.h Thu Sep 30 11:43:07 2010 +0300 +++ b/emailservices/nmutilities/inc/emailmru.h Thu Oct 14 17:33:43 2010 +0300 @@ -63,7 +63,7 @@ virtual ~EmailMRU(); - bool updateMRU(QString displayName, QString emailAddress); + bool updateMRU(const QString &displayName, const QString &emailAddress); quint32 entryCount() const; @@ -77,11 +77,11 @@ quint32 getNextEntryIndex(); - bool writeCenRep(qint32 index, QString value); + bool writeCenRep(qint32 index, const QString &value); QString readCenRep(qint32 index); - qint32 searchForAddress(QString address); + qint32 searchForAddress(const QString &address); static qint32 entryIndex(qint32 crKey); @@ -91,9 +91,9 @@ void moveEntry(qint32 oldEntryIndex, qint32 newEntryIndex); - bool writeEntry(qint32 entryIndex, QString displayName, QString emailAddress); + bool writeEntry(qint32 entryIndex, const QString &displayName, const QString &emailAddress); - bool updateEntry(qint32 entryIndex, QString newDisplayName); + bool updateEntry(qint32 entryIndex, const QString &newDisplayName); private: diff -r 6c59112cfd31 -r 38bf5461e270 emailservices/nmutilities/inc/nmcontacthistorymodel_p.h --- a/emailservices/nmutilities/inc/nmcontacthistorymodel_p.h Thu Sep 30 11:43:07 2010 +0300 +++ b/emailservices/nmutilities/inc/nmcontacthistorymodel_p.h Thu Oct 14 17:33:43 2010 +0300 @@ -31,7 +31,7 @@ public: NmContactHistoryModelItemData() : - mContactId(0xDEAD) + mContactId(0) { } @@ -94,6 +94,8 @@ NmContactHistoryModelType mType; QList mModelItemList; QList< QSharedPointer > mPrivateItemList; + + QContactManager *mContactManager; QHash mMruList; QMap mMruMatches; diff -r 6c59112cfd31 -r 38bf5461e270 emailservices/nmutilities/src/emailmailboxinfo_p.cpp --- a/emailservices/nmutilities/src/emailmailboxinfo_p.cpp Thu Sep 30 11:43:07 2010 +0300 +++ b/emailservices/nmutilities/src/emailmailboxinfo_p.cpp Thu Oct 14 17:33:43 2010 +0300 @@ -128,8 +128,14 @@ QString returnValue = ""; - if (identifier.length() > 0) { - processCenRepRecords(identifier); + QString domainName = identifier; + int delimIndex = domainName.lastIndexOf('@'); + if(delimIndex >= 0) { + domainName = domainName.mid(delimIndex + 1); + } + + if (domainName.length() > 0) { + processCenRepRecords(domainName); returnValue = mTempIcon; } diff -r 6c59112cfd31 -r 38bf5461e270 emailservices/nmutilities/src/emailmru.cpp --- a/emailservices/nmutilities/src/emailmru.cpp Thu Sep 30 11:43:07 2010 +0300 +++ b/emailservices/nmutilities/src/emailmru.cpp Thu Oct 14 17:33:43 2010 +0300 @@ -65,7 +65,7 @@ \param emailAddress \return success, was the update operation successful */ -bool EmailMRU::updateMRU(QString displayName, QString emailAddress) +bool EmailMRU::updateMRU(const QString &displayName, const QString &emailAddress) { NM_FUNCTION; @@ -141,7 +141,7 @@ \param value what to write \return success, whether write operation succeeded */ -bool EmailMRU::writeCenRep(qint32 index, QString value) +bool EmailMRU::writeCenRep(qint32 index, const QString &value) { NM_FUNCTION; @@ -200,6 +200,7 @@ entryIndex = crKey/2; } else { + // If not divisible with 2, minus 1 to get correct entry index. entryIndex = (crKey-1)/2; } @@ -231,7 +232,7 @@ \param address to search \return entry index of found address, zero if not found */ -qint32 EmailMRU::searchForAddress(QString address) +qint32 EmailMRU::searchForAddress(const QString &address) { NM_FUNCTION; @@ -275,7 +276,7 @@ \param newDisplayName \return success was update operation successfull */ -bool EmailMRU::updateEntry(qint32 entryIndex, QString newDisplayName) +bool EmailMRU::updateEntry(qint32 entryIndex, const QString &newDisplayName) { NM_FUNCTION; @@ -286,12 +287,17 @@ // until we go past the newest entry for (qint32 i = entryIndex, j = 0; i != mLatestIndex;) { j = i+1; - if (j > emailAddressHistorySize) j = 1; + + if (j > emailAddressHistorySize) { + j = 1; + } moveEntry(j, i); - i++; - if (i > emailAddressHistorySize) i = 1; + + if (i > emailAddressHistorySize) { + i = 1; + } } // Write the updated entry as the newest entry @@ -305,7 +311,8 @@ \param emailAddress \return success was update operation successfull */ -bool EmailMRU::writeEntry(qint32 entryIndex, QString displayName, QString emailAddress) +bool EmailMRU::writeEntry(qint32 entryIndex, const QString &displayName, + const QString &emailAddress) { NM_FUNCTION; diff -r 6c59112cfd31 -r 38bf5461e270 emailservices/nmutilities/src/nmcontacthistorymodel.cpp --- a/emailservices/nmutilities/src/nmcontacthistorymodel.cpp Thu Sep 30 11:43:07 2010 +0300 +++ b/emailservices/nmutilities/src/nmcontacthistorymodel.cpp Thu Oct 14 17:33:43 2010 +0300 @@ -34,7 +34,7 @@ { NM_FUNCTION; d_ptr = new NmContactHistoryModelPrivate(modelType); - + QObject::connect(d_ptr, SIGNAL(queryCompleted(int)), this, SLOT(handleQueryCompleted(int))); } @@ -71,8 +71,7 @@ int lastUpdateIndex = (d_ptr->privateDataCount())-1; - if (lastUpdateIndex != -1) - { + if (lastUpdateIndex != -1) { // Notify views that we are about to change model data. beginInsertRows(QModelIndex(),0,lastUpdateIndex); d_ptr->refreshDataModel(); @@ -81,10 +80,14 @@ // Emit dataChanged(); bool validIndex = hasIndex ( lastUpdateIndex, 0 ); - if (validIndex) - { + if (validIndex) { emit dataChanged(index(0,0), index(lastUpdateIndex,0)); } + + } + else if (lastUpdateIndex == -1) { + beginResetModel(); + endResetModel(); } emit modelCompleted(err); diff -r 6c59112cfd31 -r 38bf5461e270 emailservices/nmutilities/src/nmcontacthistorymodel_p.cpp --- a/emailservices/nmutilities/src/nmcontacthistorymodel_p.cpp Thu Sep 30 11:43:07 2010 +0300 +++ b/emailservices/nmutilities/src/nmcontacthistorymodel_p.cpp Thu Oct 14 17:33:43 2010 +0300 @@ -54,7 +54,7 @@ /*! Searches contact & MRU databases according to query parameters. - Emits QueryCompleted() when ready. + Emits queryCompleted() when ready. \param query Text to be searched \return none @@ -81,8 +81,7 @@ int spcPosition = query.indexOf(" "); - if ( spcPosition != -1 ) - { + if ( spcPosition != -1 ) { modifiedQuery = query.left(spcPosition); } @@ -99,22 +98,6 @@ populateListWithContactItems(cnt_ids, modifiedQuery); - #ifdef _DEBUG - - for (int i = 0; i < mPrivateItemList.size(); i++) - { - QSharedPointer itemData = mPrivateItemList[i]; - - QString dbgString = itemData->mItems[0].mItemText; - dbgString.append(" "); - dbgString.append(itemData->mItems[1].mItemText); - - qDebug(dbgString.toLatin1()); - } - - #endif - - emit queryCompleted(0); } @@ -163,35 +146,29 @@ NM_FUNCTION; bool rVal = false; - if (mType == EmailAddressModel) - { + if (mType == EmailAddressModel) { bool mruListFilled = fillMruMatchList(); - if (!mruListFilled) - { + if (!mruListFilled) { return rVal; } QHashIterator i(mMruList); - while (i.hasNext()) - { + while (i.hasNext()) { i.next(); QString address = i.key(); QString name = i.value(); - if ((name.length() == 0) && (address.contains('@'))) - { + if ((name.length() == 0) && (address.contains('@'))) { name = address.left(address.indexOf("@")); } - if (address.contains(query, Qt::CaseInsensitive)) - { + if (address.contains(query, Qt::CaseInsensitive)) { mMruMatches.insert(name, address); } - else if (name.contains(query, Qt::CaseInsensitive)) - { + else if (name.contains(query, Qt::CaseInsensitive)) { mMruMatches.insert(name, address); } } @@ -217,8 +194,7 @@ int cntCount = cnt_ids.count(); // Populate mPrivateItemList with contact items. - for ( int cntIndex = 0; cntIndex < cntCount; cntIndex++) - { + for ( int cntIndex = 0; cntIndex < cntCount; cntIndex++) { QContactLocalId cid = cnt_ids.at( cntIndex ); // Fetch extended contact information from DB by ID QContact contact = mContactManager->contact( cid ); @@ -227,9 +203,8 @@ int numberOfEmails = contact.details( QContactEmailAddress::DefinitionName).count(); - if (numberOfEmails == 0) - { - continue; // Scotty, I need warp speed. + if (numberOfEmails == 0) { + continue; } // Get contact name details @@ -241,8 +216,7 @@ QString lastName = contactName.value( QContactName::FieldLastName); - for (int emailIndex = 0; emailIndex < numberOfEmails; emailIndex++) - { + for (int emailIndex = 0; emailIndex < numberOfEmails; emailIndex++) { // For Display name (ex. John Doe) NmContactHistoryModelSubItem itemSubItem1; // For Email address (ex. john.doe@company.com) @@ -253,14 +227,12 @@ // Obey the contacts setting (first name last name order) itemSubItem1.mItemText = obeyContactOrder(firstName, lastName); - if( firstName.indexOf(modifiedQuery, 0, Qt::CaseInsensitive) == 0) - { + if( firstName.indexOf(modifiedQuery, 0, Qt::CaseInsensitive) == 0) { itemSubItem1.mMatchingRanges.append(0); itemSubItem1.mMatchingRanges.append(queryLength-1); } - if( lastName.indexOf(modifiedQuery, 0, Qt::CaseInsensitive) == 0) - { + if( lastName.indexOf(modifiedQuery, 0, Qt::CaseInsensitive) == 0) { int indexLN = itemSubItem1.mItemText.indexOf(lastName, firstName.length(), Qt::CaseInsensitive ); @@ -274,15 +246,13 @@ QContactEmailAddress::FieldEmailAddress ); if (itemSubItem2.mItemText.indexOf(modifiedQuery, 0, - Qt::CaseInsensitive) == 0 ) - { + Qt::CaseInsensitive) == 0 ) { itemSubItem2.mMatchingRanges.append(0); itemSubItem2.mMatchingRanges.append(queryLength-1); } if ((itemSubItem1.mMatchingRanges.count() != 0) || - (itemSubItem2.mMatchingRanges.count() != 0) ) - { + (itemSubItem2.mMatchingRanges.count() != 0) ) { QSharedPointer itemData (new NmContactHistoryModelItemData); @@ -310,8 +280,7 @@ QMapIterator mruMatch(mMruMatches); - while (mruMatch.hasNext()) - { + while (mruMatch.hasNext()) { mruMatch.next(); // For Display name (ex. John Doe) NmContactHistoryModelSubItem itemSubItem1; @@ -325,8 +294,7 @@ itemSubItem2.mItemText = address; // markup for first item. - if( name.indexOf(query, 0, Qt::CaseInsensitive) == 0) - { + if( name.indexOf(query, 0, Qt::CaseInsensitive) == 0) { itemSubItem1.mMatchingRanges.append(0); itemSubItem1.mMatchingRanges.append(query.length()-1); } @@ -334,21 +302,17 @@ QRegExp rx("[,\\s]", Qt::CaseInsensitive); bool separatorExists = name.contains(rx); - if (separatorExists) - { + if (separatorExists) { int indexLN = name.indexOf(",", 0, Qt::CaseInsensitive); - if (indexLN == -1) - { + if (indexLN == -1) { indexLN = name.indexOf(" ", 0, Qt::CaseInsensitive); } - if (indexLN > 0) - { + if (indexLN > 0) { int matchPos = name.indexOf(query, indexLN, Qt::CaseInsensitive); - if (matchPos > 0) - { + if (matchPos > 0) { itemSubItem1.mMatchingRanges.append(matchPos); itemSubItem1.mMatchingRanges.append((matchPos+query.length())-1); } @@ -356,16 +320,14 @@ } // markup for second item. - if (address.indexOf(query, 0, Qt::CaseInsensitive) == 0 ) - { + if (address.indexOf(query, 0, Qt::CaseInsensitive) == 0 ) { itemSubItem2.mMatchingRanges.append(0); itemSubItem2.mMatchingRanges.append(query.length()-1); - } + } // If match, add to data list. if ((itemSubItem1.mMatchingRanges.count() != 0) || - (itemSubItem2.mMatchingRanges.count() != 0) ) - { + (itemSubItem2.mMatchingRanges.count() != 0) ) { QSharedPointer itemData (new NmContactHistoryModelItemData); @@ -392,8 +354,7 @@ for (int cntIndex = 0; cntIndex < mPrivateItemList.count(); - cntIndex++) - { + cntIndex++) { // Construct modelItem to be added to list. NmContactHistoryModelItem modelItem; @@ -405,8 +366,7 @@ for (int itemIndex = 0; itemIndex < itemData->mItems.count(); - itemIndex++) - { + itemIndex++) { QString key = itemData->mItems[itemIndex].mItemText; modelItem.appendSubItem(itemData->mItems[itemIndex]); } @@ -453,25 +413,21 @@ QVariant NmContactHistoryModelPrivate::data(const QModelIndex &index, int role) const { NM_FUNCTION; - - if ( mModelReady ) - { + QVariant rVariant = QVariant(); + + if ( mModelReady ) { if (!index.isValid() || index.row() >= mModelItemList.count() || - index.row() < 0) - { - return QVariant(); + index.row() < 0) { + rVariant = QVariant(); } - else if (role == Qt::DisplayRole) - { - QVariant v; + else if (role == Qt::DisplayRole) { NmContactHistoryModelItem i = mModelItemList.at(index.row()); - v.setValue(i); - return v; + rVariant.setValue(i); } } - return QVariant(); + return rVariant; } /*! @@ -486,31 +442,27 @@ EmailMRU *mru = new EmailMRU(); bool rVal = false; + int updateCount = 0; - if (mru) - { - int addressCount = mru->entryCount(); + int addressCount = mru->entryCount(); - for (int i = addressCount; i > 0; i--) - { - QString key, value; // "Email or Number" & "Display Name" - bool success; + for (int i = addressCount; i > 0; i--) { + QString key, value; // "Email or Number" & "Display Name" + bool success; - success = mru->getEntry(i, value, key); + success = mru->getEntry(i, value, key); - if (success) - { - mMruList.insertMulti(key, value); - } + if (success) { + mMruList.insertMulti(key, value); + updateCount++; } + } - delete mru; + delete mru; + + if (updateCount == addressCount) { rVal = true; - } - else - { - rVal = false; - } + } return rVal; } @@ -533,22 +485,21 @@ QString result; - switch (mNameOrder) - { - case LastNameFirstName: - result = lastName + " " + firstName; + switch (mNameOrder) { + case LastNameFirstName: + result = lastName + " " + firstName; break; - case LastNameCommaFirstName: - result = lastName + ", " + firstName; + case LastNameCommaFirstName: + result = lastName + ", " + firstName; break; - case FirstNameLastName: - result = firstName + " " + lastName; + case FirstNameLastName: + result = firstName + " " + lastName; break; - default: - result = firstName + " " + lastName; + default: + result = firstName + " " + lastName; break; } diff -r 6c59112cfd31 -r 38bf5461e270 emailservices/nmutilities/src/nmcontacthistorymodelitem.cpp --- a/emailservices/nmutilities/src/nmcontacthistorymodelitem.cpp Thu Sep 30 11:43:07 2010 +0300 +++ b/emailservices/nmutilities/src/nmcontacthistorymodelitem.cpp Thu Oct 14 17:33:43 2010 +0300 @@ -28,7 +28,7 @@ */ NmContactHistoryModelItem::NmContactHistoryModelItem() { - d = new NmContactHistoryModelItemData(); + mItemData = new NmContactHistoryModelItemData(); } /*! @@ -37,7 +37,7 @@ NmContactHistoryModelItem::NmContactHistoryModelItem( const NmContactHistoryModelItem &other) { - d = other.d; + mItemData = other.mItemData; } /*! @@ -52,7 +52,7 @@ */ unsigned int NmContactHistoryModelItem::contactId() const { - return d->mContactId; + return mItemData->mContactId; } /*! @@ -60,7 +60,7 @@ */ void NmContactHistoryModelItem::setContactId(unsigned int contactId) { - d->mContactId = contactId; + mItemData->mContactId = contactId; } /*! @@ -68,7 +68,7 @@ */ int NmContactHistoryModelItem::subItemCount() const { - return d->mItems.count(); + return mItemData->mItems.count(); } /*! @@ -77,9 +77,9 @@ NmContactHistoryModelSubItem NmContactHistoryModelItem::subItemAt( int index) const { - if ( index <= d->mItems.count() ) + if ( index <= mItemData->mItems.count() ) { - return d->mItems[index]; + return mItemData->mItems[index]; } else { @@ -99,11 +99,11 @@ { QList subItemList; - if (!d->mItems.isEmpty()) + if (!mItemData->mItems.isEmpty()) { - for ( int subIndex = 0; subIndex < d->mItems.count(); subIndex++) + for ( int subIndex = 0; subIndex < mItemData->mItems.count(); subIndex++) { - subItemList.append(d->mItems[subIndex]); + subItemList.append(mItemData->mItems[subIndex]); } } @@ -118,7 +118,7 @@ void NmContactHistoryModelItem::appendSubItem( NmContactHistoryModelSubItem entry) { - d->mItems.append(entry); + mItemData->mItems.append(entry); } // -------------------------------------------------------------------------- // End of implementation (NmContactHistoryModelItem) diff -r 6c59112cfd31 -r 38bf5461e270 emailuis/nmailui/inc/nmapplication.h --- a/emailuis/nmailui/inc/nmapplication.h Thu Sep 30 11:43:07 2010 +0300 +++ b/emailuis/nmailui/inc/nmapplication.h Thu Oct 14 17:33:43 2010 +0300 @@ -101,7 +101,6 @@ bool mForegroundService; NmUiEffects *mEffects; // Owned NmAttachmentManager *mAttaManager; // Owned - NmSettingsViewLauncher* mSettingsViewLauncher; // Owned bool mViewReady; NmId mLastOperationMailbox; HbMessageBox *mQueryDialog; // Owned diff -r 6c59112cfd31 -r 38bf5461e270 emailuis/nmailui/inc/nmeditorview.h --- a/emailuis/nmailui/inc/nmeditorview.h Thu Sep 30 11:43:07 2010 +0300 +++ b/emailuis/nmailui/inc/nmeditorview.h Thu Oct 14 17:33:43 2010 +0300 @@ -82,6 +82,8 @@ void okToExitQuery(HbAction* action); void sendProgressDialogCancelled(); void safeToDraft(); + void deleteDraft(); + void closeView(); protected: void resizeEvent(QGraphicsSceneResizeEvent *event); diff -r 6c59112cfd31 -r 38bf5461e270 emailuis/nmailui/inc/nmuiextensioninterface.h --- a/emailuis/nmailui/inc/nmuiextensioninterface.h Thu Sep 30 11:43:07 2010 +0300 +++ b/emailuis/nmailui/inc/nmuiextensioninterface.h Thu Oct 14 17:33:43 2010 +0300 @@ -37,6 +37,7 @@ virtual void getActions( const NmActionRequest &request, QList &actionList) = 0; + virtual void launchSettings(const NmId &mailboxId) = 0; }; diff -r 6c59112cfd31 -r 38bf5461e270 emailuis/nmailui/inc/nmuiextensionmanager.h --- a/emailuis/nmailui/inc/nmuiextensionmanager.h Thu Sep 30 11:43:07 2010 +0300 +++ b/emailuis/nmailui/inc/nmuiextensionmanager.h Thu Oct 14 17:33:43 2010 +0300 @@ -38,6 +38,7 @@ void getActions( const NmActionRequest &menuRequest, QList &actionList); + void launchSettings(const NmId &mailboxId); private: void loadExtensionPlugins(); diff -r 6c59112cfd31 -r 38bf5461e270 emailuis/nmailui/service_conf.xml --- a/emailuis/nmailui/service_conf.xml Thu Sep 30 11:43:07 2010 +0300 +++ b/emailuis/nmailui/service_conf.xml Thu Oct 14 17:33:43 2010 +0300 @@ -9,7 +9,7 @@ Send interface Attach to new email mail - txt_mail_shareui_send_as_mail + txt_share_dblist_email qtg_large_email diff -r 6c59112cfd31 -r 38bf5461e270 emailuis/nmailui/src/nmapplication.cpp --- a/emailuis/nmailui/src/nmapplication.cpp Thu Sep 30 11:43:07 2010 +0300 +++ b/emailuis/nmailui/src/nmapplication.cpp Thu Oct 14 17:33:43 2010 +0300 @@ -21,6 +21,7 @@ static const QString NmSendServiceName = "nmail.com.nokia.symbian.IFileShare"; static const QString NmActivityName = "EmailInboxView"; static const int NmErrorNoteDelay = 300000; +static const qreal NmMinusNinetyDegrees = -90; /*! \class NmApplication @@ -44,7 +45,6 @@ mForegroundService(false), mEffects(NULL), mAttaManager(NULL), - mSettingsViewLauncher(NULL), mViewReady(false), mQueryDialog(NULL), mBackButtonPressed(false), @@ -167,7 +167,6 @@ delete mEffects; delete mMainWindow; delete mAttaManager; - delete mSettingsViewLauncher; delete mActivityStorage; delete mActivation; } @@ -253,16 +252,16 @@ void NmApplication::viewReady() { mViewReady = true; - + if (mViewStack && !mViewStack->isEmpty()) { NmBaseView *currentView = mViewStack->top(); if (currentView) { currentView->viewReady(); - emit applicationReady(); } NM_TIMESTAMP("Application view ready."); } + emit applicationReady(); } @@ -564,7 +563,7 @@ (!startParam->service() || mActiveViewId!=NmUiViewMessageEditor)) { //startParam pointer is tested before usage below - //coverity[deref_arg] + //coverity[freed_arg] mViewStack->top()->reloadViewContents(startParam); } else { @@ -809,16 +808,8 @@ { // Check whether yes button was pressed. if (mQueryDialog&& action == mQueryDialog->actions().at(0)) { - // Create settingslauncher if doesn't exist. - if(!mSettingsViewLauncher) { - mSettingsViewLauncher = new NmSettingsViewLauncher(); - } - // Mailboxname required. - NmMailboxMetaData *mailboxMetaData = mUiEngine->mailboxById(mLastOperationMailbox); // No ownership. - if( mailboxMetaData ) { - // Launch. - mSettingsViewLauncher->launchSettingsView(mLastOperationMailbox, mailboxMetaData->name()); - } + // Launch. + mExtensionManager->launchSettings(mCurrentMailboxId); } } @@ -861,7 +852,14 @@ TsTaskSettings tasksettings; tasksettings.setVisibility(false); QVariantHash metadata; - metadata.insert(ActivityScreenshotKeyword, QPixmap::grabWidget(mainWindow(), mainWindow()->rect())); + QPixmap screenshot = QPixmap::grabWidget(mainWindow(), mainWindow()->rect()); + // Landscape needs to be rotated 90 degrees counter-clockwise + if (mainWindow()->orientation() == Qt::Horizontal) { + QMatrix mat; + mat.rotate(NmMinusNinetyDegrees); + screenshot = screenshot.transformed(mat); + } + metadata.insert(ActivityScreenshotKeyword, screenshot); metadata.insert(ActivityApplicationName, meta->name()); metadata.insert(ActivityVisibility, true); ok = mActivityStorage->saveActivity(NmActivityName, QVariant(), metadata); diff -r 6c59112cfd31 -r 38bf5461e270 emailuis/nmailui/src/nmeditorview.cpp --- a/emailuis/nmailui/src/nmeditorview.cpp Thu Sep 30 11:43:07 2010 +0300 +++ b/emailuis/nmailui/src/nmeditorview.cpp Thu Oct 14 17:33:43 2010 +0300 @@ -91,7 +91,7 @@ // Delete opened temporary files. NmUtilities::deleteTempFiles(mTempFiles); - + if (mRemoveAttachmentOperation && mRemoveAttachmentOperation->isRunning()) { mRemoveAttachmentOperation->cancelOperation(); } @@ -140,7 +140,7 @@ void NmEditorView::loadViewLayout() { NM_FUNCTION; - + // Use the document loader to load the view. QObjectList objectList; objectList.append(this); @@ -154,7 +154,7 @@ mWidgetList = mDocumentLoader->load(NMUI_EDITOR_VIEW_XML, &ok); if (ok) { - mContent = new NmEditorContent(this, mDocumentLoader, + mContent = new NmEditorContent(this, mDocumentLoader, mApplication.networkAccessManager(), mApplication); @@ -166,7 +166,7 @@ NmUiEditorStartMode mode = mStartParam->editorStartMode(); if (mode == NmUiEditorReply || - mode == NmUiEditorReplyAll || + mode == NmUiEditorReplyAll || mode == NmUiEditorForward) { mContent->editor()->setCustomTextColor(true, Qt::blue); } @@ -328,13 +328,14 @@ HbMessageBox *dlg = static_cast(sender()); // The first action in dialogs action list is for the "Yes"-button. if (action == dlg->actions().at(0)) { + connect(&mUiEngine, SIGNAL(draftSaved()),this, SLOT(closeView())); safeToDraft(); + } else { + // delete draft now because it is always created in the beginning + // of new email creation process + connect(&mUiEngine, SIGNAL(draftDeleted()),this, SLOT(closeView())); + deleteDraft(); } - - // Close the view - QMetaObject::invokeMethod(&mApplication, - "popView", - Qt::QueuedConnection); } /*! @@ -345,6 +346,9 @@ // Update draft message with content. updateMessageWithEditorContents(); + // Draft messages are always read. + mMessage->envelope().setRead(true); + // Save message to drafts QList preliminaryOperations; if (mAddAttachmentOperation && mAddAttachmentOperation->isRunning()) { @@ -361,6 +365,25 @@ } /*! + Public slot to handle draft deletion. +*/ +void NmEditorView::deleteDraft() +{ + // ownership of mMessage is transferred + // NmOperations are automatically deleted after completion + mUiEngine.removeDraftMessage(mMessage); + mMessage = NULL; +} + +void NmEditorView::closeView() +{ + // Close the view + QMetaObject::invokeMethod(&mApplication, + "popView", + Qt::QueuedConnection); +} + +/*! About to exit view. Application calls this function when user has pressed back key and editor needs to delete the draft message. This is called when "auto-exiting" after a successful mail sending. @@ -545,7 +568,7 @@ { NM_FUNCTION; NM_TIMESTAMP("Start editor."); - + NmUiEditorStartMode startMode = startParam.editorStartMode(); NmId mailboxId = startParam.mailboxId(); NmId folderId = startParam.folderId(); @@ -583,7 +606,7 @@ this, SLOT(messageCreated(int))); } - + // Set focus if (mContent && mContent->header() ) { if (startMode == NmUiEditorCreateNew || XQServiceUtil::isEmbedded()) { @@ -733,7 +756,7 @@ { NM_FUNCTION; NM_TIMESTAMP("Editor opened."); - + delete mMessage; mMessage = NULL; @@ -828,8 +851,8 @@ toAddressesString = addressListToString(toAddressList); ccAddressesString = addressListToString(ccAddressList); bccAddressesString = addressListToString(bccAddressList); - // Also add recipients added for example from send service - // interface to recipient line edits. + // Also add recipients added for example from send service + // interface to recipient line edits. mContent->header()->toEdit()->addContacts(toAddressList); mContent->header()->ccEdit()->addContacts(ccAddressList); mContent->header()->bccEdit()->addContacts(bccAddressList); @@ -957,7 +980,7 @@ void NmEditorView::createToolBar() { NM_FUNCTION; - + HbToolBar *tb = toolBar(); NmUiExtensionManager &extMngr = mApplication.extManager(); @@ -972,7 +995,7 @@ NmActionContextViewEditor, NmActionContextDataNone, mStartParam->mailboxId(), - mStartParam->folderId()); + mStartParam->folderId()); QList list; extMngr.getActions(request, list); @@ -1002,22 +1025,22 @@ HbListViewItem *listView = mTBExtnContentWidget->listItemPrototype(); HbFrameBackground frame(NmPopupListFrame, HbFrameDrawer::NinePieces); listView->setDefaultFrame(frame); - + extension->setContentWidget(mTBExtnContentWidget); connect(mTBExtnContentWidget, SIGNAL(activated(HbListWidgetItem*)), extension, SLOT(close())); mAttachmentPicker = new NmAttachmentPicker(this); - + connect(mAttachmentPicker, SIGNAL(attachmentsFetchOk(const QVariant &)), this, SLOT(onAttachmentReqCompleted(const QVariant &))); connect(this, SIGNAL(titleChanged(QString)), mAttachmentPicker, SLOT(setTitle(QString))); - connect(mTBExtnContentWidget, SIGNAL(activated(HbListWidgetItem*)), + connect(mTBExtnContentWidget, SIGNAL(activated(HbListWidgetItem*)), mAttachmentPicker, SLOT (selectFetcher(HbListWidgetItem*))); } - } // for () + } // for () } @@ -1327,7 +1350,7 @@ { NM_FUNCTION; NM_TIMESTAMP("Add attachments."); - + // Add attachment name into UI foreach (QString fileName, fileNames) { // At this phase attachment size and nmid are not known @@ -1448,7 +1471,7 @@ { NM_FUNCTION; NM_TIMESTAMP("All attachments added."); - + enableToolBarAttach(true); if (result != NmNoError) { NmUtilities::displayWarningNote(hbTrId("txt_mail_dialog_unable_to_add_attachment")); @@ -1637,11 +1660,6 @@ NmAction *action = static_cast(toolbarList[i]); if (action->availabilityCondition() == NmAction::NmAttachable) { action->setEnabled(enable); - if (enable) { - // For some reason 'Add attachment' toolbar button stays dimmed sometimes, - // showItems will fix the situation. - showItems(Hb::ToolBarItem); - } } } } diff -r 6c59112cfd31 -r 38bf5461e270 emailuis/nmailui/src/nmmessagelistview.cpp --- a/emailuis/nmailui/src/nmmessagelistview.cpp Thu Sep 30 11:43:07 2010 +0300 +++ b/emailuis/nmailui/src/nmmessagelistview.cpp Thu Oct 14 17:33:43 2010 +0300 @@ -337,6 +337,7 @@ mailboxId); } } + NM_TIMESTAMP("Message list view ready."); } diff -r 6c59112cfd31 -r 38bf5461e270 emailuis/nmailui/src/nmuiextensionmanager.cpp --- a/emailuis/nmailui/src/nmuiextensionmanager.cpp Thu Sep 30 11:43:07 2010 +0300 +++ b/emailuis/nmailui/src/nmuiextensionmanager.cpp Thu Oct 14 17:33:43 2010 +0300 @@ -84,6 +84,20 @@ interface->getActions(menuRequest, actionList); } } + +/*! + Calls all extensions + */ +void NmUiExtensionManager::launchSettings(const NmId &mailboxId) +{ + NM_FUNCTION; + + for (int i = 0; i < mExtensions.count(); i++) { + NmUiExtensionInterface *interface = mExtensions[i]; + interface->launchSettings(mailboxId); + } +} + /*! Loads plug-ins which implements NmUiExtensionInterface and are registered to /resource/qt/plugins/nmail/uiext folder. diff -r 6c59112cfd31 -r 38bf5461e270 emailuis/nmailui/src/nmviewerheader.cpp --- a/emailuis/nmailui/src/nmviewerheader.cpp Thu Sep 30 11:43:07 2010 +0300 +++ b/emailuis/nmailui/src/nmviewerheader.cpp Thu Oct 14 17:33:43 2010 +0300 @@ -229,7 +229,7 @@ envelope.sentTime().addSecs(locale.universalTimeOffset()); QTime time = localTime.time(); QDate sentLocalDate = localTime.date(); - QString shortDateSpec = r_qtn_date_without_year; + QString shortDateSpec = r_qtn_date_usual; QString shortTimeSpec = r_qtn_time_usual; QString text = locale.format(sentLocalDate, shortDateSpec); text += " "; diff -r 6c59112cfd31 -r 38bf5461e270 emailuis/nmailuiengine/bwins/nmailuiengineu.def --- a/emailuis/nmailuiengine/bwins/nmailuiengineu.def Thu Sep 30 11:43:07 2010 +0300 +++ b/emailuis/nmailuiengine/bwins/nmailuiengineu.def Thu Oct 14 17:33:43 2010 +0300 @@ -239,7 +239,7 @@ ?tr@NmStoreEnvelopesOperation@@SA?AVQString@@PBD0H@Z @ 238 NONAME ; class QString NmStoreEnvelopesOperation::tr(char const *, char const *, int) ?listMailboxes@NmDataManager@@QAEXAAV?$QList@PAVNmMailbox@@@@@Z @ 239 NONAME ; void NmDataManager::listMailboxes(class QList &) ?message@NmUiEngine@@QAEPAVNmMessage@@ABVNmId@@00@Z @ 240 NONAME ; class NmMessage * NmUiEngine::message(class NmId const &, class NmId const &, class NmId const &) - ?refreshMailbox@NmUiEngine@@QAEHABVNmId@@@Z @ 241 NONAME ; int NmUiEngine::refreshMailbox(class NmId const &) + ?refreshMailbox@NmUiEngine@@QAEHABVNmId@@_N@Z @ 241 NONAME ; int NmUiEngine::refreshMailbox(class NmId const &, bool) ?trUtf8@NmUiEngine@@SA?AVQString@@PBD0@Z @ 242 NONAME ; class QString NmUiEngine::trUtf8(char const *, char const *) ?contentToMessagePart@NmUiEngine@@QAEHABVNmId@@00AAVNmMessagePart@@@Z @ 243 NONAME ; int NmUiEngine::contentToMessagePart(class NmId const &, class NmId const &, class NmId const &, class NmMessagePart &) ?removeItem@NmMessageListModel@@AAEXHAAVNmMessageListModelItem@@@Z @ 244 NONAME ; void NmMessageListModel::removeItem(int, class NmMessageListModelItem &) @@ -318,4 +318,6 @@ ?handleFolderDeletedEvent@NmMessageListModel@@QAEXABVNmId@@0@Z @ 317 NONAME ; void NmMessageListModel::handleFolderDeletedEvent(class NmId const &, class NmId const &) ?handleFolderDeletedEvent@NmUiEngine@@AAEXABV?$QList@VNmId@@@@ABVNmId@@@Z @ 318 NONAME ; void NmUiEngine::handleFolderDeletedEvent(class QList const &, class NmId const &) ?createMessageListModel@NmUiEngine@@AAEXPAPAVNmMessageListModel@@ABVNmId@@1@Z @ 319 NONAME ; void NmUiEngine::createMessageListModel(class NmMessageListModel * *, class NmId const &, class NmId const &) + ?draftDeleted@NmUiEngine@@IAEXXZ @ 320 NONAME ; void NmUiEngine::draftDeleted(void) + ?draftSaved@NmUiEngine@@IAEXXZ @ 321 NONAME ; void NmUiEngine::draftSaved(void) diff -r 6c59112cfd31 -r 38bf5461e270 emailuis/nmailuiengine/eabi/nmailuiengineu.def --- a/emailuis/nmailuiengine/eabi/nmailuiengineu.def Thu Sep 30 11:43:07 2010 +0300 +++ b/emailuis/nmailuiengine/eabi/nmailuiengineu.def Thu Oct 14 17:33:43 2010 +0300 @@ -14,7 +14,7 @@ _ZN10NmUiEngine14folderTypeByIdE4NmIdS0_ @ 13 NONAME _ZN10NmUiEngine14mailboxDeletedERK4NmId @ 14 NONAME _ZN10NmUiEngine14messageDeletedERK4NmIdS2_S2_ @ 15 NONAME - _ZN10NmUiEngine14refreshMailboxERK4NmId @ 16 NONAME + _ZN10NmUiEngine14refreshMailboxERK4NmIdb @ 16 NONAME _ZN10NmUiEngine14searchCompleteEv @ 17 NONAME _ZN10NmUiEngine14syncStateEventE11NmSyncStateRK4NmId @ 18 NONAME _ZN10NmUiEngine15connectionEventE14NmConnectStateRK4NmId @ 19 NONAME @@ -325,4 +325,6 @@ _ZN10NmUiEngine24handleFolderDeletedEventERK5QListI4NmIdERKS1_ @ 324 NONAME _ZN18NmMessageListModel24handleFolderDeletedEventERK4NmIdS2_ @ 325 NONAME _ZN10NmUiEngine22createMessageListModelEPP18NmMessageListModelRK4NmIdS5_ @ 326 NONAME + _ZN10NmUiEngine10draftSavedEv @ 327 NONAME + _ZN10NmUiEngine12draftDeletedEv @ 328 NONAME diff -r 6c59112cfd31 -r 38bf5461e270 emailuis/nmailuiengine/inc/nmdataplugininterface.h --- a/emailuis/nmailuiengine/inc/nmdataplugininterface.h Thu Sep 30 11:43:07 2010 +0300 +++ b/emailuis/nmailuiengine/inc/nmdataplugininterface.h Thu Oct 14 17:33:43 2010 +0300 @@ -120,7 +120,7 @@ const NmId &mailbox, NmFolderType folderType ) = 0; - virtual int refreshMailbox(NmId mailboxId) = 0; + virtual int refreshMailbox(NmId mailboxId, bool silentConnection) = 0; virtual int goOnline(const NmId &mailboxId) = 0; diff -r 6c59112cfd31 -r 38bf5461e270 emailuis/nmailuiengine/inc/nmuiengine.h --- a/emailuis/nmailuiengine/inc/nmuiengine.h Thu Sep 30 11:43:07 2010 +0300 +++ b/emailuis/nmailuiengine/inc/nmuiengine.h Thu Oct 14 17:33:43 2010 +0300 @@ -126,7 +126,7 @@ int saveMessage(const NmMessage &message); - int refreshMailbox(const NmId &mailboxId); + int refreshMailbox(const NmId &mailboxId, bool silentConnection=false); int goOnline(const NmId &mailboxId); @@ -218,6 +218,8 @@ void mailboxDeleted(const NmId &mailboxId); void matchFound(const NmId &, const NmId &); void searchComplete(); + void draftSaved(); + void draftDeleted(); private: diff -r 6c59112cfd31 -r 38bf5461e270 emailuis/nmailuiengine/src/nmmailboxlistmodel.cpp --- a/emailuis/nmailuiengine/src/nmmailboxlistmodel.cpp Thu Sep 30 11:43:07 2010 +0300 +++ b/emailuis/nmailuiengine/src/nmmailboxlistmodel.cpp Thu Oct 14 17:33:43 2010 +0300 @@ -113,6 +113,9 @@ metaData->setAddress(mailbox->address().address()); entryItem->setItemMetaData(metaData); } + + delete mailbox; + mailbox = NULL; } /*! diff -r 6c59112cfd31 -r 38bf5461e270 emailuis/nmailuiengine/src/nmmessagelistmodel.cpp --- a/emailuis/nmailuiengine/src/nmmessagelistmodel.cpp Thu Sep 30 11:43:07 2010 +0300 +++ b/emailuis/nmailuiengine/src/nmmessagelistmodel.cpp Thu Oct 14 17:33:43 2010 +0300 @@ -659,11 +659,12 @@ if (changed(*item->envelopePtr(), *newEnvelope)) { // function takes envelope ownership item->setEnvelope(newEnvelope); - } else { - delete newEnvelope; - newEnvelope = NULL; - } + return; + } } + + delete newEnvelope; + newEnvelope = NULL; } /*! diff -r 6c59112cfd31 -r 38bf5461e270 emailuis/nmailuiengine/src/nmuiengine.cpp --- a/emailuis/nmailuiengine/src/nmuiengine.cpp Thu Sep 30 11:43:07 2010 +0300 +++ b/emailuis/nmailuiengine/src/nmuiengine.cpp Thu Oct 14 17:33:43 2010 +0300 @@ -649,13 +649,13 @@ /*! Refreshes mailbox. */ -int NmUiEngine::refreshMailbox(const NmId &mailboxId ) +int NmUiEngine::refreshMailbox(const NmId &mailboxId, bool silentConnection ) { int ret(NmNotFoundError); NmDataPluginInterface *plugin = mPluginFactory->interfaceInstance(mailboxId); if (plugin) { - ret = plugin->refreshMailbox(mailboxId); + ret = plugin->refreshMailbox(mailboxId, silentConnection); if (NmNoError == ret) { enableSyncIndicator(true); } @@ -1030,6 +1030,11 @@ void NmUiEngine::handleCompletedRemoveDraftOperation() { // draft message deletion observing not yet implemented... + if(mDraftMessage) { + delete mDraftMessage; + mDraftMessage = NULL; + } + emit draftDeleted(); } /*! @@ -1042,6 +1047,7 @@ delete mDraftMessage; mDraftMessage = NULL; } + emit draftSaved(); } /*! diff -r 6c59112cfd31 -r 38bf5461e270 emailuis/nmailuiwidgets/bwins/nmailuiwidgetsu.def --- a/emailuis/nmailuiwidgets/bwins/nmailuiwidgetsu.def Thu Sep 30 11:43:07 2010 +0300 +++ b/emailuis/nmailuiwidgets/bwins/nmailuiwidgetsu.def Thu Oct 14 17:33:43 2010 +0300 @@ -151,9 +151,10 @@ ?paint@NmAttachmentListWidget@@UAEXPAVQPainter@@PBVQStyleOptionGraphicsItem@@PAVQWidget@@@Z @ 150 NONAME ; void NmAttachmentListWidget::paint(class QPainter *, class QStyleOptionGraphicsItem const *, class QWidget *) ?setHtml@NmHtmlLineEdit@@QAEXABVQString@@@Z @ 151 NONAME ; void NmHtmlLineEdit::setHtml(class QString const &) ?insertContactText@NmRecipientLineEdit@@AAEXABVQString@@@Z @ 152 NONAME ; void NmRecipientLineEdit::insertContactText(class QString const &) - ?gestureEvent@NmRecipientLineEdit@@EAEXPAVQGestureEvent@@@Z @ 153 NONAME ; void NmRecipientLineEdit::gestureEvent(class QGestureEvent *) + ?gestureEvent@NmRecipientLineEdit@@MAEXPAVQGestureEvent@@@Z @ 153 NONAME ; void NmRecipientLineEdit::gestureEvent(class QGestureEvent *) ?handleLongPressed@NmAttachmentListWidget@@AAEXVQPointF@@@Z @ 154 NONAME ; void NmAttachmentListWidget::handleLongPressed(class QPointF) ?changeEvent@NmAttachmentListWidget@@MAEXPAVQEvent@@@Z @ 155 NONAME ; void NmAttachmentListWidget::changeEvent(class QEvent *) ??1NmRecipientLineEdit@@UAE@XZ @ 156 NONAME ; NmRecipientLineEdit::~NmRecipientLineEdit(void) ?moveCursor@NmEditorTextEdit@@QAEXW4MoveOperation@QTextCursor@@W4MoveMode@3@@Z @ 157 NONAME ; void NmEditorTextEdit::moveCursor(enum QTextCursor::MoveOperation, enum QTextCursor::MoveMode) + ?paste@NmHtmlLineEdit@@QAEXXZ @ 158 NONAME ; void NmHtmlLineEdit::paste(void) diff -r 6c59112cfd31 -r 38bf5461e270 emailuis/nmailuiwidgets/eabi/nmailuiwidgetsu.def --- a/emailuis/nmailuiwidgets/eabi/nmailuiwidgetsu.def Thu Sep 30 11:43:07 2010 +0300 +++ b/emailuis/nmailuiwidgets/eabi/nmailuiwidgetsu.def Thu Oct 14 17:33:43 2010 +0300 @@ -186,4 +186,5 @@ _ZThn8_N22NmAttachmentListWidgetD0Ev @ 185 NONAME _ZThn8_N22NmAttachmentListWidgetD1Ev @ 186 NONAME _ZN16NmEditorTextEdit10moveCursorEN11QTextCursor13MoveOperationENS0_8MoveModeE @ 187 NONAME + _ZN14NmHtmlLineEdit5pasteEv @ 188 NONAME diff -r 6c59112cfd31 -r 38bf5461e270 emailuis/nmailuiwidgets/inc/nmautofilllistviewitem.h --- a/emailuis/nmailuiwidgets/inc/nmautofilllistviewitem.h Thu Sep 30 11:43:07 2010 +0300 +++ b/emailuis/nmailuiwidgets/inc/nmautofilllistviewitem.h Thu Oct 14 17:33:43 2010 +0300 @@ -35,7 +35,7 @@ public: // from HbListViewItem HbListViewItem *createItem(); void updateChildItems(); - bool canSetModelIndex(const QModelIndex &index); + bool canSetModelIndex(const QModelIndex &index) const; private: QString setHtmlUnderLine(const NmContactHistoryModelSubItem &subItem); diff -r 6c59112cfd31 -r 38bf5461e270 emailuis/nmailuiwidgets/inc/nmhtmllineedit.h --- a/emailuis/nmailuiwidgets/inc/nmhtmllineedit.h Thu Sep 30 11:43:07 2010 +0300 +++ b/emailuis/nmailuiwidgets/inc/nmhtmllineedit.h Thu Oct 14 17:33:43 2010 +0300 @@ -46,7 +46,9 @@ public slots: void setPlainText(const QString &text); void setHtml(const QString &text); - + // From HbAbstractEdit + void paste(); + private: qreal mIndent; }; diff -r 6c59112cfd31 -r 38bf5461e270 emailuis/nmailuiwidgets/inc/nmrecipientlineedit.h --- a/emailuis/nmailuiwidgets/inc/nmrecipientlineedit.h Thu Sep 30 11:43:07 2010 +0300 +++ b/emailuis/nmailuiwidgets/inc/nmrecipientlineedit.h Thu Oct 14 17:33:43 2010 +0300 @@ -48,6 +48,7 @@ protected: // from HbLineEdit void keyPressEvent(QKeyEvent *event); void inputMethodEvent(QInputMethodEvent *event); + void gestureEvent(QGestureEvent* event); private: void generateEmailAddressList(); @@ -58,7 +59,6 @@ void currentTextPart(int& startIndex, int& length); void getChosenAddressFromModel(const QModelIndex &modelIndex, NmAddress &address); void setHighlight(int currentPos); - void gestureEvent(QGestureEvent* event); void handleTap(); void insertContactText(const QString &text); void keyPressEventSemicolon(QKeyEvent *event); diff -r 6c59112cfd31 -r 38bf5461e270 emailuis/nmailuiwidgets/src/nmautofilllistviewitem.cpp --- a/emailuis/nmailuiwidgets/src/nmautofilllistviewitem.cpp Thu Sep 30 11:43:07 2010 +0300 +++ b/emailuis/nmailuiwidgets/src/nmautofilllistviewitem.cpp Thu Oct 14 17:33:43 2010 +0300 @@ -122,7 +122,7 @@ \param index The model index. \return always true. */ -bool NmAutoFillListViewItem::canSetModelIndex(const QModelIndex &index) +bool NmAutoFillListViewItem::canSetModelIndex(const QModelIndex &index) const { NM_FUNCTION; diff -r 6c59112cfd31 -r 38bf5461e270 emailuis/nmailuiwidgets/src/nmhtmllineedit.cpp --- a/emailuis/nmailuiwidgets/src/nmhtmllineedit.cpp Thu Sep 30 11:43:07 2010 +0300 +++ b/emailuis/nmailuiwidgets/src/nmhtmllineedit.cpp Thu Oct 14 17:33:43 2010 +0300 @@ -178,3 +178,12 @@ cursor.mergeBlockFormat(format); } +/*! + Indention for the first row of the edit field must be set again when + pasting text into field. + */ +void NmHtmlLineEdit::paste() +{ + HbAbstractEdit::paste(); + setIndentForLabel(mIndent); +} diff -r 6c59112cfd31 -r 38bf5461e270 emailuis/nmailuiwidgets/src/nmrecipientlineedit.cpp --- a/emailuis/nmailuiwidgets/src/nmrecipientlineedit.cpp Thu Sep 30 11:43:07 2010 +0300 +++ b/emailuis/nmailuiwidgets/src/nmrecipientlineedit.cpp Thu Oct 14 17:33:43 2010 +0300 @@ -380,8 +380,6 @@ HbLineEdit::gestureEvent(event); if (HbTapGesture *tap = qobject_cast(event->gesture(Qt::TapGesture))) { - //capturing gesture position, and map to local co-ordinates. - QPointF pos = mapFromScene(tap->scenePosition()); switch (tap->state()) { case Qt::GestureFinished: @@ -407,23 +405,21 @@ int currentPos = cursorPosition(); QString txt = text(); - QString leftTxt = txt.left(currentPos+2); + QString leftTxt = txt.left(currentPos+2); //recipient items delimeter takes 2 characters int previousSemicolonIndex = leftTxt.lastIndexOf(NmRecipientLineEditSemicolon,currentPos); if ((currentPos>0) && (currentPos==previousSemicolonIndex || currentPos==previousSemicolonIndex+1)) { + //do we really need this? currentPos==previousSemicolonIndex //pressed just on seperator setCursorPosition(previousSemicolonIndex+2); } - else - { + else { // pressed in middle of an address - setCursorPosition(currentPos); if (textCursor().charFormat().fontUnderline()) { // This entry is a "contact" - setHighlight(currentPos); + setHighlight(currentPos); } } - update(); } /*! @@ -508,15 +504,14 @@ //if there is no text, hide popup already if (document()->isEmpty()) { hideAutofillPopup(); + return; //no need to continue } - if (mContactHistoryModel) { - int startPos(-1), length(-1); - currentTextPart(startPos, length); - QString t = text.mid(startPos, length); - if (t.length()) { - mContactHistoryModel->query(t); - } + int startPos(-1), length(-1); + currentTextPart(startPos, length); + QString t = text.mid(startPos, length); + if (t.length()) { + mContactHistoryModel->query(t); } } @@ -590,11 +585,11 @@ if (item.subItemCount()) { QList itemlist = item.subEntries(); if (itemlist.count() == 2) { - address.setDisplayName(itemlist[0].mItemText); - address.setAddress(itemlist[1].mItemText); + address.setDisplayName(itemlist[0].mItemText.trimmed()); + address.setAddress(itemlist[1].mItemText.trimmed()); } else if (itemlist.count() == 1) { // only emailaddress found (no display name) - address.setAddress(itemlist[0].mItemText); + address.setAddress(itemlist[0].mItemText.trimmed()); } } } @@ -753,8 +748,8 @@ else { deselect(); } - - update(); + + } /*! diff -r 6c59112cfd31 -r 38bf5461e270 emailuis/nmframeworkadapter/inc/nmframeworkadapter.h --- a/emailuis/nmframeworkadapter/inc/nmframeworkadapter.h Thu Sep 30 11:43:07 2010 +0300 +++ b/emailuis/nmframeworkadapter/inc/nmframeworkadapter.h Thu Oct 14 17:33:43 2010 +0300 @@ -122,7 +122,7 @@ const NmId& mailbox, NmFolderType folderType ); - int refreshMailbox(NmId mailboxId); + int refreshMailbox(NmId mailboxId, bool silentConnection); int goOnline(const NmId& mailboxId); @@ -283,7 +283,7 @@ void resetCache(const NmId &mailboxId); - int RefreshMailboxL(NmId mailboxId); + int RefreshMailboxL(NmId mailboxId, bool silentConnection); int GoOnlineL(const NmId &mailboxId); diff -r 6c59112cfd31 -r 38bf5461e270 emailuis/nmframeworkadapter/inc/nmframeworkadapterheaders.h --- a/emailuis/nmframeworkadapter/inc/nmframeworkadapterheaders.h Thu Sep 30 11:43:07 2010 +0300 +++ b/emailuis/nmframeworkadapter/inc/nmframeworkadapterheaders.h Thu Oct 14 17:33:43 2010 +0300 @@ -77,6 +77,7 @@ #include #include #include +#include diff -r 6c59112cfd31 -r 38bf5461e270 emailuis/nmframeworkadapter/src/nmframeworkadapter.cpp --- a/emailuis/nmframeworkadapter/src/nmframeworkadapter.cpp Thu Sep 30 11:43:07 2010 +0300 +++ b/emailuis/nmframeworkadapter/src/nmframeworkadapter.cpp Thu Oct 14 17:33:43 2010 +0300 @@ -342,8 +342,8 @@ NM_TIMESTAMP("ListMessagesL in getMessagesFromFolderL start"); // Get the message list from the backend. - MFSMailIterator* iterator(NULL); - iterator = folder->ListMessagesL(details, sorting); + CFSMailIterator* iterator(NULL); + iterator = static_cast(folder->ListMessagesL(details, sorting)); NM_TIMESTAMP("ListMessagesL in getMessagesFromFolderL end"); @@ -541,7 +541,7 @@ CleanupStack::PushL(folder); // First prepare all the parameters // select message details to be listed - TFSMailDetails details(EFSMsgDataEnvelope); + TFSMailDetails details(EFSMsgDataStructure); // set sorting criteria TFSMailSortCriteria criteria; @@ -578,13 +578,16 @@ NmMessage* newMessage(NULL); newMessage = messages[i]->GetNmMessage(); if (newMessage) { - //Add content of message + CleanupStack::PushL(newMessage); + //Add content of message + childrenToNmMessagePartL(messages[i], newMessage); NmMessagePart *plainTextPart = newMessage->plainTextBodyPart(); if (plainTextPart) { contentToMessagePart(mailboxId, folderId, newMessage->envelope().messageId(), *plainTextPart); } messageList.append(newMessage); + CleanupStack::Pop(newMessage); } } @@ -960,13 +963,13 @@ \param mailboxId Id of the mailbox. \return Async request id or error code. */ -int NmFrameworkAdapter::refreshMailbox(NmId mailboxId) +int NmFrameworkAdapter::refreshMailbox(NmId mailboxId, bool silentConnection) { NM_FUNCTION; resetCache(mailboxId); - TRAPD(err, RefreshMailboxL(mailboxId)); // return value not used + TRAPD(err, RefreshMailboxL(mailboxId, silentConnection)); // return value not used return (err == KErrNone) ? NmNoError : NmGeneralError; } @@ -1616,9 +1619,10 @@ NM_FUNCTION; NmMessage* nmMessage = new(ELeave) NmMessage( envelope ); + CleanupStack::PushL(nmMessage); CFSMailMessage* message = CFSMailMessage::NewL( *nmMessage ); - delete nmMessage; - nmMessage = NULL; + CleanupStack::PopAndDestroy(nmMessage); + return message; } @@ -1653,7 +1657,7 @@ /*! Leaving Refresh function */ -int NmFrameworkAdapter::RefreshMailboxL(NmId mailboxId) +int NmFrameworkAdapter::RefreshMailboxL(NmId mailboxId, bool silentConnection) { NM_FUNCTION; @@ -1662,7 +1666,7 @@ currentMailbox = mFSfw->GetMailBoxByUidL(mailboxId); if(currentMailbox) { CleanupStack::PushL(currentMailbox); - result = currentMailbox->RefreshNowL(); + result = currentMailbox->RefreshNowL(silentConnection); CleanupStack::PopAndDestroy(currentMailbox); } return result; diff -r 6c59112cfd31 -r 38bf5461e270 emailuis/nmframeworkadapter/src/nmfwaaddattachmentsoperation.cpp --- a/emailuis/nmframeworkadapter/src/nmfwaaddattachmentsoperation.cpp Thu Sep 30 11:43:07 2010 +0300 +++ b/emailuis/nmframeworkadapter/src/nmfwaaddattachmentsoperation.cpp Thu Oct 14 17:33:43 2010 +0300 @@ -46,7 +46,7 @@ for (int i=0; i* ptrArray = + reinterpret_cast*> (aAny); + ptrArray->ResetAndDestroy(); + } + +void CleanupResetAndDestroyPushL( RPointerArray& aArray ) + { + TCleanupItem item( &ResetAndDestroyArray, &aArray ); + CleanupStack::PushL( item ); + } + /*! Constructor @@ -81,12 +94,12 @@ NM_FUNCTION; CFSMailMessage *msg = NULL; - msg = CFSMailMessage::NewL(mMessage); + CleanupStack::PushL( msg ); // Get attachment list from the message RPointerArray attachments; - attachments.Reset(); + CleanupResetAndDestroyPushL( attachments ); msg->AttachmentListL(attachments); // Search through all attachments from message and remove attachment @@ -99,9 +112,8 @@ break; } } - attachments.ResetAndDestroy(); - delete msg; - msg = NULL; + + CleanupStack::PopAndDestroy( 2, msg ); // attachments, msg // if attachment is not found, request to plugin is not made // and the operation should be completed here if (!found) { diff -r 6c59112cfd31 -r 38bf5461e270 emailuis/nmhswidget/conf/nmhswidget.docml --- a/emailuis/nmhswidget/conf/nmhswidget.docml Thu Sep 30 11:43:07 2010 +0300 +++ b/emailuis/nmhswidget/conf/nmhswidget.docml Thu Oct 14 17:33:43 2010 +0300 @@ -19,8 +19,6 @@ - - diff -r 6c59112cfd31 -r 38bf5461e270 emailuis/nmhswidget/conf/nmhswidgetlistviewitem.css --- a/emailuis/nmhswidget/conf/nmhswidgetlistviewitem.css Thu Sep 30 11:43:07 2010 +0300 +++ b/emailuis/nmhswidget/conf/nmhswidgetlistviewitem.css Thu Oct 14 17:33:43 2010 +0300 @@ -23,22 +23,24 @@ } NmHsWidgetListViewItem::subject { - fixed-height: var(hb-param-text-height-secondary); - text-height: var(hb-param-text-height-secondary); + min-height: var(hb-param-text-height-secondary); + text-height: var(hb-param-text-height-tiny); text-align: left; - text-wrap-mode: no-wrap; + text-line-count-min:1; + text-line-count-max:3; + text-wrap-mode:word-wrap; } NmHsWidgetListViewItem::icon1 { alignment: right; - fixed-height: var(hb-param-graphic-size-secondary); - fixed-width: var(hb-param-graphic-size-secondary); + max-height: var(hb-param-graphic-size-secondary); + max-width: var(hb-param-graphic-size-secondary); } NmHsWidgetListViewItem::icon2 { alignment: right; - fixed-height: var(hb-param-graphic-size-secondary); - fixed-width: var(hb-param-graphic-size-secondary); + max-height: var(hb-param-graphic-size-secondary); + max-width: var(hb-param-graphic-size-secondary); } NmHsWidgetListViewItem::separator { diff -r 6c59112cfd31 -r 38bf5461e270 emailuis/nmhswidget/conf/nmhswidgetlistviewitem.widgetml --- a/emailuis/nmhswidget/conf/nmhswidgetlistviewitem.widgetml Thu Sep 30 11:43:07 2010 +0300 +++ b/emailuis/nmhswidget/conf/nmhswidgetlistviewitem.widgetml Thu Oct 14 17:33:43 2010 +0300 @@ -15,18 +15,18 @@ + - - - - - + + + + \ No newline at end of file diff -r 6c59112cfd31 -r 38bf5461e270 emailuis/nmhswidget/inc/nmhswidget.h --- a/emailuis/nmhswidget/inc/nmhswidget.h Thu Sep 30 11:43:07 2010 +0300 +++ b/emailuis/nmhswidget/inc/nmhswidget.h Thu Oct 14 17:33:43 2010 +0300 @@ -19,6 +19,7 @@ #define NMHSWIDGET_H #include +#include #include "nmcommon.h" class NmHsWidgetEmailEngine; @@ -32,6 +33,7 @@ class HbListView; class NmHsWidgetListModel; class QModelIndex; +class QTimer; class NmHsWidget : public HbWidget @@ -55,7 +57,6 @@ void onShow(); void onHide(); //engine - void updateMailData(); void onEngineException(const int& exc); //properties void setAccountId(const QString &text); @@ -67,8 +68,10 @@ //user actions void handleExpandCollapseEvent(); + void handleMessagesAddedToModel(); void openMessage(const QModelIndex& index); - + void scrollListToStart(); + void updateLayout(); signals: void finished(); void setPreferences(const QStringList &names); @@ -81,10 +84,12 @@ void removeNoMailsLabelFromLayout(); void addEmailRowsToLayout(); void removeEmailRowsFromLayout(); - void updateLayout(const int visibleCount); void toggleExpansionState(); void createMailRowsList(); protected: + bool event( QEvent *event ); +private slots: + void toggleExpansion(const HbEffect::EffectStatus &status); private: //UI components @@ -105,7 +110,7 @@ bool mIsExpanded; //true when widget expanded, false when collapsed HbListView* mListView; //list view for messages NmHsWidgetListModel* mListModel; //list model for mListView - + QTimer *mListActivityTimer; //Timer for delaying activities after list scrolling public: friend class TestNmHsWidget; }; diff -r 6c59112cfd31 -r 38bf5461e270 emailuis/nmhswidget/inc/nmhswidgetconsts.h --- a/emailuis/nmhswidget/inc/nmhswidgetconsts.h Thu Sep 30 11:43:07 2010 +0300 +++ b/emailuis/nmhswidget/inc/nmhswidgetconsts.h Thu Oct 14 17:33:43 2010 +0300 @@ -26,6 +26,11 @@ const int KMaxNumberOfEnvelopesProvided = 99; //Maximum value for unread count const int KMaxUnreadCount = 999; +//Delay before scrolling message list to first item after scrolling has ended +const int KNmHsWidgetDelayAfterScrollingEnded = 10000; +//Time parameter used for the automatic scrolling +//(how long the scrolling will last) +const int KListScrollUpTime = 500; /************************************************** * nmhswidget diff -r 6c59112cfd31 -r 38bf5461e270 emailuis/nmhswidget/inc/nmhswidgetemailengine.h --- a/emailuis/nmhswidget/inc/nmhswidgetemailengine.h Thu Sep 30 11:43:07 2010 +0300 +++ b/emailuis/nmhswidget/inc/nmhswidgetemailengine.h Thu Oct 14 17:33:43 2010 +0300 @@ -27,9 +27,8 @@ class QPluginLoader; class QTimer; class XQAiwRequest; +class NmHsWidgetListModel; -//Three seconds -const int NmHsWidgetEmailEngineUpdateTimerValue = 3000; enum NmHsWidgetEmailEngineExceptionCode { @@ -42,11 +41,10 @@ Q_OBJECT public: - NmHsWidgetEmailEngine( const NmId& monitoredMailboxId ); + NmHsWidgetEmailEngine( const NmId& monitoredMailboxId); bool initialize(); ~NmHsWidgetEmailEngine(); - int getEnvelopes(QList &list, int maxEnvelopeAmount); int unreadCount(); QString accountName(); void deleteAiwRequest(); @@ -69,38 +67,49 @@ //Activity control void suspend(); void activate(); + void forceUpdate(); + void launchMailAppInboxView(); void launchMailAppMailViewer(const NmId &messageId); - void handleUpdateTimeout(); void aiwRequestOk(const QVariant& result); void aiwRequestError(int errorCode, const QString& errorMessage); signals: - void mailDataChanged(); + //all mail data was refreshed (list contains all items) + void mailDataRefreshed(const QList&); + //all mail data was cleared + void mailDataCleared(); + //new mails received (list contains the only items) + void mailsReceived(const QList&); + //mail items updated (list contains changed items) + void mailsUpdated(const QList&); + //mails deleted (list contains the id's of the deleted items) + void mailsDeleted(const QList&); + void accountNameChanged(const QString& accountName); void unreadCountChanged(const int& unreadCount); void exceptionOccured(const int& err); - + private: bool constructNmPlugin(); bool updateData(); + bool updateUnreadCount(); bool updateAccount(); - void resetEnvelopeList(); + QList getEnvelopesFromIds(const QList messageIds); + NmMessageEnvelope* envelopeById(const NmId &messageId); private: NmId mMailboxId; NmId mFolderId; QString mAccountName; int mUnreadCount; - QList mEnvelopeList; NmDataPluginInterface *mEmailInterface; NmDataPluginFactory* mFactory; //suspension variables - bool mAccountEventReceivedWhenSuspended; - bool mMessageEventReceivedWhenSuspended; + bool mAccountDataNeedsUpdate; + bool mMessageDataNeedsUpdate; bool mSuspended; - QTimer* mUpdateTimer; XQAiwRequest* mAiwRequest; }; diff -r 6c59112cfd31 -r 38bf5461e270 emailuis/nmhswidget/inc/nmhswidgetlistmodel.h --- a/emailuis/nmhswidget/inc/nmhswidgetlistmodel.h Thu Sep 30 11:43:07 2010 +0300 +++ b/emailuis/nmhswidget/inc/nmhswidgetlistmodel.h Thu Oct 14 17:33:43 2010 +0300 @@ -22,6 +22,7 @@ class NmMessageEnvelope; class NmHsWidgetListModelItem; +class NmId; class NmHsWidgetListModel : public QStandardItemModel { @@ -31,13 +32,22 @@ NmHsWidgetListModel(QObject *parent = 0); virtual ~NmHsWidgetListModel(); QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const; - void refresh(QList &mailboxList); + public slots: + void refresh(const QList &messageEnvs); + void addMessages(const QList &messageEnvs); + void updateMessages(const QList &messageEnvs); + void removeMessages(const QList &messageIds); + void removeAllMessages(); + +signals: + void messagesAddedToModel(); //emitted only when single items are inserted to model + void modelIsEmpty(bool isEmpty); private: NmHsWidgetListModelItem *createMessageListModelItem(const NmMessageEnvelope* env); - + int getInsertionIndex(const NmMessageEnvelope &envelope) const; }; #endif /* NMHSWIDGETLISTMODEL_H_ */ diff -r 6c59112cfd31 -r 38bf5461e270 emailuis/nmhswidget/inc/nmhswidgetlistviewitem.h --- a/emailuis/nmhswidget/inc/nmhswidgetlistviewitem.h Thu Sep 30 11:43:07 2010 +0300 +++ b/emailuis/nmhswidget/inc/nmhswidgetlistviewitem.h Thu Oct 14 17:33:43 2010 +0300 @@ -47,6 +47,7 @@ void setContentsToMessageItem(const NmMessageEnvelope &envelope); void setFontsRead(); void setFontsUnread(); + bool event( QEvent *event ); private: HbIconItem *mSeparator; // Owned diff -r 6c59112cfd31 -r 38bf5461e270 emailuis/nmhswidget/inc/nmhswidgettitlerow.h --- a/emailuis/nmhswidget/inc/nmhswidgettitlerow.h Thu Sep 30 11:43:07 2010 +0300 +++ b/emailuis/nmhswidget/inc/nmhswidgettitlerow.h Thu Oct 14 17:33:43 2010 +0300 @@ -19,6 +19,7 @@ #define NMHSWIDGETTITLEROW_H_ #include +#include //FORWARD DECLARATIONS: class HbLabel; @@ -44,12 +45,14 @@ bool loadDocML(HbDocumentLoader &loader); bool setupGraphics(); void updateData(); - void setHighlighedFontsColor( bool pressed ); - void showHighlight( bool pressed ); + void setFontsColor(); public slots: void updateAccountName(const QString& accountName ); void updateUnreadCount(const int& unreadCount ); + +private slots: + void hideHighlight(const HbEffect::EffectStatus &status); signals: void expandCollapseButtonPressed(); diff -r 6c59112cfd31 -r 38bf5461e270 emailuis/nmhswidget/resources/nmhswidget.manifest --- a/emailuis/nmhswidget/resources/nmhswidget.manifest Thu Sep 30 11:43:07 2010 +0300 +++ b/emailuis/nmhswidget/resources/nmhswidget.manifest Thu Oct 14 17:33:43 2010 +0300 @@ -2,6 +2,6 @@ nmhswidget nmhswidget - false + true nmhswidget.xml diff -r 6c59112cfd31 -r 38bf5461e270 emailuis/nmhswidget/sis/nmhswidget.pkg --- a/emailuis/nmhswidget/sis/nmhswidget.pkg Thu Sep 30 11:43:07 2010 +0300 +++ b/emailuis/nmhswidget/sis/nmhswidget.pkg Thu Oct 14 17:33:43 2010 +0300 @@ -17,7 +17,7 @@ &EN ; Package header -#{"NmHsWidget Installation package"}, (0x2002DD15), 1, 0, 0 +#{"NmHsWidget Installation package"}, (0x2002DD15), 1, 1, 0, TYPE=SA, RU ;Localised Vendor name %{"Nokia"} diff -r 6c59112cfd31 -r 38bf5461e270 emailuis/nmhswidget/sis/nmhswidget_udeb.pkg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/emailuis/nmhswidget/sis/nmhswidget_udeb.pkg Thu Oct 14 17:33:43 2010 +0300 @@ -0,0 +1,145 @@ +; +; 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: +; +;Language - standard language definitions +&EN + +; Package header +#{"NmHsWidget Installation package"}, (0x2002DD15), 1, 1, 0, TYPE=SA, RU + +;Localised Vendor name +%{"Nokia"} + +;Unique Vendor name +:"Nokia" + +;notify HS about new provider - keep this always as a first item +"..\resources\nmhswidget.manifest" - "!:\private\20022F35\import\widgetregistry\2002DD15\nmhswidget.manifest",FM,"application\hs-widget-uninstall+xml",RR,RW + +;nmhswidget +"\epoc32\release\armv5\udeb\nmhswidget.dll" - "!:\sys\bin\nmhswidget.dll" +"\epoc32\data\z\resource\qt\plugins\nmhswidget.qtplugin" - "!:\private\20022F35\import\widgetregistry\2002DD15\nmhswidget.qtplugin" +"\epoc32\data\z\private\2002DD15\nmhswidget.xml" - "!:\private\20022F35\import\widgetregistry\2002DD15\nmhswidget.xml" +"..\resources\nmhswidget.manifest" - "!:\private\20022F35\import\widgetregistry\2002DD15\nmhswidget.manifest" +"\epoc32\data\z\resource\qt\translations\mailwidget_ar.qm" - "!:\resource\qt\translations\mailwidget_ar.qm" +"\epoc32\data\z\resource\qt\translations\mailwidget_bg.qm" - "!:\resource\qt\translations\mailwidget_bg.qm" +"\epoc32\data\z\resource\qt\translations\mailwidget_ca.qm" - "!:\resource\qt\translations\mailwidget_ca.qm" +"\epoc32\data\z\resource\qt\translations\mailwidget_cs.qm" - "!:\resource\qt\translations\mailwidget_cs.qm" +"\epoc32\data\z\resource\qt\translations\mailwidget_da.qm" - "!:\resource\qt\translations\mailwidget_da.qm" +"\epoc32\data\z\resource\qt\translations\mailwidget_de.qm" - "!:\resource\qt\translations\mailwidget_de.qm" +"\epoc32\data\z\resource\qt\translations\mailwidget_el.qm" - "!:\resource\qt\translations\mailwidget_el.qm" +"\epoc32\data\z\resource\qt\translations\mailwidget_en.qm" - "!:\resource\qt\translations\mailwidget_en.qm" +"\epoc32\data\z\resource\qt\translations\mailwidget_en_US.qm" - "!:\resource\qt\translations\mailwidget_en_US.qm" +"\epoc32\data\z\resource\qt\translations\mailwidget_es.qm" - "!:\resource\qt\translations\mailwidget_es.qm" +"\epoc32\data\z\resource\qt\translations\mailwidget_es_419.qm" - "!:\resource\qt\translations\mailwidget_es_419.qm" +"\epoc32\data\z\resource\qt\translations\mailwidget_et.qm" - "!:\resource\qt\translations\mailwidget_et.qm" +"\epoc32\data\z\resource\qt\translations\mailwidget_eu.qm" - "!:\resource\qt\translations\mailwidget_eu.qm" +"\epoc32\data\z\resource\qt\translations\mailwidget_fa.qm" - "!:\resource\qt\translations\mailwidget_fa.qm" +"\epoc32\data\z\resource\qt\translations\mailwidget_fi.qm" - "!:\resource\qt\translations\mailwidget_fi.qm" +"\epoc32\data\z\resource\qt\translations\mailwidget_fr.qm" - "!:\resource\qt\translations\mailwidget_fr.qm" +"\epoc32\data\z\resource\qt\translations\mailwidget_fr_CA.qm" - "!:\resource\qt\translations\mailwidget_fr_CA.qm" +"\epoc32\data\z\resource\qt\translations\mailwidget_gl.qm" - "!:\resource\qt\translations\mailwidget_gl.qm" +"\epoc32\data\z\resource\qt\translations\mailwidget_he.qm" - "!:\resource\qt\translations\mailwidget_he.qm" +"\epoc32\data\z\resource\qt\translations\mailwidget_hi.qm" - "!:\resource\qt\translations\mailwidget_hi.qm" +"\epoc32\data\z\resource\qt\translations\mailwidget_hr.qm" - "!:\resource\qt\translations\mailwidget_hr.qm" +"\epoc32\data\z\resource\qt\translations\mailwidget_hu.qm" - "!:\resource\qt\translations\mailwidget_hu.qm" +"\epoc32\data\z\resource\qt\translations\mailwidget_id.qm" - "!:\resource\qt\translations\mailwidget_id.qm" +"\epoc32\data\z\resource\qt\translations\mailwidget_is.qm" - "!:\resource\qt\translations\mailwidget_is.qm" +"\epoc32\data\z\resource\qt\translations\mailwidget_it.qm" - "!:\resource\qt\translations\mailwidget_it.qm" +"\epoc32\data\z\resource\qt\translations\mailwidget_ja.qm" - "!:\resource\qt\translations\mailwidget_ja.qm" +"\epoc32\data\z\resource\qt\translations\mailwidget_ko.qm" - "!:\resource\qt\translations\mailwidget_ko.qm" +"\epoc32\data\z\resource\qt\translations\mailwidget_lt.qm" - "!:\resource\qt\translations\mailwidget_lt.qm" +"\epoc32\data\z\resource\qt\translations\mailwidget_lv.qm" - "!:\resource\qt\translations\mailwidget_lv.qm" +"\epoc32\data\z\resource\qt\translations\mailwidget_ms.qm" - "!:\resource\qt\translations\mailwidget_ms.qm" +"\epoc32\data\z\resource\qt\translations\mailwidget_nb.qm" - "!:\resource\qt\translations\mailwidget_nb.qm" +"\epoc32\data\z\resource\qt\translations\mailwidget_nl.qm" - "!:\resource\qt\translations\mailwidget_nl.qm" +"\epoc32\data\z\resource\qt\translations\mailwidget_pl.qm" - "!:\resource\qt\translations\mailwidget_pl.qm" +"\epoc32\data\z\resource\qt\translations\mailwidget_pt.qm" - "!:\resource\qt\translations\mailwidget_pt.qm" +"\epoc32\data\z\resource\qt\translations\mailwidget_pt_BR.qm" - "!:\resource\qt\translations\mailwidget_pt_BR.qm" +"\epoc32\data\z\resource\qt\translations\mailwidget_ro.qm" - "!:\resource\qt\translations\mailwidget_ro.qm" +"\epoc32\data\z\resource\qt\translations\mailwidget_ru.qm" - "!:\resource\qt\translations\mailwidget_ru.qm" +"\epoc32\data\z\resource\qt\translations\mailwidget_sk.qm" - "!:\resource\qt\translations\mailwidget_sk.qm" +"\epoc32\data\z\resource\qt\translations\mailwidget_sl.qm" - "!:\resource\qt\translations\mailwidget_sl.qm" +"\epoc32\data\z\resource\qt\translations\mailwidget_sr.qm" - "!:\resource\qt\translations\mailwidget_sr.qm" +"\epoc32\data\z\resource\qt\translations\mailwidget_sv.qm" - "!:\resource\qt\translations\mailwidget_sv.qm" +"\epoc32\data\z\resource\qt\translations\mailwidget_th.qm" - "!:\resource\qt\translations\mailwidget_th.qm" +"\epoc32\data\z\resource\qt\translations\mailwidget_tl.qm" - "!:\resource\qt\translations\mailwidget_tl.qm" +"\epoc32\data\z\resource\qt\translations\mailwidget_tr.qm" - "!:\resource\qt\translations\mailwidget_tr.qm" +"\epoc32\data\z\resource\qt\translations\mailwidget_uk.qm" - "!:\resource\qt\translations\mailwidget_uk.qm" +"\epoc32\data\z\resource\qt\translations\mailwidget_ur.qm" - "!:\resource\qt\translations\mailwidget_ur.qm" +"\epoc32\data\z\resource\qt\translations\mailwidget_vi.qm" - "!:\resource\qt\translations\mailwidget_vi.qm" +"\epoc32\data\z\resource\qt\translations\mailwidget_zh.qm" - "!:\resource\qt\translations\mailwidget_zh.qm" +"\epoc32\data\z\resource\qt\translations\mailwidget_zh_HK.qm" - "!:\resource\qt\translations\mailwidget_zh_HK.qm" +"\epoc32\data\z\resource\qt\translations\mailwidget_zh_TW.qm" - "!:\resource\qt\translations\mailwidget_zh_TW.qm" + + +;nmregister +"\epoc32\release\armv5\udeb\nmregister.dll" - "!:\sys\bin\nmregister.dll" +"\epoc32\data\z\private\2002DD16\nmregister.xml" - "!:\private\2002DD16\import\nmregister.xml" +"\epoc32\data\z\resource\qt\plugins\nmregister.qtplugin" - "!:\resource\qt\plugins\nmregister.qtplugin" +"\epoc32\data\z\resource\qt\translations\nmregister_ar.qm" - "!:\resource\qt\translations\nmregister_ar.qm" +"\epoc32\data\z\resource\qt\translations\nmregister_bg.qm" - "!:\resource\qt\translations\nmregister_bg.qm" +"\epoc32\data\z\resource\qt\translations\nmregister_ca.qm" - "!:\resource\qt\translations\nmregister_ca.qm" +"\epoc32\data\z\resource\qt\translations\nmregister_cs.qm" - "!:\resource\qt\translations\nmregister_cs.qm" +"\epoc32\data\z\resource\qt\translations\nmregister_da.qm" - "!:\resource\qt\translations\nmregister_da.qm" +"\epoc32\data\z\resource\qt\translations\nmregister_de.qm" - "!:\resource\qt\translations\nmregister_de.qm" +"\epoc32\data\z\resource\qt\translations\nmregister_el.qm" - "!:\resource\qt\translations\nmregister_el.qm" +"\epoc32\data\z\resource\qt\translations\nmregister_en.qm" - "!:\resource\qt\translations\nmregister_en.qm" +"\epoc32\data\z\resource\qt\translations\nmregister_en_US.qm" - "!:\resource\qt\translations\nmregister_en_US.qm" +"\epoc32\data\z\resource\qt\translations\nmregister_es.qm" - "!:\resource\qt\translations\nmregister_es.qm" +"\epoc32\data\z\resource\qt\translations\nmregister_es_419.qm" - "!:\resource\qt\translations\nmregister_es_419.qm" +"\epoc32\data\z\resource\qt\translations\nmregister_et.qm" - "!:\resource\qt\translations\nmregister_et.qm" +"\epoc32\data\z\resource\qt\translations\nmregister_eu.qm" - "!:\resource\qt\translations\nmregister_eu.qm" +"\epoc32\data\z\resource\qt\translations\nmregister_fa.qm" - "!:\resource\qt\translations\nmregister_fa.qm" +"\epoc32\data\z\resource\qt\translations\nmregister_fi.qm" - "!:\resource\qt\translations\nmregister_fi.qm" +"\epoc32\data\z\resource\qt\translations\nmregister_fr.qm" - "!:\resource\qt\translations\nmregister_fr.qm" +"\epoc32\data\z\resource\qt\translations\nmregister_fr_CA.qm" - "!:\resource\qt\translations\nmregister_fr_CA.qm" +"\epoc32\data\z\resource\qt\translations\nmregister_gl.qm" - "!:\resource\qt\translations\nmregister_gl.qm" +"\epoc32\data\z\resource\qt\translations\nmregister_he.qm" - "!:\resource\qt\translations\nmregister_he.qm" +"\epoc32\data\z\resource\qt\translations\nmregister_hi.qm" - "!:\resource\qt\translations\nmregister_hi.qm" +"\epoc32\data\z\resource\qt\translations\nmregister_hr.qm" - "!:\resource\qt\translations\nmregister_hr.qm" +"\epoc32\data\z\resource\qt\translations\nmregister_hu.qm" - "!:\resource\qt\translations\nmregister_hu.qm" +"\epoc32\data\z\resource\qt\translations\nmregister_id.qm" - "!:\resource\qt\translations\nmregister_id.qm" +"\epoc32\data\z\resource\qt\translations\nmregister_is.qm" - "!:\resource\qt\translations\nmregister_is.qm" +"\epoc32\data\z\resource\qt\translations\nmregister_it.qm" - "!:\resource\qt\translations\nmregister_it.qm" +"\epoc32\data\z\resource\qt\translations\nmregister_ja.qm" - "!:\resource\qt\translations\nmregister_ja.qm" +"\epoc32\data\z\resource\qt\translations\nmregister_ko.qm" - "!:\resource\qt\translations\nmregister_ko.qm" +"\epoc32\data\z\resource\qt\translations\nmregister_lt.qm" - "!:\resource\qt\translations\nmregister_lt.qm" +"\epoc32\data\z\resource\qt\translations\nmregister_lv.qm" - "!:\resource\qt\translations\nmregister_lv.qm" +"\epoc32\data\z\resource\qt\translations\nmregister_ms.qm" - "!:\resource\qt\translations\nmregister_ms.qm" +"\epoc32\data\z\resource\qt\translations\nmregister_nb.qm" - "!:\resource\qt\translations\nmregister_nb.qm" +"\epoc32\data\z\resource\qt\translations\nmregister_nl.qm" - "!:\resource\qt\translations\nmregister_nl.qm" +"\epoc32\data\z\resource\qt\translations\nmregister_pl.qm" - "!:\resource\qt\translations\nmregister_pl.qm" +"\epoc32\data\z\resource\qt\translations\nmregister_pt.qm" - "!:\resource\qt\translations\nmregister_pt.qm" +"\epoc32\data\z\resource\qt\translations\nmregister_pt_BR.qm" - "!:\resource\qt\translations\nmregister_pt_BR.qm" +"\epoc32\data\z\resource\qt\translations\nmregister_ro.qm" - "!:\resource\qt\translations\nmregister_ro.qm" +"\epoc32\data\z\resource\qt\translations\nmregister_ru.qm" - "!:\resource\qt\translations\nmregister_ru.qm" +"\epoc32\data\z\resource\qt\translations\nmregister_sk.qm" - "!:\resource\qt\translations\nmregister_sk.qm" +"\epoc32\data\z\resource\qt\translations\nmregister_sl.qm" - "!:\resource\qt\translations\nmregister_sl.qm" +"\epoc32\data\z\resource\qt\translations\nmregister_sr.qm" - "!:\resource\qt\translations\nmregister_sr.qm" +"\epoc32\data\z\resource\qt\translations\nmregister_sv.qm" - "!:\resource\qt\translations\nmregister_sv.qm" +"\epoc32\data\z\resource\qt\translations\nmregister_th.qm" - "!:\resource\qt\translations\nmregister_th.qm" +"\epoc32\data\z\resource\qt\translations\nmregister_tl.qm" - "!:\resource\qt\translations\nmregister_tl.qm" +"\epoc32\data\z\resource\qt\translations\nmregister_tr.qm" - "!:\resource\qt\translations\nmregister_tr.qm" +"\epoc32\data\z\resource\qt\translations\nmregister_uk.qm" - "!:\resource\qt\translations\nmregister_uk.qm" +"\epoc32\data\z\resource\qt\translations\nmregister_ur.qm" - "!:\resource\qt\translations\nmregister_ur.qm" +"\epoc32\data\z\resource\qt\translations\nmregister_vi.qm" - "!:\resource\qt\translations\nmregister_vi.qm" +"\epoc32\data\z\resource\qt\translations\nmregister_zh.qm" - "!:\resource\qt\translations\nmregister_zh.qm" +"\epoc32\data\z\resource\qt\translations\nmregister_zh_HK.qm" - "!:\resource\qt\translations\nmregister_zh_HK.qm" +"\epoc32\data\z\resource\qt\translations\nmregister_zh_TW.qm" - "!:\resource\qt\translations\nmregister_zh_TW.qm" + + +;installer +"\epoc32\release\armv5\udeb\nmregisterinstaller.exe" - "!:\sys\bin\nmregisterinstaller.exe", FR, RB, RW \ No newline at end of file diff -r 6c59112cfd31 -r 38bf5461e270 emailuis/nmhswidget/src/nmhswidget.cpp --- a/emailuis/nmhswidget/src/nmhswidget.cpp Thu Sep 30 11:43:07 2010 +0300 +++ b/emailuis/nmhswidget/src/nmhswidget.cpp Thu Oct 14 17:33:43 2010 +0300 @@ -17,6 +17,7 @@ #include #include #include +#include #include #include #include @@ -25,6 +26,8 @@ #include #include #include +#include + #include "nmcommon.h" #include "nmmessageenvelope.h" #include "nmhswidget.h" @@ -54,7 +57,8 @@ mDateObserver(0), mIsExpanded(false), mListView(0), - mListModel(0) + mListModel(0), + mListActivityTimer(0) { NM_FUNCTION; } @@ -77,6 +81,12 @@ delete mDateObserver; mDateObserver = NULL; + + if (mListActivityTimer){ + mListActivityTimer->stop(); + delete mListActivityTimer; + mListActivityTimer = NULL; + } } /*! @@ -223,7 +233,11 @@ HbFrameItem* backgroundLayoutItem = new HbFrameItem(mBackgroundFrameDrawer); //set to NULL to indicate that ownership transferred mBackgroundFrameDrawer = NULL; - mWidgetContainer->setBackgroundItem(backgroundLayoutItem); + mContentContainer->setBackgroundItem(backgroundLayoutItem); + + HbEffect::add(mContentContainer, "combo_disappear_up", "collapse"); + HbEffect::add(mContentContainer, "combo_appear_down", "expand"); + } /*! @@ -232,13 +246,27 @@ void NmHsWidget::createMailRowsList() { NM_FUNCTION; - connect(mListView, SIGNAL(activated(const QModelIndex&)), this, + + //construct list model + mListModel = new NmHsWidgetListModel(); + + //Connect item activation (click) to message view launching + connect(mListView, SIGNAL(activated(const QModelIndex&)), this, SLOT(openMessage(const QModelIndex&))); - + + //When new mails arrive, scroll list to the start + connect(mListModel, SIGNAL( messagesAddedToModel() ), + this, SLOT( handleMessagesAddedToModel() )); + + //connect item removal signal to update layout, so that nomailslabel & listview visibility + //can be determined + connect(mListModel, SIGNAL( modelIsEmpty(bool) ), + this, SLOT( updateLayout() )); + // Set the list widget properties. + mListView->setItemRecycling(false); //This should be changed in future NmHsWidgetListViewItem *prototype = new NmHsWidgetListViewItem(mListView); mListView->setItemPrototype(prototype); - mListModel = new NmHsWidgetListModel(); mListView->setModel(mListModel); } @@ -252,7 +280,6 @@ NM_FUNCTION; QT_TRY { - HbStyleLoader::registerFilePath(":/layout/nmhswidgetlistviewitem.widgetml"); HbStyleLoader::registerFilePath(":/layout/nmhswidgetlistviewitem.css"); @@ -279,8 +306,21 @@ setupUi(); + //Crete list for mail items + createMailRowsList(); + //Engine construction is 2 phased. mEngine = new NmHsWidgetEmailEngine(mAccountId); + connect(mEngine, SIGNAL( mailDataRefreshed(const QList&) ), + mListModel, SLOT ( refresh (const QList&) )); + connect(mEngine, SIGNAL( mailDataCleared() ), + mListModel, SLOT ( removeAllMessages() )); + connect(mEngine, SIGNAL( mailsReceived (const QList&) ), + mListModel, SLOT ( addMessages (const QList&) )); + connect(mEngine, SIGNAL( mailsUpdated (const QList&) ), + mListModel, SLOT ( updateMessages(const QList&) )); + connect(mEngine, SIGNAL( mailsDeleted (const QList&)), + mListModel, SLOT ( removeMessages(const QList&) )); //Client must connect to exception signals before calling the initialize function //because we don't want to miss any signals. connect(mEngine, SIGNAL( exceptionOccured(const int&) ), this, @@ -298,17 +338,23 @@ //create observer for date/time change events mDateObserver = new NmHsWidgetDateTimeObserver(); - //Crete list for mail items - createMailRowsList(); - - updateMailData(); + //Create timer for delaying events after list scrolling is ended + mListActivityTimer = new QTimer(this); + mListActivityTimer->setInterval(KNmHsWidgetDelayAfterScrollingEnded); + connect(mListActivityTimer, SIGNAL(timeout()), this, SLOT(scrollListToStart()) ); + //Connect scrolling ended to scrolling timer activation + //so that after timeout the list will be scrolled to first item + connect(mListView, SIGNAL( scrollingEnded() ), + mListActivityTimer, SLOT( start() )); + + //if timer is running, stop it right away when new activity happens + connect(mListView, SIGNAL( scrollingStarted() ), + mListActivityTimer, SLOT( stop() )); + mTitleRow->updateUnreadCount(mEngine->unreadCount()); mTitleRow->setAccountIcon(mAccountIconName); mTitleRow->setExpandCollapseIcon(mIsExpanded); - - //Get signals about changes in mail data - connect(mEngine, SIGNAL( mailDataChanged() ), this, SLOT( updateMailData() )); - + //Get Signals about changes in unread count connect(mEngine, SIGNAL( unreadCountChanged(const int&) ) ,mTitleRow, SLOT( updateUnreadCount(const int&) ) ); @@ -327,7 +373,8 @@ //Get date/time events from date observer connect(mDateObserver, SIGNAL(dateTimeChanged()) - , this, SLOT(updateMailData())); + , mEngine, SLOT(forceUpdate())); + setMinimumSize(mTitleRow->minimumWidth(), mEmptySpaceContainer->minimumHeight() + mTitleRow->minimumHeight()); } @@ -349,25 +396,6 @@ HbStyleLoader::unregisterFilePath(":/layout/nmhswidgetlistviewitem.css"); } -/*! - updateMailData slot - */ -void NmHsWidget::updateMailData() -{ - NM_FUNCTION; - QT_TRY { - QList envelopes; - int count = 0; - if (mIsExpanded) { - count = mEngine->getEnvelopes(envelopes, KMaxNumberOfMailsShown); - } - mListModel->refresh( envelopes ); - updateLayout(count); - }QT_CATCH(...) { - NM_ERROR(1,"NmHsWidget::updateMailData fail @ catch"); - emit error(); - } -} /*! Sets monitored account id from given string @@ -423,7 +451,13 @@ void NmHsWidget::handleExpandCollapseEvent() { NM_FUNCTION; - toggleExpansionState(); + if(mIsExpanded){ + HbEffect::start( mContentContainer, "collapse", this, "toggleExpansion"); + } + else{ + toggleExpansionState(); + HbEffect::start( mContentContainer, "expand"); + } } /*! @@ -442,7 +476,7 @@ emit setPreferences(propertiesList); //handle state change drawing - updateMailData(); + updateLayout(); mTitleRow->setExpandCollapseIcon(mIsExpanded); } @@ -486,10 +520,10 @@ than zero, layout will contain titlerow and KMaxNumberOfMailsShown times emailrow(s) */ -void NmHsWidget::updateLayout(const int mailCount) +void NmHsWidget::updateLayout() { NM_FUNCTION; - + int mailCount = mListModel->rowCount(); //collapsed size qreal totalHeight = mEmptySpaceContainer->preferredHeight() + mTitleRow->containerHeight(); @@ -583,12 +617,48 @@ */ void NmHsWidget::openMessage(const QModelIndex& index) { - QVariant var = mListModel->data(index,Qt::DisplayRole); - if(!var.isNull()){ - NmMessageEnvelope *envelope = var.value(); - mEngine->launchMailAppMailViewer(envelope->messageId()); - } + NM_FUNCTION; + QVariant var = mListModel->data(index,Qt::DisplayRole); + if(!var.isNull()){ + NmMessageEnvelope *envelope = var.value(); + mEngine->launchMailAppMailViewer(envelope->messageId()); + } +} +/*! + handleMessagesAddedToModel slo + Slot is called when new messages is added to model. This function should scroll + the list right away to the first item, unless there is user activity ongoing or + the scrolling timer is active + */ +void NmHsWidget::handleMessagesAddedToModel() +{ + NM_FUNCTION; + if(mListActivityTimer->isActive() || mListView->isScrolling()){ + //No need to scroll right away as user is active and we don't want to interupt it + //or the scrolling event will occur within KNmHsWidgetDelayAfterScrollingEnded msecs. + return; + }else{ + //if the list is idle, scroll to the first item + scrollListToStart(); + } +} + +/*! + scrollListToStart slot - Scrolls the mListView to the beginning of the list with + KListScrollUpTime as a time to do it. + */ +void NmHsWidget::scrollListToStart() +{ + NM_FUNCTION; + QModelIndex index = (mListModel->item(0,0))->index(); + //next line will fail if item recycling is enabled!! + QPointF pos = (mListView->itemByIndex(index))->pos(); + if(mListView->contentWidget()->pos() != pos){ + //dont move if already there. Otherwise new scrolling events are emitted + mListView->scrollContentsTo(pos, KListScrollUpTime); + } + mListActivityTimer->stop(); //stop the timer } /*! @@ -610,3 +680,32 @@ break; } } + +/*! + toggleExpansion +*/ +void NmHsWidget::toggleExpansion(const HbEffect::EffectStatus &status) + { + NM_FUNCTION; + + Q_UNUSED(status); + + toggleExpansionState(); + } + + +/* + * NmHsWidget::event() + */ +bool NmHsWidget::event( QEvent *event ) +{ + NM_FUNCTION; + QEvent::Type eventType = event->type(); + if( eventType == HbEvent::ThemeChanged ){ + QColor newFontColor; + newFontColor = HbColorScheme::color("qtc_hs_list_item_content_normal"); + mNoMailsLabel->setTextColor(newFontColor); + return true; + } + return HbWidget::event(event); +} diff -r 6c59112cfd31 -r 38bf5461e270 emailuis/nmhswidget/src/nmhswidgetemailengine.cpp --- a/emailuis/nmhswidget/src/nmhswidgetemailengine.cpp Thu Sep 30 11:43:07 2010 +0300 +++ b/emailuis/nmhswidget/src/nmhswidgetemailengine.cpp Thu Oct 14 17:33:43 2010 +0300 @@ -26,10 +26,12 @@ #include "nmhswidgetemailengine.h" #include "nmdataplugininterface.h" #include "nmmailbox.h" +#include "nmmessage.h" #include "nmfolder.h" #include "nmdatapluginfactory.h" #include "nmhswidgetconsts.h" #include "emailtrace.h" +#include "nmhswidgetlistmodel.h" /*! Constructor @@ -41,10 +43,9 @@ mUnreadCount(-1), mEmailInterface(0), mFactory(0), - mAccountEventReceivedWhenSuspended(false), - mMessageEventReceivedWhenSuspended(false), + mAccountDataNeedsUpdate(false), + mMessageDataNeedsUpdate(false), mSuspended(false), - mUpdateTimer(0), mAiwRequest(0) { NM_FUNCTION; @@ -65,12 +66,9 @@ return false; } updateData(); + updateUnreadCount(); updateAccount(); - mUpdateTimer = new QTimer(this); - mUpdateTimer->setInterval(NmHsWidgetEmailEngineUpdateTimerValue); - connect(mUpdateTimer, SIGNAL(timeout()), this, SLOT(handleUpdateTimeout()) ); - return true; } @@ -140,18 +138,6 @@ return true; } -/*! - Reset envelope list - \post mEnvelopeList.isEmpty() == true && all contained objects are deleted - */ -void NmHsWidgetEmailEngine::resetEnvelopeList() -{ - NM_FUNCTION; - - while (!mEnvelopeList.isEmpty()) { - delete mEnvelopeList.takeFirst(); - } -} /*! Destructor @@ -160,33 +146,12 @@ { NM_FUNCTION; - resetEnvelopeList(); if (mFactory) { NmDataPluginFactory::releaseInstance(mFactory); } - if (mUpdateTimer){ - mUpdateTimer->stop(); - delete mUpdateTimer; - } } -/*! - getEnvelopes() provides message envelopes as a list of stack objects - Amount of message envelopes in the list parameter is the smallest of the following factors: - 'KMaxNumberOfEnvelopesProvided', 'maxEnvelopeAmount', 'amount of available envelopes'. - - \param list list to be filled with message envelopes - \param maxEnvelopeAmount Client side limit for amount of message envelope count. - \return count of envelopes added to list - */ -int NmHsWidgetEmailEngine::getEnvelopes(QList &list, int maxEnvelopeAmount) -{ - NM_FUNCTION; - list.clear(); //Reset the parameter list to avoid side effects - list.append(mEnvelopeList.mid(0, maxEnvelopeAmount)); - return list.count(); -} /*! UnreadCount @@ -210,38 +175,9 @@ return mAccountName; } -/*! - Refresh email data. - \post mEnvelopeList is refreshed with valid content so that it has - valid data with maximum of KMaxNumberOfEnvelopesProvided envelopes. - - emits exceptionOccured(NmEngineExcFailure) if fatal error occurs. - - emits mailDataChanged() if new mail data is set into mEnvelopeList - - emits unreadCountChanged(mUnreadCount), if mUnreadCount is updated - - \return true if everything succeeded, otherwise false - */ -bool NmHsWidgetEmailEngine::updateData() +bool NmHsWidgetEmailEngine::updateUnreadCount() { - NM_FUNCTION; - if (!mEmailInterface) { - NM_ERROR(1,"NmHsWidgetEmailEngine::updateData() -- Interface missing"); - emit exceptionOccured(NmEngineExcFailure); //fatal error - return false; //if interface is missing there's nothing to do - } - - //reset envelope list before retrieving new items - resetEnvelopeList(); - - //get messages from inbox - int msgErr = mEmailInterface->listMessages(mMailboxId, mFolderId, mEnvelopeList, - KMaxNumberOfEnvelopesProvided); - if (msgErr) { - //retrieval of messages failed. - return false; - } - //emit signal about new message data right away - emit mailDataChanged(); //retrieve new unread count to mUnreadCount NmFolder* folder = NULL; int folderErr = mEmailInterface->getFolderById(mMailboxId, mFolderId, folder); @@ -251,7 +187,7 @@ } if (folder) { //If messageCount in the folder is zero we must indicate unread count to be -1 - if (mEnvelopeList.count() == 0) { + if (folder->messageCount() == 0) { mUnreadCount = -1; } else { @@ -271,6 +207,42 @@ return true; } + +/*! + * TODO: UPDATE THIS + Refresh email data. + \post mEnvelopeList is refreshed with valid content so that it has + valid data with maximum of KMaxNumberOfEnvelopesProvided envelopes. + + - emits exceptionOccured(NmEngineExcFailure) if fatal error occurs. + - emits mailDataChanged() if new mail data is set into mEnvelopeList + - emits unreadCountChanged(mUnreadCount), if mUnreadCount is updated + + \return true if everything succeeded, otherwise false + */ +bool NmHsWidgetEmailEngine::updateData() +{ + NM_FUNCTION; + if (!mEmailInterface) { + NM_ERROR(1,"NmHsWidgetEmailEngine::updateData() -- Interface missing"); + emit exceptionOccured(NmEngineExcFailure); //fatal error + return false; //if interface is missing there's nothing to do + } + + QList envelopeList; + //get messages from inbox + int msgErr = mEmailInterface->listMessages(mMailboxId, mFolderId, envelopeList, + KMaxNumberOfEnvelopesProvided); + if (msgErr) { + //retrieval of messages failed. + return false; + } + //emit signal about new message data right away + emit mailDataRefreshed(envelopeList); + + return true; +} + /*! handleMessageEvent slot. */ @@ -281,8 +253,6 @@ const NmId& mailboxId) { NM_FUNCTION; - Q_UNUSED(event); - Q_UNUSED(messageIds); if (!mEmailInterface) { NM_ERROR(1,"NmHsWidgetEmailEngine::handleMessageEvent() -- Interface missing"); @@ -297,17 +267,71 @@ } if ((folderId == mFolderId) && (mailboxId == mMailboxId)) { //Data is updated only if the engine is not suspended + if (mSuspended) { - mMessageEventReceivedWhenSuspended = true; + mMessageDataNeedsUpdate = true; + return; //no further actions } - else { - //start or restart the timer. Update is started when timer expires - mUpdateTimer->start(); + updateUnreadCount(); + switch(event){ + case(NmMessageCreated): + emit mailsReceived(getEnvelopesFromIds(messageIds)); + break; + case(NmMessageChanged): + emit mailsUpdated(getEnvelopesFromIds(messageIds)); + break; + case(NmMessageDeleted): + emit mailsDeleted(messageIds); + break; + } + + } +} + +QList NmHsWidgetEmailEngine::getEnvelopesFromIds(const QList messageIds) +{ + NM_FUNCTION; + QList ret; + foreach(NmId id, messageIds){ + NmMessageEnvelope *msgEnvelope = NULL; + msgEnvelope = envelopeById(id); + if(msgEnvelope){ + ret.append(msgEnvelope); } } + return ret; } /*! + Get new NmMessageEnvelope object by id \a messageId from any folder. + Ownership is transferred to the caller. NULL pointer is returned if + message id is not found. + */ +NmMessageEnvelope *NmHsWidgetEmailEngine::envelopeById(const NmId &messageId) +{ + NM_FUNCTION; + + NmMessageEnvelope *msgEnvelope(NULL); + NmMessage *newMessageObject(NULL); + int retVal(NmNotFoundError); + + retVal = mEmailInterface->getMessageById(mMailboxId, mFolderId, messageId, newMessageObject); + if (retVal < NmNoError || !newMessageObject) { + // Return null object if fetching failed + delete newMessageObject; + newMessageObject = NULL; + return NULL; + } + + msgEnvelope = new NmMessageEnvelope(newMessageObject->envelope()); + + delete newMessageObject; + newMessageObject = NULL; + return msgEnvelope; +} + + +/*! handleFolderEvent slot. If the monitored folder is deleted, clear the envelope list and unread count. Also the mFolderId is set to 0 to indicate the current state so that in device boot up @@ -321,10 +345,9 @@ //react only if the monitored folder for monitored account is deleted if (event == NmFolderIsDeleted && mailboxId == mMailboxId && folderIds.contains(mFolderId) ) { - resetEnvelopeList(); //cached envelopes to be cleared + emit mailDataCleared(); //emit mail data clearance mUnreadCount = 0; //unread count to 0 mFolderId = NmId(0); //folder id to zero (indicates the situation where folder is not available) - emit mailDataChanged(); //emit data change for UI emit unreadCountChanged(mUnreadCount); // emit unread count change to UI } } @@ -340,7 +363,7 @@ switch (event) { case (NmMailboxChanged): { if (mSuspended) { - mAccountEventReceivedWhenSuspended = true; + mAccountDataNeedsUpdate = true; } else { updateAccount(); @@ -358,17 +381,6 @@ } } -/*! - * handleUpdateTimeout slot - */ -void NmHsWidgetEmailEngine::handleUpdateTimeout() -{ - NM_FUNCTION; - if (mUpdateTimer){ - mUpdateTimer->stop(); - } - updateData(); -} /*! Update Account data @@ -396,6 +408,22 @@ return true; } + +/*! + forceUpdate slot. + \post If engine is not suspended, this will force full update immediately. + */ +void NmHsWidgetEmailEngine::forceUpdate() +{ + NM_FUNCTION; + if(mSuspended){ + mMessageDataNeedsUpdate = true; //this is enough to force update when activated + }else{ + updateData(); + updateUnreadCount(); + } +} + /*! suspend slot. \post engine will not emit signals or refresh its data during suspension. @@ -415,16 +443,18 @@ { NM_FUNCTION; mSuspended = false; - if (mAccountEventReceivedWhenSuspended) { - mAccountEventReceivedWhenSuspended = false; + if (mAccountDataNeedsUpdate) { + mAccountDataNeedsUpdate = false; updateAccount(); } - if (mMessageEventReceivedWhenSuspended) { - mMessageEventReceivedWhenSuspended = false; + if (mMessageDataNeedsUpdate) { + mMessageDataNeedsUpdate = false; updateData(); + updateUnreadCount(); } } + /*! launchMailAppInboxView slot. \post Mail application is launched to inbox view corresponding widget's mailbox id diff -r 6c59112cfd31 -r 38bf5461e270 emailuis/nmhswidget/src/nmhswidgetlistmodel.cpp --- a/emailuis/nmhswidget/src/nmhswidgetlistmodel.cpp Thu Sep 30 11:43:07 2010 +0300 +++ b/emailuis/nmhswidget/src/nmhswidgetlistmodel.cpp Thu Oct 14 17:33:43 2010 +0300 @@ -66,22 +66,6 @@ return qVariant; } -/*! - This refreshes the data of the model. - NOTE: safe guard any call to this function with try-catch. - */ -void NmHsWidgetListModel::refresh( - QList &envelopeList) -{ - NM_FUNCTION; - - clear(); - foreach(NmMessageEnvelope *env, envelopeList){ - NmHsWidgetListModelItem *item = createMessageListModelItem(env); - appendRow(item); - } -} - /*! Create mailbox item @@ -97,3 +81,136 @@ item->setData(Hb::StandardItem, Hb::ItemTypeRole); return item; } + + +/*! + Function determines model index in which the new message should be inserted. +*/ +int NmHsWidgetListModel::getInsertionIndex( + const NmMessageEnvelope &envelope) const +{ + NM_FUNCTION; + + int ret(NmNotFoundError); + + // Date+descending sort mode based comparison. + // Go through model and compare sent times with QDateTime >= comparison operation. + QList items = findItems("*", Qt::MatchWildcard | Qt::MatchRecursive); + int count(items.count()); + bool found(false); + int i(0); + while (i < count && !found) { + QModelIndex index = items[i]->index(); + NmHsWidgetListModelItem *item = static_cast(itemFromIndex(index)); + found = envelope.sentTime() >= item->itemMetaData()->sentTime(); + if (found) { + ret = i; + } + i++; + } + if (0 == count) { + ret = NmNoError; + } + items.clear(); + return ret; +} + + +/*! + Inserts given messages into the model +*/ +void NmHsWidgetListModel::addMessages(const QList &messageEnvs) +{ + NM_FUNCTION; + int orig_count = rowCount(); + foreach(NmMessageEnvelope* env, messageEnvs){ + int insertionIndex = getInsertionIndex(*env); + NmHsWidgetListModelItem *newItem = createMessageListModelItem(env); + insertRow(insertionIndex, newItem); + } + + if( !messageEnvs.isEmpty() ){ + if (orig_count == 0){ + emit modelIsEmpty(false); + } + emit messagesAddedToModel(); //emit messages added to model + } +} + +/*! + This refreshes the data of the model. + NOTE: safe guard any call to this function with try-catch. + */ +void NmHsWidgetListModel::refresh(const QList &envelopeList) +{ + NM_FUNCTION; + + clear(); + foreach(NmMessageEnvelope *env, envelopeList){ + NmHsWidgetListModelItem *item = createMessageListModelItem(env); + appendRow(item); + } + + //As we refresh all data, emit signal in any case + if( rowCount() == 0 ){ + emit modelIsEmpty(true); + }else{ + emit modelIsEmpty(false); + } +} + +/*! + Updates existing messages in model with given envelopes +*/ +void NmHsWidgetListModel::updateMessages(const QList &messageEnvs) +{ + NM_FUNCTION; + QList modelItemList = findItems("*", Qt::MatchWildcard | Qt::MatchRecursive); + foreach(NmMessageEnvelope *env, messageEnvs){ + foreach (QStandardItem *it, modelItemList){ + QModelIndex index = it->index(); + NmHsWidgetListModelItem *item = static_cast(itemFromIndex(index)); + if (env->messageId() == item->itemMetaData()->messageId()) { + item->setItemMetaData(env); + break; + } + } + } +} + + +/*! + Removes the given messages from the model +*/ +void NmHsWidgetListModel::removeMessages(const QList &messageIds) +{ + NM_FUNCTION; + foreach(NmId msgId, messageIds){ + //lets refresh the item list every time, so that it really is up to date after each iteration + //(and the count stays valid!) + QList modelItemList = findItems("*", Qt::MatchWildcard | Qt::MatchRecursive); + foreach(QStandardItem *it, modelItemList){ + QModelIndex index = it->index(); + NmHsWidgetListModelItem *item = static_cast(itemFromIndex(index)); + if (msgId == item->itemMetaData()->messageId()) { + removeRow(index.row()); + break; + } + } + } + + //if model is empty after removing messages, signal it. + if( rowCount() == 0 ){ + emit modelIsEmpty(true); + } + +} + +/*! + Clears the model and emits modelIsEmpty signal +*/ +void NmHsWidgetListModel::removeAllMessages() +{ + clear(); + emit modelIsEmpty(true); +} diff -r 6c59112cfd31 -r 38bf5461e270 emailuis/nmhswidget/src/nmhswidgetlistviewitem.cpp --- a/emailuis/nmhswidget/src/nmhswidgetlistviewitem.cpp Thu Sep 30 11:43:07 2010 +0300 +++ b/emailuis/nmhswidget/src/nmhswidgetlistviewitem.cpp Thu Oct 14 17:33:43 2010 +0300 @@ -22,6 +22,7 @@ #include #include #include +#include #include #include #include @@ -161,14 +162,21 @@ QDateTime localTime = envelope.sentTime().addSecs(locale.universalTimeOffset()); QDate sentLocalDate = localTime.date(); QDate currentdate = QDate::currentDate(); + QString timeString; if (sentLocalDate == currentdate) { QString shortTimeSpec = r_qtn_time_usual; QTime time = localTime.time(); - mTime->setText(HbStringUtil::convertDigits(locale.format(time, shortTimeSpec))); + timeString = HbStringUtil::convertDigits(locale.format(time, shortTimeSpec)); } else { QString shortDateSpec = r_qtn_date_without_year; - mTime->setText(HbStringUtil::convertDigits(locale.format(sentLocalDate, shortDateSpec))); + timeString = HbStringUtil::convertDigits(locale.format(sentLocalDate, shortDateSpec)); } + //shrink/expand the date field, so that sender field is as large as possible + QFontMetrics fm(mTime->font()); + qreal textWidth = fm.width(timeString); + mTime->setMaximumWidth(textWidth); + mTime->setText(timeString); + // Subject. QString subjectText = envelope.subject(); if (subjectText.length()) { @@ -184,6 +192,7 @@ //make sure icons are not shown yet for (int i = 0; i < mStatusIcons.count(); i++) { mStatusIcons.at(i)->hide(); + mStatusIcons.at(i)->setPreferredWidth(0); //Do not consume space! } // Priority icon is added to list first thus it is always shown most right. @@ -209,6 +218,7 @@ for (int count = 0; count < iconList.count(); count++) { mStatusIcons.at(count)->setIcon(iconList.at(count)); mStatusIcons.at(count)->show(); + mStatusIcons.at(count)->setMinimumWidth(mStatusIcons.at(count)->maximumWidth()); } // Message read status. @@ -254,7 +264,7 @@ void NmHsWidgetListViewItem::setFontsUnread() { NM_FUNCTION; - static QColor colorRole = HbColorScheme::color("qtc_list_item_title_normal"); + QColor colorRole = HbColorScheme::color("qtc_hs_list_item_title_normal"); HbFontSpec fontSpec(HbFontSpec::Primary); setFonts(colorRole, fontSpec); } @@ -265,7 +275,7 @@ void NmHsWidgetListViewItem::setFontsRead() { NM_FUNCTION; - static QColor colorRole = HbColorScheme::color("qtc_list_item_content_normal"); + QColor colorRole = HbColorScheme::color("qtc_hs_list_item_content_normal"); HbFontSpec fontSpec(HbFontSpec::Secondary); setFonts(colorRole, fontSpec); } @@ -302,12 +312,12 @@ mSender->setFontSpec(fontSpec); mSender->setTextColor(colorRole); + + fontSpec.setTextHeight(mSecondarySize); mSubject->setFontSpec(fontSpec); mSubject->setTextColor(colorRole); - - fontSpec.setTextHeight(mSecondarySize); - + mTime->setFontSpec(fontSpec); mTime->setTextColor(colorRole); } @@ -331,3 +341,25 @@ return displayName.mid(firstPos, lastPos - firstPos + 1); } + + +/*! + Handle font color changes in the case of theme change + */ +bool NmHsWidgetListViewItem::event(QEvent *event) +{ + NM_FUNCTION; + + bool ret = HbListViewItem::event(event); + if (event && event->type() == HbEvent::ThemeChanged) { + NmMessageEnvelope *envelope = + modelIndex().data(Qt::DisplayRole).value(); + if (envelope && !envelope->isRead()) { + setFontsUnread(); + } + else if (envelope) { + setFontsRead(); + } + } + return ret; +} diff -r 6c59112cfd31 -r 38bf5461e270 emailuis/nmhswidget/src/nmhswidgettitlerow.cpp --- a/emailuis/nmhswidget/src/nmhswidgettitlerow.cpp Thu Sep 30 11:43:07 2010 +0300 +++ b/emailuis/nmhswidget/src/nmhswidgettitlerow.cpp Thu Oct 14 17:33:43 2010 +0300 @@ -103,6 +103,10 @@ if(!loadDocML(loader) || !setupGraphics()){ return false; } + + HbEffect::add(mBackgroundLayoutItem, "listviewitem_press", "pressed"); + HbEffect::add(mBackgroundLayoutItem, "listviewitem_release", "released"); + return true; } @@ -154,14 +158,13 @@ HbFrameDrawer* backgroundFrameDrawer = 0; QT_TRY{ - //pressed background - backgroundFrameDrawer = new HbFrameDrawer("qtg_fr_hsitems_pressed", HbFrameDrawer::NinePieces); + //default background + backgroundFrameDrawer = new HbFrameDrawer(KNmHsWidgetBackgroundImage, HbFrameDrawer::NinePieces); mBackgroundLayoutItem = new HbFrameItem( backgroundFrameDrawer ); mContainer->setBackgroundItem( mBackgroundLayoutItem ); - mBackgroundLayoutItem->hide(); //set fonts color - setHighlighedFontsColor(false); + setFontsColor(); //to get gestures setGeometry(mContainer->childrenBoundingRect()); @@ -242,44 +245,33 @@ mUnreadCountLabel->setMaximumWidth(textWidth); } else { + //set empty string as nothing to show + mUnreadCountLabel->setPlainText(QString()); mUnreadCountLabel->setMaximumWidth(0); } } /*! sets fonts color. - /param bool pressed indicates if row is pressed down or not */ -void NmHsWidgetTitleRow::setHighlighedFontsColor( bool pressed ) +void NmHsWidgetTitleRow::setFontsColor() { NM_FUNCTION; - QColor newFontColor; - - if(pressed){ - newFontColor = HbColorScheme::color("qtc_hs_list_item_pressed"); - } - else{ - newFontColor = HbColorScheme::color("qtc_hs_list_item_title_normal"); - } + QColor newFontColor = HbColorScheme::color("qtc_hs_list_item_title_normal"); mMailboxInfo->setTextColor(newFontColor); mUnreadCountLabel->setTextColor(newFontColor); } /*! - change background pressed state - /param bool show if true then shown, false hide + hide background */ -void NmHsWidgetTitleRow::showHighlight( bool show ) +void NmHsWidgetTitleRow::hideHighlight(const HbEffect::EffectStatus &status) { - NM_FUNCTION;; - - if(show){ - mBackgroundLayoutItem->show(); - } - else{ - mBackgroundLayoutItem->hide(); - } + NM_FUNCTION; + + Q_UNUSED(status); + mBackgroundLayoutItem->frameDrawer().setFrameGraphicsName(KNmHsWidgetBackgroundImage); } /* @@ -313,16 +305,14 @@ if (inArea) { switch (gesture->state()) { case Qt::GestureStarted: - setHighlighedFontsColor(true); - showHighlight(true); + HbEffect::start( mBackgroundLayoutItem, "pressed"); + mBackgroundLayoutItem->frameDrawer().setFrameGraphicsName("qtg_fr_hsitems_pressed"); break; case Qt::GestureCanceled: - setHighlighedFontsColor(false); - showHighlight(false); + HbEffect::start( mBackgroundLayoutItem, "released", this, "hideHighlight"); break; case Qt::GestureFinished: - setHighlighedFontsColor(false); - showHighlight(false); + HbEffect::start( mBackgroundLayoutItem, "released", this, "hideHighlight"); if (gesture->tapStyleHint() == HbTapGesture::Tap) { HbInstantFeedback::play(HbFeedback::BasicItem); emit mailboxLaunchTriggered(); @@ -342,7 +332,7 @@ NM_FUNCTION; QEvent::Type eventType = event->type(); if( eventType == HbEvent::ThemeChanged ){ - setHighlighedFontsColor(false); + setFontsColor(); return true; } return HbWidget::event(event); diff -r 6c59112cfd31 -r 38bf5461e270 ipsservices/ipssosaoplugin/inc/IpsSosAOImapPopLogic.h --- a/ipsservices/ipssosaoplugin/inc/IpsSosAOImapPopLogic.h Thu Sep 30 11:43:07 2010 +0300 +++ b/ipsservices/ipssosaoplugin/inc/IpsSosAOImapPopLogic.h Thu Oct 14 17:33:43 2010 +0300 @@ -143,7 +143,10 @@ * Takes care of reacting to entries created type of events */ void handleEntriesCreatedL(const TAny* aArg1); - + /** + * Takes care of reacting to created type of events + */ + void handleEntriesChangedL(const TAny* aArg1, TAny* aArg2); /** * Takes the first entryId from the given selection and * instantiates a TMsvEntry for that entry. diff -r 6c59112cfd31 -r 38bf5461e270 ipsservices/ipssosaoplugin/inc/ipssosaopluginheaders.h --- a/ipsservices/ipssosaoplugin/inc/ipssosaopluginheaders.h Thu Sep 30 11:43:07 2010 +0300 +++ b/ipsservices/ipssosaoplugin/inc/ipssosaopluginheaders.h Thu Oct 14 17:33:43 2010 +0300 @@ -30,7 +30,6 @@ #include #include #include -#include #include #include #include diff -r 6c59112cfd31 -r 38bf5461e270 ipsservices/ipssosaoplugin/src/IpsSosAOBaseAgent.cpp --- a/ipsservices/ipssosaoplugin/src/IpsSosAOBaseAgent.cpp Thu Sep 30 11:43:07 2010 +0300 +++ b/ipsservices/ipssosaoplugin/src/IpsSosAOBaseAgent.cpp Thu Oct 14 17:33:43 2010 +0300 @@ -32,19 +32,19 @@ aSession.GetEntry( aServiceId, service, tentry ); CIpsSosAOBaseAgent* self = NULL; - if ( tentry.iMtm.iUid == KSenduiMtmImap4UidValue ) + if ( tentry.iMtm == KUidMsgTypeIMAP4 ) { CIpsSosAOImapAgent* imap = CIpsSosAOImapAgent::NewL( aSession, aOpResponse, aServiceId ); self = static_cast(imap); - self->iMtmType = KSenduiMtmImap4Uid; + self->iMtmType = KUidMsgTypeIMAP4; } - else if ( tentry.iMtm.iUid == KSenduiMtmPop3UidValue ) + else if ( tentry.iMtm == KUidMsgTypePOP3 ) { CIpsSosAOPopAgent* pop = CIpsSosAOPopAgent::NewL( aSession, aOpResponse, aServiceId ); self = static_cast(pop); - self->iMtmType = KSenduiMtmPop3Uid; + self->iMtmType = KUidMsgTypePOP3; } else { @@ -136,7 +136,7 @@ TBool CIpsSosAOBaseAgent::IsTypeImap4() const { FUNC_LOG; - if ( iMtmType.iUid == KSenduiMtmImap4UidValue ) + if ( iMtmType == KUidMsgTypeIMAP4 ) { return ETrue; } @@ -149,11 +149,11 @@ { FUNC_LOG; TInt pluginId = 0; - if ( iMtmType.iUid == KSenduiMtmImap4UidValue ) + if ( iMtmType == KUidMsgTypeIMAP4 ) { pluginId = IPSSOSIMAP4PLUGIN_IMPLEMENTATION_UID; } - else if ( iMtmType.iUid == KSenduiMtmPop3UidValue ) + else if ( iMtmType == KUidMsgTypePOP3 ) { pluginId = IPSSOSPOP3PLUGIN_IMPLEMENTATION_UID; } diff -r 6c59112cfd31 -r 38bf5461e270 ipsservices/ipssosaoplugin/src/IpsSosAOImapPopLogic.cpp --- a/ipsservices/ipssosaoplugin/src/IpsSosAOImapPopLogic.cpp Thu Sep 30 11:43:07 2010 +0300 +++ b/ipsservices/ipssosaoplugin/src/IpsSosAOImapPopLogic.cpp Thu Oct 14 17:33:43 2010 +0300 @@ -219,38 +219,20 @@ break; case MMsvSessionObserver::EMsvEntriesChanged: { - TMsvId parent = (*(TMsvId*) (aArg2)); - //we check that parent is the root. if not, it cannot be an - //event from service, thus can't be from connection change.. - if ( parent == KMsvRootIndexEntryId ) - { - const CMsvEntrySelection* selection = - static_cast( aArg1 ); - - TMsvEntry tEntry; - TMsvId service; - if ( selection->Count() ) - { - iSession.GetEntry( selection->At(0), service, tEntry ); - } - - if ( !tEntry.Connected() ) - { - SendCommandToSpecificMailboxL( - tEntry.Id(), - CIpsSosAOMBoxLogic::ECommandClearDoNotDisconnect ); - } - } + handleEntriesChangedL(aArg1, aArg2); } break; case MMsvSessionObserver::EMsvEntriesDeleted: { - TMsvId parent = (*(TMsvId*) (aArg2)); - //we check that parent is the root. if not, it cannot be an - //event indicating deleted mailbox entry - if ( parent == KMsvRootIndexEntryId ) + if (aArg2) { - RemoveOrphanLogicsL(); + TMsvId parent = (*(TMsvId*) (aArg2)); + //we check that parent is the root. if not, it cannot be an + //event indicating deleted mailbox entry + if ( parent == KMsvRootIndexEntryId ) + { + RemoveOrphanLogicsL(); + } } } break; @@ -356,12 +338,12 @@ CMsvEntry* cEntry = iSession.GetEntryL( KMsvRootIndexEntryId ); CleanupStack::PushL( cEntry ); - CMsvEntrySelection* childEntries = cEntry->ChildrenWithMtmL( KSenduiMtmPop3Uid ); + CMsvEntrySelection* childEntries = cEntry->ChildrenWithMtmL( KUidMsgTypePOP3 ); CleanupStack::PushL( childEntries ); UpdateLogicArrayL( *childEntries ); CleanupStack::PopAndDestroy( childEntries ); - childEntries = cEntry->ChildrenWithMtmL( KSenduiMtmImap4Uid ); + childEntries = cEntry->ChildrenWithMtmL( KUidMsgTypeIMAP4 ); CleanupStack::PushL( childEntries ); UpdateLogicArrayL( *childEntries ); CleanupStack::PopAndDestroy( childEntries ); @@ -491,10 +473,10 @@ CMsvEntry* cEntry = iSession.GetEntryL( KMsvRootIndexEntryId ); CleanupStack::PushL( cEntry ); - CMsvEntrySelection* popEntries = cEntry->ChildrenWithMtmL( KSenduiMtmPop3Uid ); + CMsvEntrySelection* popEntries = cEntry->ChildrenWithMtmL( KUidMsgTypePOP3 ); CleanupStack::PushL( popEntries ); - CMsvEntrySelection* imapEntries = cEntry->ChildrenWithMtmL( KSenduiMtmImap4Uid ); + CMsvEntrySelection* imapEntries = cEntry->ChildrenWithMtmL( KUidMsgTypeIMAP4 ); CleanupStack::PushL( imapEntries ); @@ -517,25 +499,51 @@ void CIpsSosAOImapPopLogic::handleEntriesCreatedL(const TAny* aArg1) { FUNC_LOG; - TMsvEntry entry; - getFirstEntryFromSelectionL(static_cast(aArg1), entry); - - if( entry.iMtm==KSenduiMtmImap4Uid || entry.iMtm==KSenduiMtmPop3Uid) + if (aArg1) { - // handling imap4 or pop3 entry - if(entry.iType.iUid==KUidMsvServiceEntryValue) + TMsvEntry entry; + getFirstEntryFromSelectionL(static_cast(aArg1), entry); + + if( entry.iMtm == KUidMsgTypeIMAP4 || entry.iMtm == KUidMsgTypePOP3 ) { - // new mailbox has been created, starting sync for it - User::After(KMailboxCreatedTimeout); // sleep for 0.5 sec; guarantees that mailbox is fully set up, and message server ready to serve it - RefreshMailboxListL(); - SendCommandToSpecificMailboxL( entry.Id(), CIpsSosAOMBoxLogic::ECommandStart ); - SendCommandToSpecificMailboxL( entry.Id(), CIpsSosAOMBoxLogic::ECommandStartSync ); + // handling imap4 or pop3 entry + if ( entry.iType.iUid == KUidMsvServiceEntryValue ) + { + // new mailbox has been created, starting sync for it + User::After(KMailboxCreatedTimeout); // sleep for 0.5 sec; guarantees that mailbox is fully set up, and message server ready to serve it + RefreshMailboxListL(); + SendCommandToSpecificMailboxL( entry.Id(), CIpsSosAOMBoxLogic::ECommandStart ); + SendCommandToSpecificMailboxL( entry.Id(), CIpsSosAOMBoxLogic::ECommandStartSync ); + } } } } // ---------------------------------------------------------------------------- // ---------------------------------------------------------------------------- +void CIpsSosAOImapPopLogic::handleEntriesChangedL(const TAny* aArg1, TAny* aArg2) + { + if (aArg1 && aArg2) + { + TMsvId parent = (*(TMsvId*) (aArg2)); + //we check that parent is the root. if not, it cannot be an + //event from service, thus can't be from connection change.. + if ( parent == KMsvRootIndexEntryId ) + { + TMsvEntry entry; + getFirstEntryFromSelectionL(static_cast(aArg1), entry); + if ( !entry.Connected() ) + { + SendCommandToSpecificMailboxL( + entry.Id(), + CIpsSosAOMBoxLogic::ECommandClearDoNotDisconnect ); + } + } + } + } + +// ---------------------------------------------------------------------------- +// ---------------------------------------------------------------------------- void CIpsSosAOImapPopLogic::getFirstEntryFromSelectionL(const CMsvEntrySelection* aSelection, TMsvEntry& aEntry) { FUNC_LOG; diff -r 6c59112cfd31 -r 38bf5461e270 ipsservices/ipssosaoplugin/src/IpsSosAOMboxLogic.cpp --- a/ipsservices/ipssosaoplugin/src/IpsSosAOMboxLogic.cpp Thu Sep 30 11:43:07 2010 +0300 +++ b/ipsservices/ipssosaoplugin/src/IpsSosAOMboxLogic.cpp Thu Oct 14 17:33:43 2010 +0300 @@ -329,7 +329,11 @@ case EEventStartSync: NM_COMMENT("CIpsSosAOMBoxLogic: event: EEventStartSync"); if ( iState == EStateWaitSyncStart ) - { + { + if (iTimer->IsActive()) + { + iTimer->Cancel(); + } iError = KErrNone; iAgent->StartSyncL(); iState = EStateSyncOngoing; diff -r 6c59112cfd31 -r 38bf5461e270 ipsservices/ipssosaoplugin/src/IpsSosAOSettingsHandler.cpp --- a/ipsservices/ipssosaoplugin/src/IpsSosAOSettingsHandler.cpp Thu Sep 30 11:43:07 2010 +0300 +++ b/ipsservices/ipssosaoplugin/src/IpsSosAOSettingsHandler.cpp Thu Oct 14 17:33:43 2010 +0300 @@ -63,11 +63,11 @@ TInt CIpsSosAOSettingsHandler::GetFSPluginId() const { TInt pluginId = 0; - if ( iEntry.iMtm.iUid == KSenduiMtmImap4UidValue ) + if ( iEntry.iMtm == KUidMsgTypeIMAP4 ) { pluginId = IPSSOSIMAP4PLUGIN_IMPLEMENTATION_UID; } - else if ( iEntry.iMtm.iUid == KSenduiMtmPop3UidValue ) + else if ( iEntry.iMtm == KUidMsgTypePOP3 ) { pluginId = IPSSOSPOP3PLUGIN_IMPLEMENTATION_UID; } diff -r 6c59112cfd31 -r 38bf5461e270 ipsservices/ipssosplugin/inc/ipsplgheaders.h --- a/ipsservices/ipssosplugin/inc/ipsplgheaders.h Thu Sep 30 11:43:07 2010 +0300 +++ b/ipsservices/ipssosplugin/inc/ipsplgheaders.h Thu Oct 14 17:33:43 2010 +0300 @@ -26,8 +26,8 @@ #include #include #include - #include +#include // eikenv, eikrutil, coemain includes removed @@ -73,9 +73,6 @@ #include #include #include -// sendui -#include -#include // fsmailserverconst include removed // mfsmail diff -r 6c59112cfd31 -r 38bf5461e270 ipsservices/ipssosplugin/inc/ipsplgimap4connectop.h --- a/ipsservices/ipssosplugin/inc/ipsplgimap4connectop.h Thu Sep 30 11:43:07 2010 +0300 +++ b/ipsservices/ipssosplugin/inc/ipsplgimap4connectop.h Thu Oct 14 17:33:43 2010 +0300 @@ -50,11 +50,13 @@ * back aFSOperationObserver * @param aEventHandler used for signalling synchronisation statuses * @param aDoPlainConnect whether just connect to mailbox, or synch messages also + * @param aSilentConnection set if silent connection is used * @return CIpsPlgImap4ConnectionOp* self pointer */ // priority parameter has been removed // MFSMailRequestObserver& changed it to pointer // aSignallingAllowed parameter has been removed + // silent connection parameter added static CIpsPlgImap4ConnectOp* NewL( CMsvSession& aMsvSession, TRequestStatus& aObserverRequestStatus, @@ -64,7 +66,8 @@ MFSMailRequestObserver* aFSOperationObserver, TInt aFSRequestId, CIpsPlgEventHandler* aEventHandler, - TBool aDoPlainConnect=EFalse ); + TBool aDoPlainConnect=EFalse, + TBool aSilentConnection=EFalse); // make destructor virtual virtual ~CIpsPlgImap4ConnectOp(); @@ -129,6 +132,7 @@ // priority parameter has been removed // MFSMailRequestObserver& changed it to pointer // aSignallingAllowed parameter has been removed + // aSilentConnection parameter added CIpsPlgImap4ConnectOp( CMsvSession& aMsvSession, TRequestStatus& aObserverRequestStatus, @@ -138,7 +142,8 @@ MFSMailRequestObserver* aFSOperationObserver, TInt aFSRequestId, TBool aDoPlainConnect, - CIpsPlgEventHandler* aEventHandler ); + CIpsPlgEventHandler* aEventHandler, + TBool aSilentConnection ); void ConstructL(); @@ -196,6 +201,10 @@ CIpsPlgEventHandler* iEventHandler; // not owned // prevents signalling sync started for more than once TBool iIsSyncStartedSignaled; + // + // whether silent connection is requested or not + TBool iSilentConnection; + // // iAlreadyConnected removed }; diff -r 6c59112cfd31 -r 38bf5461e270 ipsservices/ipssosplugin/inc/ipsplgmsgmapper.inl --- a/ipsservices/ipssosplugin/inc/ipsplgmsgmapper.inl Thu Sep 30 11:43:07 2010 +0300 +++ b/ipsservices/ipssosplugin/inc/ipsplgmsgmapper.inl Thu Oct 14 17:33:43 2010 +0300 @@ -15,8 +15,8 @@ * */ - -#include "ipsplgmsgmapper.h" // for Lint +//we won't care about pc-lint error here. +//including msgmapper header (lint would require this) here would create include recursion // ----------------------------------------------------------------------------- // ----------------------------------------------------------------------------- diff -r 6c59112cfd31 -r 38bf5461e270 ipsservices/ipssosplugin/inc/ipsplgonlineoperation.h --- a/ipsservices/ipssosplugin/inc/ipsplgonlineoperation.h Thu Sep 30 11:43:07 2010 +0300 +++ b/ipsservices/ipssosplugin/inc/ipsplgonlineoperation.h Thu Oct 14 17:33:43 2010 +0300 @@ -139,7 +139,18 @@ * @param aStatus completion status of the operation */ void SignalFSObserver( TInt aStatus ); - + + /** + * Checks whether the currently used drive has enough space for a file with + * the given size. + * + * @param fileSize The file size in bytes. + * @return ETrue if a file with the given file size fits on the currently + * used drive, EFalse otherwise. + */ + TBool EnoughDiskSpaceOnCurrentDrive( const TInt aFileSize ) const; + + protected: // mailbox specific activity timer CIpsPlgTimerOperation* iActivityTimer; diff -r 6c59112cfd31 -r 38bf5461e270 ipsservices/ipssosplugin/inc/ipsplgpop3connectop.h --- a/ipsservices/ipssosplugin/inc/ipsplgpop3connectop.h Thu Sep 30 11:43:07 2010 +0300 +++ b/ipsservices/ipssosplugin/inc/ipsplgpop3connectop.h Thu Oct 14 17:33:43 2010 +0300 @@ -46,11 +46,13 @@ * @param aEventHandler event handler for sending sync events * @param aSignallingAllowed for asynchronous request response message * @param aFetchWillFollow used when connection must be kept open + * @param aSilentConnection set if silent connection is used * @return new instance of the class */ // MFSMailRequestObserver& changed to pointer // aSignallingAllowed parameter added // aFetchWillFollow parameter added + // aSilentConnection parameter added static CIpsPlgPop3ConnectOp* NewL( CMsvSession& aMsvSession, TRequestStatus& aObserverRequestStatus, @@ -62,7 +64,8 @@ TInt aFSRequestId, CIpsPlgEventHandler* aEventHandler, TBool aSignallingAllowed=ETrue, - TBool aFetchWillFollow=EFalse ); + TBool aFetchWillFollow=EFalse, + TBool aSilentConnection=EFalse); /** * @@ -118,6 +121,7 @@ // MFSMailRequestObserver& changed to pointer // aSignallingAllowed parameter added // aFetchWillFollow parameter added + // aSilentConnection parameter added CIpsPlgPop3ConnectOp( CMsvSession& aMsvSession, TRequestStatus& aObserverRequestStatus, @@ -129,7 +133,8 @@ TInt aFSRequestId, CIpsPlgEventHandler* aEventHandler, TBool aSignallingAllowed, - TBool aFetchWillFollow ); + TBool aFetchWillFollow, + TBool aSilentConnection); /** * @@ -179,6 +184,8 @@ // iAlreadyConnected removed // TBool iFetchWillFollow; + // whether silent connection is requested or not + TBool iSilentConnection; // }; diff -r 6c59112cfd31 -r 38bf5461e270 ipsservices/ipssosplugin/ipssosplugin.pro --- a/ipsservices/ipssosplugin/ipssosplugin.pro Thu Sep 30 11:43:07 2010 +0300 +++ b/ipsservices/ipssosplugin/ipssosplugin.pro Thu Oct 14 17:33:43 2010 +0300 @@ -169,6 +169,7 @@ -lfsfwcommonlib \ -lbafl \ -lcentralrepository \ + -lsysutil \ -lCommonEngine \ -lcharconv \ -lConnMon \ diff -r 6c59112cfd31 -r 38bf5461e270 ipsservices/ipssosplugin/src/ipsplgconnectandrefreshfolderlist.cpp --- a/ipsservices/ipssosplugin/src/ipsplgconnectandrefreshfolderlist.cpp Thu Sep 30 11:43:07 2010 +0300 +++ b/ipsservices/ipssosplugin/src/ipsplgconnectandrefreshfolderlist.cpp Thu Oct 14 17:33:43 2010 +0300 @@ -88,7 +88,7 @@ void CIpsPlgConnectAndRefreshFolderList::ConstructL() { FUNC_LOG; - BaseConstructL( KSenduiMtmImap4Uid ); + BaseConstructL( KUidMsgTypeIMAP4 ); iState = EStartConnect; DoRunL(); } diff -r 6c59112cfd31 -r 38bf5461e270 ipsservices/ipssosplugin/src/ipsplgcreatereplymessageoperation.cpp --- a/ipsservices/ipssosplugin/src/ipsplgcreatereplymessageoperation.cpp Thu Sep 30 11:43:07 2010 +0300 +++ b/ipsservices/ipssosplugin/src/ipsplgcreatereplymessageoperation.cpp Thu Oct 14 17:33:43 2010 +0300 @@ -139,10 +139,9 @@ for( TInt i = 0; i < toRecipientCount; i++ ) { emailAddr = header->ToRecipients()[i].AllocLC(); - fsAddr = CFSMailAddress::NewLC(); + fsAddr = CFSMailAddress::NewL(); fsAddr->SetEmailAddress( *emailAddr ); // Copy created newMessage->AppendToRecipient( fsAddr ); // No copy - CleanupStack::Pop( fsAddr ); // fsAddr belong now to fsMsg CleanupStack::PopAndDestroy( emailAddr ); // emailAddr not used } @@ -238,6 +237,7 @@ } } + CleanupStack::Pop( fsAddr ); // fsAddr belong now to fsMsg if( present ) { aNewMessage->AppendToRecipient( fsAddr ); // No copy @@ -247,7 +247,6 @@ aNewMessage->AppendCCRecipient( fsAddr ); // No copy } - CleanupStack::Pop( fsAddr ); // fsAddr belong now to fsMsg CleanupStack::PopAndDestroy( emailAddr ); // emailAddr not used } CleanupStack::PopAndDestroy( tmpHeader ); @@ -258,10 +257,9 @@ for( TInt i = 0; i < aHeader->BccRecipients().Count(); i++ ) { emailAddr = aHeader->BccRecipients()[i].AllocLC(); - fsAddr = CFSMailAddress::NewLC(); + fsAddr = CFSMailAddress::NewL(); fsAddr->SetEmailAddress( *emailAddr ); // Copy created aNewMessage->AppendBCCRecipient( fsAddr ); // No copy - CleanupStack::Pop( fsAddr ); // fsAddr belong now to fsMsg CleanupStack::PopAndDestroy( emailAddr ); // emailAddr not used } } diff -r 6c59112cfd31 -r 38bf5461e270 ipsservices/ipssosplugin/src/ipsplgeventhandler.cpp --- a/ipsservices/ipssosplugin/src/ipsplgeventhandler.cpp Thu Sep 30 11:43:07 2010 +0300 +++ b/ipsservices/ipssosplugin/src/ipsplgeventhandler.cpp Thu Oct 14 17:33:43 2010 +0300 @@ -373,7 +373,7 @@ AppendSettingsObserverL( aMailboxId, aKey ); //at the moment we won't support syncstate events for IMAP alwaysonline. //because of imap idle. we can't extract usefull syncstate changes when it is in use. - /* if ( iBasePlugin.MtmId().iUid != KSenduiMtmImap4UidValue ) + /* if ( iBasePlugin.MtmId() != KUidMsgTypeIMAP4 ) { AppendSyncStateObserverL( aMailboxId ); }*/ @@ -447,7 +447,7 @@ ret = EFalse; } - if ( !ret && aEntry.iMtm.iUid == KSenduiMtmSmtpUidValue ) + if ( !ret && aEntry.iMtm == KUidMsgTypeSMTP ) { ret = ETrue; } @@ -464,15 +464,15 @@ FUNC_LOG; TFSMailMsgId id; id.SetId( aId ); - if ( aMtmUid == KSenduiMtmImap4UidValue ) + if ( aMtmUid == KUidMsgTypeIMAP4.iUid ) { id.SetPluginId( KIpsPlgImap4PluginUid ); } - else if ( aMtmUid == KSenduiMtmPop3UidValue ) + else if ( aMtmUid == KUidMsgTypePOP3.iUid ) { id.SetPluginId( KIpsPlgPop3PluginUid ); } - else if ( aMtmUid == KSenduiMtmSmtpUidValue ) + else if ( aMtmUid == KUidMsgTypeSMTP.iUid ) { // set plugin id to this plugin id.SetPluginId( TUid::Uid(iPluginId) ); @@ -570,10 +570,10 @@ CMsvEntry* root = iSession->GetEntryL( KMsvRootIndexEntryIdValue ); CleanupStack::PushL( root ); - CMsvEntrySelection* pop = root->ChildrenWithMtmL( KSenduiMtmPop3Uid ); + CMsvEntrySelection* pop = root->ChildrenWithMtmL( KUidMsgTypePOP3 ); CleanupStack::PushL( pop ); - CMsvEntrySelection* imap = root->ChildrenWithMtmL( KSenduiMtmImap4Uid ); + CMsvEntrySelection* imap = root->ChildrenWithMtmL( KUidMsgTypeIMAP4 ); CleanupStack::PushL( imap ); TInt count = pop->Count(); @@ -729,7 +729,7 @@ CleanupStack::PopAndDestroy( &array ); - if( tNew.iMtm.iUid == KSenduiMtmImap4UidValue ) + if( tNew.iMtm == KUidMsgTypeIMAP4 ) { SetFolderIdToArrayL( tNew.Id() ); } @@ -787,7 +787,7 @@ TFSMailMsgId mbox; // solve mailbox. - if ( tMoved.iMtm.iUid == KSenduiMtmSmtpUidValue ) + if ( tMoved.iMtm == KUidMsgTypeSMTP ) { TMsvEntry serv; TMsvId service; @@ -909,7 +909,7 @@ CleanupClosePushL( array ); TFSMailMsgId parentId( iPluginId, tEntry.Id() ); - if ( tEntry.iMtm.iUid == KSenduiMtmImap4UidValue ) + if ( tEntry.iMtm == KUidMsgTypeIMAP4 ) { isFolderId = MatchFolderIdFound( deletedId ); } @@ -949,15 +949,21 @@ CleanupStack::PopAndDestroy( &array ); } - else if ( tEntry.iMtm.iUid == KSenduiMtmSmtpUidValue ) + else if ( tEntry.iMtm == KUidMsgTypeSMTP ) { // seems that case when deleding from draft, symbian // sends event that contains some child part's id of // correct deleted mail. So append parents id to array TFSMailMsgId msg; msg.SetId( tEntry.Id() ); + // In case where child is attachment do not append parent id. TFSMailMsgId parent; - parent.SetId( tEntry.Parent() ); + if (!tEntry.Attachment()) + { + parent.SetId( tEntry.Parent() ); + } + // + if( !iSession ) { User::Leave( KErrNotReady ); @@ -971,15 +977,25 @@ mbox.SetId( tEntry.Id() ); // set plugin id to msg, parent and mbox - if ( tEntry.iMtm.iUid == KSenduiMtmImap4UidValue ) + if ( tEntry.iMtm == KUidMsgTypeIMAP4 ) { - parent.SetPluginId( KIpsPlgImap4PluginUid ); + // + if (!tEntry.Attachment()) + { + parent.SetPluginId( KIpsPlgImap4PluginUid ); + } + // msg.SetPluginId( KIpsPlgImap4PluginUid ); mbox.SetPluginId( KIpsPlgImap4PluginUid ); } - else if ( tEntry.iMtm.iUid == KSenduiMtmPop3UidValue ) + else if ( tEntry.iMtm == KUidMsgTypePOP3 ) { - parent.SetPluginId( KIpsPlgPop3PluginUid ); + // + if (!tEntry.Attachment()) + { + parent.SetPluginId( KIpsPlgPop3PluginUid ); + } + // msg.SetPluginId( KIpsPlgPop3PluginUid ); mbox.SetPluginId( KIpsPlgPop3PluginUid ); } @@ -993,7 +1009,12 @@ CleanupClosePushL( array ); array.AppendL( msg ); arg1 = &array; - arg2 = &parent; + // + if (!tEntry.Attachment()) + { + arg2 = &parent; + } + // event = TFSEventMailDeleted; SendDelayedEventL( event, @@ -1071,7 +1092,7 @@ TFSMailMsgId id = SymId2FsId( *(static_cast(aArg2)), tChanged.iMtm.iUid ); arg2 = &id; - if ( tChanged.iMtm.iUid == KSenduiMtmImap4UidValue ) + if ( tChanged.iMtm == KUidMsgTypeIMAP4 ) { TMsvEmailEntry eml( tChanged ); TInt index = iImapFolderIds.Find(tChanged.Id()); @@ -1118,7 +1139,7 @@ { TFSMailMsgId mbox; // solve mailbox. - if ( tChanged.iMtm.iUid == KSenduiMtmSmtpUidValue ) + if ( tChanged.iMtm == KUidMsgTypeSMTP ) { TMsvEntry serv; TMsvId service; @@ -1211,10 +1232,10 @@ // --------------------------------------------------------------------------- TUid CIpsPlgEventHandler::MtmId() const { - TUid ret = KSenduiMtmImap4Uid; + TUid ret = KUidMsgTypeIMAP4; if ( iBasePlugin.MtmId().iUid == KIpsPlgPop3PluginUidValue ) { - ret = KSenduiMtmPop3Uid; + ret = KUidMsgTypePOP3; } return ret; } @@ -1402,8 +1423,8 @@ TBool CIpsPlgEventHandler::AccountExistsL( const TMsvEntry& aEntry ) { FUNC_LOG; - if ( !(aEntry.iMtm.iUid == KSenduiMtmImap4UidValue - || aEntry.iMtm.iUid == KSenduiMtmPop3UidValue) ) + if ( !(aEntry.iMtm == KUidMsgTypeIMAP4 + || aEntry.iMtm == KUidMsgTypePOP3) ) { // check only imap and pop return ETrue; @@ -1440,13 +1461,13 @@ } // only pop or imap types are alloved beyond this point - __ASSERT_DEBUG( ( aParent.iMtm.iUid == KSenduiMtmImap4UidValue || - aParent.iMtm.iUid == KSenduiMtmPop3UidValue ), + __ASSERT_DEBUG( ( aParent.iMtm == KUidMsgTypeIMAP4 || + aParent.iMtm == KUidMsgTypePOP3 ), User::Panic( KIpsPlgEventHandlerPanic, KErrGeneral ) ); TBool doRecursion = EFalse; - if ( aParent.iMtm.iUid == KSenduiMtmImap4UidValue ) + if ( aParent.iMtm == KUidMsgTypeIMAP4 ) { if ( aParent.iType.iUid == KUidMsvServiceEntryValue ) { diff -r 6c59112cfd31 -r 38bf5461e270 ipsservices/ipssosplugin/src/ipsplgimap4connectop.cpp --- a/ipsservices/ipssosplugin/src/ipsplgimap4connectop.cpp Thu Sep 30 11:43:07 2010 +0300 +++ b/ipsservices/ipssosplugin/src/ipsplgimap4connectop.cpp Thu Oct 14 17:33:43 2010 +0300 @@ -29,6 +29,7 @@ // priority parameter has been removed // MFSMailRequestObserver& changed it to pointer // aSignallingAllowed parameter has been removed +// silent connection parameter added CIpsPlgImap4ConnectOp* CIpsPlgImap4ConnectOp::NewL( CMsvSession& aMsvSession, TRequestStatus& aObserverRequestStatus, @@ -38,7 +39,8 @@ MFSMailRequestObserver* aFSOperationObserver, TInt aFSRequestId, CIpsPlgEventHandler* aEventHandler, - TBool aDoPlainConnect ) + TBool aDoPlainConnect, + TBool aSilentConnection) { FUNC_LOG; CIpsPlgImap4ConnectOp* self = new (ELeave) CIpsPlgImap4ConnectOp( @@ -50,7 +52,8 @@ aFSOperationObserver, aFSRequestId, aDoPlainConnect, - aEventHandler ); + aEventHandler, + aSilentConnection); CleanupStack::PushL( self ); self->ConstructL(); @@ -64,6 +67,7 @@ // priority parameter has been removed // MFSMailRequestObserver& changed it to pointer // aSignallingAllowed parameter has been removed +// silent connection parameter added CIpsPlgImap4ConnectOp::CIpsPlgImap4ConnectOp( CMsvSession& aMsvSession, TRequestStatus& aObserverRequestStatus, @@ -73,7 +77,8 @@ MFSMailRequestObserver* aFSOperationObserver, TInt aFSRequestId, TBool aDoPlainConnect, - CIpsPlgEventHandler* aEventHandler) + CIpsPlgEventHandler* aEventHandler, + TBool aSilentConnection) : CIpsPlgOnlineOperation( aMsvSession, @@ -86,7 +91,8 @@ iSelection( NULL ), iDoPlainConnect( aDoPlainConnect ), iEventHandler( aEventHandler ), - iIsSyncStartedSignaled( EFalse ) + iIsSyncStartedSignaled( EFalse ), + iSilentConnection( aSilentConnection ) { FUNC_LOG; iService = aService; @@ -341,6 +347,8 @@ TBuf8<1> parameter; NM_COMMENT("CIpsPlgImap4ConnectOp: do plain connect"); // connect and synchronise starts background sync or idle + // select connection type based on iSilentConnection + // NOTE: Cannot be implemented yet, because MTM support is not released yet iSubOperation = iBaseMtm->InvokeAsyncFunctionL( KIMAP4MTMConnect, *iSelection, parameter, iStatus); } @@ -358,6 +366,8 @@ // the used command requires an observer to be given even though we're not using it NM_COMMENT("CIpsPlgImap4ConnectOp: connect and sync"); TPckg parameter( NULL ); + // select connection type based on iSilentConnection + // NOTE: Cannot be implemented yet, because MTM support is not released yet iSubOperation = iBaseMtm->InvokeAsyncFunctionL( KIMAP4MTMConnectAndSyncCompleteAfterFullSync, *iSelection, parameter, iStatus ); diff -r 6c59112cfd31 -r 38bf5461e270 ipsservices/ipssosplugin/src/ipsplgimap4fetchattachmentop.cpp --- a/ipsservices/ipssosplugin/src/ipsplgimap4fetchattachmentop.cpp Thu Sep 30 11:43:07 2010 +0300 +++ b/ipsservices/ipssosplugin/src/ipsplgimap4fetchattachmentop.cpp Thu Oct 14 17:33:43 2010 +0300 @@ -308,7 +308,9 @@ void CIpsPlgImap4FetchAttachmentOp::ReportProgressL() { FUNC_LOG; + TInt error = KErrNone; + TFSProgress fsProgress = { TFSProgress::EFSStatus_Waiting, 0, 0, KErrNone }; if ( iSubOperation && iState == EStateFetching ) { @@ -337,6 +339,20 @@ User::Leave( error ); } + TInt fileSize( 0 ); + + if ( fsProgress.iMaxCount - fsProgress.iCounter > 0 ) + { + fileSize = fsProgress.iMaxCount - fsProgress.iCounter; + } + + if ( EnoughDiskSpaceOnCurrentDrive( fileSize ) == EFalse ) + { + // Not enough space on the disk for the attachment! + error = KErrDiskFull; + fsProgress.iError = error; + } + // // signal observer if it exists if ( iFSOperationObserver ) @@ -344,6 +360,11 @@ iFSOperationObserver->RequestResponseL( fsProgress, iFSRequestId ); } // + + if ( error == KErrDiskFull ) + { + Cancel(); + } } // ---------------------------------------------------------------------------- diff -r 6c59112cfd31 -r 38bf5461e270 ipsservices/ipssosplugin/src/ipsplgimap4plugin.cpp --- a/ipsservices/ipssosplugin/src/ipsplgimap4plugin.cpp Thu Sep 30 11:43:07 2010 +0300 +++ b/ipsservices/ipssosplugin/src/ipsplgimap4plugin.cpp Thu Oct 14 17:33:43 2010 +0300 @@ -142,7 +142,7 @@ const TFSMailMsgId& aMailBoxId, MFSMailRequestObserver& aOperationObserver, TInt aRequestId, - const TBool /*aSilentConnection*/ ) + const TBool aSilentConnection ) { FUNC_LOG; @@ -152,6 +152,7 @@ CleanupStack::PushL( watcher ); // priority parameter has been removed + // silent connection parameter added CIpsPlgBaseOperation* op = CIpsPlgImap4ConnectOp::NewL( *iSession, watcher->iStatus, @@ -160,9 +161,12 @@ aMailBoxId, &aOperationObserver, aRequestId, - iEventHandler ); + iEventHandler, + EFalse, + aSilentConnection ); - watcher->SetOperation( op ); + watcher->SetOperation( op ); // watcher takes ownership, + // no PushL needed before AppendL iOperations.AppendL( watcher ); CleanupStack::Pop( watcher ); @@ -309,7 +313,8 @@ iEventHandler, EFalse ); // do not filter mail selection - watcher->SetOperation( op ); + watcher->SetOperation( op ); // watcher takes ownership, + // no PushL needed before AppendL CleanupStack::PopAndDestroy( sel ); iOperations.AppendL( watcher ); CleanupStack::Pop( watcher ); @@ -372,7 +377,8 @@ NULL, // no observer, async not supported 0 ); // async not supported - watcher->SetOperation( op ); + watcher->SetOperation( op ); // watcher takes ownership, + // no PushL needed before AppendL CleanupStack::PopAndDestroy( sel ); iOperations.AppendL( watcher ); CleanupStack::Pop( watcher ); @@ -445,7 +451,8 @@ &aOperationObserver, // async not supported 0 ); // async not supported - watcher->SetOperation( op ); + watcher->SetOperation( op ); // watcher takes ownership, + // no PushL needed before AppendL CleanupStack::PopAndDestroy( sel ); iOperations.AppendL( watcher ); CleanupStack::Pop( watcher ); @@ -536,7 +543,8 @@ &aOperationObserver, aRequestId ); - watcher->SetOperation( op ); + watcher->SetOperation( op ); // watcher takes ownership, + // no PushL needed before next line iOperations.AppendL( watcher ); // CleanupStack::Pop( sel ); @@ -612,7 +620,8 @@ iEventHandler, EFalse ); // do not block entry changed and created events - watcher->SetOperation( op ); + watcher->SetOperation( op ); // watcher takes ownership, + // no PushL needed before AppendL CleanupStack::PopAndDestroy( sel ); iOperations.AppendL( watcher ); CleanupStack::Pop( watcher ); diff -r 6c59112cfd31 -r 38bf5461e270 ipsservices/ipssosplugin/src/ipsplgmsgiterator.cpp --- a/ipsservices/ipssosplugin/src/ipsplgmsgiterator.cpp Thu Sep 30 11:43:07 2010 +0300 +++ b/ipsservices/ipssosplugin/src/ipsplgmsgiterator.cpp Thu Oct 14 17:33:43 2010 +0300 @@ -261,7 +261,7 @@ const TMsvEmailEntry& entry( iFolderEntry->ChildDataL( aMessageEntries->At(i) ) ); if ( ( EDisconnectedDeleteOperation != entry.DisconnectedOperation() ) && - (( entry.iMtm != KSenduiMtmImap4Uid ) || !entry.DeletedIMAP4Flag() ) && + (( entry.iMtm != KUidMsgTypeIMAP4 ) || !entry.DeletedIMAP4Flag() ) && ( entry.iType == KUidMsvMessageEntry ) ) { fsMsg = iMsgMapper->GetMailMessageL( iMailboxId, entry, @@ -301,7 +301,7 @@ const TMsvEmailEntry& entry( iFolderEntry->ChildDataL( aMessageEntries->At(i) ) ); if ( ( EDisconnectedDeleteOperation != entry.DisconnectedOperation() ) && - (( entry.iMtm != KSenduiMtmImap4Uid ) || !entry.DeletedIMAP4Flag() ) && + (( entry.iMtm != KUidMsgTypeIMAP4 ) || !entry.DeletedIMAP4Flag() ) && ( entry.iType == KUidMsvMessageEntry ) ) { fsMsg = iMsgMapper->GetMailMessageL( iMailboxId, entry, diff -r 6c59112cfd31 -r 38bf5461e270 ipsservices/ipssosplugin/src/ipsplgmsgmapper.cpp --- a/ipsservices/ipssosplugin/src/ipsplgmsgmapper.cpp Thu Sep 30 11:43:07 2010 +0300 +++ b/ipsservices/ipssosplugin/src/ipsplgmsgmapper.cpp Thu Oct 14 17:33:43 2010 +0300 @@ -307,10 +307,8 @@ TBool modified ( EFalse ); TBool unread( aEmlEntry.Unread() ); -// - if ( LogicalXor( unread, msgFlags & EFSMsgFlag_Read ) || - LogicalXor( unread, msgFlags & EFSMsgFlag_Read_Locally )) -// + if ( !LogicalXor( unread, msgFlags & EFSMsgFlag_Read ) || + !LogicalXor( unread, msgFlags & EFSMsgFlag_Read_Locally )) { aEmlEntry.SetUnread( !unread ); modified = ETrue; @@ -349,7 +347,7 @@ // EFSMsgFlag_Multiple: no counterpart in Symbian message // EFSMsgFlag_CalendarMsg - if( ( aEmlEntry.iMtm == KSenduiMtmSmtpUid ) && ( msgFlags & EFSMsgFlag_CalendarMsg ) ) + if( ( aEmlEntry.iMtm == KUidMsgTypeSMTP ) && ( msgFlags & EFSMsgFlag_CalendarMsg ) ) { if( !aEmlEntry.ICalendar() ) { @@ -375,7 +373,7 @@ // EFSMsgFlag_Answered // IMAP flags - if ( aEmlEntry.iMtm == KSenduiMtmImap4Uid ) + if ( aEmlEntry.iMtm == KUidMsgTypeIMAP4 ) { // EFSMsgFlag_FollowUp if ( LogicalXor( aEmlEntry.FlaggedIMAP4Flag(), @@ -546,8 +544,8 @@ { addr = CFSMailAddress::NewLC(); ConvertAddressL( toRecs[i], *addr ); + CleanupStack::Pop( addr ); aMsg.AppendToRecipient( addr ); - CleanupStack::Pop( addr ); } const CDesCArray& ccRecs = header->CcRecipients(); @@ -556,8 +554,8 @@ { addr = CFSMailAddress::NewLC(); ConvertAddressL( ccRecs[i], *addr ); + CleanupStack::Pop( addr ); aMsg.AppendCCRecipient( addr ); - CleanupStack::Pop( addr ); } const CDesCArray& bccRecs = header->BccRecipients(); @@ -566,8 +564,8 @@ { addr = CFSMailAddress::NewLC(); ConvertAddressL( bccRecs[i], *addr ); + CleanupStack::Pop( addr ); aMsg.AppendBCCRecipient( addr ); - CleanupStack::Pop( addr ); } CleanupStack::PopAndDestroy( header ); @@ -674,7 +672,7 @@ // //only for incomplete POP3 messages - if ( aEntry.iMtm.iUid == KSenduiMtmPop3UidValue && + if ( aEntry.iMtm == KUidMsgTypePOP3 && ( !aEntry.Complete() || aEntry.PartialDownloaded () ) ) { TRAP_IGNORE( AttaCheckForIncompleteMsgL( aEntry, aMsg ) ); @@ -759,7 +757,7 @@ // but this should be tested // Additional logic for IMAP4 messages - if ( aEntry.iMtm == KSenduiMtmImap4Uid ) + if ( aEntry.iMtm == KUidMsgTypeIMAP4 ) { if ( aEntry.FlaggedIMAP4Flag() ) { @@ -782,7 +780,7 @@ CFSMailMessagePart& aMessage ) { FUNC_LOG; - if ( aEntry.iMtm.iUid == KSenduiMtmPop3UidValue && + if ( aEntry.iMtm == KUidMsgTypePOP3 && aEntry.Id() != aMsgMainId && !aIsAtta ) { @@ -1222,7 +1220,7 @@ CleanupStack::PopAndDestroy( cEntry ); } - else if ( aEntry.iMtm == KSenduiMtmPop3Uid && + else if ( aEntry.iMtm == KUidMsgTypePOP3 && iSession.GetEntry( aEntry.Parent(), dummy, parent ) == KErrNone && parent.PartialDownloaded() ) { diff -r 6c59112cfd31 -r 38bf5461e270 ipsservices/ipssosplugin/src/ipsplgonlineoperation.cpp --- a/ipsservices/ipssosplugin/src/ipsplgonlineoperation.cpp Thu Sep 30 11:43:07 2010 +0300 +++ b/ipsservices/ipssosplugin/src/ipsplgonlineoperation.cpp Thu Oct 14 17:33:43 2010 +0300 @@ -189,7 +189,7 @@ const TDesC8& aParams ) { FUNC_LOG; - + TMsvEntry tEntry; TMsvId service; if ( aSel.Count() ) @@ -242,6 +242,29 @@ } } + +// ---------------------------------------------------------------------------- +// CIpsPlgOnlineOperation::EnoughDiskSpaceOnCurrentDrive() +// Returns true if there is enough space on the disk for a file with given +// file size. +// ---------------------------------------------------------------------------- +// +TBool CIpsPlgOnlineOperation::EnoughDiskSpaceOnCurrentDrive( + const TInt aFileSize ) const + { + TDriveUnit driveUnit; + TRAP_IGNORE( driveUnit = iMsvSession.CurrentDriveL() ); + RFs rfs( iMsvSession.FileSession() ); + + TBool belowCriticalLevel( EFalse ); + + TRAP_IGNORE( belowCriticalLevel = + SysUtil::DiskSpaceBelowCriticalLevelL( &rfs, aFileSize, driveUnit ) ); + + return !belowCriticalLevel; + } + + // removed IpsOpType() // makes more sence to have this method here in "base" online op than in every derived class diff -r 6c59112cfd31 -r 38bf5461e270 ipsservices/ipssosplugin/src/ipsplgpop3connectop.cpp --- a/ipsservices/ipssosplugin/src/ipsplgpop3connectop.cpp Thu Sep 30 11:43:07 2010 +0300 +++ b/ipsservices/ipssosplugin/src/ipsplgpop3connectop.cpp Thu Oct 14 17:33:43 2010 +0300 @@ -32,6 +32,7 @@ // MFSMailRequestObserver& changed to pointer // aSignallingAllowed parameter added // aFetchWillFollow parameter added +// Silent connection parameter added CIpsPlgPop3ConnectOp* CIpsPlgPop3ConnectOp::NewL( CMsvSession& aMsvSession, TRequestStatus& aObserverRequestStatus, @@ -43,7 +44,8 @@ TInt aFSRequestId, CIpsPlgEventHandler* aEventHandler, TBool aSignallingAllowed, - TBool aFetchWillFollow ) + TBool aFetchWillFollow, + TBool aSilentConnection) { FUNC_LOG; CIpsPlgPop3ConnectOp* op = new(ELeave) CIpsPlgPop3ConnectOp( @@ -57,7 +59,8 @@ aFSRequestId, aEventHandler, aSignallingAllowed, - aFetchWillFollow ); + aFetchWillFollow, + aSilentConnection); CleanupStack::PushL( op ); op->ConstructL(); @@ -259,6 +262,7 @@ // aSignallingAllowed parameter added // aFetchWillFollow parameter added // iAlreadyConnected removed +// Silent connection parameter added CIpsPlgPop3ConnectOp::CIpsPlgPop3ConnectOp( CMsvSession& aMsvSession, TRequestStatus& aObserverRequestStatus, @@ -270,7 +274,8 @@ TInt aFSRequestId, CIpsPlgEventHandler* aEventHandler, TBool aSignallingAllowed, - TBool aFetchWillFollow ) + TBool aFetchWillFollow, + TBool aSilentConnection ) : CIpsPlgOnlineOperation( aMsvSession, @@ -283,7 +288,8 @@ iState( EIdle ), iForcePopulate( aForcePopulate ), iEventHandler( aEventHandler ), - iFetchWillFollow( aFetchWillFollow ) + iFetchWillFollow( aFetchWillFollow ), + iSilentConnection( aSilentConnection ) { iService = aServiceId; } @@ -337,6 +343,9 @@ FUNC_LOG; // unnecessary: iStatus = KRequestPending; NM_COMMENT("CIpsPlgPop3ConnectOp: connecting"); + + // select connection type based on iSilentConnection + // NOTE: Cannot be implemented yet, because MTM support is not released yet InvokeClientMtmAsyncFunctionL( KPOP3MTMConnect, iService ); // 1 param removed SetActive(); diff -r 6c59112cfd31 -r 38bf5461e270 ipsservices/ipssosplugin/src/ipsplgpop3plugin.cpp --- a/ipsservices/ipssosplugin/src/ipsplgpop3plugin.cpp Thu Sep 30 11:43:07 2010 +0300 +++ b/ipsservices/ipssosplugin/src/ipsplgpop3plugin.cpp Thu Oct 14 17:33:43 2010 +0300 @@ -140,7 +140,7 @@ const TFSMailMsgId& aMailBoxId, MFSMailRequestObserver& aOperationObserver, TInt aRequestId, - const TBool /*aSilentConnection*/ ) + const TBool aSilentConnection ) { FUNC_LOG; TMsvId service = aMailBoxId.Id(); @@ -181,9 +181,14 @@ aMailBoxId, &aOperationObserver, aRequestId, - iEventHandler ); + iEventHandler, +// silent connection parameter added + ETrue, + EFalse, + aSilentConnection ); +// - watcher->SetOperation( op ); + watcher->SetOperation( op ); // watcher takes ownership, no PushL needed CleanupStack::PopAndDestroy( sel ); // >>> sel iOperations.AppendL( watcher ); @@ -349,7 +354,7 @@ aRequestId, iEventHandler ); - watcher->SetOperation( op ); + watcher->SetOperation( op ); // watcher takes ownership, no PushL needed // change PopAndDestroy to Pop CleanupStack::Pop( sel ); CleanupStack::Pop( watcher ); diff -r 6c59112cfd31 -r 38bf5461e270 ipsservices/ipssosplugin/src/ipsplgsearch.cpp --- a/ipsservices/ipssosplugin/src/ipsplgsearch.cpp Thu Sep 30 11:43:07 2010 +0300 +++ b/ipsservices/ipssosplugin/src/ipsplgsearch.cpp Thu Oct 14 17:33:43 2010 +0300 @@ -569,7 +569,7 @@ FUNC_LOG; iActiveEntry->SetEntryL( aParams.iMailbox.Id() ); - if ( iActiveEntry->Entry().iMtm == KSenduiMtmPop3Uid ) + if ( iActiveEntry->Entry().iMtm == KUidMsgTypePOP3 ) { aParams.iFolderIds.AppendL( TFSMailMsgId( iPlugin.PluginId(), aParams.iMailbox.Id() ) ); @@ -1005,7 +1005,7 @@ const TMsvEntry& entry = ( *iActiveEntry )[msg]; if ( entry.iType == KUidMsvMessageEntry && entry.iServiceId == serviceId && - ( entry.iMtm.iUid == KSenduiMtmSmtpUidValue || + ( entry.iMtm == KUidMsgTypeSMTP || entry.iMtm.iUid == iPlugin.MtmId().iUid ) ) { iEmailMessages.AppendL( TMsgContainer( entry, diff -r 6c59112cfd31 -r 38bf5461e270 ipsservices/ipssosplugin/src/ipsplgsmtpoperation.cpp --- a/ipsservices/ipssosplugin/src/ipsplgsmtpoperation.cpp Thu Sep 30 11:43:07 2010 +0300 +++ b/ipsservices/ipssosplugin/src/ipsplgsmtpoperation.cpp Thu Oct 14 17:33:43 2010 +0300 @@ -436,7 +436,7 @@ if ( !iSmtpMtm ) { iSmtpMtm = static_cast( - iMtmRegistry->NewMtmL( KSenduiMtmSmtpUid ) ); + iMtmRegistry->NewMtmL( KUidMsgTypeSMTP ) ); } } diff -r 6c59112cfd31 -r 38bf5461e270 ipsservices/ipssosplugin/src/ipsplgsosbaseplugin.cpp --- a/ipsservices/ipssosplugin/src/ipsplgsosbaseplugin.cpp Thu Sep 30 11:43:07 2010 +0300 +++ b/ipsservices/ipssosplugin/src/ipsplgsosbaseplugin.cpp Thu Oct 14 17:33:43 2010 +0300 @@ -816,7 +816,7 @@ aOperationObserver, aRequestId ); // - watcher->SetOperation( op ); + watcher->SetOperation( op ); // takes ownership of op iOperations.AppendL( watcher ); CleanupStack::Pop( watcher ); @@ -861,7 +861,7 @@ } if ( ( orgMsg.Parent() == KMsvSentEntryIdValue ) && - ( orgMsg.iMtm == KSenduiMtmSmtpUid ) ) + ( orgMsg.iMtm == KUidMsgTypeSMTP ) ) { iSmtpService->ChangeServiceIdL( orgMsg ); } @@ -881,7 +881,7 @@ aOperationObserver, aRequestId ); // - watcher->SetOperation( op ); + watcher->SetOperation( op ); // takes ownership of op iOperations.AppendL( watcher ); CleanupStack::Pop( watcher ); @@ -927,7 +927,7 @@ } if ( ( orgMsg.Parent() == KMsvSentEntryIdValue ) && - ( orgMsg.iMtm == KSenduiMtmSmtpUid ) ) + ( orgMsg.iMtm == KUidMsgTypeSMTP ) ) { iSmtpService->ChangeServiceIdL( orgMsg ); } @@ -953,7 +953,7 @@ aOperationObserver, aRequestId ); // - watcher->SetOperation( op ); + watcher->SetOperation( op ); // takes ownership of op iOperations.AppendL( watcher ); CleanupStack::Pop( watcher ); @@ -981,8 +981,8 @@ if ( status == KErrNone ) { - incoming = ( tEntry.iMtm == KSenduiMtmImap4Uid ) || - ( tEntry.iMtm == KSenduiMtmPop3Uid ); + incoming = ( tEntry.iMtm == KUidMsgTypeIMAP4 ) || + ( tEntry.iMtm == KUidMsgTypePOP3 ); } } @@ -1036,7 +1036,7 @@ aOperationObserver, aRequestId ); - watcher->SetOperation(op); + watcher->SetOperation(op); // takes ownership of op iOperations.AppendL(watcher); CleanupStack::Pop( 2, watcher ); } @@ -1138,7 +1138,7 @@ aOperationObserver, aRequestId, iMsgMapper); - watcher->SetOperation( op ); + watcher->SetOperation( op ); // takes ownership of op iOperations.AppendL( watcher ); CleanupStack::Pop( watcher ); @@ -1214,7 +1214,7 @@ aPartId, aOperationObserver, aRequestId); - watcher->SetOperation( op ); + watcher->SetOperation( op ); // takes ownership of op iOperations.AppendL( watcher ); CleanupStack::Pop( watcher ); @@ -1487,7 +1487,7 @@ watcher->iStatus, *this, aMessageParts, aOperationObserver, aRequestId); - watcher->SetOperation(op); + watcher->SetOperation(op); // takes ownership of op iOperations.AppendL(watcher); CleanupStack::Pop( 2, watcher ); } @@ -1688,7 +1688,7 @@ CMsvOperation* op = CIpsPlgDeleteOperation::NewL( *iSession, watcher->iStatus, sel ); // - watcher->SetOperation( op ); + watcher->SetOperation( op ); // takes ownership of op iOperations.AppendL( watcher ); CleanupStack::Pop( watcher ); // @@ -1728,7 +1728,7 @@ CleanupStack::PushL( watcher ); CMsvOperation* op = CIpsPlgDeleteOperation::NewL( *iSession, watcher->iStatus, sel, aOperationObserver, aRequestId ); - watcher->SetOperation( op ); + watcher->SetOperation( op ); // takes ownership of op iOperations.AppendL( watcher ); CleanupStack::Pop( watcher ); CleanupStack::Pop( sel ); @@ -1953,7 +1953,7 @@ { folderType = EFSInbox; } - else if( ( aEntry->Entry().iMtm == KSenduiMtmPop3Uid ) && + else if( ( aEntry->Entry().iMtm == KUidMsgTypePOP3 ) && ( aEntry->Entry().iType == KUidMsvServiceEntry ) && ( aEntry->Entry().iServiceId == aFolderId.Id() ) ) { @@ -2156,7 +2156,7 @@ &aObserver, aRequestId ); - watcher->SetOperation( op ); + watcher->SetOperation( op ); // takes ownership of op CleanupStack::PopAndDestroy( sel ); iOperations.AppendL( watcher ); CleanupStack::Pop( watcher ); @@ -2199,7 +2199,7 @@ CIpsPlgSmtpOperation* op = CIpsPlgSmtpOperation::NewLC( *iSession, watcher->iStatus ); // op->SetEventHandler(iEventHandler); - watcher->SetOperation(op); + watcher->SetOperation(op); // takes ownership of op op->EmptyOutboxFromPendingMessagesL( aMailBoxId.Id() ); iOperations.AppendL(watcher); CleanupStack::Pop( 2, watcher ); @@ -2399,10 +2399,10 @@ TUid CIpsPlgSosBasePlugin::MtmId() const { FUNC_LOG; - TUid ret = KSenduiMtmImap4Uid; + TUid ret = KUidMsgTypeIMAP4; if ( iFSPluginId == KIpsPlgPop3PluginUidValue ) { - ret = KSenduiMtmPop3Uid; + ret = KUidMsgTypePOP3; } return ret; } @@ -2468,7 +2468,7 @@ //currently, no actions unless this is inbox //also, if id is '0', it means inbox before first sync...it doesn't really exist yet if( folder.iDetails.CompareF( KIpsPlgInbox ) == 0 || folder.Id() == 0 || - ( folder.iMtm == KSenduiMtmPop3Uid ) && + ( folder.iMtm == KUidMsgTypePOP3 ) && ( folder.iType == KUidMsvServiceEntry ) && ( folder.iServiceId == aActiveFolderId.Id() ) ) { diff -r 6c59112cfd31 -r 38bf5461e270 ipsservices/nmimapclientplugin/inc/nmimapclientplugin.h --- a/ipsservices/nmimapclientplugin/inc/nmimapclientplugin.h Thu Sep 30 11:43:07 2010 +0300 +++ b/ipsservices/nmimapclientplugin/inc/nmimapclientplugin.h Thu Oct 14 17:33:43 2010 +0300 @@ -40,9 +40,10 @@ virtual ~NmImapClientPlugin(); void getActions( const NmActionRequest &request, QList &actionList); + void launchSettings(const NmId &mailboxId); private slots: - void settings(); + void settings(const NmId &mailboxId=0); void switchToStandardFolderInbox(); void switchToStandardFolderOutbox(); void switchToStandardFolderDrafts(); diff -r 6c59112cfd31 -r 38bf5461e270 ipsservices/nmimapclientplugin/src/nmimapclientplugin.cpp --- a/ipsservices/nmimapclientplugin/src/nmimapclientplugin.cpp Thu Sep 30 11:43:07 2010 +0300 +++ b/ipsservices/nmimapclientplugin/src/nmimapclientplugin.cpp Thu Oct 14 17:33:43 2010 +0300 @@ -146,16 +146,32 @@ } /*! + Public method to access from extensionmanager to launch settings. + Opens mailbox settings. + */ +void NmImapClientPlugin::launchSettings(const NmId &mailboxId) +{ + NMLOG("NmImapClientPlugin::launchSettings()-->"); + // Check if this request is for the IMAP protocol. + if (mailboxId.pluginId32() == this->pluginId()) { + settings(mailboxId); + } +} + +/*! Slot connected to options menu settings NmAction. Opens mailbox settings. */ -void NmImapClientPlugin::settings() +void NmImapClientPlugin::settings(const NmId &mailboxId) { NMLOG("NmImapClientPlugin::settings()-->"); - - const NmId &id = mMenuRequest.mailboxId(); - NmMailboxMetaData *mailbox = mUiEngine->mailboxById(id); - + + NmId id = mMenuRequest.mailboxId(); + if (mailboxId.id()) { + id = mailboxId; + } + NmMailboxMetaData *mailbox = mUiEngine->mailboxById(id); + if (mailbox) { if (!mSettingsViewLauncher) { mSettingsViewLauncher = new NmSettingsViewLauncher(); diff -r 6c59112cfd31 -r 38bf5461e270 ipsservices/nmipsmtms/src/nmipsmtmui.cpp --- a/ipsservices/nmipsmtms/src/nmipsmtmui.cpp Thu Sep 30 11:43:07 2010 +0300 +++ b/ipsservices/nmipsmtms/src/nmipsmtmui.cpp Thu Oct 14 17:33:43 2010 +0300 @@ -16,7 +16,6 @@ */ #include -#include #include #include "nmipsmtmui.h" diff -r 6c59112cfd31 -r 38bf5461e270 ipsservices/nmipssettings/inc/nmipssettingsdeletemailboxop.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ipsservices/nmipssettings/inc/nmipssettingsdeletemailboxop.h Thu Oct 14 17:33:43 2010 +0300 @@ -0,0 +1,97 @@ +/* +* 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: +* +*/ + +#ifndef NMIPSSETTINGSDELETEMAILBOXOP_H +#define NMIPSSETTINGSDELETEMAILBOXOP_H + +#include +#include + +class CMailboxDisconnectWait; +class NmIpsSettingsManagerBase; +class HbMessageBox; +class HbProgressDialog; +class HbAction; + +/// Operation results +enum NmDeleteMailboxOpResults { + /// Operation successful. Errorcode is always 0 + DeleteMbResultSuccess, + /// Operation has failed. Errorcode will identify the error + DeleteMbResultFailure, + /// Operation was canceled. Errorcode is always 0 + DeleteMbResultCanceled +}; + +class NmIpsSettingsDeleteMailboxOp : public QObject +{ + Q_OBJECT + +public: + NmIpsSettingsDeleteMailboxOp(NmIpsSettingsManagerBase &settingsManager); + ~NmIpsSettingsDeleteMailboxOp(); + + void startOperation(); + +public slots: + void mailboxDisconnected(); + +signals: + void operationComplete(int result, int error); + void goOffline(NmId mailboxId); + void stateChanged(); + +private: + /// Operation states + enum DeleteOpStates { + StateConfirmation, + StateDisconnect, + StateDelete, + StateUnregisterMailbox, + StateDone + }; + +private: + void complete(int result, int error); + +private slots: + void handleConfimationDlg(HbAction *action); + void handleDisconnectTimeout(); + void processState(); + void changeState(DeleteOpStates nextState); + + +private: // data + // Owned. Messaging server observer (Symbian class) + CMailboxDisconnectWait *mDisconnectWait; + // Settings manager + NmIpsSettingsManagerBase &mSettingsManager; + // Owned. Confirmation query dialog + HbMessageBox *mDeleteConfirmationDlg; + // Owned. Wait dialog + HbProgressDialog* mDeleteProgressDlg; + // Current state + DeleteOpStates mState; + // How many retry attempts is left + int mRetryCount; + // Operation error code + int mError; + // Operation result (NmDeleteMailboxOpResults) + int mResult; +}; + +#endif // NMIPSSETTINGSDELETEMAILBOXOP_H diff -r 6c59112cfd31 -r 38bf5461e270 ipsservices/nmipssettings/inc/nmipssettingshelper.h --- a/ipsservices/nmipssettings/inc/nmipssettingshelper.h Thu Sep 30 11:43:07 2010 +0300 +++ b/ipsservices/nmipssettings/inc/nmipssettingshelper.h Thu Oct 14 17:33:43 2010 +0300 @@ -38,7 +38,7 @@ class NmIpsSettingsManagerBase; class NmId; class CmApplSettingsUi; - +class NmIpsSettingsDeleteMailboxOp; // Constant for User Defined sync profile (EmailProfileOffsetUD) // \sa ipssettingkeys.h - Currently used sync profile @@ -117,14 +117,14 @@ void receivingWeekdaysModified(); void startTimeModified(QTime time); void endTimeModified(QTime time); - void handleMailboxDelete(HbAction *action); void handleMailboxDeleteUpdate(HbAction *action); void handleUserDefinedIncomingPortInput(HbAction *action); void handleUserDefinedFolderPathInput(HbAction *action); void handleUserDefinedOutgoingPortInput(HbAction *action); void handleConnectionSelected(uint status); void refreshPeriodModified(int index); - + void deleteOpComplete(int result, int error); + private: enum AppLibUpdateOperation @@ -165,6 +165,7 @@ bool mServerInfoDynamicItemsVisible; bool mAbortDynamicRSItemHandling; int mPrevInboxCount; + NmIpsSettingsDeleteMailboxOp *mDeleteOp; }; #endif // NMIPSSETTINGSHELPER_H diff -r 6c59112cfd31 -r 38bf5461e270 ipsservices/nmipssettings/nmipssettings.pro --- a/ipsservices/nmipssettings/nmipssettings.pro Thu Sep 30 11:43:07 2010 +0300 +++ b/ipsservices/nmipssettings/nmipssettings.pro Thu Oct 14 17:33:43 2010 +0300 @@ -49,7 +49,8 @@ inc/nmipssettingscustomitem.h \ inc/nmipssettingslabeledcombobox.h \ inc/nmipssettingstimeeditor.h \ - inc/nmipssettingsmultiselectionitem.h + inc/nmipssettingsmultiselectionitem.h \ + inc/nmipssettingsdeletemailboxop.h SOURCES += src/nmipssettingsplugin.cpp \ src/nmipssettingshelper.cpp \ @@ -61,7 +62,8 @@ src/nmipssettingscustomitem.cpp \ src/nmipssettingslabeledcombobox.cpp \ src/nmipssettingstimeeditor.cpp \ - src/nmipssettingsmultiselectionitem.cpp + src/nmipssettingsmultiselectionitem.cpp \ + src/nmipssettingsdeletemailboxop.cpp symbian: { TARGET.EPOCALLOWDLLDATA = 1 @@ -76,6 +78,7 @@ LIBS += -llibc LIBS += -lcmapplsettingsui LIBS += -lAlwaysOnlineManagerClient + LIBS += -lmsgs CONFIG += mobility MOBILITY += bearer serviceframework diff -r 6c59112cfd31 -r 38bf5461e270 ipsservices/nmipssettings/src/nmipssettingsdeletemailboxop.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ipsservices/nmipssettings/src/nmipssettingsdeletemailboxop.cpp Thu Oct 14 17:33:43 2010 +0300 @@ -0,0 +1,357 @@ +/* +* 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: +* +*/ +#include +#include + +#include +#include +#include +#include + +#include +#include +#include + +#include "nmipssettingsdeletemailboxop.h" +#include "nmipssettingsmanagerbase.h" + +/// CONSTANTS + +/// How many times the delete is attempted before giving up. +const int KDeleteRetryCount = 3; +/// How long will the operation wait (ms) for the disconnect event to arrive before timing out +const int KDisconnectTimeout = 2500; +/// How long will the operation wait (ms) before attempting the delete again if error happened. +const int KRetryDelay = 250; + + +/*! + \class CMailboxDisconnectWait + \brief Symbian helper class for mailbox delete operation. Used for listening disconnect events + from messaging server. + +*/ +class CMailboxDisconnectWait : public CBase, public MMsvSessionObserver +{ +public: + static CMailboxDisconnectWait* NewL( + NmIpsSettingsDeleteMailboxOp& aDeleteOp, const TMsvId& aMailboxId ); + ~CMailboxDisconnectWait(); + + TBool IsConnected(); + +public: // from MMsvSessionObserver + void HandleSessionEventL(TMsvSessionEvent aEvent, TAny* aArg1, TAny* aArg2, TAny* aArg3); + +private: + CMailboxDisconnectWait( NmIpsSettingsDeleteMailboxOp& aDeleteOp, const TMsvId& aMailboxId ); + +private: // data + /// Own. Messaging server session + CMsvSession* iMsvSession; + /// Mailbox ID that is observed + TMsvId iMailboxId; + /// Delete operation + NmIpsSettingsDeleteMailboxOp& iDeleteOp; +}; + +/*! + Constructor of CMailboxDisconnectWait. +*/ +CMailboxDisconnectWait* CMailboxDisconnectWait::NewL( + NmIpsSettingsDeleteMailboxOp& aDeleteOp, + const TMsvId& aMailboxId ) +{ + CMailboxDisconnectWait* self = new(ELeave) CMailboxDisconnectWait( aDeleteOp, aMailboxId ); + CleanupStack::PushL( self ); + self->iMsvSession = CMsvSession::OpenSyncL( *self ); + CleanupStack::Pop( self ); + return self; +} + +/*! + Constructor of CMailboxDisconnectWait. +*/ +CMailboxDisconnectWait::CMailboxDisconnectWait( + NmIpsSettingsDeleteMailboxOp& aDeleteOp, const TMsvId& aMailboxId ) : + iMailboxId( aMailboxId ), + iDeleteOp( aDeleteOp ) +{ +} + +/*! + Destructor of CMailboxDisconnectWait. +*/ +CMailboxDisconnectWait::~CMailboxDisconnectWait() +{ + delete iMsvSession; +} + +/*! + Check if observed mailbox is connected or not +*/ +TBool CMailboxDisconnectWait::IsConnected() +{ + TBool connected = EFalse; + TMsvEntry entry; + TMsvId id; + if( iMsvSession->GetEntry( iMailboxId, id, entry ) == KErrNone ) + { + connected = entry.Connected(); + } + return connected; +} + +/*! + Event handler of Messaging server events +*/ +void CMailboxDisconnectWait::HandleSessionEventL(TMsvSessionEvent aEvent, TAny* aArg1, TAny* aArg2, TAny* /*aArg3*/) +{ + // Entry changed event is received when online/offline state has changed + if( EMsvEntriesChanged == aEvent ) + { + // mailboxes are only on root level, so check the parent + TMsvId parent = *static_cast(aArg2); + if( parent == KMsvRootIndexEntryId ) + { + // find the mailbox we're observing + CMsvEntrySelection* selection = static_cast(aArg1); + TInt count = selection->Count(); + for( TInt i = 0; i < count; ++i ) + { + if( (*selection)[i] == iMailboxId ) + { + // if mailbox is not connected -> report to observer + TMsvEntry entry; + TMsvId id; + TInt err = iMsvSession->GetEntry( iMailboxId, id, entry ); + if( !err && !entry.Connected() ) + { + TInt err; // error code ignored + QT_TRYCATCH_ERROR( err, iDeleteOp.mailboxDisconnected() ); + Q_UNUSED(err); // remove compile warning + } + } + } + } + } +} + + +/*! + \class NmIpsSettingsDeleteMailboxOp + \brief Operation that handles the deletion of mailbox + +*/ + +// ======== MEMBER FUNCTIONS ======== + +/*! + Constructor of NmIpsSettingsDeleteMailboxOp. +*/ +NmIpsSettingsDeleteMailboxOp::NmIpsSettingsDeleteMailboxOp(NmIpsSettingsManagerBase &settingsManager) : + mDisconnectWait(NULL), + mSettingsManager(settingsManager), + mDeleteConfirmationDlg(NULL), + mDeleteProgressDlg(NULL), + mRetryCount(KDeleteRetryCount), + mError(0) +{ + connect( this, SIGNAL(stateChanged()), this, SLOT(processState()), Qt::QueuedConnection ); +} + +/*! + Destructor of NmIpsSettingsDeleteMailboxOp. +*/ +NmIpsSettingsDeleteMailboxOp::~NmIpsSettingsDeleteMailboxOp() +{ + delete mDeleteConfirmationDlg; + delete mDeleteProgressDlg; + delete mDisconnectWait; +} + +/*! + Starts the operation +*/ +void NmIpsSettingsDeleteMailboxOp::startOperation() +{ + // reset state + mRetryCount = KDeleteRetryCount; + mResult = DeleteMbResultSuccess; + mError = 0; + + delete mDisconnectWait; + mDisconnectWait = NULL; + TRAPD( err, mDisconnectWait = CMailboxDisconnectWait::NewL( + *this, mSettingsManager.mailboxId().id32() ) ); + + if(!err) { + changeState(StateConfirmation); + } else { + // failed + complete(DeleteMbResultFailure, err); + } +} + +/*! + Observer method to get notifications when the handled mailbox has disconnected +*/ +void NmIpsSettingsDeleteMailboxOp::mailboxDisconnected() +{ + if( mState == StateDisconnect ) + { + changeState(StateDelete); + } +} + +/*! + Notification method that is called when user has responded to confirmation query +*/ +void NmIpsSettingsDeleteMailboxOp::handleConfimationDlg(HbAction *action) +{ + if (action == mDeleteConfirmationDlg->actions().at(0)) { + changeState(StateDisconnect); + } else { + complete(DeleteMbResultCanceled, 0); + } +} + +/*! + Notification method that is called when timeout has occured while waiting for disconnect event +*/ +void NmIpsSettingsDeleteMailboxOp::handleDisconnectTimeout() +{ + if( mState == StateDisconnect ) + { + changeState(StateDelete); + } +} + +/*! + Operation's state machine. Handles states. +*/ +void NmIpsSettingsDeleteMailboxOp::processState() +{ + switch( mState ) { + case StateConfirmation: { + // Ask user whether to delete or not + if(!mDeleteConfirmationDlg) { + mDeleteConfirmationDlg = + new HbMessageBox(HbMessageBox::MessageTypeQuestion); + mDeleteConfirmationDlg->setText( + hbTrId("txt_mail_dialog_do_you_want_to_delete_the_mailbox")); + mDeleteConfirmationDlg->setTimeout(HbMessageBox::NoTimeout); + mDeleteConfirmationDlg->setStandardButtons(HbMessageBox::Yes | HbMessageBox::No); + } + mDeleteConfirmationDlg->open(this, SLOT(handleConfimationDlg(HbAction *))); + break; + } + + case StateDisconnect: { + // Disconnect mailbox + emit goOffline(mSettingsManager.mailboxId()); + + // Display the progress note during rest of the operation + if( !mDeleteProgressDlg ) { + mDeleteProgressDlg = new HbProgressDialog(HbProgressDialog::WaitDialog); + mDeleteProgressDlg->removeAction( mDeleteProgressDlg->actions().at(0)); + mDeleteProgressDlg->setText(hbTrId("txt_common_info_deleting")); + } + mDeleteProgressDlg->delayedShow(); + + if( mDisconnectWait->IsConnected() ) { + // connected -> wait for disconnect or timeout + QTimer::singleShot(KDisconnectTimeout, this, SLOT(handleDisconnectTimeout())); + } else { + // not connected -> delete mailbox immediately + changeState( StateDelete ); + } + break; + } + + case StateDelete: { + // delete mailbox + int error = mSettingsManager.deleteMailbox(); + if( !error ) { + changeState(StateUnregisterMailbox); + + } else if( mRetryCount-- ) { + // attempt again after small delay + QTimer::singleShot(KRetryDelay, this, SLOT(processState())); + + } else { + // enough failures. give up + complete(DeleteMbResultFailure, error); + } + break; + } + + case StateUnregisterMailbox: { + // Unregister mailbox from application library + QtMobility::QServiceManager manager; + QtMobility::QServiceFilter filter("com.nokia.symbian.IEmailRegisterAccount"); + QList interfaces = manager.findInterfaces(filter); + QObject *registerInterface = NULL; + if (!interfaces.isEmpty()) { + registerInterface = manager.loadInterface(interfaces.first()); + } + + if (registerInterface) { + quint64 mailboxId(mSettingsManager.mailboxId().id()); + // Try to remove the mailbox from the App Library. + (void)QMetaObject::invokeMethod(registerInterface, + "unregisterMailbox", Q_ARG(quint64, mailboxId)); + } + + // All done -> complete + complete(DeleteMbResultSuccess, 0); + break; + } + + case StateDone: // fall through + default: { + // Hide the progress note + if( mDeleteProgressDlg ) { + mDeleteProgressDlg->close(); + } + emit operationComplete(mResult, mError); + break; + } + } +} + +/*! + Changes the operation state +*/ +void NmIpsSettingsDeleteMailboxOp::changeState(DeleteOpStates nextState) +{ + mState = nextState; + emit stateChanged(); +} + +/*! + Completes the operation by setting the result values and changing the state to [done] +*/ +void NmIpsSettingsDeleteMailboxOp::complete(int result, int error) +{ + mError = error; + mResult = result; + mState = StateDone; + emit stateChanged(); +} + + diff -r 6c59112cfd31 -r 38bf5461e270 ipsservices/nmipssettings/src/nmipssettingshelper.cpp --- a/ipsservices/nmipssettings/src/nmipssettingshelper.cpp Thu Sep 30 11:43:07 2010 +0300 +++ b/ipsservices/nmipssettings/src/nmipssettingshelper.cpp Thu Oct 14 17:33:43 2010 +0300 @@ -44,6 +44,7 @@ #include "nmipssettingsmanagerbase.h" #include "nmipssettingscustomitem.h" #include "nmipsextendedsettingsmanager.h" +#include "nmipssettingsdeletemailboxop.h" // CONSTANTS @@ -100,7 +101,8 @@ mOutgoingPortInputValidator(NULL), mDestinationDialog(NULL), mServerInfoDynamicItemsVisible(false), - mAbortDynamicRSItemHandling(false) + mAbortDynamicRSItemHandling(false), + mDeleteOp(NULL) { QVariant inboxValue; mSettingsManager.readSetting(IpsServices::ReceptionInboxSyncWindow, inboxValue); @@ -113,6 +115,7 @@ NmIpsSettingsHelper::~NmIpsSettingsHelper() { mContentItems.clear(); + delete mDeleteOp; delete mDeleteConfirmationDialog; delete mIncomingPortInputDialog; delete mIncomingPortInputValidator; @@ -205,7 +208,7 @@ weekdayItemValues); formItemData->setContentWidgetData("heading", - hbTrId("txt_mailips_dialog_heading_receiving_weekdays")); + hbTrId("txt_mailips_dialog_heading_receiving_days")); formItemData->setContentWidgetData("items", weekdayItems); @@ -597,55 +600,14 @@ */ void NmIpsSettingsHelper::deleteButtonPress() { - if(!mDeleteConfirmationDialog) { - mDeleteConfirmationDialog = - new HbMessageBox(HbMessageBox::MessageTypeQuestion); - mDeleteConfirmationDialog->setText( - hbTrId("txt_mail_dialog_do_you_want_to_delete_the_mailbox")); - mDeleteConfirmationDialog->setTimeout(HbMessageBox::NoTimeout); - mDeleteConfirmationDialog->setStandardButtons(HbMessageBox::Yes | HbMessageBox::No); + if( !mDeleteOp ) { + mDeleteOp = new NmIpsSettingsDeleteMailboxOp( mSettingsManager ); + connect( mDeleteOp, SIGNAL(goOffline(const NmId &)), this, SIGNAL(goOffline(const NmId &))); + connect( mDeleteOp, SIGNAL(operationComplete(int,int)), + this, SLOT(deleteOpComplete(int,int))); + mDeleteOp->startOperation(); } - mDeleteConfirmationDialog->open(this, SLOT(handleMailboxDelete(HbAction *))); -} - -/*! - Deletes mailbox and displays the proper notes. -*/ -void NmIpsSettingsHelper::handleMailboxDelete(HbAction *action) -{ - if (action == mDeleteConfirmationDialog->actions().at(0)) { - emit goOffline(mSettingsManager.mailboxId()); - mEmitOnline = false; - - QVariant mailboxName; - mSettingsManager.readSetting(IpsServices::MailboxName, mailboxName); - - // Display the progress note. Before display the note, remove the cancel - // button. - HbProgressDialog progressNote(HbProgressDialog::WaitDialog); - progressNote.setText(hbTrId("txt_common_info_deleting")); - progressNote.removeAction(progressNote.actions().at(0)); - progressNote.delayedShow(); - - if (!mSettingsManager.deleteMailbox()) { - // The mailbox was deleted successfully. - - // Delete the mailbox also from AppLib. - updateAppLib(UnregisterMailbox); - - // Hide the progress note and display the "mailbox deleted" dialog. - progressNote.close(); - - HbNotificationDialog *note = new HbNotificationDialog(); - QString noteText = hbTrId("txt_mail_dialog_1_deleted").arg(mailboxName.toString()); - note->setTitle(noteText); - note->setAttribute(Qt::WA_DeleteOnClose); - note->open(this, SLOT(handleMailboxDeleteUpdate(HbAction *))); - } else { - // Failed to delete the mailbox! - progressNote.close(); - } - } + } /*! @@ -654,6 +616,10 @@ void NmIpsSettingsHelper::handleMailboxDeleteUpdate(HbAction *action) { Q_UNUSED(action); + + delete mDeleteOp; + mDeleteOp = NULL; + // Emit the signal to update the UI. emit mailboxListChanged(mSettingsManager.mailboxId(), NmSettings::MailboxDeleted); @@ -678,12 +644,12 @@ // Read receiving schedule item values and // make a decision based on those if item should be visible or not. mAbortDynamicRSItemHandling = false; - for (int index(0); (index < NmIpsSettingsReceivingScheduleItemCount) && - !mAbortDynamicRSItemHandling; ++index) { + for (int i(0); (i < NmIpsSettingsReceivingScheduleItemCount) && + !mAbortDynamicRSItemHandling; ++i) { // Read setting value from active profile QVariant setting; - IpsServices::SettingItem item(NmIpsSettingsReceivingScheduleItems[index]); + IpsServices::SettingItem item(NmIpsSettingsReceivingScheduleItems[i]); mSettingsManager.readSetting(item, setting); // If setting value is not valid (-1=N/A) then remove setting item. @@ -1541,3 +1507,26 @@ selectedValue); } } + +void NmIpsSettingsHelper::deleteOpComplete( int result, int error) +{ + Q_UNUSED(error); + if( result == DeleteMbResultSuccess ) { + // Show notification that mailbox has been deleted + QVariant mailboxName; + mSettingsManager.readSetting(IpsServices::MailboxName, mailboxName); + + HbNotificationDialog *note = new HbNotificationDialog(); + QString noteText = hbTrId("txt_mail_dialog_1_deleted").arg(mailboxName.toString()); + note->setTitle(noteText); + note->setAttribute(Qt::WA_DeleteOnClose); + note->open(this, SLOT(handleMailboxDeleteUpdate(HbAction *))); + } else { + // Add error note here to be shown if delete operation has failed + + // delete operation + delete mDeleteOp; + mDeleteOp = NULL; + } +} + diff -r 6c59112cfd31 -r 38bf5461e270 ipsservices/nmipssettings/src/nmipssettingsplugin.cpp --- a/ipsservices/nmipssettings/src/nmipssettingsplugin.cpp Thu Sep 30 11:43:07 2010 +0300 +++ b/ipsservices/nmipssettings/src/nmipssettingsplugin.cpp Thu Oct 14 17:33:43 2010 +0300 @@ -589,7 +589,7 @@ int folderPathItemIndex = mSettingsHelper->getCorrectFolderPathComboBoxIndex(); folderPathItem->setContentWidgetData(NmIpsSettingsCurrentIndex, folderPathItemIndex); - mForm->addConnection(folderPathItem, SIGNAL(itemSelected(int)), + mForm->addConnection(folderPathItem, SIGNAL(currentIndexChanged(int)), mSettingsHelper, SLOT(folderPathChange(int))); item.appendChild(folderPathItem); diff -r 6c59112cfd31 -r 38bf5461e270 ipsservices/nmpopclientplugin/inc/nmpopclientplugin.h --- a/ipsservices/nmpopclientplugin/inc/nmpopclientplugin.h Thu Sep 30 11:43:07 2010 +0300 +++ b/ipsservices/nmpopclientplugin/inc/nmpopclientplugin.h Thu Oct 14 17:33:43 2010 +0300 @@ -40,9 +40,10 @@ virtual ~NmPopClientPlugin(); void getActions( const NmActionRequest &request, QList &actionList); + void launchSettings(const NmId &mailboxId); private slots: - void settings(); + void settings(const NmId &mailboxId=0); void switchToStandardFolderInbox(); void switchToStandardFolderOutbox(); void switchToStandardFolderDrafts(); diff -r 6c59112cfd31 -r 38bf5461e270 ipsservices/nmpopclientplugin/src/nmpopclientplugin.cpp --- a/ipsservices/nmpopclientplugin/src/nmpopclientplugin.cpp Thu Sep 30 11:43:07 2010 +0300 +++ b/ipsservices/nmpopclientplugin/src/nmpopclientplugin.cpp Thu Oct 14 17:33:43 2010 +0300 @@ -151,15 +151,31 @@ } /*! + Public method to access from extensionmanager to launch settings. + Opens mailbox settings. + */ +void NmPopClientPlugin::launchSettings(const NmId &mailboxId) +{ + NMLOG("NmPopClientPlugin::launchSettings()-->"); + // Check if this request is for the POP protocol. + if (mailboxId.pluginId32() == this->pluginId()) { + settings(mailboxId); + } +} + +/*! Slot connected to options menu settings NmAction. Opens mailbox settings. */ -void NmPopClientPlugin::settings() +void NmPopClientPlugin::settings(const NmId &mailboxId) { NMLOG("NmPopClientPlugin::settings()-->"); - const NmId &id = mMenuRequest.mailboxId(); - NmMailboxMetaData *mailbox = mUiEngine->mailboxById(id); + NmId id = mMenuRequest.mailboxId(); + if (mailboxId.id()) { + id = mailboxId; + } + NmMailboxMetaData *mailbox = mUiEngine->mailboxById(id); if (mailbox) { if (!mSettingsViewLauncher) { @@ -181,7 +197,6 @@ SIGNAL(goOffline(const NmId &)), this, SLOT(goOffline(const NmId &))); } - handleRequest(NmActionResponseCommandSettings, mMenuRequest); mSettingsViewLauncher->launchSettingsView(id, mailbox->name()); } diff -r 6c59112cfd31 -r 38bf5461e270 package_definition.xml --- a/package_definition.xml Thu Sep 30 11:43:07 2010 +0300 +++ b/package_definition.xml Thu Oct 14 17:33:43 2010 +0300 @@ -50,7 +50,7 @@ - +