00001 // 00002 // Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies). 00003 // All rights reserved. 00004 // This component and the accompanying materials are made available 00005 // under the terms of the License "Eclipse Public License v1.0" 00006 // which accompanies this distribution, and is available 00007 // at the URL "http://www.eclipse.org/legal/epl-v10.html". 00008 // 00009 // Initial Contributors: 00010 // Nokia Corporation - initial contribution. 00011 // 00012 // Contributors: 00013 // 00014 // Description: 00015 // 00016 00017 // INCLUDES 00018 #include <QikCommand.h> 00019 #include <eiklabel.h> 00020 #include <FileStore.rsg> 00021 00022 #include "FileStoreExternalInterface.h" 00023 #include "FileStoreAppUi.h" 00024 #include "FileStoreMainView.h" 00025 #include "FileStore.hrh" 00026 00027 // MEMBER FUNCTIONS 00028 00029 // -------------------------------------------------------------------------- 00030 // Two-phase constructor 00031 // -------------------------------------------------------------------------- 00032 CFileStoreMainView* CFileStoreMainView::NewLC(CQikAppUi& aAppUi) 00033 { 00034 CFileStoreMainView* self = new (ELeave) CFileStoreMainView(aAppUi); 00035 CleanupStack::PushL(self); 00036 self->ConstructL(); 00037 return self; 00038 } 00039 00040 // -------------------------------------------------------------------------- 00041 // Default constructor 00042 // -------------------------------------------------------------------------- 00043 CFileStoreMainView::CFileStoreMainView(CQikAppUi& aAppUi) 00044 : CQikViewBase(aAppUi, KNullViewId) 00045 { 00046 } 00047 00048 // -------------------------------------------------------------------------- 00049 // Destructor 00050 // -------------------------------------------------------------------------- 00051 CFileStoreMainView::~CFileStoreMainView() 00052 { 00053 } 00054 00055 // -------------------------------------------------------------------------- 00056 // Second phase constructor 00057 // -------------------------------------------------------------------------- 00058 void CFileStoreMainView::ConstructL() 00059 { 00060 BaseConstructL(); 00061 } 00062 00063 // -------------------------------------------------------------------------- 00064 // Called when this view is first time activated. 00065 // -------------------------------------------------------------------------- 00066 void CFileStoreMainView::ViewConstructL() 00067 { 00068 ViewConstructFromResourceL(R_FILESTORE_UI_CONFIGURATIONS); 00069 iEikLabel = LocateControlByUniqueHandle<CEikLabel> (EFileStoreLabelCtrl); 00070 } 00071 00072 // -------------------------------------------------------------------------- 00073 // Returns the identifier of this view. 00074 // -------------------------------------------------------------------------- 00075 TVwsViewId CFileStoreMainView::ViewId()const 00076 { 00077 return TVwsViewId(KUidFileStoreApp, KUidFileStoreMainView); 00078 } 00079 00080 // -------------------------------------------------------------------------- 00081 // Handles user command. 00082 // In this example, all commands are sent to AppUi because 00083 // we want to have the same code with S60. 00084 // -------------------------------------------------------------------------- 00085 void CFileStoreMainView::HandleCommandL(CQikCommand& aCommand) 00086 { 00087 iQikAppUi.HandleCommandL(aCommand.Id()); 00088 CQikViewBase::HandleCommandL(aCommand); 00089 } 00090 00091 // -------------------------------------------------------------------------- 00092 // Sets the text to be displayed on this control. 00093 // -------------------------------------------------------------------------- 00094 void CFileStoreMainView::SetTextL(const TDesC& aText) 00095 { 00096 if (iEikLabel) 00097 { 00098 iEikLabel->SetTextL(aText); 00099 DrawDeferred(); 00100 } 00101 } 00102 00103 // -------------------------------------------------------------------------- 00104 // Called when the size/resolution of this control has been 00105 // changed. If this happens, the size of the label has to be 00106 // adjusted as well. 00107 // -------------------------------------------------------------------------- 00108 void CFileStoreMainView::SizeChanged() 00109 { 00110 if (iEikLabel) 00111 { 00112 TRect rect(Rect()); 00113 iEikLabel->SetExtent( 00114 TPoint(0, 0), 00115 TSize(rect.Width(), rect.Height())); 00116 } 00117 } 00118 00119 // End of File