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: Methods to parse the server alert messages for data sync and device |
|
15 * Management frameworks. Launches respective application |
|
16 * in appropriate conditions |
|
17 * |
|
18 */ |
|
19 |
|
20 #include "SyncMLAknPopUplist.h" |
|
21 |
|
22 const TInt KSyncMLuSecsInSec = 1000000; // Microseconds in a second |
|
23 |
|
24 // ----------------------------------------------------------------------------- |
|
25 // CSyncMLAknPopUpList::CSyncMLAknPopUpList() |
|
26 // Constructor |
|
27 // ----------------------------------------------------------------------------- |
|
28 // |
|
29 CSyncMLAknPopUpList::CSyncMLAknPopUpList(TInt aTimeout ):CAknPopupList() |
|
30 { |
|
31 iTimeout = aTimeout; |
|
32 iMmcwatcher = NULL; |
|
33 iTimer = NULL; |
|
34 immcremoved = EFalse; |
|
35 } |
|
36 |
|
37 // ----------------------------------------------------------------------------- |
|
38 // CSyncMLAknPopUpList::NewL() |
|
39 // ----------------------------------------------------------------------------- |
|
40 // |
|
41 CSyncMLAknPopUpList* CSyncMLAknPopUpList::NewL(CAknSingleHeadingPopupMenuStyleListBox* listBox, |
|
42 TInt aResId,AknPopupLayouts::TAknPopupLayouts aPopuplayout, |
|
43 TInt aTimeout ) |
|
44 { |
|
45 CSyncMLAknPopUpList* self = new( ELeave ) CSyncMLAknPopUpList(aTimeout); |
|
46 CleanupStack::PushL( self ); |
|
47 self->ConstructL(listBox,aResId,aPopuplayout ); |
|
48 CleanupStack::Pop( self ); |
|
49 return self; |
|
50 } |
|
51 |
|
52 // ----------------------------------------------------------------------------- |
|
53 // CSyncMLAknPopUpList::ConstructL() |
|
54 // Second phase constructor |
|
55 // ----------------------------------------------------------------------------- |
|
56 // |
|
57 void CSyncMLAknPopUpList::ConstructL(CAknSingleHeadingPopupMenuStyleListBox* aListBox, |
|
58 TInt aCbaResource, |
|
59 AknPopupLayouts::TAknPopupLayouts aType ) |
|
60 { |
|
61 CAknPopupList::ConstructL(aListBox,aCbaResource,aType); |
|
62 } |
|
63 |
|
64 // ----------------------------------------------------------------------------- |
|
65 // CSyncMLAknPopUpList::~CSyncMLAknPopUpList() |
|
66 // Destructor. |
|
67 // ----------------------------------------------------------------------------- |
|
68 // |
|
69 CSyncMLAknPopUpList::~CSyncMLAknPopUpList() |
|
70 { |
|
71 if ( iTimer ) |
|
72 { |
|
73 iTimer->Cancel(); |
|
74 delete iTimer; |
|
75 iTimer = NULL; |
|
76 } |
|
77 |
|
78 if(iMmcwatcher) |
|
79 { |
|
80 iMmcwatcher->CancelMmcwatch(); |
|
81 delete iMmcwatcher; |
|
82 iMmcwatcher = NULL; |
|
83 } |
|
84 } |
|
85 |
|
86 // ----------------------------------------------------------------------------- |
|
87 // CSyncMLAknPopUpList::TimerExpired |
|
88 // ----------------------------------------------------------------------------- |
|
89 // |
|
90 void CSyncMLAknPopUpList::TimerExpired() |
|
91 { |
|
92 if ( iTimer ) |
|
93 { |
|
94 iTimer->Cancel(); |
|
95 delete iTimer; |
|
96 iTimer = NULL; |
|
97 iTimeout = KSyncMLNNoListTimeout; |
|
98 } |
|
99 if(iMmcwatcher) |
|
100 { |
|
101 iMmcwatcher->CancelMmcwatch(); |
|
102 } |
|
103 CancelPopup(); |
|
104 |
|
105 } |
|
106 |
|
107 // ----------------------------------------------------------------------------- |
|
108 // CSyncMLAknPopUpList::ExecuteLD |
|
109 // ----------------------------------------------------------------------------- |
|
110 // |
|
111 TBool CSyncMLAknPopUpList::ExecuteLD() |
|
112 { |
|
113 if ( iTimeout > KSyncMLNNoListTimeout ) |
|
114 { |
|
115 iTimer = CSyncMLQueryTimer::NewL( this ); |
|
116 iTimer->After( iTimeout * KSyncMLuSecsInSec ); |
|
117 } |
|
118 iMmcwatcher = CSyncmlmmcwatcher::NewL(this); |
|
119 iMmcwatcher->StartL(); |
|
120 return CAknPopupList::ExecuteLD(); |
|
121 } |
|
122 |
|
123 // ----------------------------------------------------------------------------- |
|
124 // CSyncMLAknPopUpList::MmcRemoved |
|
125 // ----------------------------------------------------------------------------- |
|
126 // |
|
127 void CSyncMLAknPopUpList::MmcRemoved() |
|
128 { |
|
129 FLOG(_L("CSyncMLAknPopUpList::MmcRemoved- cancelling the pop up")); |
|
130 immcremoved = ETrue; |
|
131 CancelPopup(); |
|
132 FLOG(_L("CSyncMLAknPopUpList::MmcRemoved- cancelling the pop up done")); |
|
133 } |
|
134 |
|
135 // ----------------------------------------------------------------------------- |
|
136 // CSyncMLAknPopUpList::IsMmcRemoved |
|
137 // ----------------------------------------------------------------------------- |
|
138 // |
|
139 TBool CSyncMLAknPopUpList::IsMmcRemoved() |
|
140 { |
|
141 return immcremoved; |
|
142 } |
|