os/mm/mmlibs/mmfw/tsrc/mmvalidationsuite/mmvalidationsuiteapp/src/MVSViewMetaInfoDialog.cpp
author sl
Tue, 10 Jun 2014 14:32:02 +0200
changeset 1 260cb5ec6c19
permissions -rw-r--r--
Update contrib.
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
sl@0
    18
#include "MVSViewMetaInfoDialog.h"
sl@0
    19
#include "MVSApp.hrh"
sl@0
    20
#include <techview/eiklabel.h>
sl@0
    21
#include "MVSAppUI.h"
sl@0
    22
#include "MVSConstants.h"
sl@0
    23
sl@0
    24
sl@0
    25
sl@0
    26
void CMVSViewMetaInfoDialog::SetupDialogLD(RPointerArray<CMMFMetaDataEntry> aMetaArray,
sl@0
    27
                                        CMVSAppUi* aAppUi)
sl@0
    28
     {
sl@0
    29
     CMVSViewMetaInfoDialog* dialog = new (ELeave) CMVSViewMetaInfoDialog(aAppUi);
sl@0
    30
     CleanupStack::PushL(dialog); 
sl@0
    31
     dialog->ConstructL(aMetaArray);
sl@0
    32
     CleanupStack::Pop(dialog);
sl@0
    33
     dialog->ExecuteLD(R_MVS_DIALOG_SETMETAINFO);
sl@0
    34
     }
sl@0
    35
sl@0
    36
sl@0
    37
void CMVSViewMetaInfoDialog::PreLayoutDynInitL()
sl@0
    38
	{
sl@0
    39
    CEikEdwin* myEdwin1 = static_cast<CEikEdwin*>(Control(EMVSMeta1));
sl@0
    40
    //author
sl@0
    41
    if(myEdwin1)
sl@0
    42
    	{
sl@0
    43
    	myEdwin1->SetReadOnly(TRUE);
sl@0
    44
    	myEdwin1->SetBackgroundColorL(KRgbGray);
sl@0
    45
    	}
sl@0
    46
    
sl@0
    47
    CEikEdwin* myEdwin2 = static_cast<CEikEdwin*>(Control(EMVSMeta2));
sl@0
    48
    if(myEdwin2)
sl@0
    49
    	{
sl@0
    50
    	myEdwin2->SetReadOnly(TRUE);
sl@0
    51
    	myEdwin2->SetBackgroundColorL(KRgbGray);
sl@0
    52
    	}
sl@0
    53
    
sl@0
    54
    //copyright
sl@0
    55
    CEikEdwin* myEdwin3 = static_cast<CEikEdwin*>(Control(EMVSMeta3));
sl@0
    56
    if(myEdwin3)
sl@0
    57
    	{
sl@0
    58
    	myEdwin3->SetReadOnly(TRUE);
sl@0
    59
    	myEdwin3->SetBackgroundColorL(KRgbGray);
sl@0
    60
    	}
sl@0
    61
    
sl@0
    62
    //revision
sl@0
    63
    CEikEdwin* myEdwin4 = static_cast<CEikEdwin*>(Control(EMVSMeta4));
sl@0
    64
    if(myEdwin4)
sl@0
    65
    	{
sl@0
    66
    	myEdwin4->SetReadOnly(TRUE);
sl@0
    67
    	myEdwin4->SetBackgroundColorL(KRgbGray);
sl@0
    68
    	}
sl@0
    69
    
sl@0
    70
    //category
sl@0
    71
    CEikEdwin* myEdwin5 = static_cast<CEikEdwin*>(Control(EMVSMeta5));
sl@0
    72
    if(myEdwin5)
sl@0
    73
    	{
sl@0
    74
    	myEdwin5->SetReadOnly(TRUE);
sl@0
    75
    	myEdwin5->SetBackgroundColorL(KRgbGray);
sl@0
    76
    	}
sl@0
    77
    
sl@0
    78
    //comments
sl@0
    79
    CEikEdwin* myEdwin6 = static_cast<CEikEdwin*>(Control(EMVSMeta6));
sl@0
    80
	if(myEdwin6)
sl@0
    81
    	{
sl@0
    82
    	myEdwin6->SetReadOnly(TRUE);
sl@0
    83
    	myEdwin6->SetBackgroundColorL(KRgbGray);
sl@0
    84
    	}
sl@0
    85
    
sl@0
    86
    TRAPD(err,iAppUi->GetMetaDataL(iMetaArray));
sl@0
    87
	TInt metaArrayCount = iMetaArray.Count();
sl@0
    88
	if(err == KErrNone && metaArrayCount > 0)
sl@0
    89
		{
sl@0
    90
		for(TInt counter = 0; counter< iMetaArray.Count(); counter++)
sl@0
    91
	    	{
sl@0
    92
	        TBufC<256> temp(iMetaArray[counter]->Name());
sl@0
    93
	        TBufC<256> tempval(iMetaArray[counter]->Value());
sl@0
    94
	        if((iMetaArray[counter]->Name()).CompareF(KTitle)==0)
sl@0
    95
	        	{
sl@0
    96
	            myEdwin1->SetTextL(&(iMetaArray[counter]->Value()));
sl@0
    97
	            iTitlePos = counter;
sl@0
    98
	            }
sl@0
    99
	        if((iMetaArray[counter]->Name()).CompareF(KAuthor)==0)
sl@0
   100
	            {
sl@0
   101
	            myEdwin2->SetTextL(&(iMetaArray[counter]->Value()));
sl@0
   102
	            iAuthorPos = counter;
sl@0
   103
	            }
sl@0
   104
	        if((iMetaArray[counter]->Name()).CompareF(KCopyrt)==0)
sl@0
   105
	            {
sl@0
   106
	            myEdwin3->SetTextL(&(iMetaArray[counter]->Value()));
sl@0
   107
	            iCopyrightPos = counter;
sl@0
   108
	            }
sl@0
   109
	        if((iMetaArray[counter]->Name()).CompareF(KRevision)==0)
sl@0
   110
	            {
sl@0
   111
	            myEdwin4->SetTextL(&(iMetaArray[counter]->Value()));
sl@0
   112
	            iRevisionPos = counter;
sl@0
   113
	            }
sl@0
   114
	        if((iMetaArray[counter]->Name()).CompareF(KCategory)==0)
sl@0
   115
	            {
sl@0
   116
	            myEdwin5->SetTextL(&(iMetaArray[counter]->Value()));
sl@0
   117
	            iCategoryPos = counter;
sl@0
   118
	            }
sl@0
   119
	        if((iMetaArray[counter]->Name()).CompareF(KComments)==0)
sl@0
   120
	            {
sl@0
   121
	            myEdwin6->SetTextL(&(iMetaArray[counter]->Value()));
sl@0
   122
	            iCommentsPos = counter;
sl@0
   123
	            }
sl@0
   124
	        }	
sl@0
   125
		}
sl@0
   126
    
sl@0
   127
     
sl@0
   128
    if(err == KErrNotSupported || metaArrayCount == 0)
sl@0
   129
		{
sl@0
   130
		User::InfoPrint(KNotSupported);
sl@0
   131
		}
sl@0
   132
     }
sl@0
   133
sl@0
   134
sl@0
   135
sl@0
   136
sl@0
   137
CMVSViewMetaInfoDialog::CMVSViewMetaInfoDialog(CMVSAppUi* aAppUi)
sl@0
   138
: iTitlePos(-1), iAuthorPos(-1), iCopyrightPos(-1), iRevisionPos(-1),\
sl@0
   139
iCategoryPos(-1), iCommentsPos(-1), iAppUi(aAppUi)
sl@0
   140
    {
sl@0
   141
     
sl@0
   142
    }
sl@0
   143
    
sl@0
   144
    
sl@0
   145
void CMVSViewMetaInfoDialog::ConstructL(RPointerArray<CMMFMetaDataEntry> aMetaArray)
sl@0
   146
    {
sl@0
   147
    iMetaArray.Reset();
sl@0
   148
    TInt noElements = aMetaArray.Count();
sl@0
   149
    for(TInt counter = 0; counter < noElements; counter++)
sl@0
   150
    	{
sl@0
   151
        iMetaArray.Append(aMetaArray[counter]);
sl@0
   152
        }
sl@0
   153
    }
sl@0
   154
sl@0
   155
TBool CMVSViewMetaInfoDialog::OkToExitL(TInt /*aButtonId*/)
sl@0
   156
     {
sl@0
   157
     //Delete the metadata entries populated in the array
sl@0
   158
     iMetaArray.ResetAndDestroy();
sl@0
   159
     return ETrue;
sl@0
   160
     }