sl@0: // Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). sl@0: // All rights reserved. sl@0: // This component and the accompanying materials are made available sl@0: // under the terms of "Eclipse Public License v1.0" sl@0: // which accompanies this distribution, and is available sl@0: // at the URL "http://www.eclipse.org/legal/epl-v10.html". sl@0: // sl@0: // Initial Contributors: sl@0: // Nokia Corporation - initial contribution. sl@0: // sl@0: // Contributors: sl@0: // sl@0: // Description: sl@0: // Part of the MVS Application for TechView sl@0: // sl@0: sl@0: sl@0: #include "MVSViewMetaInfoDialog.h" sl@0: #include "MVSApp.hrh" sl@0: #include sl@0: #include "MVSAppUI.h" sl@0: #include "MVSConstants.h" sl@0: sl@0: sl@0: sl@0: void CMVSViewMetaInfoDialog::SetupDialogLD(RPointerArray aMetaArray, sl@0: CMVSAppUi* aAppUi) sl@0: { sl@0: CMVSViewMetaInfoDialog* dialog = new (ELeave) CMVSViewMetaInfoDialog(aAppUi); sl@0: CleanupStack::PushL(dialog); sl@0: dialog->ConstructL(aMetaArray); sl@0: CleanupStack::Pop(dialog); sl@0: dialog->ExecuteLD(R_MVS_DIALOG_SETMETAINFO); sl@0: } sl@0: sl@0: sl@0: void CMVSViewMetaInfoDialog::PreLayoutDynInitL() sl@0: { sl@0: CEikEdwin* myEdwin1 = static_cast(Control(EMVSMeta1)); sl@0: //author sl@0: if(myEdwin1) sl@0: { sl@0: myEdwin1->SetReadOnly(TRUE); sl@0: myEdwin1->SetBackgroundColorL(KRgbGray); sl@0: } sl@0: sl@0: CEikEdwin* myEdwin2 = static_cast(Control(EMVSMeta2)); sl@0: if(myEdwin2) sl@0: { sl@0: myEdwin2->SetReadOnly(TRUE); sl@0: myEdwin2->SetBackgroundColorL(KRgbGray); sl@0: } sl@0: sl@0: //copyright sl@0: CEikEdwin* myEdwin3 = static_cast(Control(EMVSMeta3)); sl@0: if(myEdwin3) sl@0: { sl@0: myEdwin3->SetReadOnly(TRUE); sl@0: myEdwin3->SetBackgroundColorL(KRgbGray); sl@0: } sl@0: sl@0: //revision sl@0: CEikEdwin* myEdwin4 = static_cast(Control(EMVSMeta4)); sl@0: if(myEdwin4) sl@0: { sl@0: myEdwin4->SetReadOnly(TRUE); sl@0: myEdwin4->SetBackgroundColorL(KRgbGray); sl@0: } sl@0: sl@0: //category sl@0: CEikEdwin* myEdwin5 = static_cast(Control(EMVSMeta5)); sl@0: if(myEdwin5) sl@0: { sl@0: myEdwin5->SetReadOnly(TRUE); sl@0: myEdwin5->SetBackgroundColorL(KRgbGray); sl@0: } sl@0: sl@0: //comments sl@0: CEikEdwin* myEdwin6 = static_cast(Control(EMVSMeta6)); sl@0: if(myEdwin6) sl@0: { sl@0: myEdwin6->SetReadOnly(TRUE); sl@0: myEdwin6->SetBackgroundColorL(KRgbGray); sl@0: } sl@0: sl@0: TRAPD(err,iAppUi->GetMetaDataL(iMetaArray)); sl@0: TInt metaArrayCount = iMetaArray.Count(); sl@0: if(err == KErrNone && metaArrayCount > 0) sl@0: { sl@0: for(TInt counter = 0; counter< iMetaArray.Count(); counter++) sl@0: { sl@0: TBufC<256> temp(iMetaArray[counter]->Name()); sl@0: TBufC<256> tempval(iMetaArray[counter]->Value()); sl@0: if((iMetaArray[counter]->Name()).CompareF(KTitle)==0) sl@0: { sl@0: myEdwin1->SetTextL(&(iMetaArray[counter]->Value())); sl@0: iTitlePos = counter; sl@0: } sl@0: if((iMetaArray[counter]->Name()).CompareF(KAuthor)==0) sl@0: { sl@0: myEdwin2->SetTextL(&(iMetaArray[counter]->Value())); sl@0: iAuthorPos = counter; sl@0: } sl@0: if((iMetaArray[counter]->Name()).CompareF(KCopyrt)==0) sl@0: { sl@0: myEdwin3->SetTextL(&(iMetaArray[counter]->Value())); sl@0: iCopyrightPos = counter; sl@0: } sl@0: if((iMetaArray[counter]->Name()).CompareF(KRevision)==0) sl@0: { sl@0: myEdwin4->SetTextL(&(iMetaArray[counter]->Value())); sl@0: iRevisionPos = counter; sl@0: } sl@0: if((iMetaArray[counter]->Name()).CompareF(KCategory)==0) sl@0: { sl@0: myEdwin5->SetTextL(&(iMetaArray[counter]->Value())); sl@0: iCategoryPos = counter; sl@0: } sl@0: if((iMetaArray[counter]->Name()).CompareF(KComments)==0) sl@0: { sl@0: myEdwin6->SetTextL(&(iMetaArray[counter]->Value())); sl@0: iCommentsPos = counter; sl@0: } sl@0: } sl@0: } sl@0: sl@0: sl@0: if(err == KErrNotSupported || metaArrayCount == 0) sl@0: { sl@0: User::InfoPrint(KNotSupported); sl@0: } sl@0: } sl@0: sl@0: sl@0: sl@0: sl@0: CMVSViewMetaInfoDialog::CMVSViewMetaInfoDialog(CMVSAppUi* aAppUi) sl@0: : iTitlePos(-1), iAuthorPos(-1), iCopyrightPos(-1), iRevisionPos(-1),\ sl@0: iCategoryPos(-1), iCommentsPos(-1), iAppUi(aAppUi) sl@0: { sl@0: sl@0: } sl@0: sl@0: sl@0: void CMVSViewMetaInfoDialog::ConstructL(RPointerArray aMetaArray) sl@0: { sl@0: iMetaArray.Reset(); sl@0: TInt noElements = aMetaArray.Count(); sl@0: for(TInt counter = 0; counter < noElements; counter++) sl@0: { sl@0: iMetaArray.Append(aMetaArray[counter]); sl@0: } sl@0: } sl@0: sl@0: TBool CMVSViewMetaInfoDialog::OkToExitL(TInt /*aButtonId*/) sl@0: { sl@0: //Delete the metadata entries populated in the array sl@0: iMetaArray.ResetAndDestroy(); sl@0: return ETrue; sl@0: }