49 const TInt KLinkStartTagLength = 22; |
49 const TInt KLinkStartTagLength = 22; |
50 const TInt KLinkEndTagLength = 23; |
50 const TInt KLinkEndTagLength = 23; |
51 const TInt KBoldStartTagLength = 22; |
51 const TInt KBoldStartTagLength = 22; |
52 const TInt KBoldEndTagLength = 23; |
52 const TInt KBoldEndTagLength = 23; |
53 |
53 |
|
54 NONSHARABLE_CLASS(CAknAsynCallbackRunner) : public CActive |
|
55 { |
|
56 public: |
|
57 CAknAsynCallbackRunner( CAknMessageQueryDialogExtension* aMsgQueryExtension ); |
|
58 ~CAknAsynCallbackRunner(); |
|
59 |
|
60 public: |
|
61 // new functions |
|
62 void AsyncCallbackRunL( TInt aCurLink ); |
|
63 |
|
64 // from CActive |
|
65 void DoCancel(); |
|
66 void RunL(); |
|
67 |
|
68 private: |
|
69 CAknMessageQueryDialogExtension* iMsgQueryExtension; |
|
70 TInt iCurLink; |
|
71 }; |
54 |
72 |
55 class CAknMessageQueryDialogExtension : public CBase, public CAknExtendedInputCapabilities::MAknEventObserver, |
73 class CAknMessageQueryDialogExtension : public CBase, public CAknExtendedInputCapabilities::MAknEventObserver, |
56 public MAknHeadingPaneTouchObserver |
74 public MAknHeadingPaneTouchObserver |
57 { |
75 { |
58 public: |
76 public: |
59 CAknMessageQueryDialogExtension( CAknMessageQueryDialog* aParent ) : iParent(aParent), |
77 CAknMessageQueryDialogExtension( CAknMessageQueryDialog* aParent ) : iParent(aParent), |
60 iControlRegisted( EFalse ) {} |
78 iControlRegisted( EFalse ) {} |
61 ~CAknMessageQueryDialogExtension() |
79 ~CAknMessageQueryDialogExtension() |
62 { |
80 { |
|
81 delete iAsyncCallbackRunner; |
63 TInt count = iFormatTextArray.Count(); |
82 TInt count = iFormatTextArray.Count(); |
64 for ( TInt i = 0; i < count; i++ ) |
83 for ( TInt i = 0; i < count; i++ ) |
65 { |
84 { |
66 delete iFormatTextArray[i]; |
85 delete iFormatTextArray[i]; |
67 } |
86 } |
68 iCallBackArray.Close(); |
87 iCallBackArray.Close(); |
69 iFormatTextLocationArray.Close(); |
88 iFormatTextLocationArray.Close(); |
70 iFormatTextArray.Close(); |
89 iFormatTextArray.Close(); |
71 iFormatTypeArray.Close(); |
90 iFormatTypeArray.Close(); |
72 |
|
73 if ( iDestroyedPtr ) |
|
74 { |
|
75 // Mark the object as destroyed. |
|
76 *iDestroyedPtr = ETrue; |
|
77 iDestroyedPtr = NULL; |
|
78 } |
|
79 } |
91 } |
80 |
92 |
81 /** From CAknExtendedInputCapabilities::MAknEventObserver |
93 /** From CAknExtendedInputCapabilities::MAknEventObserver |
82 */ |
94 */ |
83 void HandleInputCapabilitiesEventL( TInt aEvent, TAny* aParams ) |
95 void HandleInputCapabilitiesEventL( TInt aEvent, TAny* aParams ) |
112 TInt iLinkCount; // values between 0 and KMaxLinks-1 |
133 TInt iLinkCount; // values between 0 and KMaxLinks-1 |
113 TBool iMarkedLinks; |
134 TBool iMarkedLinks; |
114 TInt iButtonGroupPreviouslyChanged; |
135 TInt iButtonGroupPreviouslyChanged; |
115 CAknMessageQueryDialog* iParent; |
136 CAknMessageQueryDialog* iParent; |
116 TBool iControlRegisted; |
137 TBool iControlRegisted; |
117 CAknMessageQueryControl* iCtrl; |
138 CAknMessageQueryControl* iCtrl; |
118 |
139 |
119 /** |
|
120 * @c iDestroyedPtr is used for the object destruction check. |
|
121 * If it has non-null value, the destruction check is turned on, and |
|
122 * the value points to a local boolean variable that keeps the destroyed state. |
|
123 */ |
|
124 TBool* iDestroyedPtr; |
|
125 TBool iIsInEditor; |
140 TBool iIsInEditor; |
|
141 |
|
142 CAknAsynCallbackRunner* iAsyncCallbackRunner; |
126 }; |
143 }; |
|
144 |
|
145 CAknAsynCallbackRunner::CAknAsynCallbackRunner( |
|
146 CAknMessageQueryDialogExtension* aMsgQueryExtension ) : |
|
147 CActive( EPriorityStandard ), iMsgQueryExtension( aMsgQueryExtension ) |
|
148 { |
|
149 CActiveScheduler::Add( this ); |
|
150 } |
|
151 |
|
152 CAknAsynCallbackRunner::~CAknAsynCallbackRunner() |
|
153 { |
|
154 Cancel(); |
|
155 } |
|
156 |
|
157 void CAknAsynCallbackRunner::AsyncCallbackRunL( TInt aCurLink ) |
|
158 { |
|
159 iCurLink = aCurLink; |
|
160 if ( !IsActive() ) |
|
161 { |
|
162 iStatus = KRequestPending; |
|
163 TRequestStatus* status = &iStatus; |
|
164 User::RequestComplete( status, KErrNone ); |
|
165 SetActive(); |
|
166 } |
|
167 } |
|
168 |
|
169 void CAknAsynCallbackRunner::DoCancel() |
|
170 { |
|
171 } |
|
172 |
|
173 void CAknAsynCallbackRunner::RunL() |
|
174 { |
|
175 if ( iMsgQueryExtension && iCurLink >= 0 && |
|
176 iCurLink < iMsgQueryExtension->iCallBackArray.Count() ) |
|
177 { |
|
178 iMsgQueryExtension->iCallBackArray[iCurLink].CallBack(); |
|
179 } |
|
180 } |
127 |
181 |
128 |
182 |
129 EXPORT_C CAknMessageQueryDialog* CAknMessageQueryDialog::NewL( TDesC& aMessage, const TTone& aTone ) |
183 EXPORT_C CAknMessageQueryDialog* CAknMessageQueryDialog::NewL( TDesC& aMessage, const TTone& aTone ) |
130 { |
184 { |
131 _AKNTRACE_FUNC_ENTER; |
185 _AKNTRACE_FUNC_ENTER; |
1005 { |
1059 { |
1006 _AKNTRACE_FUNC_EXIT; |
1060 _AKNTRACE_FUNC_EXIT; |
1007 return EFalse; |
1061 return EFalse; |
1008 } |
1062 } |
1009 TInt curLink = control->CurrentLink(); |
1063 TInt curLink = control->CurrentLink(); |
1010 /** |
1064 TRAPD( err, iMsgQueryExtension->ExecuteLinkCallbackL( curLink ) ); |
1011 * The local @c destroyed variable keeps track of the object destroyed state. |
1065 control->DehighlightLink(); |
1012 */ |
|
1013 TBool destroyed = EFalse; |
|
1014 iMsgQueryExtension->iDestroyedPtr = &destroyed; |
|
1015 TRAPD( err, iMsgQueryExtension->iCallBackArray[curLink].CallBack() ); |
|
1016 if ( !destroyed ) |
|
1017 { |
|
1018 iMsgQueryExtension->iDestroyedPtr = NULL; |
|
1019 } |
|
1020 User::LeaveIfError( err ); |
|
1021 if ( !destroyed ) |
|
1022 { |
|
1023 control->DehighlightLink(); |
|
1024 } |
|
1025 _AKNTRACE_FUNC_EXIT; |
1066 _AKNTRACE_FUNC_EXIT; |
1026 return ETrue; |
1067 return ETrue; |
1027 } |
1068 } |
1028 |
1069 |
1029 // End of File |
1070 // End of File |