×

Discussion Board

Results 1 to 2 of 2
  1. #1
    Registered User
    Join Date
    Apr 2007
    Location
    Manchester
    Posts
    8

    Commiting change on CMsvEntry using ChangeL leaves

    Hi,

    I want to iterate trough the inbox using filter for only SMS type of messages and mark every message with the certain address pattern as invisible and read one. The problem is with the call to CMsvEntry::ChangeL function (it leaves with error -46 which I think is KPermissionDenide). The function works fine on emulator but leaves happen only on device.

    Here is the part of the code, which makes the change:


    // Create new selection list
    iSelection = new (ELeave) CMsvEntrySelection();

    // Create the message filter
    CMsvEntryFilter* messageFilter = CMsvEntryFilter::NewLC();
    messageFilter->SetType( KUidMsvMessageEntry ); // message entry
    messageFilter->SetMtm( KUidMsgTypeSMS ); // we want only SMS messages
    // set order with no grouping, sort by date and show invisible
    messageFilter->SetOrder(TMsvSelectionOrdering(KMsvNoGrouping, EMsvSortByDate, ETrue));

    // Get all filtered messages from the Global Inbox
    iMsvSession->GetChildIdsL( KInbox, *messageFilter, *iSelection );
    // we do not need the filter any more
    CleanupStack::PopAndDestroy(messageFilter);

    RArray<TInt> noneCmdEntries;
    CleanupClosePushL(noneCmdEntries);

    TMsvId serviceID; // the ID of the service that owns the entry
    TMsvEntry entry; // the index of an entry
    for(TInt index = 0; index < iSelection->Count(); index++)
    {
    // Take the entry and the service that owns the entry from the given entry TMsvID
    iMsvSession->GetEntry((*iSelection)[index], serviceID, entry);

    // Check the entry address if its match the pattern
    if (entry.iDetails.FindF(KAddressPattern) != KErrNotFound)
    {
    delete iMsvEntry;
    iMsvEntry = NULL;

    // Get the entry
    // Taking an ownership of this CMsvEntry so we are responsible of deleting it
    iMsvEntry = iMsvSession->GetEntryL(entry.Id());

    // set message as read one
    entry.SetUnread(EFalse);
    // set message invisible flag to true
    entry.SetInPreparation(EFalse);
    entry.SetVisible(EFalse);
    // Sets the context's index entry to the current entry
    // Commit the changes
    iMsvEntry->ChangeL(entry);
    }
    else
    {
    // It is not an SMS we are looking for
    noneCmdEntries.AppendL(index);
    }
    } // for

    // CMsvEntry is relatively expensive in RAM usage.
    // They should therefore be created sparingly.
    // We do not need the entry any more so we can delete it.
    delete iMsvEntry;
    iMsvEntry = NULL;

    Does anyone know why ChangeL leaves with -46 and what I have to do to fix this?

  2. #2
    Nokia Developer Champion
    Join Date
    Mar 2006
    Location
    Helsinki, Finland
    Posts
    8,347

    Re: Commiting change on CMsvEntry using ChangeL leaves

    Please do no multipost:

    Crossposted and answered:
    http://discussion.forum.nokia.com/fo...d.php?t=141097

    Kiran.
    Nokia Developer Wiki Moderation team

Similar Threads

  1. Commiting change on CMsvEntry leaves
    By dejan_medic in forum Symbian Networking & Messaging (Closed)
    Replies: 4
    Last Post: 2008-08-11, 18:41
  2. Commiting change on CMsvEntry leaves
    By dejan_medic in forum Symbian Networking & Messaging (Closed)
    Replies: 1
    Last Post: 2008-08-09, 20:46
  3. [announce] Google Directions via PyS60
    By neil.young in forum Symbian
    Replies: 29
    Last Post: 2008-02-15, 10:55

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×