|
1 /* |
|
2 * Copyright (c) 2008 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: Events editor dialog. |
|
15 * |
|
16 */ |
|
17 |
|
18 // INCLUDE FILES |
|
19 #include "evteventsdlg.h" |
|
20 #include "evteditor.h" |
|
21 #include "evtmgmtuiengine.h" |
|
22 |
|
23 // CONSTANTS |
|
24 /// Unnamed namespace for local definitions |
|
25 namespace { |
|
26 #if defined(_DEBUG) |
|
27 |
|
28 _LIT( KPanicMsg, "CEvtEventsDlg" ); |
|
29 |
|
30 enum TPanicCode |
|
31 { |
|
32 KEvtPanicNullMember = 1 |
|
33 }; |
|
34 |
|
35 void Panic( TPanicCode aReason ) |
|
36 { |
|
37 User::Panic( KPanicMsg, aReason ); |
|
38 } |
|
39 #endif |
|
40 } // namespace |
|
41 |
|
42 // ============================= LOCAL FUNCTIONS =============================== |
|
43 |
|
44 // ----------------------------------------------------------------------------- |
|
45 // CEvtEventsDlg::NewL |
|
46 // ----------------------------------------------------------------------------- |
|
47 // |
|
48 EXPORT_C CEvtEventsDlg* CEvtEventsDlg::NewL(TBool aIsEditable, |
|
49 CEvtEvent& aEvent, |
|
50 CEvtMgmtUiEngine& aEventEngine, |
|
51 TBool aDisplayExitMenuItem |
|
52 ) |
|
53 { |
|
54 CEvtEventsDlg* self = new( ELeave ) CEvtEventsDlg(); |
|
55 CleanupStack::PushL( self ); |
|
56 self->ConstructL( aIsEditable, aEvent, aEventEngine, aDisplayExitMenuItem ); |
|
57 CleanupStack::Pop(); //self |
|
58 return self; |
|
59 } |
|
60 |
|
61 // ----------------------------------------------------------------------------- |
|
62 // CEvtEventsDlg::~CEvtEventsDlg |
|
63 // ----------------------------------------------------------------------------- |
|
64 // |
|
65 EXPORT_C CEvtEventsDlg::~CEvtEventsDlg() |
|
66 { |
|
67 if ( iDestroyedPtr ) |
|
68 { |
|
69 *iDestroyedPtr = ETrue; |
|
70 } |
|
71 delete iEvtEditor; |
|
72 } |
|
73 |
|
74 // ----------------------------------------------------------------------------- |
|
75 // CEvtEventsDlg::CEvtEventsDlg |
|
76 // ----------------------------------------------------------------------------- |
|
77 // |
|
78 CEvtEventsDlg::CEvtEventsDlg() |
|
79 { |
|
80 } |
|
81 |
|
82 // ----------------------------------------------------------------------------- |
|
83 // CEvtEventsDlg::ConstructL |
|
84 // ----------------------------------------------------------------------------- |
|
85 // |
|
86 void CEvtEventsDlg::ConstructL( TBool aIsEditable, |
|
87 CEvtEvent& aEvent, |
|
88 CEvtMgmtUiEngine& aEventEngine, |
|
89 TBool aDisplayExitMenuItem |
|
90 ) |
|
91 { |
|
92 iEvtEditor = CEvtEditor::NewL( aIsEditable, aEvent, aEventEngine, aDisplayExitMenuItem ); |
|
93 |
|
94 } |
|
95 |
|
96 // ----------------------------------------------------------------------------- |
|
97 // CEvtEventsDlg::SetMopParent |
|
98 // ----------------------------------------------------------------------------- |
|
99 // |
|
100 EXPORT_C void CEvtEventsDlg::SetMopParent( MObjectProvider* aParent ) |
|
101 { |
|
102 __ASSERT_DEBUG( iEvtEditor, Panic( KEvtPanicNullMember ) ); |
|
103 iEvtEditor->SetMopParent( aParent ); |
|
104 } |
|
105 |
|
106 // ----------------------------------------------------------------------------- |
|
107 // CEvtEventsDlg::SetHelpContext |
|
108 // ----------------------------------------------------------------------------- |
|
109 // |
|
110 EXPORT_C void CEvtEventsDlg::SetHelpContext( TCoeHelpContext aContext ) |
|
111 { |
|
112 __ASSERT_DEBUG( iEvtEditor, Panic( KEvtPanicNullMember ) ); |
|
113 iEvtEditor->SetHelpContext( aContext ); |
|
114 } |
|
115 |
|
116 // ----------------------------------------------------------------------------- |
|
117 // CEvtEventsDlg::ExecuteLD |
|
118 // ----------------------------------------------------------------------------- |
|
119 // |
|
120 EXPORT_C TInt CEvtEventsDlg::ExecuteLD() |
|
121 { |
|
122 CleanupStack::PushL( this ); |
|
123 |
|
124 TBool thisDestroyed( EFalse ); |
|
125 iDestroyedPtr = &thisDestroyed; |
|
126 |
|
127 TInt ret( iEvtEditor->ExecuteLD() ); |
|
128 iEvtEditor = NULL; |
|
129 |
|
130 if ( thisDestroyed ) |
|
131 { |
|
132 // this object has been deleted already |
|
133 CleanupStack::Pop( this ); |
|
134 } |
|
135 else |
|
136 { |
|
137 CleanupStack::PopAndDestroy(this); //this |
|
138 } |
|
139 return ret; |
|
140 } |
|
141 |
|
142 // End of File |