730 |
730 |
731 // special handling needed for year |
731 // special handling needed for year |
732 CCoeControl* coeControl = ControlOrNull( EMPXMetadataEditorDlgCtrlIdYear ); |
732 CCoeControl* coeControl = ControlOrNull( EMPXMetadataEditorDlgCtrlIdYear ); |
733 if ( coeControl ) |
733 if ( coeControl ) |
734 { |
734 { |
735 CEikNumberEditor* control = static_cast<CEikNumberEditor*>( coeControl ); |
735 CEikEdwin* control = static_cast<CEikEdwin*>( coeControl ); |
736 if ( control ) |
736 if ( control ) |
737 { |
737 { |
738 TInt num = control->Number(); |
738 TBuf<KMPXSongDetailsNumTextWidth> num; |
739 if ( num != iYear ) |
739 control->GetText( num ); |
|
740 TLex numLex( num ); |
|
741 TInt LexToInt; |
|
742 numLex.Val( LexToInt ); |
|
743 if ( LexToInt != iYear ) |
740 { |
744 { |
741 MPX_DEBUG3( "CMPXMetadataEditorDialog::SaveFormDataL year changed from %d to %d", iYear, num ); |
745 MPX_DEBUG3( "CMPXMetadataEditorDialog::SaveFormDataL year changed from %d to %d", iYear, num ); |
742 TDateTime newYear; |
746 TDateTime newYear; |
743 newYear.Set( num, EJanuary, 0, 0, 0, 0, 0 ); |
747 newYear.Set( LexToInt, EJanuary, 0, 0, 0, 0, 0 ); |
744 TTime year( newYear ); |
748 TTime year( newYear ); |
745 iMedia->SetTObjectValueL<TInt64>( |
749 iMedia->SetTObjectValueL<TInt64>( |
746 KMPXMediaMusicYear, year.Int64() ); |
750 KMPXMediaMusicYear, year.Int64() ); |
747 media->SetTObjectValueL<TInt64>( |
751 media->SetTObjectValueL<TInt64>( |
748 KMPXMediaMusicYear, year.Int64() ); |
752 KMPXMediaMusicYear, year.Int64() ); |
749 iYear = num; |
753 iYear = LexToInt; |
750 changed = ETrue; |
754 changed = ETrue; |
751 } |
755 } |
752 else |
756 else |
753 { |
757 { |
754 MPX_DEBUG1( "CMPXMetadataEditorDialog::SaveFormDataL year not changed" ); |
758 MPX_DEBUG1( "CMPXMetadataEditorDialog::SaveFormDataL year not changed" ); |
2661 // |
2630 // |
2662 void CMPXMetadataEditorDialog::SetControlNumberL( TInt aControlId, |
2631 void CMPXMetadataEditorDialog::SetControlNumberL( TInt aControlId, |
2663 const TDesC& aValue, TInt aMinValue, TInt aMaxValue ) |
2632 const TDesC& aValue, TInt aMinValue, TInt aMaxValue ) |
2664 { |
2633 { |
2665 MPX_FUNC( "CMPXMetadataEditorDialog::SetControlNumberL" ); |
2634 MPX_FUNC( "CMPXMetadataEditorDialog::SetControlNumberL" ); |
2666 CEikNumberEditor* myNumberEditor = static_cast< CEikNumberEditor* > |
2635 CEikEdwin* myEdwin = static_cast< CEikEdwin* > |
2667 ( ControlOrNull( aControlId ) ); |
2636 ( ControlOrNull( aControlId ) ); |
2668 |
2637 |
2669 TInt defaultValue( 0 ); |
2638 if ( myEdwin ) |
2670 if ( aMinValue > 0 ) |
|
2671 { |
|
2672 defaultValue = aMinValue; |
|
2673 } |
|
2674 |
|
2675 if ( myNumberEditor ) |
|
2676 { |
2639 { |
2677 if ( aValue.Length() > 0 ) |
2640 if ( aValue.Length() > 0 ) |
2678 { |
2641 { |
2679 TLex trackNumLex( aValue ); |
2642 TLex numLex( aValue ); |
2680 TInt LexToInt; |
2643 TInt LexToInt; |
2681 if ( trackNumLex.Val( LexToInt ) == KErrNone ) |
2644 if ( numLex.Val( LexToInt ) == KErrNone ) |
2682 { |
2645 { |
2683 if ( LexToInt > aMaxValue ) |
2646 if ( LexToInt > aMaxValue ) |
2684 { |
2647 { |
2685 LexToInt = aMaxValue; |
2648 LexToInt = aMaxValue; |
2686 } |
2649 } |
2687 if ( LexToInt < aMinValue ) |
2650 if ( LexToInt < aMinValue ) |
2688 { |
2651 { |
2689 LexToInt = aMinValue; |
2652 LexToInt = aMinValue; |
2690 } |
2653 } |
2691 myNumberEditor->SetNumber( LexToInt ); |
2654 TBuf<KMPXSongDetailsNumTextWidth> num; |
|
2655 num.AppendNum( LexToInt ); |
|
2656 myEdwin->SetTextL( &num ); |
2692 } |
2657 } |
2693 else |
|
2694 { |
|
2695 myNumberEditor->SetNumber( defaultValue ); |
|
2696 } |
|
2697 } |
|
2698 else |
|
2699 { |
|
2700 myNumberEditor->SetNumber( defaultValue ); |
|
2701 } |
2658 } |
2702 } |
2659 } |
2703 } |
2660 } |
2704 |
2661 |
2705 // ----------------------------------------------------------------------------- |
2662 // ----------------------------------------------------------------------------- |
3047 // CMPXMetadataEditorDialog::PopulatePodcastFileDetailsL |
2990 // CMPXMetadataEditorDialog::PopulatePodcastFileDetailsL |
3048 // ----------------------------------------------------------------------------- |
2991 // ----------------------------------------------------------------------------- |
3049 // |
2992 // |
3050 void CMPXMetadataEditorDialog::PopulatePodcastFileDetailsL() |
2993 void CMPXMetadataEditorDialog::PopulatePodcastFileDetailsL() |
3051 { |
2994 { |
3052 InsertLineL(13,R_MPX_CUI_LAST_PLAYBACK_POSITION,ActivePageId() ); |
2995 TInt lastPbPosition((TInt) iMedia->ValueTObjectL<TInt> ( |
3053 |
2996 KMPXMediaGeneralLastPlaybackPosition )); |
3054 TInt lastPbPosition((TInt) iMedia->ValueTObjectL<TInt> ( |
2997 if (lastPbPosition > 0) |
3055 KMPXMediaGeneralLastPlaybackPosition)); |
2998 { |
3056 |
2999 // convert milliseconds to seconds |
3057 if (lastPbPosition > 0) |
3000 lastPbPosition = lastPbPosition / KSecondInMilliseconds; |
3058 { |
3001 CMPXCommonUiHelper::TMPXDuratDisplayMode lastPbPositionMode = |
3059 // convert milliseconds to seconds |
3002 CMPXCommonUiHelper::EMPXDuratAuto; |
3060 lastPbPosition = lastPbPosition / KSecondInMilliseconds; |
3003 if (lastPbPosition > KOneHourInSeconds) |
3061 CMPXCommonUiHelper::TMPXDuratDisplayMode lastPbPositionMode = |
3004 { |
3062 CMPXCommonUiHelper::EMPXDuratAuto; |
3005 lastPbPositionMode = CMPXCommonUiHelper::EMPXDuratHMS; |
3063 if (lastPbPosition > KOneHourInSeconds) |
3006 } |
3064 { |
3007 HBufC* stringBuf = iCommonUiHelper->DisplayableDurationL( |
3065 lastPbPositionMode = CMPXCommonUiHelper::EMPXDuratHMS; |
3008 lastPbPosition, lastPbPositionMode); |
3066 } |
3009 CleanupStack::PushL(stringBuf); |
3067 HBufC* stringBuf = iCommonUiHelper->DisplayableDurationL( |
3010 SetControlTextL(EMPXMetadataEditorDlgCtrlIdLastPlayedPosition, |
3068 lastPbPosition, lastPbPositionMode); |
3011 *stringBuf, KNullDesC); |
3069 CleanupStack::PushL(stringBuf); |
3012 CleanupStack::PopAndDestroy(stringBuf); |
3070 SetControlTextL(EMPXMetadataEditorDlgCtrlIdLastPlayedPosition, |
3013 } |
3071 *stringBuf, KNullDesC); |
3014 else if (lastPbPosition == 0 && iMedia->IsSupported( |
3072 CleanupStack::PopAndDestroy(stringBuf); |
3015 KMPXMediaGeneralPlayCount) && iMedia->ValueTObjectL<TInt> ( |
3073 } |
3016 KMPXMediaGeneralPlayCount) > 0) |
3074 else if (lastPbPosition == 0 && iMedia->IsSupported( |
3017 { |
3075 KMPXMediaGeneralPlayCount) && iMedia->ValueTObjectL<TInt> ( |
3018 HBufC* stringBuf = StringLoader::LoadLC( |
3076 KMPXMediaGeneralPlayCount) > 0) |
3019 R_MPX_CUI_METADATAEDITOR_PLAYBACK_COMPLETE); |
3077 { |
3020 SetControlTextL(EMPXMetadataEditorDlgCtrlIdLastPlayedPosition, |
3078 HBufC* stringBuf = StringLoader::LoadLC( |
3021 *stringBuf, KNullDesC); |
3079 R_MPX_CUI_METADATAEDITOR_PLAYBACK_COMPLETE); |
3022 CleanupStack::PopAndDestroy(stringBuf); |
3080 SetControlTextL(EMPXMetadataEditorDlgCtrlIdLastPlayedPosition, |
3023 } |
3081 *stringBuf, KNullDesC); |
3024 else |
3082 CleanupStack::PopAndDestroy(stringBuf); |
3025 { |
3083 |
3026 SetControlTextL(EMPXMetadataEditorDlgCtrlIdLastPlayedPosition, |
3084 } |
3027 KNullDesC, KNullDesC); |
3085 else |
3028 } |
3086 { |
|
3087 SetControlTextL(EMPXMetadataEditorDlgCtrlIdLastPlayedPosition, |
|
3088 KNullDesC, KNullDesC); |
|
3089 } |
|
3090 |
3029 |
3091 InsertLineL(14,R_MPX_CUI_DETAILS_PUBLISHED,ActivePageId() ); |
3030 // Get published |
3092 |
3031 if (iMedia->IsSupported(TMPXAttribute(KMPXMediaIdPodcast, |
3093 // Get published |
3032 EMPXMediaPodcastPubDate))) |
3094 if (iMedia->IsSupported(TMPXAttribute(KMPXMediaIdPodcast, |
3033 { |
3095 EMPXMediaPodcastPubDate))) |
3034 TInt64 timeInt( |
3096 { |
3035 (TInt64) iMedia->ValueTObjectL<TInt64> (TMPXAttribute( |
3097 TInt64 timeInt( |
3036 KMPXMediaIdPodcast, EMPXMediaPodcastPubDate))); |
3098 (TInt64) iMedia->ValueTObjectL<TInt64> (TMPXAttribute( |
3037 TTime time(timeInt); |
3099 KMPXMediaIdPodcast, EMPXMediaPodcastPubDate))); |
3038 ConvertToLocalTimeL(time); |
3100 TTime time(timeInt); |
3039 HBufC* modDateTime = HBufC::NewLC(KMPXMaxTimeLength |
3101 ConvertToLocalTimeL(time); |
3040 + KMPXDurationDisplayResvLen); |
3102 HBufC* modDateTime = HBufC::NewLC(KMPXMaxTimeLength |
3041 HBufC* format = StringLoader::LoadLC(R_QTN_DATE_USUAL_WITH_ZERO); |
3103 + KMPXDurationDisplayResvLen); |
3042 TPtr modDatePtr = modDateTime->Des(); |
3104 HBufC* format = StringLoader::LoadLC(R_QTN_DATE_USUAL_WITH_ZERO); |
3043 MPX_TRAPD( err, time.FormatL( modDatePtr, *format ) ); |
3105 TPtr modDatePtr = modDateTime->Des(); |
3044 CleanupStack::PopAndDestroy(format); |
3106 MPX_TRAPD( err, time.FormatL( modDatePtr, *format ) ); |
3045 if (err != KErrNone || time == 0) |
3107 CleanupStack::PopAndDestroy(format); |
3046 { |
3108 if (err != KErrNone || time == 0) |
3047 SetControlTextL(EMPXMetadataEditorDlgCtrlIdLastPublished, |
3109 { |
3048 KNullDesC, KNullDesC); |
3110 SetControlTextL(EMPXMetadataEditorDlgCtrlIdLastPublished, |
3049 } |
3111 KNullDesC, KNullDesC); |
3050 else |
3112 } |
3051 { |
3113 else |
3052 format = StringLoader::LoadLC(R_QTN_TIME_USUAL_WITH_ZERO); |
3114 { |
3053 HBufC* modTime = HBufC::NewLC(format->Length() |
3115 format = StringLoader::LoadLC(R_QTN_TIME_USUAL_WITH_ZERO); |
3054 + KMPXDurationDisplayResvLen); |
3116 HBufC* modTime = HBufC::NewLC(format->Length() |
3055 TPtr modTimePtr = modTime->Des(); |
3117 + KMPXDurationDisplayResvLen); |
3056 MPX_TRAPD( err, time.FormatL( modTimePtr, *format ) ); |
3118 TPtr modTimePtr = modTime->Des(); |
3057 if (err != KErrNone) |
3119 MPX_TRAPD( err, time.FormatL( modTimePtr, *format ) ); |
3058 { |
3120 if (err != KErrNone) |
3059 SetControlTextL(EMPXMetadataEditorDlgCtrlIdLastPublished, |
3121 { |
3060 KNullDesC, KNullDesC); |
3122 SetControlTextL(EMPXMetadataEditorDlgCtrlIdLastPublished, |
3061 } |
3123 KNullDesC, KNullDesC); |
3062 else |
3124 } |
3063 { |
3125 else |
3064 modDatePtr.Append(KMPXSpace); |
3126 { |
3065 modDatePtr.Append(modTimePtr); |
3127 modDatePtr.Append(KMPXSpace); |
3066 SetControlTextL(EMPXMetadataEditorDlgCtrlIdLastPublished, |
3128 modDatePtr.Append(modTimePtr); |
3067 modTimePtr, KNullDesC); |
3129 SetControlTextL(EMPXMetadataEditorDlgCtrlIdLastPublished, |
3068 } |
3130 modTimePtr, KNullDesC); |
3069 CleanupStack::PopAndDestroy(modTime); |
3131 } |
3070 CleanupStack::PopAndDestroy(format); |
3132 CleanupStack::PopAndDestroy(modTime); |
3071 } |
3133 CleanupStack::PopAndDestroy(format); |
3072 CleanupStack::PopAndDestroy(modDateTime); |
3134 } |
3073 } |
3135 CleanupStack::PopAndDestroy(modDateTime); |
3074 else |
3136 } |
3075 { |
3137 else |
3076 SetControlTextL(EMPXMetadataEditorDlgCtrlIdLastPublished, |
3138 { |
3077 KNullDesC, KNullDesC); |
3139 SetControlTextL(EMPXMetadataEditorDlgCtrlIdLastPublished, |
3078 } |
3140 KNullDesC, KNullDesC); |
3079 } |
3141 } |
|
3142 } |
|
3143 |
3080 |
3144 // ----------------------------------------------------------------------------- |
3081 // ----------------------------------------------------------------------------- |
3145 // CMPXMetadataEditorDialog::LaunchDrmInfoL |
3082 // CMPXMetadataEditorDialog::LaunchDrmInfoL |
3146 // ----------------------------------------------------------------------------- |
3083 // ----------------------------------------------------------------------------- |
3147 // |
3084 // |