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