1 /* |
|
2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 // INCLUDE FILES |
|
20 #include "FBAppUi.h" |
|
21 #include "FBFileListView.h" |
|
22 #include "FB.hrh" |
|
23 #include "FBModel.h" |
|
24 #include "FBDocument.h" |
|
25 #include <filebrowser.rsg> |
|
26 |
|
27 #include <avkon.hrh> |
|
28 #include <AknQueryDialog.h> |
|
29 |
|
30 // ================= MEMBER FUNCTIONS ======================= |
|
31 // |
|
32 // ---------------------------------------------------------- |
|
33 // CFileBrowserAppUi::ConstructL() |
|
34 // ?implementation_description |
|
35 // ---------------------------------------------------------- |
|
36 // |
|
37 void CFileBrowserAppUi::ConstructL() |
|
38 { |
|
39 BaseConstructL(EAknEnableSkin); |
|
40 |
|
41 iModel = static_cast<CFileBrowserDocument*>(reinterpret_cast<CEikAppUi*>(iEikonEnv->AppUi())->Document())->Model(); |
|
42 |
|
43 CFileBrowserFileListView* fileListView = new (ELeave) CFileBrowserFileListView; |
|
44 CleanupStack::PushL( fileListView ); |
|
45 fileListView->ConstructL(); |
|
46 AddViewL( fileListView ); // transfer ownership to CAknViewAppUi |
|
47 CleanupStack::Pop(); // fileListView |
|
48 |
|
49 SetDefaultViewL(*fileListView); |
|
50 |
|
51 // notify the model that everything has been constructed |
|
52 iModel->ActivateModelL(); |
|
53 } |
|
54 |
|
55 // ---------------------------------------------------- |
|
56 // CFileBrowserAppUi::~CFileBrowserAppUi() |
|
57 // Destructor |
|
58 // Frees reserved resources |
|
59 // ---------------------------------------------------- |
|
60 // |
|
61 CFileBrowserAppUi::~CFileBrowserAppUi() |
|
62 { |
|
63 // notify the model that app ui will be deconstructed |
|
64 if (iModel) |
|
65 TRAP_IGNORE(iModel->DeActivateModelL()); |
|
66 } |
|
67 |
|
68 // ------------------------------------------------------------------------------ |
|
69 // CFileBrowserAppUi::::DynInitMenuPaneL(TInt aResourceId,CEikMenuPane* aMenuPane) |
|
70 // This function is called by the EIKON framework just before it displays |
|
71 // a menu pane. Its default implementation is empty, and by overriding it, |
|
72 // the application can set the state of menu items dynamically according |
|
73 // to the state of application data. |
|
74 // ------------------------------------------------------------------------------ |
|
75 // |
|
76 void CFileBrowserAppUi::DynInitMenuPaneL( |
|
77 TInt /*aResourceId*/,CEikMenuPane* /*aMenuPane*/) |
|
78 { |
|
79 } |
|
80 |
|
81 // ---------------------------------------------------- |
|
82 // CFileBrowserAppUi::HandleKeyEventL( |
|
83 // const TKeyEvent& aKeyEvent,TEventCode /*aType*/) |
|
84 // ?implementation_description |
|
85 // ---------------------------------------------------- |
|
86 // |
|
87 TKeyResponse CFileBrowserAppUi::HandleKeyEventL( |
|
88 const TKeyEvent& /*aKeyEvent*/,TEventCode /*aType*/) |
|
89 { |
|
90 return EKeyWasNotConsumed; |
|
91 } |
|
92 |
|
93 // ---------------------------------------------------- |
|
94 // CFileBrowserAppUi::HandleCommandL(TInt aCommand) |
|
95 // ?implementation_description |
|
96 // ---------------------------------------------------- |
|
97 // |
|
98 void CFileBrowserAppUi::HandleCommandL(TInt aCommand) |
|
99 { |
|
100 switch ( aCommand ) |
|
101 { |
|
102 // a normal way to close an application |
|
103 case EAknCmdExit: |
|
104 case EEikCmdExit: |
|
105 { |
|
106 Exit(); |
|
107 } |
|
108 break; |
|
109 |
|
110 default: |
|
111 break; |
|
112 } |
|
113 } |
|
114 |
|
115 // ---------------------------------------------------- |
|
116 // CFileBrowserAppUi::HandleWsEventL(const TWsEvent& aEvent, CCoeControl* aDestination) |
|
117 // ?implementation_description |
|
118 // ---------------------------------------------------- |
|
119 // |
|
120 void CFileBrowserAppUi::HandleWsEventL(const TWsEvent& aEvent, CCoeControl* aDestination) |
|
121 { |
|
122 //if (iModel->ScreenCapture()->HandleKeyCaptureEventsL(aEvent)) |
|
123 CAknViewAppUi::HandleWsEventL(aEvent, aDestination); //continue the event loop if needed |
|
124 } |
|
125 |
|
126 // End of File |
|