os/mm/mmlibs/mmfw/tsrc/mmvalidationsuite/mmvalidationsuiteapp/src/MVSEditMetaInfoDialog.cpp
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/mm/mmlibs/mmfw/tsrc/mmvalidationsuite/mmvalidationsuiteapp/src/MVSEditMetaInfoDialog.cpp Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,165 @@
1.4 +// Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
1.5 +// All rights reserved.
1.6 +// This component and the accompanying materials are made available
1.7 +// under the terms of "Eclipse Public License v1.0"
1.8 +// which accompanies this distribution, and is available
1.9 +// at the URL "http://www.eclipse.org/legal/epl-v10.html".
1.10 +//
1.11 +// Initial Contributors:
1.12 +// Nokia Corporation - initial contribution.
1.13 +//
1.14 +// Contributors:
1.15 +//
1.16 +// Description:
1.17 +// Part of the MVS Application for TechView
1.18 +//
1.19 +
1.20 +#include "MVSEditMetaInfoDialog.h"
1.21 +#include "MVSApp.hrh"
1.22 +#include <techview/eiklabel.h>
1.23 +#include "MVSConstants.h"
1.24 +
1.25 +void CMVSEditMetaInfoDialog::SetupDialogLD(RPointerArray<CMMFMetaDataEntry> aMetaArray,
1.26 + CMVSAppUi* aAppUi)
1.27 + {
1.28 + CMVSEditMetaInfoDialog* dialog = new (ELeave) CMVSEditMetaInfoDialog(aAppUi);
1.29 + CleanupStack::PushL(dialog);
1.30 + dialog->ConstructL(aMetaArray);
1.31 + CleanupStack::Pop(dialog);
1.32 + dialog->ExecuteLD(R_MVS_DIALOG_SETMETAINFO);
1.33 + }
1.34 +
1.35 +
1.36 +void CMVSEditMetaInfoDialog::ConstructL(RPointerArray<CMMFMetaDataEntry> aMetaArray)
1.37 + {
1.38 + iMetaArray.Reset();
1.39 + TInt noElements = aMetaArray.Count();
1.40 + for(TInt counter = 0; counter < noElements; counter++)
1.41 + {
1.42 + iMetaArray.Append(aMetaArray[counter]);
1.43 + }
1.44 + }
1.45 +
1.46 +
1.47 +CMVSEditMetaInfoDialog::CMVSEditMetaInfoDialog(CMVSAppUi* aAppUi)
1.48 +: iTitlePos(-1), iAuthorPos(-1), iCopyrightPos(-1), iRevisionPos(-1),\
1.49 +iCategoryPos(-1), iCommentsPos(-1), iAppUi(aAppUi)
1.50 + {
1.51 +
1.52 + }
1.53 +
1.54 +
1.55 +TBool CMVSEditMetaInfoDialog::OkToExitL(TInt aButtonId)
1.56 + {
1.57 + if(aButtonId == EMVSButtonCancel)
1.58 + {
1.59 + iMetaArray.Close();
1.60 + return ETrue;
1.61 + }
1.62 + //title
1.63 + CEikEdwin* myEdwin1 = static_cast<CEikEdwin*>(Control(EMVSMeta1));
1.64 +
1.65 + //author
1.66 + CEikEdwin* myEdwin2 = static_cast<CEikEdwin*>(Control(EMVSMeta2));
1.67 +
1.68 + //copyright
1.69 + CEikEdwin* myEdwin3 = static_cast<CEikEdwin*>(Control(EMVSMeta3));
1.70 +
1.71 + //revision
1.72 + CEikEdwin* myEdwin4 = static_cast<CEikEdwin*>(Control(EMVSMeta4));
1.73 +
1.74 + //category
1.75 + CEikEdwin* myEdwin5 = static_cast<CEikEdwin*>(Control(EMVSMeta5));
1.76 +
1.77 + //comments
1.78 + CEikEdwin* myEdwin6 = static_cast<CEikEdwin*>(Control(EMVSMeta6));
1.79 +
1.80 + TBuf<256> myBuf;
1.81 + CMMFMetaDataEntry* newMetaEntry = CMMFMetaDataEntry::NewL();
1.82 + if(iTitlePos != -1)
1.83 + {
1.84 + myEdwin1->GetText(myBuf);
1.85 + iMetaArray[iTitlePos]->SetValueL(myBuf);
1.86 + }
1.87 + else
1.88 + {
1.89 + newMetaEntry->SetNameL(KTitle);
1.90 + myEdwin1->GetText(myBuf);
1.91 + newMetaEntry->SetValueL(myBuf);
1.92 + iMetaArray.Append(newMetaEntry);
1.93 + }
1.94 + if(iAuthorPos != -1)
1.95 + {
1.96 + myEdwin2->GetText(myBuf);
1.97 + iMetaArray[iAuthorPos]->SetValueL(myBuf);
1.98 + }
1.99 + else
1.100 + {
1.101 + newMetaEntry->SetNameL(KAuthor);
1.102 + myEdwin1->GetText(myBuf);
1.103 + newMetaEntry->SetValueL(myBuf);
1.104 + iMetaArray.Append(newMetaEntry);
1.105 + }
1.106 + if(iCopyrightPos != -1)
1.107 + {
1.108 + myEdwin3->GetText(myBuf);
1.109 + iMetaArray[iCopyrightPos]->SetValueL(myBuf);
1.110 + }
1.111 + else
1.112 + {
1.113 + newMetaEntry->SetNameL(KCopyrt);
1.114 + myEdwin3->GetText(myBuf);
1.115 + newMetaEntry->SetValueL(myBuf);
1.116 + iMetaArray.Append(newMetaEntry);
1.117 + }
1.118 + if(iRevisionPos != -1)
1.119 + {
1.120 + myEdwin4->GetText(myBuf);
1.121 + iMetaArray[iRevisionPos]->SetValueL(myBuf);
1.122 + }
1.123 + else
1.124 + {
1.125 + newMetaEntry->SetNameL(KRevision);
1.126 + myEdwin4->GetText(myBuf);
1.127 + newMetaEntry->SetValueL(myBuf);
1.128 + iMetaArray.Append(newMetaEntry);
1.129 + }
1.130 + if(iCategoryPos != -1)
1.131 + {
1.132 + myEdwin5->GetText(myBuf);
1.133 + iMetaArray[iCategoryPos]->SetValueL(myBuf);
1.134 + }
1.135 + else
1.136 + {
1.137 + newMetaEntry->SetNameL(KCategory);
1.138 + myEdwin5->GetText(myBuf);
1.139 + newMetaEntry->SetValueL(myBuf);
1.140 + iMetaArray.Append(newMetaEntry);
1.141 + }
1.142 + if(iCommentsPos != -1)
1.143 + {
1.144 + myEdwin6->GetText(myBuf);
1.145 + iMetaArray[iCommentsPos]->SetValueL(myBuf);
1.146 + }
1.147 + else
1.148 + {
1.149 + newMetaEntry->SetNameL(KComments);
1.150 + myEdwin6->GetText(myBuf);
1.151 + newMetaEntry->SetValueL(myBuf);
1.152 + iMetaArray.Append(newMetaEntry);
1.153 + }
1.154 + TInt err;
1.155 + TInt count=iMetaArray.Count();
1.156 + TRAP(err,iAppUi->SetMetaDataL(iMetaArray));
1.157 + if(err==KErrNotSupported)
1.158 + {
1.159 + User::InfoPrint(KNotSupported);
1.160 + }
1.161 + delete newMetaEntry;
1.162 + return ETrue;
1.163 + }
1.164 +
1.165 +CMVSEditMetaInfoDialog::~CMVSEditMetaInfoDialog()
1.166 + {
1.167 + iMetaArray.Close();
1.168 + }