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: #include "MVSEditMetaInfoDialog.h" sl@0: #include "MVSApp.hrh" sl@0: #include sl@0: #include "MVSConstants.h" sl@0: sl@0: void CMVSEditMetaInfoDialog::SetupDialogLD(RPointerArray aMetaArray, sl@0: CMVSAppUi* aAppUi) sl@0: { sl@0: CMVSEditMetaInfoDialog* dialog = new (ELeave) CMVSEditMetaInfoDialog(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 CMVSEditMetaInfoDialog::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: sl@0: CMVSEditMetaInfoDialog::CMVSEditMetaInfoDialog(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: TBool CMVSEditMetaInfoDialog::OkToExitL(TInt aButtonId) sl@0: { sl@0: if(aButtonId == EMVSButtonCancel) sl@0: { sl@0: iMetaArray.Close(); sl@0: return ETrue; sl@0: } sl@0: //title sl@0: CEikEdwin* myEdwin1 = static_cast(Control(EMVSMeta1)); sl@0: sl@0: //author sl@0: CEikEdwin* myEdwin2 = static_cast(Control(EMVSMeta2)); sl@0: sl@0: //copyright sl@0: CEikEdwin* myEdwin3 = static_cast(Control(EMVSMeta3)); sl@0: sl@0: //revision sl@0: CEikEdwin* myEdwin4 = static_cast(Control(EMVSMeta4)); sl@0: sl@0: //category sl@0: CEikEdwin* myEdwin5 = static_cast(Control(EMVSMeta5)); sl@0: sl@0: //comments sl@0: CEikEdwin* myEdwin6 = static_cast(Control(EMVSMeta6)); sl@0: sl@0: TBuf<256> myBuf; sl@0: CMMFMetaDataEntry* newMetaEntry = CMMFMetaDataEntry::NewL(); sl@0: if(iTitlePos != -1) sl@0: { sl@0: myEdwin1->GetText(myBuf); sl@0: iMetaArray[iTitlePos]->SetValueL(myBuf); sl@0: } sl@0: else sl@0: { sl@0: newMetaEntry->SetNameL(KTitle); sl@0: myEdwin1->GetText(myBuf); sl@0: newMetaEntry->SetValueL(myBuf); sl@0: iMetaArray.Append(newMetaEntry); sl@0: } sl@0: if(iAuthorPos != -1) sl@0: { sl@0: myEdwin2->GetText(myBuf); sl@0: iMetaArray[iAuthorPos]->SetValueL(myBuf); sl@0: } sl@0: else sl@0: { sl@0: newMetaEntry->SetNameL(KAuthor); sl@0: myEdwin1->GetText(myBuf); sl@0: newMetaEntry->SetValueL(myBuf); sl@0: iMetaArray.Append(newMetaEntry); sl@0: } sl@0: if(iCopyrightPos != -1) sl@0: { sl@0: myEdwin3->GetText(myBuf); sl@0: iMetaArray[iCopyrightPos]->SetValueL(myBuf); sl@0: } sl@0: else sl@0: { sl@0: newMetaEntry->SetNameL(KCopyrt); sl@0: myEdwin3->GetText(myBuf); sl@0: newMetaEntry->SetValueL(myBuf); sl@0: iMetaArray.Append(newMetaEntry); sl@0: } sl@0: if(iRevisionPos != -1) sl@0: { sl@0: myEdwin4->GetText(myBuf); sl@0: iMetaArray[iRevisionPos]->SetValueL(myBuf); sl@0: } sl@0: else sl@0: { sl@0: newMetaEntry->SetNameL(KRevision); sl@0: myEdwin4->GetText(myBuf); sl@0: newMetaEntry->SetValueL(myBuf); sl@0: iMetaArray.Append(newMetaEntry); sl@0: } sl@0: if(iCategoryPos != -1) sl@0: { sl@0: myEdwin5->GetText(myBuf); sl@0: iMetaArray[iCategoryPos]->SetValueL(myBuf); sl@0: } sl@0: else sl@0: { sl@0: newMetaEntry->SetNameL(KCategory); sl@0: myEdwin5->GetText(myBuf); sl@0: newMetaEntry->SetValueL(myBuf); sl@0: iMetaArray.Append(newMetaEntry); sl@0: } sl@0: if(iCommentsPos != -1) sl@0: { sl@0: myEdwin6->GetText(myBuf); sl@0: iMetaArray[iCommentsPos]->SetValueL(myBuf); sl@0: } sl@0: else sl@0: { sl@0: newMetaEntry->SetNameL(KComments); sl@0: myEdwin6->GetText(myBuf); sl@0: newMetaEntry->SetValueL(myBuf); sl@0: iMetaArray.Append(newMetaEntry); sl@0: } sl@0: TInt err; sl@0: TInt count=iMetaArray.Count(); sl@0: TRAP(err,iAppUi->SetMetaDataL(iMetaArray)); sl@0: if(err==KErrNotSupported) sl@0: { sl@0: User::InfoPrint(KNotSupported); sl@0: } sl@0: delete newMetaEntry; sl@0: return ETrue; sl@0: } sl@0: sl@0: CMVSEditMetaInfoDialog::~CMVSEditMetaInfoDialog() sl@0: { sl@0: iMetaArray.Close(); sl@0: }