10 * Nokia Corporation - initial contribution. |
10 * Nokia Corporation - initial contribution. |
11 * |
11 * |
12 * Contributors: |
12 * Contributors: |
13 * |
13 * |
14 * Description: Implementation of ccappdetailsview menuhandler |
14 * Description: Implementation of ccappdetailsview menuhandler |
15 * Version : %version: he1s60#31.1.16 % |
15 * Version : %version: be1neux1#31.1.17 % |
16 * |
16 * |
17 */ |
17 */ |
18 |
18 |
19 #include <AiwServiceHandler.h> |
19 #include <AiwServiceHandler.h> |
20 #include <AiwContactAssignDataTypes.h> |
20 #include <AiwContactAssignDataTypes.h> |
221 if ( aMenuPane->MenuItemExists( |
221 if ( aMenuPane->MenuItemExists( |
222 ECCAppDetailsViewFindOnMapCmd, pos ) |
222 ECCAppDetailsViewFindOnMapCmd, pos ) |
223 && aMenuPane->MenuItemExists( |
223 && aMenuPane->MenuItemExists( |
224 ECCAppDetailsViewShowOnMapCmd, pos ) ) |
224 ECCAppDetailsViewShowOnMapCmd, pos ) ) |
225 { |
225 { |
226 if ( iMapViewProvider && HasAddressFieldL() ) |
226 if ( iMapViewProvider && IsFocusedAddressFieldL()) |
227 { |
227 { |
228 if ( IsAddressValidatedL() ) |
228 if ( IsAddressValidatedL() ) |
229 { |
229 { |
230 aMenuPane->SetItemDimmed( |
230 aMenuPane->SetItemDimmed( |
231 ECCAppDetailsViewFindOnMapCmd, ETrue ); |
231 ECCAppDetailsViewFindOnMapCmd, ETrue ); |
840 iCommandHandler->HandleCommandL( |
840 iCommandHandler->HandleCommandL( |
841 EPbk2ExtensionShowOnMap, container, NULL); |
841 EPbk2ExtensionShowOnMap, container, NULL); |
842 } |
842 } |
843 |
843 |
844 // --------------------------------------------------------------------------- |
844 // --------------------------------------------------------------------------- |
845 // CCCAppDetailsViewMenuHandler::HasAddressFieldL |
845 // CCCAppDetailsViewMenuHandler::IsFocusedAddressFieldL |
846 // --------------------------------------------------------------------------- |
846 // --------------------------------------------------------------------------- |
847 // |
847 // |
848 TBool CCCAppDetailsViewMenuHandler::HasAddressFieldL() |
848 TBool CCCAppDetailsViewMenuHandler::IsFocusedAddressFieldL() |
849 { |
849 { |
850 TBool addressField = EFalse; |
850 TBool addressField = EFalse; |
851 |
851 |
852 const CCCAppDetailsViewContainer& container = |
852 const CCCAppDetailsViewContainer& container = |
853 static_cast<const CCCAppDetailsViewContainer&>( iPlugin.GetContainer() ); |
853 static_cast<const CCCAppDetailsViewContainer&>( iPlugin.GetContainer() ); |
854 TInt countFields = |
854 |
855 container.FocusedStoreContact()->Fields().FieldCount(); |
855 MVPbkBaseContactField* field = container.ListBoxModel().FocusedFieldLC(); |
856 for ( TInt i = 0; i < countFields; i++ ) |
856 const MVPbkFieldType* fieldType = field->BestMatchingFieldType(); |
857 { |
857 if ( fieldType ) |
858 const MVPbkStoreContactField& field = |
858 { |
859 container.FocusedStoreContact()->Fields().FieldAt( i ); |
859 TInt countProps = fieldType->VersitProperties().Count(); |
860 const MVPbkFieldType* fieldType = field.BestMatchingFieldType(); |
860 TArray<TVPbkFieldVersitProperty> props = |
861 if ( fieldType ) |
861 fieldType->VersitProperties(); |
862 { |
862 for (TInt ii = 0; ii < countProps; ii++ ) |
863 TInt countProps = fieldType->VersitProperties().Count(); |
863 { |
864 TArray<TVPbkFieldVersitProperty> props = |
864 if ( props[ii].Name() == EVPbkVersitNameADR ) |
865 fieldType->VersitProperties(); |
865 { |
866 for (TInt ii = 0; ii < countProps; ii++ ) |
866 addressField = ETrue; |
867 { |
867 break; |
868 if ( props[ii].Name() == EVPbkVersitNameADR ) |
868 } |
869 { |
869 } |
870 addressField = ETrue; |
870 } |
871 break; |
871 CleanupStack::PopAndDestroy(field); |
872 } |
|
873 } |
|
874 } |
|
875 } |
|
876 return addressField; |
872 return addressField; |
877 } |
873 } |
878 |
874 |
879 // --------------------------------------------------------------------------- |
875 // --------------------------------------------------------------------------- |
880 // CCCAppDetailsViewMenuHandler::IsAddressValidatedL |
876 // CCCAppDetailsViewMenuHandler::IsAddressValidatedL |