|
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: Implementation of COfflineWlanNoteNotif. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 // INCLUDE FILES |
|
20 #include "OfflineWlanNoteNotif.h" |
|
21 #include "OfflineWlanNoteDlg.h" |
|
22 #include "ConnectionUiUtilitiesCommon.h" |
|
23 #include "ConnUiUtilsNotif.h" |
|
24 #include "ConnectionDialogsLogger.h" |
|
25 |
|
26 #include <e32property.h> // For RProperty |
|
27 #include <UikonInternalPSKeys.h> // For KPSUidUikon and KUikGlobalNotesAllowed. |
|
28 #include <ConnUiUtilsNotif.rsg> |
|
29 |
|
30 |
|
31 // ================= MEMBER FUNCTIONS ======================= |
|
32 |
|
33 // --------------------------------------------------------- |
|
34 // COfflineWlanNoteNotif::TNotifierInfo COfflineWlanNoteNotif::RegisterL() |
|
35 // --------------------------------------------------------- |
|
36 // |
|
37 COfflineWlanNoteNotif::TNotifierInfo COfflineWlanNoteNotif::RegisterL() |
|
38 { |
|
39 iInfo.iUid = KUidCOfflineWlanNoteDlg; |
|
40 iInfo.iPriority = ENotifierPriorityHigh; |
|
41 iInfo.iChannel = KUidCOfflineWlanNoteDlg; |
|
42 |
|
43 return iInfo; |
|
44 } |
|
45 |
|
46 // --------------------------------------------------------- |
|
47 // void COfflineWlanNoteNotif::StartL |
|
48 // --------------------------------------------------------- |
|
49 // |
|
50 void COfflineWlanNoteNotif::StartL( const TDesC8& aBuffer, |
|
51 TInt aReplySlot, |
|
52 const RMessagePtr2& aMessage ) |
|
53 { |
|
54 CLOG_ENTERFN( "COfflineWlanNoteNotif::StartL" ); |
|
55 |
|
56 TPckgBuf<TBool> asyncVersion; |
|
57 asyncVersion.Copy( aBuffer ); |
|
58 |
|
59 iCancelled = EFalse; |
|
60 |
|
61 // We are about to display the Offline note. |
|
62 // Since this part of the code can be executed during the bootup, check if |
|
63 // the UI has really started up to display notes/dialogs. |
|
64 TInt notesAllowed = 0; |
|
65 User::LeaveIfError ( RProperty::Get( KPSUidUikon, KUikGlobalNotesAllowed, |
|
66 notesAllowed ) ); |
|
67 |
|
68 iReplySlot = aReplySlot; |
|
69 iMessage = aMessage; |
|
70 |
|
71 CLOG_WRITEF( _L( "notesAllowed : %d" ), notesAllowed ); |
|
72 |
|
73 if ( notesAllowed ) |
|
74 { |
|
75 GetDialogL(); |
|
76 } |
|
77 else if ( asyncVersion() ) |
|
78 { |
|
79 CLOG_WRITE( "Completing with KErrNotReady" ); |
|
80 CompleteL( KErrNotReady ); |
|
81 } |
|
82 else |
|
83 { |
|
84 CLOG_WRITE( "Leaving with KErrNotReady" ); |
|
85 iCancelled = ETrue; |
|
86 User::Leave( KErrNotReady ); |
|
87 } |
|
88 } |
|
89 |
|
90 // --------------------------------------------------------- |
|
91 // void COfflineWlanNoteNotif::Cancel() |
|
92 // --------------------------------------------------------- |
|
93 // |
|
94 void COfflineWlanNoteNotif::Cancel() |
|
95 { |
|
96 if ( !iCancelled ) |
|
97 { |
|
98 iCancelled = ETrue; |
|
99 if ( !iMessage.IsNull() ) |
|
100 { |
|
101 iMessage.Complete( KErrCancel ); |
|
102 } |
|
103 |
|
104 delete iDialog; |
|
105 iDialog = NULL; |
|
106 } |
|
107 } |
|
108 |
|
109 |
|
110 // --------------------------------------------------------- |
|
111 // void COfflineWlanNoteNotif::GetDialogL() |
|
112 // --------------------------------------------------------- |
|
113 // |
|
114 void COfflineWlanNoteNotif::GetDialogL() |
|
115 { |
|
116 iDialog = new ( ELeave ) COfflineWlanNoteDlg( this ); |
|
117 iDialog->ExecuteLD( R_QUERY_DIALOG ); |
|
118 } |
|
119 |
|
120 |
|
121 // --------------------------------------------------------- |
|
122 // void COfflineWlanNoteNotif::CompleteL( TInt aStatus ) |
|
123 // --------------------------------------------------------- |
|
124 // |
|
125 void COfflineWlanNoteNotif::CompleteL( TInt aStatus ) |
|
126 { |
|
127 iCancelled = ETrue; |
|
128 if ( !iMessage.IsNull() ) |
|
129 { |
|
130 iMessage.Complete( aStatus ); |
|
131 } |
|
132 Cancel(); |
|
133 } |
|
134 |
|
135 |
|
136 // --------------------------------------------------------- |
|
137 // COfflineWlanNoteNotif* COfflineWlanNoteNotif::NewL() |
|
138 // --------------------------------------------------------- |
|
139 // |
|
140 COfflineWlanNoteNotif* COfflineWlanNoteNotif::NewL( |
|
141 const TBool aResourceFileResponsible ) |
|
142 { |
|
143 COfflineWlanNoteNotif* self = new ( ELeave ) COfflineWlanNoteNotif(); |
|
144 CleanupStack::PushL( self ); |
|
145 self->ConstructL( KResourceFileName, aResourceFileResponsible ); |
|
146 CleanupStack::Pop(); |
|
147 |
|
148 return self; |
|
149 } |
|
150 |
|
151 |
|
152 // End of File |