Ejemplo n.º 1
0
/*
-----------------------------------------------------------------------------
----------------------------------------------------------------------------
*/
void CSMSMonitor::CheckInboxL(void)
{	
	TInt smsCount(0),mmsCount(0);

	CMsvEntry* Entrie = iSession->GetEntryL(KMsvGlobalInBoxIndexEntryId);
	if(Entrie)
	{
		CleanupStack::PushL(Entrie);
		
		if(Entrie->Count())
		{
			TMsvSelectionOrdering MySortType;
			
			MySortType.SetSorting(EMsvSortByDate);
			
			Entrie->SetSortTypeL(MySortType);
			
			CMsvEntrySelection* entries = Entrie->ChildrenL();
			if(entries)
			{
				CleanupStack::PushL(entries);
		 
				for(TInt i = (entries->Count() - 1); i >= 0; i--)
				{
					if(Entrie->ChildDataL(entries->At(i)).Unread())
					{	
						if(Entrie->ChildDataL(entries->At(i)).iMtm == KUidMsgTypeSMS)
						{
							smsCount++;
						}
						else if(Entrie->ChildDataL(entries->At(i)).iMtm == KUidMsgTypeMultimedia)
						{
							mmsCount++;
						}
					}
				} 
			
				CleanupStack::PopAndDestroy(entries);
			}
		}
		
		CleanupStack::PopAndDestroy(1);//Entrie
	}
	
	if(iObserver){
		iObserver->InboxChangedL(smsCount,mmsCount);
	}
}
Ejemplo n.º 2
0
/*
-----------------------------------------------------------------------------
----------------------------------------------------------------------------
*/
void CMailBoxContainer::AddEmailFoldersL(CMsvSession* aSession)
{
	if(aSession)
	{	
		CMsvEntry *localServiceEntry = aSession->GetEntryL(KMsvRootIndexEntryId);//KMsvLocalServiceIndexEntryId);
		CleanupStack::PushL(localServiceEntry);
		CMsvEntrySelection *folders = localServiceEntry->ChildrenL();
		CleanupStack::PushL(folders);

		if(folders->Count() > 1) // first is local folder
		{
			for (TInt i = 1;i <  folders->Count();i++)
			{
				TMsvEntry ExtraFolder = localServiceEntry->ChildDataL((*folders)[i]);
				
				CMailFldItem* NewIttem = new(ELeave)CMailFldItem();
				CleanupStack::PushL(NewIttem);
					
				NewIttem->iTitle = ExtraFolder.iDetails.AllocL();
				NewIttem->iMscId = 	ExtraFolder.Id();
			
				CleanupStack::Pop();//NewIttem
				iFolderArray.Append(NewIttem);
			}
		}
		
		CleanupStack::PopAndDestroy(2); // localServiceEntry, folders
	}
}
Ejemplo n.º 3
0
/*
-----------------------------------------------------------------------------
----------------------------------------------------------------------------
*/
void CMailBoxContainer::GetFoldersL(void)
{
	iFolderArray.ResetAndDestroy();
	
	if(iSession)
	{	
		
		CMsvEntry *localServiceEntry = iSession->GetEntryL(KMsvLocalServiceIndexEntryId);
		CleanupStack::PushL(localServiceEntry);
		CMsvEntrySelection *folders = localServiceEntry->ChildrenWithTypeL(KUidMsvFolderEntry);
		CleanupStack::PushL(folders);

		for (TInt i = 0;i <  folders->Count();i++)
		{
			TMsvEntry ExtraFolder = localServiceEntry->ChildDataL((*folders)[i]);
			
			CMailFldItem* NewIttem = new(ELeave)CMailFldItem();
			CleanupStack::PushL(NewIttem);
			
			NewIttem->iTitle = ExtraFolder.iDetails.AllocL();
			NewIttem->iMscId = 	ExtraFolder.Id();

			CleanupStack::Pop();//NewIttem
			iFolderArray.Append(NewIttem);
		}
		
		CleanupStack::PopAndDestroy(2); // localServiceEntry, folders
	
	
		AddEmailFoldersL(iSession);
	}
}
// ---------------------------------------------------------
// GetOutboxEntries()
// Outgoing Pending message/messages
// ---------------------------------------------------------
TInt MsgStoreHandler::GetOutboxEntriesL(MsgInfo& aFailedIndicatorData,
    MsgInfo& aPendingIndicatorData)
{
    CMsvEntry* rootEntry = iMsvSession->GetEntryL(KMsvGlobalOutBoxIndexEntryId);
    CMsvEntrySelection* messages = rootEntry->ChildrenL();

    TInt failedMessageCount = 0;
    TInt pendingMessageCount = 0;

    for (TInt i = 0; i < messages->Count(); ++i) {
        TMsvEntry entry = rootEntry->ChildDataL(messages->At(i));
        if ((entry.iMtm != KSenduiMtmSmsUid) && (entry.iMtm != KSenduiMtmMmsUid)) {
            continue;
        }

        if (entry.SendingState() == KMsvSendStateFailed) {
            ++failedMessageCount;
        }
        else {
            ++pendingMessageCount;
        }

        if (entry.SendingState() == KMsvSendStateFailed) {
            ProcessIndicatorDataL(entry.Id(), aFailedIndicatorData);
        }
        else {
            ProcessIndicatorDataL(entry.Id(), aPendingIndicatorData);
        }
       
    }

    aFailedIndicatorData.mFromSingle = (failedMessageCount > 1) ? false : true;
    aPendingIndicatorData.mFromSingle = (pendingMessageCount > 1) ? false : true;
    aFailedIndicatorData.mIndicatorType = FailedIndicatorPlugin;
    aPendingIndicatorData.mIndicatorType = PendingIndicatorPlugin;
    aFailedIndicatorData.mMsgCount = failedMessageCount;
    aPendingIndicatorData.mMsgCount = pendingMessageCount;

    return KErrNone;
}
// ---------------------------------------------------------
// MsgStoreHandler::HandleSessionEventL()
// ---------------------------------------------------------
//
void MsgStoreHandler::HandleSessionEventL(TMsvSessionEvent aEvent, TAny* aArg1, TAny* aArg2, TAny* /*aArg3*/)
{
    CMsvEntrySelection* selection = NULL;
    TMsvId parent;

    //args
    if (aArg1 == NULL || aArg2 == NULL) {
        return;
    }

    //start, processing the event
    selection = (CMsvEntrySelection*) aArg1;
    parent = *(TMsvId*) aArg2;

    // Return when not (outbox or inbox) and  event not EMsvEntriesChanged
    if (!(parent == KMsvGlobalOutBoxIndexEntryIdValue || parent == KMsvGlobalInBoxIndexEntryIdValue)
        && aEvent != EMsvEntriesChanged) {
        return;
    }

    // check for incoming class 0 sms 
    if (parent == KMsvGlobalInBoxIndexEntryIdValue && aEvent == EMsvEntriesChanged) {
        CMsvEntry* inboxEntry = iMsvSession->GetEntryL(KMsvGlobalInBoxIndexEntryId);
        for (TInt i = 0; i < selection->Count(); ++i) {
            TMsvEntry entry = inboxEntry->ChildDataL(selection->At(i));
            if (KSenduiMtmSmsUidValue == entry.iMtm.iUid) {
                CMsvEntry* msgEntry = iMsvSession->GetEntryL(entry.Id());
                TMsvSmsEntry smsEntry = msgEntry->Entry();
                TSmsDataCodingScheme::TSmsClass classType(TSmsDataCodingScheme::ESmsClass0);

                if (smsEntry.Class(classType) && smsEntry.Unread()) 
                {
                    HandleClass0SmsL(msgEntry, smsEntry.Id());
                }
                else 
                {
                    delete msgEntry;
                    msgEntry = NULL;
                }
            }

        } // for (TInt i = 0; i < selection->Count(); ++i)
        delete inboxEntry;
    }
    //Handling for outbox entries
    else if (parent == KMsvGlobalOutBoxIndexEntryIdValue) {
        CMsvEntry* rootEntry = iMsvSession->GetEntryL(KMsvGlobalOutBoxIndexEntryId);

        for (TInt i = 0; i < selection->Count(); ++i) {
            TMsvEntry entry = rootEntry->ChildDataL(selection->At(i));

            if ((entry.iMtm == KSenduiMtmSmsUid) || (entry.iMtm == KSenduiMtmMmsUid)) {
                TUint sendingState = entry.SendingState();
                TInt index = iFailedMessages->Find(entry.Id());

                if (sendingState == KMsvSendStateFailed && KErrNotFound == index) {

                    iFailedMessages->AppendL(entry.Id());
                    MsgInfo aInfo;
                    ProcessIndicatorDataL(entry.Id(), aInfo);
                    iNotifier->displayFailedNote(aInfo);
                }
                else if (sendingState != KMsvSendStateFailed && KErrNotFound != index) {
                    iFailedMessages->Delete(index);
                    iFailedMessages->Compress();
                }

            }
        }//end for
    }
    else {
        TMsvEntry entry;
        TMsvId service;
        TInt error = KErrNone;
        for (TInt i = 0; i < selection->Count(); ++i) {
            error = iMsvSession->GetEntry(selection->At(i), service, entry);

            if (error == KErrNone && entry.iMtm == KUidMsgMMSNotification && 
                MmsNotificationStatus(entry) == EMsgStatusFailed) {

                TInt index = iFailedMessages->Find(entry.Id());

                if (KErrNotFound == index) {
                    iFailedMessages->AppendL(entry.Id());
                    MsgInfo aInfo;
                    //Fill aInfo with appropriate data
                    aInfo.mMessageType = ECsMmsNotification;
                    ProcessIndicatorDataL(entry.Id(), aInfo);
                    iNotifier->displayFailedNote(aInfo);

                }// end of if
            }
            else if (error == KErrNone && entry.iMtm == KUidMsgMMSNotification
                && MmsNotificationStatus(entry) == EMsgStatusRetrieving) {
                
                TInt index = iFailedMessages->Find(entry.Id());
                if (KErrNotFound != index) {
                    iFailedMessages->Delete(index);
                    iFailedMessages->Compress();
                }// end of KErrNotFound != index if block

            } // end of 2nd if  
        } // for loop
    }

}