equal
deleted
inserted
replaced
118 { |
118 { |
119 iMimeMappings.Insert(KMTPExtensionMimeTypeMappings[i].iExtension, KMTPExtensionMimeTypeMappings[i].iMimeType); |
119 iMimeMappings.Insert(KMTPExtensionMimeTypeMappings[i].iExtension, KMTPExtensionMimeTypeMappings[i].iMimeType); |
120 } |
120 } |
121 |
121 |
122 //Define RProperty of new pictures for status data provider |
122 //Define RProperty of new pictures for status data provider |
|
123 RProcess process; |
|
124 TUid tSid = process.SecureId(); |
123 _LIT_SECURITY_POLICY_PASS(KAllowReadAll); |
125 _LIT_SECURITY_POLICY_PASS(KAllowReadAll); |
124 TInt error = RProperty::Define(TUid::Uid(KMTPServerUID), KMTPNewPicKey, RProperty::EInt, KAllowReadAll, KAllowReadAll); |
126 TInt error = RProperty::Define(tSid, KMTPNewPicKey, RProperty::EInt, KAllowReadAll, KAllowReadAll); |
125 if (error != KErrNone && error != KErrAlreadyExists) |
127 if (error != KErrNone && error != KErrAlreadyExists) |
126 { |
128 { |
127 __FLOG_1(_L8("CMTPImageDataProvider::ConstructL - RProperty define error:%d"), error); |
129 __FLOG_1(_L8("CMTPImageDataProvider::ConstructL - RProperty define error:%d"), error); |
128 User::LeaveIfError(error); |
130 User::LeaveIfError(error); |
129 } |
131 } |
163 iMimeMappings.Close(); |
165 iMimeMappings.Close(); |
164 |
166 |
165 //Try to delete objects in array |
167 //Try to delete objects in array |
166 HandleDeleteObjectsArray(); |
168 HandleDeleteObjectsArray(); |
167 iDeleteObjectsArray.ResetAndDestroy(); |
169 iDeleteObjectsArray.ResetAndDestroy(); |
|
170 iNewPicHandles.Reset(); |
168 |
171 |
169 __FLOG(_L8("<< ~CMTPImageDataProvider")); |
172 __FLOG(_L8("<< ~CMTPImageDataProvider")); |
170 __FLOG_CLOSE; |
173 __FLOG_CLOSE; |
171 } |
174 } |
172 |
175 |
608 if (iEnumerated) |
611 if (iEnumerated) |
609 { |
612 { |
610 /** |
613 /** |
611 * Get image object count from framework and calculate the new pictures |
614 * Get image object count from framework and calculate the new pictures |
612 */ |
615 */ |
613 TUint newPictures = QueryImageObjectCountL(); |
616 TUint newPictures = QueryImageObjectCountL(); |
614 RProperty::Set(TUid::Uid(KMTPServerUID), KMTPNewPicKey, newPictures); |
|
615 iNewPicNotifier->SetNewPictures(newPictures); |
617 iNewPicNotifier->SetNewPictures(newPictures); |
616 __FLOG_1(_L16("CMTPImageDpEnumerator::CompleteEnumeration - New Pics: %d"), newPictures); |
618 __FLOG_1(_L16("CMTPImageDpEnumerator::CompleteEnumeration - New Pics: %d"), newPictures); |
617 iEnumerated = EFalse; |
619 iEnumerated = EFalse; |
618 } |
620 } |
619 |
621 |
691 RArray<TUint> handles; |
693 RArray<TUint> handles; |
692 TMTPObjectMgrQueryParams params(KMTPStorageAll, KMTPFormatsAll, KMTPHandleNone, Framework().DataProviderId()); |
694 TMTPObjectMgrQueryParams params(KMTPStorageAll, KMTPFormatsAll, KMTPHandleNone, Framework().DataProviderId()); |
693 CleanupClosePushL(context); |
695 CleanupClosePushL(context); |
694 CleanupClosePushL(handles); |
696 CleanupClosePushL(handles); |
695 |
697 |
|
698 iNewPicHandles.Reset(); |
|
699 |
696 do |
700 do |
697 { |
701 { |
698 /* |
702 /* |
699 * Speed up query performance, avoid to duplicated copy object handle between RArrays |
703 * Speed up query performance, avoid to duplicated copy object handle between RArrays |
700 */ |
704 */ |
710 { |
714 { |
711 Framework().ObjectMgr().ObjectL(handles[i], *objMetadata); |
715 Framework().ObjectMgr().ObjectL(handles[i], *objMetadata); |
712 if (MTPImageDpUtilits::IsNewPicture(*objMetadata)) |
716 if (MTPImageDpUtilits::IsNewPicture(*objMetadata)) |
713 { |
717 { |
714 ++newPictures; |
718 ++newPictures; |
|
719 iNewPicHandles.Append(handles[i]); |
715 } |
720 } |
716 } |
721 } |
717 |
722 |
718 |
723 |
719 CleanupStack::PopAndDestroy(objMetadata); |
724 CleanupStack::PopAndDestroy(objMetadata); |
763 iNewPicNotifier->DecreaseCount(aCount); |
768 iNewPicNotifier->DecreaseCount(aCount); |
764 |
769 |
765 __FLOG(_L8("<< DecreaseNewPictures ")); |
770 __FLOG(_L8("<< DecreaseNewPictures ")); |
766 } |
771 } |
767 |
772 |
|
773 void CMTPImageDataProvider::ResetNewPictures() |
|
774 { |
|
775 __FLOG(_L8(">> ResetNewPictures ")); |
|
776 |
|
777 iNewPicNotifier->SetNewPictures(0); |
|
778 |
|
779 TInt count = iNewPicHandles.Count(); |
|
780 if (!count) |
|
781 { |
|
782 return; |
|
783 } |
|
784 |
|
785 CMTPObjectMetaData* objMetadata = CMTPObjectMetaData::NewLC(); |
|
786 |
|
787 for (TInt i(0); i<count; ++i) |
|
788 { |
|
789 Framework().ObjectMgr().ObjectL(iNewPicHandles[i], *objMetadata); |
|
790 MTPImageDpUtilits::UpdateObjectStatusToOldL(Framework(), *objMetadata); |
|
791 } |
|
792 |
|
793 iNewPicHandles.Reset(); |
|
794 CleanupStack::PopAndDestroy(objMetadata); |
|
795 |
|
796 __FLOG(_L8("<< ResetNewPictures ")); |
|
797 } |
|
798 |
768 void CMTPImageDataProvider::HandleMdeSessionCompleteL(TInt aError) |
799 void CMTPImageDataProvider::HandleMdeSessionCompleteL(TInt aError) |
769 { |
800 { |
770 __FLOG(_L8(">> HandleMdeSessionComplete")); |
801 __FLOG(_L8(">> HandleMdeSessionComplete")); |
771 |
802 |
772 NotifyEnumerationCompleteL(KMTPStorageAll, KErrNone); |
803 NotifyEnumerationCompleteL(KMTPStorageAll, KErrNone); |