|
1 /* |
|
2 * Copyright (c) 2005 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 <aknmessagequerydialog.h> |
|
21 #include <aknquerydialog.h> |
|
22 #include <aknnotewrappers.h> |
|
23 #include <aknviewappui.h> |
|
24 #include <avkon.hrh> |
|
25 #include <cenrepeditor.rsg> |
|
26 #include "cenrepeditorappui.h" |
|
27 #include "cenrepeditordocument.h" |
|
28 #include "cenrepeditormodel.h" |
|
29 #include "cenrepeditorview2.h" |
|
30 #include "cenrepeditorview2container.h" |
|
31 |
|
32 // ================= MEMBER FUNCTIONS ======================= |
|
33 |
|
34 // --------------------------------------------------------- |
|
35 // CCenrepEditorView2::ConstructL(const TRect& aRect) |
|
36 // EPOC two-phased constructor |
|
37 // --------------------------------------------------------- |
|
38 // |
|
39 void CCenrepEditorView2::ConstructL() |
|
40 { |
|
41 BaseConstructL( R_CENREPEDITOR_VIEW1 ); |
|
42 } |
|
43 |
|
44 // --------------------------------------------------------- |
|
45 // CCenrepEditorView2::~CCenrepEditorView2() |
|
46 // destructor |
|
47 // --------------------------------------------------------- |
|
48 // |
|
49 CCenrepEditorView2::~CCenrepEditorView2() |
|
50 { |
|
51 if ( iContainer ) |
|
52 { |
|
53 AppUi()->RemoveFromViewStack( *this, iContainer ); |
|
54 } |
|
55 |
|
56 delete iContainer; |
|
57 } |
|
58 |
|
59 // --------------------------------------------------------- |
|
60 // TUid CCenrepEditorView2::Id() |
|
61 // |
|
62 // --------------------------------------------------------- |
|
63 // |
|
64 TUid CCenrepEditorView2::Id() const |
|
65 { |
|
66 return KViewId2; |
|
67 } |
|
68 |
|
69 // --------------------------------------------------------- |
|
70 // CCenrepEditorView2::HandleCommandL(TInt aCommand) |
|
71 // takes care of view command handling |
|
72 // --------------------------------------------------------- |
|
73 // |
|
74 void CCenrepEditorView2::HandleCommandL(TInt aCommand) |
|
75 { |
|
76 |
|
77 iContainer->StoreSettingsL(); |
|
78 |
|
79 COtherResources * otherResources = static_cast<CCenrepEditorAppUi*>(AppUi())->OtherResouces(); |
|
80 TRAPD(err,otherResources->SaveL()); |
|
81 |
|
82 TBuf<50> buf; |
|
83 |
|
84 if(err) |
|
85 { |
|
86 CAknErrorNote *dlg = new CAknErrorNote(ETrue); |
|
87 buf.Copy(_L("Unable to Save ")); |
|
88 buf.AppendNum(err); |
|
89 dlg->ExecuteLD(buf); |
|
90 } |
|
91 else |
|
92 { |
|
93 CAknInformationNote *dlg = new CAknInformationNote(ETrue); |
|
94 buf.Copy(_L("Saved")); |
|
95 dlg->ExecuteLD(buf); |
|
96 } |
|
97 |
|
98 AppUi()->HandleCommandL( aCommand ); |
|
99 |
|
100 } |
|
101 |
|
102 // --------------------------------------------------------- |
|
103 // CCenrepEditorView2::HandleClientRectChange() |
|
104 // --------------------------------------------------------- |
|
105 // |
|
106 void CCenrepEditorView2::HandleClientRectChange() |
|
107 { |
|
108 if ( iContainer ) |
|
109 { |
|
110 iContainer->SetRect( ClientRect() ); |
|
111 } |
|
112 } |
|
113 |
|
114 // --------------------------------------------------------- |
|
115 // CCenrepEditorView2::DoActivateL(...) |
|
116 // |
|
117 // --------------------------------------------------------- |
|
118 // |
|
119 void CCenrepEditorView2::DoActivateL( |
|
120 const TVwsViewId& /*aPrevViewId*/,TUid /*aCustomMessageId*/, |
|
121 const TDesC8& /*aCustomMessage*/) |
|
122 { |
|
123 CCenrepEditorAppUi* appUI= static_cast<CCenrepEditorAppUi*>(iEikonEnv->EikAppUi()); |
|
124 COtherResources* otherResources=appUI->OtherResouces(); |
|
125 if (!iContainer) |
|
126 { |
|
127 iContainer = new (ELeave) CCenrepEditorView2Container; |
|
128 iContainer->SetMopParent(this); |
|
129 iContainer->ConstructL( ClientRect(),R_OTHER_RESOURCE_DETAILS_SETTINGS_LIST, otherResources); |
|
130 AppUi()->AddToViewStackL( *this, iContainer ); |
|
131 iContainer->MakeVisible( ETrue ); |
|
132 } |
|
133 |
|
134 iContainer->DrawNow(); |
|
135 } |
|
136 |
|
137 // --------------------------------------------------------- |
|
138 // CCenrepEditorView2::DoDeactivate() |
|
139 // |
|
140 // --------------------------------------------------------- |
|
141 // |
|
142 void CCenrepEditorView2::DoDeactivate() |
|
143 { |
|
144 if ( iContainer ) |
|
145 { |
|
146 AppUi()->RemoveFromViewStack( *this, iContainer ); |
|
147 } |
|
148 |
|
149 delete iContainer; |
|
150 iContainer = NULL; |
|
151 } |
|
152 |
|
153 // End of File |
|
154 |