os/mm/mmlibs/mmfw/tsrc/mmvalidationsuite/mmvalidationsuiteapp/src/MVSEditMetaInfoDialog.cpp
Update contrib.
1 // Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
2 // All rights reserved.
3 // This component and the accompanying materials are made available
4 // under the terms of "Eclipse Public License v1.0"
5 // which accompanies this distribution, and is available
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
14 // Part of the MVS Application for TechView
17 #include "MVSEditMetaInfoDialog.h"
19 #include <techview/eiklabel.h>
20 #include "MVSConstants.h"
22 void CMVSEditMetaInfoDialog::SetupDialogLD(RPointerArray<CMMFMetaDataEntry> aMetaArray,
25 CMVSEditMetaInfoDialog* dialog = new (ELeave) CMVSEditMetaInfoDialog(aAppUi);
26 CleanupStack::PushL(dialog);
27 dialog->ConstructL(aMetaArray);
28 CleanupStack::Pop(dialog);
29 dialog->ExecuteLD(R_MVS_DIALOG_SETMETAINFO);
33 void CMVSEditMetaInfoDialog::ConstructL(RPointerArray<CMMFMetaDataEntry> aMetaArray)
36 TInt noElements = aMetaArray.Count();
37 for(TInt counter = 0; counter < noElements; counter++)
39 iMetaArray.Append(aMetaArray[counter]);
44 CMVSEditMetaInfoDialog::CMVSEditMetaInfoDialog(CMVSAppUi* aAppUi)
45 : iTitlePos(-1), iAuthorPos(-1), iCopyrightPos(-1), iRevisionPos(-1),\
46 iCategoryPos(-1), iCommentsPos(-1), iAppUi(aAppUi)
52 TBool CMVSEditMetaInfoDialog::OkToExitL(TInt aButtonId)
54 if(aButtonId == EMVSButtonCancel)
60 CEikEdwin* myEdwin1 = static_cast<CEikEdwin*>(Control(EMVSMeta1));
63 CEikEdwin* myEdwin2 = static_cast<CEikEdwin*>(Control(EMVSMeta2));
66 CEikEdwin* myEdwin3 = static_cast<CEikEdwin*>(Control(EMVSMeta3));
69 CEikEdwin* myEdwin4 = static_cast<CEikEdwin*>(Control(EMVSMeta4));
72 CEikEdwin* myEdwin5 = static_cast<CEikEdwin*>(Control(EMVSMeta5));
75 CEikEdwin* myEdwin6 = static_cast<CEikEdwin*>(Control(EMVSMeta6));
78 CMMFMetaDataEntry* newMetaEntry = CMMFMetaDataEntry::NewL();
81 myEdwin1->GetText(myBuf);
82 iMetaArray[iTitlePos]->SetValueL(myBuf);
86 newMetaEntry->SetNameL(KTitle);
87 myEdwin1->GetText(myBuf);
88 newMetaEntry->SetValueL(myBuf);
89 iMetaArray.Append(newMetaEntry);
93 myEdwin2->GetText(myBuf);
94 iMetaArray[iAuthorPos]->SetValueL(myBuf);
98 newMetaEntry->SetNameL(KAuthor);
99 myEdwin1->GetText(myBuf);
100 newMetaEntry->SetValueL(myBuf);
101 iMetaArray.Append(newMetaEntry);
103 if(iCopyrightPos != -1)
105 myEdwin3->GetText(myBuf);
106 iMetaArray[iCopyrightPos]->SetValueL(myBuf);
110 newMetaEntry->SetNameL(KCopyrt);
111 myEdwin3->GetText(myBuf);
112 newMetaEntry->SetValueL(myBuf);
113 iMetaArray.Append(newMetaEntry);
115 if(iRevisionPos != -1)
117 myEdwin4->GetText(myBuf);
118 iMetaArray[iRevisionPos]->SetValueL(myBuf);
122 newMetaEntry->SetNameL(KRevision);
123 myEdwin4->GetText(myBuf);
124 newMetaEntry->SetValueL(myBuf);
125 iMetaArray.Append(newMetaEntry);
127 if(iCategoryPos != -1)
129 myEdwin5->GetText(myBuf);
130 iMetaArray[iCategoryPos]->SetValueL(myBuf);
134 newMetaEntry->SetNameL(KCategory);
135 myEdwin5->GetText(myBuf);
136 newMetaEntry->SetValueL(myBuf);
137 iMetaArray.Append(newMetaEntry);
139 if(iCommentsPos != -1)
141 myEdwin6->GetText(myBuf);
142 iMetaArray[iCommentsPos]->SetValueL(myBuf);
146 newMetaEntry->SetNameL(KComments);
147 myEdwin6->GetText(myBuf);
148 newMetaEntry->SetValueL(myBuf);
149 iMetaArray.Append(newMetaEntry);
152 TInt count=iMetaArray.Count();
153 TRAP(err,iAppUi->SetMetaDataL(iMetaArray));
154 if(err==KErrNotSupported)
156 User::InfoPrint(KNotSupported);
162 CMVSEditMetaInfoDialog::~CMVSEditMetaInfoDialog()