os/mm/mmlibs/mmfw/tsrc/mmvalidationsuite/mmvalidationsuiteapp/src/MVSEditMetaInfoDialog.cpp
author sl@SLION-WIN7.fritz.box
Fri, 15 Jun 2012 03:10:57 +0200
changeset 0 bde4ae8d615e
permissions -rw-r--r--
First public contribution.
sl@0
     1
// Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
sl@0
     2
// All rights reserved.
sl@0
     3
// This component and the accompanying materials are made available
sl@0
     4
// under the terms of "Eclipse Public License v1.0"
sl@0
     5
// which accompanies this distribution, and is available
sl@0
     6
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
sl@0
     7
//
sl@0
     8
// Initial Contributors:
sl@0
     9
// Nokia Corporation - initial contribution.
sl@0
    10
//
sl@0
    11
// Contributors:
sl@0
    12
//
sl@0
    13
// Description:
sl@0
    14
// Part of the MVS Application for TechView
sl@0
    15
//
sl@0
    16
sl@0
    17
#include "MVSEditMetaInfoDialog.h"
sl@0
    18
#include "MVSApp.hrh"
sl@0
    19
#include <techview/eiklabel.h>
sl@0
    20
#include "MVSConstants.h"
sl@0
    21
sl@0
    22
void CMVSEditMetaInfoDialog::SetupDialogLD(RPointerArray<CMMFMetaDataEntry> aMetaArray,
sl@0
    23
                                        CMVSAppUi* aAppUi)
sl@0
    24
	{
sl@0
    25
    CMVSEditMetaInfoDialog* dialog = new (ELeave) CMVSEditMetaInfoDialog(aAppUi);
sl@0
    26
    CleanupStack::PushL(dialog); 
sl@0
    27
    dialog->ConstructL(aMetaArray);
sl@0
    28
    CleanupStack::Pop(dialog);
sl@0
    29
    dialog->ExecuteLD(R_MVS_DIALOG_SETMETAINFO);
sl@0
    30
    }
sl@0
    31
sl@0
    32
sl@0
    33
void CMVSEditMetaInfoDialog::ConstructL(RPointerArray<CMMFMetaDataEntry> aMetaArray)
sl@0
    34
    {
sl@0
    35
    iMetaArray.Reset();
sl@0
    36
    TInt noElements = aMetaArray.Count();
sl@0
    37
    for(TInt counter = 0; counter < noElements; counter++)
sl@0
    38
    	{
sl@0
    39
        iMetaArray.Append(aMetaArray[counter]);
sl@0
    40
        }
sl@0
    41
    }
sl@0
    42
sl@0
    43
sl@0
    44
CMVSEditMetaInfoDialog::CMVSEditMetaInfoDialog(CMVSAppUi* aAppUi)
sl@0
    45
: iTitlePos(-1), iAuthorPos(-1), iCopyrightPos(-1), iRevisionPos(-1),\
sl@0
    46
iCategoryPos(-1), iCommentsPos(-1), iAppUi(aAppUi)
sl@0
    47
    {
sl@0
    48
     
sl@0
    49
    }
sl@0
    50
sl@0
    51
sl@0
    52
TBool CMVSEditMetaInfoDialog::OkToExitL(TInt aButtonId)
sl@0
    53
    {
sl@0
    54
    if(aButtonId == EMVSButtonCancel)
sl@0
    55
    	{
sl@0
    56
       	iMetaArray.Close();
sl@0
    57
       	return ETrue;
sl@0
    58
       	}
sl@0
    59
    //title
sl@0
    60
    CEikEdwin* myEdwin1 = static_cast<CEikEdwin*>(Control(EMVSMeta1));
sl@0
    61
     
sl@0
    62
    //author
sl@0
    63
    CEikEdwin* myEdwin2 = static_cast<CEikEdwin*>(Control(EMVSMeta2));
sl@0
    64
     
sl@0
    65
    //copyright
sl@0
    66
    CEikEdwin* myEdwin3 = static_cast<CEikEdwin*>(Control(EMVSMeta3));
sl@0
    67
     
sl@0
    68
    //revision
sl@0
    69
    CEikEdwin* myEdwin4 = static_cast<CEikEdwin*>(Control(EMVSMeta4));
sl@0
    70
     
sl@0
    71
    //category
sl@0
    72
    CEikEdwin* myEdwin5 = static_cast<CEikEdwin*>(Control(EMVSMeta5));
sl@0
    73
     
sl@0
    74
    //comments
sl@0
    75
    CEikEdwin* myEdwin6 = static_cast<CEikEdwin*>(Control(EMVSMeta6));
sl@0
    76
	
sl@0
    77
	TBuf<256> myBuf;
sl@0
    78
    CMMFMetaDataEntry* newMetaEntry = CMMFMetaDataEntry::NewL();
sl@0
    79
	if(iTitlePos != -1)
sl@0
    80
    	{
sl@0
    81
        myEdwin1->GetText(myBuf);
sl@0
    82
        iMetaArray[iTitlePos]->SetValueL(myBuf);
sl@0
    83
        }
sl@0
    84
    else
sl@0
    85
        {
sl@0
    86
        newMetaEntry->SetNameL(KTitle);
sl@0
    87
        myEdwin1->GetText(myBuf);
sl@0
    88
        newMetaEntry->SetValueL(myBuf);
sl@0
    89
        iMetaArray.Append(newMetaEntry);
sl@0
    90
        }
sl@0
    91
    if(iAuthorPos != -1)
sl@0
    92
        {
sl@0
    93
        myEdwin2->GetText(myBuf);
sl@0
    94
        iMetaArray[iAuthorPos]->SetValueL(myBuf);
sl@0
    95
        }
sl@0
    96
    else
sl@0
    97
        {
sl@0
    98
        newMetaEntry->SetNameL(KAuthor);
sl@0
    99
        myEdwin1->GetText(myBuf);
sl@0
   100
        newMetaEntry->SetValueL(myBuf);
sl@0
   101
        iMetaArray.Append(newMetaEntry);
sl@0
   102
        }
sl@0
   103
    if(iCopyrightPos != -1)
sl@0
   104
        {
sl@0
   105
        myEdwin3->GetText(myBuf);
sl@0
   106
        iMetaArray[iCopyrightPos]->SetValueL(myBuf);
sl@0
   107
        }
sl@0
   108
    else
sl@0
   109
        {
sl@0
   110
        newMetaEntry->SetNameL(KCopyrt);
sl@0
   111
        myEdwin3->GetText(myBuf);
sl@0
   112
        newMetaEntry->SetValueL(myBuf);
sl@0
   113
        iMetaArray.Append(newMetaEntry);
sl@0
   114
        }
sl@0
   115
    if(iRevisionPos != -1)
sl@0
   116
        {
sl@0
   117
        myEdwin4->GetText(myBuf);
sl@0
   118
        iMetaArray[iRevisionPos]->SetValueL(myBuf);
sl@0
   119
        }
sl@0
   120
    else
sl@0
   121
        {
sl@0
   122
        newMetaEntry->SetNameL(KRevision);
sl@0
   123
        myEdwin4->GetText(myBuf);
sl@0
   124
        newMetaEntry->SetValueL(myBuf);
sl@0
   125
        iMetaArray.Append(newMetaEntry);
sl@0
   126
        }
sl@0
   127
    if(iCategoryPos != -1)
sl@0
   128
        {
sl@0
   129
        myEdwin5->GetText(myBuf);
sl@0
   130
        iMetaArray[iCategoryPos]->SetValueL(myBuf);
sl@0
   131
        }
sl@0
   132
    else
sl@0
   133
        {
sl@0
   134
        newMetaEntry->SetNameL(KCategory);
sl@0
   135
        myEdwin5->GetText(myBuf);
sl@0
   136
        newMetaEntry->SetValueL(myBuf);
sl@0
   137
        iMetaArray.Append(newMetaEntry);
sl@0
   138
        }
sl@0
   139
    if(iCommentsPos != -1)
sl@0
   140
        {
sl@0
   141
        myEdwin6->GetText(myBuf);
sl@0
   142
        iMetaArray[iCommentsPos]->SetValueL(myBuf);
sl@0
   143
        }
sl@0
   144
    else
sl@0
   145
        {
sl@0
   146
        newMetaEntry->SetNameL(KComments);
sl@0
   147
        myEdwin6->GetText(myBuf);
sl@0
   148
        newMetaEntry->SetValueL(myBuf);
sl@0
   149
        iMetaArray.Append(newMetaEntry);
sl@0
   150
        }
sl@0
   151
    TInt err;
sl@0
   152
    TInt count=iMetaArray.Count();
sl@0
   153
    TRAP(err,iAppUi->SetMetaDataL(iMetaArray));
sl@0
   154
    if(err==KErrNotSupported)
sl@0
   155
      	{
sl@0
   156
      	User::InfoPrint(KNotSupported);
sl@0
   157
      	}
sl@0
   158
    delete newMetaEntry;
sl@0
   159
    return ETrue; 	    
sl@0
   160
    }
sl@0
   161
sl@0
   162
CMVSEditMetaInfoDialog::~CMVSEditMetaInfoDialog()
sl@0
   163
	{
sl@0
   164
	iMetaArray.Close();
sl@0
   165
	}