author | hgs |
Wed, 03 Nov 2010 17:12:22 +0530 | |
changeset 89 | b57382753122 |
parent 83 | 5aadd1120515 |
permissions | -rw-r--r-- |
0
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1 |
/* |
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
2 |
* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). |
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
3 |
* All rights reserved. |
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
4 |
* This component and the accompanying materials are made available |
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
5 |
* under the terms of "Eclipse Public License v1.0" |
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
6 |
* which accompanies this distribution, and is available |
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
7 |
* at the URL "http://www.eclipse.org/legal/epl-v10.html". |
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
8 |
* |
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
9 |
* Initial Contributors: |
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
10 |
* Nokia Corporation - initial contribution. |
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
11 |
* |
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
12 |
* Contributors: |
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
13 |
* |
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
14 |
* Description: Controller class for editing related UI behavior |
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
15 |
* |
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
16 |
*/ |
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
17 |
|
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
18 |
|
89 | 19 |
#include <eikenv.h> |
20 |
#include <e32math.h> |
|
21 |
#include <StringLoader.h> |
|
22 |
#include <utf.h> |
|
23 |
#include <aknnotewrappers.h> |
|
24 |
#include <avkon.hrh> |
|
25 |
#include <CAgnEntryUi.h> |
|
26 |
#include <calentryview.h> |
|
27 |
#include <calentry.h> |
|
28 |
#include <calrrule.h> |
|
29 |
#include <caluser.h> |
|
30 |
#include <calenagendautils.h> |
|
31 |
#include <calendateutils.h> |
|
32 |
#include <CalenInterimUtils2.h> |
|
33 |
#include <CalenEditorsPlugin.h> |
|
34 |
#include <calenglobaldata.h> |
|
35 |
#include <Calendar.rsg> |
|
36 |
#include <calencommonui.rsg> |
|
37 |
#include <calencommands.hrh> // Calendar commands |
|
38 |
#include <calencontext.h> |
|
39 |
#include <caleninstanceid.h> // TCalenInstanceId |
|
40 |
#include <calentoolbar.h> |
|
41 |
#include <calenactionuiutils.h> |
|
42 |
#include <aknViewAppUi.h> // CAknViewAppUi |
|
43 |
#include <aknview.h> |
|
44 |
#include <featmgr.h> |
|
45 |
||
0
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
46 |
#include "calendarui_debug.h" |
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
47 |
#include "caleneditui.h" |
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
48 |
#include "calencontroller.h" |
89 | 49 |
#include "calendar.hrh" |
50 |
#include "calensend.h" |
|
51 |
#include "CalenUid.h" |
|
0
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
52 |
#include "calenservicesimpl.h" |
89 | 53 |
#include "calenviewmanager.h" |
0
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
54 |
|
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
55 |
// ---------------------------------------------------------------------------- |
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
56 |
// CCalenEditUi::NewL |
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
57 |
// First stage construction |
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
58 |
// (other items were commented in a header). |
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
59 |
// ---------------------------------------------------------------------------- |
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
60 |
// |
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
61 |
CCalenEditUi* CCalenEditUi::NewL( CCalenController& aController ) |
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
62 |
{ |
89 | 63 |
TRACE_ENTRY_POINT; |
64 |
||
0
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
65 |
CCalenEditUi* self = new(ELeave) CCalenEditUi( aController ); |
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
66 |
CleanupStack::PushL( self ); |
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
67 |
self->ConstructL(); |
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
68 |
CleanupStack::Pop( self ); |
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
69 |
|
89 | 70 |
TRACE_EXIT_POINT; |
0
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
71 |
return self; |
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
72 |
} |
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
73 |
|
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
74 |
// ---------------------------------------------------------------------------- |
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
75 |
// CCalenEditUi::~CCalenEditUi |
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
76 |
// Destructor |
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
77 |
// (other items were commented in a header). |
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
78 |
// ---------------------------------------------------------------------------- |
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
79 |
// |
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
80 |
CCalenEditUi::~CCalenEditUi() |
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
81 |
{ |
89 | 82 |
TRACE_ENTRY_POINT; |
83 |
||
84 |
delete iEditorsPlugin; |
|
85 |
delete iListItems; |
|
86 |
delete iListItemCommands; |
|
51 | 87 |
|
89 | 88 |
if( iWaitDialog ) |
89 |
{ |
|
90 |
delete iWaitDialog; |
|
91 |
} |
|
92 |
||
93 |
if( iGlobalData ) |
|
94 |
{ |
|
95 |
iGlobalData->Release(); |
|
96 |
} |
|
97 |
||
98 |
TRACE_EXIT_POINT; |
|
0
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
99 |
} |
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
100 |
|
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
101 |
// ---------------------------------------------------------------------------- |
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
102 |
// CCalenEditUi::CCalenEditUi |
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
103 |
// Constructor |
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
104 |
// (other items were commented in a header). |
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
105 |
// ---------------------------------------------------------------------------- |
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
106 |
// |
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
107 |
CCalenEditUi::CCalenEditUi( CCalenController& aController ) |
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
108 |
: iController( aController ) |
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
109 |
{ |
89 | 110 |
TRACE_ENTRY_POINT; |
111 |
TRACE_EXIT_POINT; |
|
0
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
112 |
} |
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
113 |
|
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
114 |
// ---------------------------------------------------------------------------- |
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
115 |
// CCalenEditUi::ConstructL |
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
116 |
// Second stage construction |
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
117 |
// (other items were commented in a header). |
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
118 |
// ---------------------------------------------------------------------------- |
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
119 |
// |
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
120 |
void CCalenEditUi::ConstructL() |
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
121 |
{ |
89 | 122 |
TRACE_ENTRY_POINT; |
123 |
||
124 |
iGlobalData = CCalenGlobalData::InstanceL(); |
|
125 |
iEntriesToComplete = 1; |
|
126 |
iMoreEntriesToComplete = EFalse; |
|
127 |
isEditorActive = EFalse; |
|
0
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
128 |
|
89 | 129 |
iController.RegisterForNotificationsL( this, ECalenNotifyCancelStatusUpdation ); |
130 |
||
131 |
TRACE_EXIT_POINT; |
|
0
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
132 |
} |
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
133 |
|
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
134 |
// ---------------------------------------------------------------------------- |
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
135 |
// CCalenEditUi::HandleActionUiCommandL |
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
136 |
// Handles action ui commands |
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
137 |
// (other items were commented in a header). |
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
138 |
// ---------------------------------------------------------------------------- |
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
139 |
// |
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
140 |
TBool CCalenEditUi::HandleCommandL( const TCalenCommand& aCommand ) |
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
141 |
{ |
89 | 142 |
TRACE_ENTRY_POINT; |
0
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
143 |
|
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
144 |
TBool continueCommand(EFalse); |
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
145 |
TInt command = aCommand.Command(); |
89 | 146 |
|
147 |
switch(command) |
|
0
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
148 |
{ |
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
149 |
case ECalenNewMeeting: |
89 | 150 |
case ECalenNewDayNote: |
151 |
||
152 |
{ |
|
153 |
TUid currentView = iController.ViewManager().CurrentView(); |
|
154 |
if( KUidCalenTodoView == currentView ) |
|
155 |
{ |
|
156 |
// Open NewEntry as "To-Do", if editor is launched from To-Do view. |
|
157 |
MCalenContext& context = iController.Services().Context(); |
|
158 |
// Set the date on the context to today. |
|
159 |
TTime homeTime; |
|
160 |
homeTime.HomeTime(); |
|
161 |
TCalTime today; |
|
162 |
today.SetTimeLocalL( homeTime ); |
|
163 |
context.SetFocusDateL( today, TVwsViewId( KUidCalendar, KUidCalenTodoView ) ); |
|
164 |
EditNewEntryL( CCalEntry::ETodo ); |
|
165 |
} |
|
166 |
else |
|
167 |
{ |
|
168 |
EditNewEntryL(); |
|
169 |
} |
|
170 |
} |
|
171 |
break; |
|
172 |
case ECalenNewTodo: |
|
173 |
EditNewEntryL( CCalEntry::ETodo ); |
|
174 |
break; |
|
175 |
case ECalenNewAnniv: |
|
176 |
EditNewEntryL( CCalEntry::EAnniv ); |
|
177 |
break; |
|
178 |
case ECalenNewMeetingRequest: |
|
179 |
{ |
|
180 |
EditNewMeetingRequestL(); |
|
181 |
} |
|
0
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
182 |
break; |
89 | 183 |
case ECalenEditCurrentEntry: |
184 |
case ECalenEditSeries: |
|
185 |
case ECalenEditOccurrence: |
|
186 |
case ECalenCompleteTodo: |
|
187 |
case ECalenRestoreTodo: |
|
188 |
case ECalenMarkEntryAsDone: |
|
189 |
case ECalenMarkEntryAsUnDone: |
|
190 |
{ |
|
191 |
// These commands need the entry view |
|
192 |
// to be constructed before being called |
|
193 |
CCalEntryView* entryView = iGlobalData->EntryViewL(); |
|
194 |
if( !entryView ) |
|
195 |
{ |
|
196 |
// Store the command and wait for notification |
|
197 |
WaitForEntryViewNotificationL( aCommand ); |
|
198 |
} |
|
199 |
else |
|
200 |
{ |
|
201 |
switch ( command ) |
|
202 |
{ |
|
203 |
case ECalenEditCurrentEntry: |
|
204 |
{ |
|
205 |
MCalenContext& context = iGlobalData->Context(); |
|
206 |
entryView = iGlobalData->EntryViewL(context.InstanceId().iColId); |
|
207 |
CCalEntry* entry = entryView->FetchL( |
|
208 |
context.InstanceId().iEntryLocalUid ); |
|
209 |
CleanupStack::PushL( entry ); |
|
210 |
User::LeaveIfNull( entry ); |
|
211 |
EditEntryL( entry, |
|
212 |
context.InstanceId().iInstanceTime, |
|
213 |
MAgnEntryUi::EEditExistingEntry ); |
|
214 |
||
215 |
CleanupStack::PopAndDestroy( entry ); |
|
216 |
||
217 |
break; |
|
218 |
} |
|
219 |
case ECalenCompleteTodo: |
|
220 |
SetTodoCompleteL( ETrue ); |
|
221 |
break; |
|
222 |
case ECalenRestoreTodo: |
|
223 |
SetTodoCompleteL( EFalse ); |
|
224 |
break; |
|
225 |
case ECalenMarkEntryAsDone: |
|
226 |
continueCommand = SetMultipleTodoCompleteL(ETrue ); |
|
227 |
break; |
|
228 |
case ECalenMarkEntryAsUnDone: |
|
229 |
continueCommand = SetMultipleTodoCompleteL(EFalse ); |
|
230 |
break; |
|
231 |
default: |
|
232 |
{ |
|
233 |
// Should never reach this point. |
|
234 |
ASSERT( EFalse ); |
|
235 |
} |
|
236 |
} |
|
237 |
} |
|
238 |
} |
|
239 |
break; |
|
240 |
case ECalenSend: |
|
241 |
{ |
|
242 |
iGlobalData->CalenSendL().DisplaySendCascadeMenuL(); |
|
243 |
||
244 |
if( iGlobalData->CalenSendL().CanSendL( ECalenSend ) ) |
|
245 |
{ |
|
246 |
SendEntryL(); |
|
247 |
iController.BroadcastNotification( ECalenNotifyEntrySent ); |
|
248 |
} |
|
249 |
// ECalenNotifyDialogClosed issued when Messaging Query is cancelled |
|
250 |
// by the user. |
|
251 |
else |
|
252 |
{ |
|
253 |
iController.BroadcastNotification( ECalenNotifyEntrySendCancel ); |
|
254 |
} |
|
255 |
||
0
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
256 |
} |
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
257 |
break; |
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
258 |
default: |
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
259 |
// Controller decided this class was the place to handle this |
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
260 |
// command |
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
261 |
break; |
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
262 |
} |
89 | 263 |
|
264 |
TRACE_EXIT_POINT; |
|
0
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
265 |
return continueCommand; |
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
266 |
} |
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
267 |
|
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
268 |
// ---------------------------------------------------------------------------- |
89 | 269 |
// CCalenEditUi::CalenCommandHandlerExtensionL |
270 |
// Dummy implementation. |
|
271 |
// (other items were commented in a header). |
|
272 |
// ---------------------------------------------------------------------------- |
|
273 |
// |
|
274 |
TAny* CCalenEditUi::CalenCommandHandlerExtensionL( TUid /*aExtensionUid*/ ) |
|
275 |
{ |
|
276 |
TRACE_ENTRY_POINT; |
|
277 |
TRACE_EXIT_POINT; |
|
278 |
return NULL; |
|
279 |
} |
|
280 |
||
281 |
// ---------------------------------------------------------------------------- |
|
282 |
// CCalenEditUi::SetTodoCompleteL |
|
283 |
// Completes or restores a todo. |
|
284 |
// (other items were commented in a header). |
|
285 |
// ---------------------------------------------------------------------------- |
|
286 |
// |
|
287 |
void CCalenEditUi::SetTodoCompleteL( TBool aComplete ) |
|
288 |
{ |
|
289 |
TRACE_ENTRY_POINT; |
|
290 |
||
291 |
MCalenContext& context = iGlobalData->Context(); |
|
292 |
ASSERT( !( context.InstanceId() == ( TCalenInstanceId::NullInstanceId() ) ) ); |
|
293 |
||
294 |
// HandleActionUiCommandL creates the entry view if it has |
|
295 |
// not already been created before SetTodoCompleteL is called. |
|
296 |
CCalEntryView* entryView = iGlobalData->EntryViewL(context.InstanceId().iColId); |
|
297 |
ASSERT( entryView ); |
|
298 |
||
299 |
CCalEntry* entry = entryView->FetchL( context.InstanceId().iEntryLocalUid ); |
|
300 |
||
301 |
CleanupStack::PushL( entry ); |
|
302 |
||
303 |
if( entry ) |
|
304 |
{ |
|
305 |
CalenActionUiUtils::SetToDoCompleteStatusL( *entryView, entry, aComplete ); |
|
306 |
//iContainer->NotifyEntryChangeL( *entry, entry->StartTimeL() ); |
|
307 |
iController.BroadcastNotification( ECalenNotifyEntrySaved ); |
|
308 |
} |
|
309 |
||
310 |
CleanupStack::PopAndDestroy( entry ); |
|
311 |
||
312 |
TRACE_EXIT_POINT; |
|
313 |
} |
|
314 |
||
315 |
// ---------------------------------------------------------------------------- |
|
316 |
// CCalenEditUi::SetTodoEntryCompleteL |
|
317 |
// Completes or restores a todo. |
|
318 |
// (other items were commented in a header). |
|
319 |
// ---------------------------------------------------------------------------- |
|
320 |
// |
|
321 |
void CCalenEditUi::SetTodoEntryCompleteL(TBool aComplete,TCalLocalUid aEntryUid,TCalCollectionId colId) |
|
322 |
{ |
|
323 |
TRACE_ENTRY_POINT; |
|
324 |
||
325 |
// HandleActionUiCommandL creates the entry view if it has |
|
326 |
// not already been created before SetTodoCompleteL is called. |
|
327 |
CCalEntryView* entryView = iGlobalData->EntryViewL(colId); |
|
328 |
ASSERT( entryView ); |
|
329 |
||
330 |
CCalEntry* entry = entryView->FetchL( aEntryUid ); |
|
331 |
CleanupStack::PushL( entry ); |
|
332 |
||
333 |
if( entry ) |
|
334 |
{ |
|
335 |
CalenActionUiUtils::SetToDoCompleteStatusL( *entryView, entry, aComplete ); |
|
336 |
} |
|
337 |
||
338 |
CleanupStack::PopAndDestroy( entry ); |
|
339 |
TRACE_EXIT_POINT; |
|
340 |
} |
|
341 |
||
342 |
// ---------------------------------------------------------------------------- |
|
343 |
// CCalenEditUi::EditNewEntryL |
|
344 |
// Creates a new entry and opens it for editing |
|
345 |
// (other items were commented in a header). |
|
0
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
346 |
// ---------------------------------------------------------------------------- |
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
347 |
// |
89 | 348 |
void CCalenEditUi::EditNewEntryL( CCalEntry::TType aEntryType) |
349 |
{ |
|
350 |
TRACE_ENTRY_POINT; |
|
351 |
||
352 |
// Create unique ID. |
|
353 |
HBufC8* guid = iGlobalData->InterimUtilsL().GlobalUidL(); |
|
354 |
CleanupStack::PushL( guid ); |
|
355 |
CCalEntry* entry = CCalEntry::NewL( aEntryType, guid, CCalEntry::EMethodNone, 0 ); |
|
356 |
CleanupStack::Pop( guid ); |
|
357 |
||
358 |
CleanupStack::PushL( entry ); |
|
359 |
||
360 |
// Set initial start and end times from Calendar context |
|
361 |
TTime focusedTime = CalculateActiveTimeFromContextL(); |
|
362 |
TCalTime initialCalTime; |
|
363 |
||
364 |
initialCalTime.SetTimeLocalL( focusedTime ); |
|
365 |
||
366 |
entry->SetStartAndEndTimeL( initialCalTime, initialCalTime ); |
|
367 |
||
368 |
if( entry->EntryTypeL()==CCalEntry::EAnniv ) |
|
369 |
{ |
|
370 |
TCalRRule rrule( TCalRRule::EYearly ); |
|
371 |
TCalTime startDate; |
|
372 |
rrule.SetDtStart( initialCalTime ); |
|
373 |
rrule.SetInterval( 1 ); // once a year |
|
374 |
entry->SetRRuleL( rrule ); |
|
375 |
} |
|
376 |
||
377 |
MCalenContext& context = iGlobalData->Context(); |
|
378 |
TCalCollectionId colId = context.InstanceId().iColId; |
|
379 |
TCalenInstanceId id = TCalenInstanceId::CreateL( *entry, initialCalTime ); |
|
380 |
id.iColId = colId; |
|
381 |
||
382 |
context.SetInstanceIdL( id, context.ViewId() ); |
|
51 | 383 |
|
89 | 384 |
TTime instanceTime = entry->StartTimeL().TimeLocalL(); |
385 |
EditEntryL( entry, instanceTime, MAgnEntryUi::ECreateNewEntry ); |
|
386 |
CleanupStack::PopAndDestroy( entry ); |
|
387 |
||
388 |
TRACE_EXIT_POINT; |
|
389 |
} |
|
390 |
||
391 |
// ---------------------------------------------------------------------------- |
|
392 |
// CCalenEditUi::EditNewMeetingRequestL |
|
393 |
// Creates a new meeting request and opens it for editing |
|
394 |
// (other items were commented in a header). |
|
395 |
// ---------------------------------------------------------------------------- |
|
396 |
// |
|
397 |
void CCalenEditUi::EditNewMeetingRequestL() |
|
398 |
{ |
|
399 |
TRACE_ENTRY_POINT; |
|
400 |
||
401 |
CMRMailboxUtils::TMailboxInfo defaultMailBox; |
|
402 |
||
403 |
if( !iGlobalData->AttemptToRetrieveDefaultMailboxL( defaultMailBox ) ) |
|
404 |
{ |
|
405 |
// User either doesn't have any mailboxes or didn't select a default mailbox. |
|
406 |
// Don't create the meeting request. |
|
407 |
TRACE_EXIT_POINT; |
|
408 |
return; |
|
409 |
} |
|
410 |
||
411 |
// If we got this far, defaultMailBox should be initialised. |
|
412 |
HBufC8* guid = iGlobalData->InterimUtilsL().GlobalUidL(); |
|
413 |
||
414 |
CleanupStack::PushL( guid ); |
|
415 |
CCalEntry* entry = CCalEntry::NewL( CCalEntry::EAppt, |
|
416 |
guid, |
|
417 |
CCalEntry::EMethodRequest, |
|
418 |
0 ); |
|
419 |
CleanupStack::Pop( guid ); |
|
420 |
CleanupStack::PushL( entry ); |
|
421 |
||
422 |
// Set initial start and end times from Active Calendar Context |
|
423 |
TTime focusedTime = iGlobalData->Context().FocusDateAndTimeL().TimeLocalL(); |
|
424 |
TCalTime initialCalTime; |
|
425 |
// No need to handle floating time check here, as meetings are |
|
426 |
// always fixed. |
|
427 |
initialCalTime.SetTimeLocalL( focusedTime ); |
|
428 |
||
429 |
entry->SetStartAndEndTimeL( initialCalTime, initialCalTime ); |
|
430 |
||
431 |
//Set the organizer from the selected mailbox |
|
432 |
CCalUser* organizer = CCalUser::NewL( defaultMailBox.iEmailAddress ); |
|
433 |
entry->SetOrganizerL( organizer ); |
|
434 |
||
435 |
TTime instanceTime = entry->StartTimeL().TimeLocalL(); |
|
436 |
EditEntryL( entry, instanceTime, MAgnEntryUi::ECreateNewEntry ); |
|
437 |
CleanupStack::PopAndDestroy( entry ); |
|
438 |
||
439 |
TRACE_EXIT_POINT; |
|
440 |
} |
|
0
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
441 |
|
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
442 |
// ---------------------------------------------------------------------------- |
89 | 443 |
// CCalenEditUi::EditEntryL |
444 |
// Opens the entry aEntry for editing |
|
445 |
// (other items were commented in a header). |
|
0
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
446 |
// ---------------------------------------------------------------------------- |
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
447 |
// |
89 | 448 |
void CCalenEditUi::EditEntryL( CCalEntry* aEntry, |
449 |
const TTime& aInstanceDate, |
|
450 |
MAgnEntryUi::TAgnEntryUiEditorMode aEditorMode ) |
|
451 |
{ |
|
452 |
TRACE_ENTRY_POINT; |
|
453 |
||
454 |
// Set the flag |
|
455 |
isEditorActive = ETrue; |
|
456 |
||
457 |
if( !iEditorsPlugin ) |
|
458 |
{ |
|
459 |
//Only created on first use |
|
460 |
LoadEditorsPluginL(); |
|
461 |
if( !iEditorsPlugin ) |
|
462 |
{ |
|
463 |
// User was prompted to set a default mailbox and hit cancel |
|
464 |
// Entry will not be opened |
|
465 |
TRACE_EXIT_POINT; |
|
466 |
return; |
|
467 |
} |
|
468 |
} |
|
469 |
||
470 |
MAgnEntryUi::TAgnEntryUiInParams inParams( KUidCalendar, |
|
471 |
iGlobalData->CalSessionL(), |
|
472 |
aEditorMode ); |
|
473 |
||
474 |
// Use floating time for non-timed entries |
|
475 |
if( !CalenAgendaUtils::IsTimedEntryL(aEntry->EntryTypeL()) ) |
|
476 |
{ |
|
477 |
inParams.iInstanceDate.SetTimeLocalFloatingL( aInstanceDate ); |
|
478 |
} |
|
479 |
else |
|
480 |
{ |
|
481 |
inParams.iInstanceDate.SetTimeLocalL( aInstanceDate ); |
|
482 |
} |
|
483 |
||
484 |
inParams.iMsgSession = NULL; |
|
485 |
||
486 |
MAgnEntryUi::TAgnEntryUiOutParams outParams; |
|
487 |
||
488 |
// Launch Entry UI |
|
489 |
RPointerArray<CCalEntry> entries; |
|
490 |
CleanupClosePushL( entries ); |
|
491 |
entries.AppendL( aEntry ); // aEntry already in cleanup stack -> safe |
|
492 |
||
493 |
// Editors need a services implementation. |
|
494 |
MCalenServices* svc = CCalenServicesImpl::NewL(); |
|
495 |
CleanupReleasePushL( *svc ); |
|
496 |
inParams.iSpare = ( TInt )svc; |
|
497 |
||
498 |
||
499 |
// Stop the population of the current view |
|
500 |
iController.ViewManager().InterruptPopulationL(); |
|
501 |
||
502 |
// hide the toolbar |
|
503 |
MCalenToolbar* toolbar = iController.Services().ToolbarOrNull(); |
|
504 |
if(toolbar) |
|
505 |
{ |
|
506 |
toolbar->SetToolbarVisibilityL(EFalse); |
|
507 |
} |
|
508 |
||
509 |
||
510 |
// If a menubar is active,stop displaying it before launching editor |
|
511 |
TUid viewUid = iController.ViewManager().CurrentView(); |
|
512 |
CEikMenuBar* menuBar = iController.AppUi().View(viewUid)->MenuBar(); |
|
513 |
if(menuBar) |
|
514 |
{ |
|
515 |
menuBar->StopDisplayingMenuBar(); |
|
516 |
} |
|
517 |
||
518 |
// Launch the viewer / editor plugin |
|
519 |
iEditorsPlugin->ExecuteViewL( entries, inParams, outParams, *this ); |
|
520 |
||
521 |
// Reset the flag |
|
522 |
isEditorActive = EFalse; |
|
51 | 523 |
|
89 | 524 |
// Unhide the toolbar when settings is closed |
525 |
TUid activeViewUid = iController.ViewManager().CurrentView(); |
|
526 |
if(toolbar && (activeViewUid != KUidCalenMissedAlarmsView ) &&(activeViewUid != KUidCalenMissedEventView ) ) |
|
527 |
{ |
|
528 |
toolbar->SetToolbarVisibilityL(ETrue); |
|
529 |
} |
|
51 | 530 |
|
89 | 531 |
CleanupStack::PopAndDestroy( svc ); |
532 |
||
533 |
// Close the entries array |
|
534 |
CleanupStack::PopAndDestroy( &entries ); |
|
535 |
||
536 |
switch( outParams.iAction ) |
|
537 |
{ |
|
538 |
case MAgnEntryUi::EMeetingSaved: |
|
539 |
case MAgnEntryUi::EInstanceRescheduled: |
|
540 |
{ |
|
541 |
// Update context and issue notification before confirmation dialog |
|
542 |
// to avoid delay of updating title pane |
|
543 |
MCalenContext& context = iGlobalData->Context(); |
|
544 |
TCalCollectionId colId = context.InstanceId().iColId; |
|
545 |
TCalenInstanceId id = TCalenInstanceId::CreateL( TCalLocalUid( |
|
546 |
outParams.iSpare), |
|
547 |
outParams.iNewInstanceDate.TimeLocalL(), EFalse ); |
|
548 |
id.iColId = colId; |
|
549 |
id.iType = context.InstanceId().iType; |
|
550 |
if( aEditorMode != MAgnEntryUi::ECreateNewEntry ) |
|
551 |
{ |
|
552 |
id.iInstanceTime = context.InstanceId().iInstanceTime; |
|
553 |
} |
|
554 |
context.SetInstanceIdL( id, context.ViewId() ); |
|
555 |
iController.BroadcastNotification( ECalenNotifyEntrySaved ); |
|
556 |
||
557 |
if( aEditorMode == MAgnEntryUi::ECreateNewEntry ) |
|
558 |
{ |
|
559 |
// Show saved note for new entries |
|
560 |
TInt res; |
|
561 |
if( context.InstanceId().iType == CCalEntry::ETodo ) |
|
562 |
{ |
|
563 |
res = R_QTN_CALE_NOTE_TODO_SAVED; |
|
564 |
} |
|
565 |
else |
|
566 |
{ |
|
567 |
res = R_TEXT_CALENDAR_NOTE_SAVED; |
|
568 |
} |
|
569 |
||
570 |
HBufC* prompt = StringLoader::LoadLC( res, CEikonEnv::Static() ); |
|
571 |
CAknConfirmationNote* dialog = new( ELeave )CAknConfirmationNote(); |
|
572 |
dialog->ExecuteLD( *prompt ); |
|
573 |
CleanupStack::PopAndDestroy( prompt ); |
|
574 |
} |
|
575 |
} |
|
576 |
break; |
|
577 |
||
578 |
case MAgnEntryUi::EMeetingDeleted: |
|
579 |
iController.BroadcastNotification( ECalenNotifyEntryDeleted ); |
|
580 |
break; |
|
581 |
||
582 |
case MAgnEntryUi::EInstanceDeleted: |
|
583 |
iController.BroadcastNotification( ECalenNotifyInstanceDeleted ); |
|
584 |
break; |
|
585 |
||
586 |
case MAgnEntryUi::ENoAction: |
|
587 |
default: |
|
588 |
iController.BroadcastNotification( ECalenNotifyEntrySaved ); |
|
589 |
break; |
|
590 |
} |
|
591 |
||
592 |
||
593 |
TRACE_EXIT_POINT; |
|
594 |
} |
|
595 |
||
596 |
// ---------------------------------------------------------------------------- |
|
597 |
// CCalenEditUi::LoadEditorsPluginL |
|
598 |
// Attempts to load the editors plugin into iEditorsPlugin. If failure occurs |
|
599 |
// (for example, if the user is prompted to select a default mailbox and hits |
|
600 |
// cancel), iEditorsPlugin is set to NULL. |
|
601 |
// (other items were commented in a header). |
|
602 |
// ---------------------------------------------------------------------------- |
|
603 |
// |
|
604 |
void CCalenEditUi::LoadEditorsPluginL() |
|
605 |
{ |
|
606 |
TRACE_ENTRY_POINT; |
|
607 |
||
608 |
delete iEditorsPlugin; |
|
609 |
iEditorsPlugin = NULL; |
|
610 |
||
611 |
if( iGlobalData->InterimUtilsL().MRViewersEnabledL() ) |
|
612 |
{ |
|
613 |
//Get the currently selected mailbox |
|
614 |
CMRMailboxUtils::TMailboxInfo defaultMailBox; |
|
615 |
||
616 |
if( iGlobalData->AttemptToRetrieveDefaultMailboxL( defaultMailBox ) ) |
|
617 |
{ |
|
618 |
//CAgnEntryUi resolves Meeting request viewer based on mtm uid |
|
619 |
TBuf8<KMaxUidName> mrMtm; |
|
620 |
CnvUtfConverter::ConvertFromUnicodeToUtf8( mrMtm, |
|
621 |
defaultMailBox.iMtmUid.Name() ); |
|
622 |
iEditorsPlugin = CAgnEntryUi::NewL( mrMtm ); |
|
623 |
} |
|
624 |
} |
|
625 |
else |
|
626 |
{ |
|
627 |
iEditorsPlugin = CCalenEditorsPlugin::NewL(); |
|
628 |
} |
|
629 |
||
630 |
TRACE_EXIT_POINT; |
|
631 |
} |
|
632 |
||
0
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
633 |
|
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
634 |
// ---------------------------------------------------------------------------- |
89 | 635 |
// CCalenEditUi::SendEntryL |
636 |
// Sends the current entry. |
|
637 |
// (other items were commented in a header). |
|
638 |
// ---------------------------------------------------------------------------- |
|
639 |
// |
|
640 |
void CCalenEditUi::SendEntryL() |
|
641 |
{ |
|
642 |
TRACE_ENTRY_POINT; |
|
643 |
||
644 |
MCalenContext& context = iGlobalData->Context(); |
|
645 |
ASSERT( !( context.InstanceId() == TCalenInstanceId::NullInstanceId() ) ); |
|
646 |
||
647 |
//If todo, use the LUid. |
|
648 |
//Todos returns the current time if start or end time has not been saved. |
|
649 |
if( CCalEntry::ETodo == context.InstanceId().iType ) |
|
650 |
{ |
|
651 |
CCalEntry* entry = iGlobalData->EntryViewL(context.InstanceId().iColId)->FetchL( |
|
652 |
context.InstanceId().iEntryLocalUid ); |
|
653 |
if( entry ) |
|
654 |
{ |
|
655 |
CleanupStack::PushL( entry ); |
|
656 |
iGlobalData->CalenSendL().SendAsVCalendarL( ECalenSend, *entry ); |
|
657 |
CleanupStack::PopAndDestroy( entry ); |
|
658 |
} |
|
659 |
} |
|
660 |
else // Not todo |
|
661 |
{ |
|
662 |
RArray<TInt> colIdArray; |
|
663 |
CleanupClosePushL(colIdArray); |
|
664 |
iController.GetActiveCollectionidsL(colIdArray); |
|
665 |
||
666 |
CCalInstance* instance = CalenActionUiUtils::FindPossibleInstanceL( |
|
667 |
context.InstanceId(), |
|
668 |
*iGlobalData->InstanceViewL(colIdArray) ); |
|
669 |
CleanupStack::PushL( instance ); |
|
670 |
||
671 |
if( instance ) |
|
672 |
{ |
|
673 |
CCalEntry& entry = instance->Entry(); |
|
674 |
iGlobalData->CalenSendL().SendAsVCalendarL( ECalenSend, entry ); |
|
675 |
} |
|
676 |
||
677 |
CleanupStack::PopAndDestroy( instance ); |
|
678 |
CleanupStack::PopAndDestroy(&colIdArray); |
|
679 |
} |
|
680 |
||
681 |
TRACE_EXIT_POINT; |
|
682 |
} |
|
683 |
||
684 |
// ---------------------------------------------------------------------------- |
|
685 |
// CCalenEditUi::ProcessCommandWithResultL |
|
686 |
// This is pure virtual from MAgnEntryUiCallback. We don't use it. |
|
687 |
// (other items were commented in a header). |
|
688 |
// ---------------------------------------------------------------------------- |
|
689 |
// |
|
690 |
TInt CCalenEditUi::ProcessCommandWithResultL( TInt /*aCommandId*/ ) |
|
691 |
{ |
|
692 |
TRACE_ENTRY_POINT; |
|
693 |
TRACE_EXIT_POINT; |
|
694 |
return KErrNone; |
|
695 |
} |
|
696 |
||
697 |
// ---------------------------------------------------------------------------- |
|
698 |
// CCalenEditUi::ProcessCommandL |
|
699 |
// This is pure virtual from MAgnEntryUiCallback. We don't use it. |
|
700 |
// (other items were commented in a header). |
|
701 |
// ---------------------------------------------------------------------------- |
|
702 |
// |
|
703 |
void CCalenEditUi::ProcessCommandL( TInt /*aCommandId*/ ) |
|
704 |
{ |
|
705 |
TRACE_ENTRY_POINT; |
|
706 |
TRACE_EXIT_POINT; |
|
707 |
} |
|
708 |
||
709 |
// ---------------------------------------------------------------------------- |
|
710 |
// CCalenEditUi::WaitForEntryViewNotificationL |
|
711 |
// Register for view created notification |
|
712 |
// (other items were commented in a header). |
|
713 |
// ---------------------------------------------------------------------------- |
|
714 |
// |
|
715 |
void CCalenEditUi::WaitForEntryViewNotificationL( const TCalenCommand& aCommand ) |
|
716 |
{ |
|
717 |
TRACE_ENTRY_POINT; |
|
718 |
||
719 |
iStoredCommand = aCommand; |
|
720 |
||
721 |
// Only wait for an entry view if it doesn't already exist |
|
722 |
ASSERT( !( iGlobalData->EntryViewL() ) ); |
|
723 |
||
724 |
// Register for notifications |
|
725 |
iController.RegisterForNotificationsL( this, ECalenNotifyEntryInstanceViewCreated ); |
|
726 |
||
727 |
TRACE_EXIT_POINT; |
|
728 |
} |
|
729 |
||
730 |
// ---------------------------------------------------------------------------- |
|
731 |
// CCalenEditUi::HandleECalenNotifyViewCreatedL |
|
732 |
// Handle ECalenNotifyViewCreated |
|
733 |
// (other items were commented in a header). |
|
734 |
// ---------------------------------------------------------------------------- |
|
735 |
// |
|
736 |
void CCalenEditUi::HandleECalenNotifyViewCreatedL() |
|
737 |
{ |
|
738 |
TRACE_ENTRY_POINT; |
|
739 |
||
740 |
if( iGlobalData->EntryViewL() ) |
|
741 |
{ |
|
742 |
// Handle the outstanding command |
|
743 |
HandleCommandL( iStoredCommand ); |
|
744 |
||
745 |
// Cancel the notify as the entry view is now |
|
746 |
// constructed. |
|
747 |
iController.CancelNotifications( this ); |
|
748 |
} |
|
749 |
||
750 |
TRACE_EXIT_POINT; |
|
751 |
} |
|
752 |
// ---------------------------------------------------------------------------- |
|
0
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
753 |
// CCalenEditUi::HandleNotification |
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
754 |
// Handle notifications |
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
755 |
// (other items were commented in a header). |
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
756 |
// ---------------------------------------------------------------------------- |
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
757 |
// |
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
758 |
void CCalenEditUi::HandleNotification(const TCalenNotification aNotification ) |
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
759 |
{ |
89 | 760 |
TRACE_ENTRY_POINT; |
761 |
||
762 |
if ( aNotification == ECalenNotifyEntryInstanceViewCreated ) |
|
763 |
{ |
|
764 |
PIM_TRAPD_HANDLE( HandleECalenNotifyViewCreatedL() ); |
|
765 |
} |
|
766 |
if( aNotification == ECalenNotifyCancelStatusUpdation) |
|
767 |
{ |
|
768 |
if(iMutlipleContextIdsCount) |
|
769 |
{ |
|
770 |
// get the context |
|
771 |
MCalenContext& context = iGlobalData->Context(); |
|
772 |
// reset the multiple contexts |
|
773 |
context.ResetMultipleContextIds(); |
|
774 |
||
775 |
// dismiss the waitdialog |
|
776 |
if(iWaitDialog) |
|
777 |
{ |
|
778 |
TRAP_IGNORE(iWaitDialog->ProcessFinishedL()); |
|
779 |
} |
|
780 |
} |
|
781 |
} |
|
782 |
TRACE_EXIT_POINT; |
|
0
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
783 |
} |
89 | 784 |
|
785 |
TBool CCalenEditUi::SetMultipleTodoCompleteL(TBool aComplete ) |
|
786 |
{ |
|
787 |
TRACE_ENTRY_POINT; |
|
788 |
TBool continueCommand(EFalse); |
|
789 |
||
790 |
// get the context |
|
791 |
MCalenContext& context = iGlobalData->Context(); |
|
792 |
||
793 |
// get the multliple context ids count |
|
794 |
iMutlipleContextIdsCount = context.MutlipleContextIdsCount(); |
|
795 |
||
796 |
ASSERT( iMutlipleContextIdsCount ); |
|
797 |
||
798 |
if(!iMoreEntriesToComplete) |
|
799 |
{ |
|
800 |
DisplayWaitDialogL(); |
|
801 |
} |
|
802 |
// get the multiple context instance ids |
|
803 |
RArray<TCalenInstanceId>& multipleContextIds = context.GetMutlipleContextIds(); |
|
804 |
||
805 |
if(iMutlipleContextIdsCount <= iEntriesToComplete ) |
|
806 |
{ |
|
807 |
iMoreEntriesToComplete = EFalse; |
|
808 |
iEntriesToComplete = iMutlipleContextIdsCount; |
|
809 |
} |
|
810 |
else |
|
811 |
{ |
|
812 |
iMoreEntriesToComplete = ETrue; |
|
813 |
// set the continue command flag if more entries are there to delete |
|
814 |
continueCommand = ETrue; |
|
815 |
} |
|
816 |
||
817 |
TInt index(0); |
|
818 |
while(index<iEntriesToComplete) |
|
819 |
{ |
|
820 |
// get the local uid of the entry through multiple context list |
|
821 |
TCalLocalUid entryLocalUid = multipleContextIds[0].iEntryLocalUid; |
|
822 |
TCalCollectionId colId = multipleContextIds[0].iColId; |
|
823 |
if(entryLocalUid) |
|
824 |
{ |
|
825 |
SetTodoEntryCompleteL(aComplete, entryLocalUid,colId); |
|
826 |
} |
|
827 |
// remove mutliple context based on the instanceid |
|
828 |
context.RemoveMultipleContextId(multipleContextIds[0]); |
|
829 |
index++; |
|
830 |
} |
|
831 |
||
832 |
if(!iMoreEntriesToComplete) |
|
833 |
{ |
|
834 |
MarkedEntriesCompletedL(); |
|
835 |
} |
|
836 |
||
837 |
||
838 |
||
839 |
TRACE_EXIT_POINT; |
|
840 |
return continueCommand; |
|
841 |
} |
|
842 |
// ----------------------------------------------------------------------------- |
|
843 |
// CCalenEditUi::DisplayWaitDialogL |
|
844 |
// Display wait dialog |
|
845 |
// ----------------------------------------------------------------------------- |
|
55 | 846 |
// |
89 | 847 |
void CCalenEditUi::DisplayWaitDialogL() |
55 | 848 |
{ |
89 | 849 |
TRACE_ENTRY_POINT; |
850 |
||
851 |
delete iWaitDialog; |
|
852 |
iWaitDialog = NULL; |
|
853 |
iWaitDialog = new( ELeave )CAknWaitDialog( REINTERPRET_CAST( CEikDialog**, &iWaitDialog ), ETrue ); |
|
854 |
iWaitDialog->ExecuteLD( R_TODO_UPDATING_STATUS_NOTE ); |
|
855 |
iWaitDialog->SetCallback(this); |
|
856 |
||
857 |
TRACE_EXIT_POINT; |
|
83 | 858 |
} |
859 |
||
89 | 860 |
// ----------------------------------------------------------------------------- |
861 |
// CCalenEditUi::MarkedEntriesDeletedL |
|
862 |
// Dismiss wait dialog and show information note |
|
863 |
// ----------------------------------------------------------------------------- |
|
864 |
// |
|
865 |
void CCalenEditUi::MarkedEntriesCompletedL() |
|
866 |
{ |
|
867 |
TRACE_ENTRY_POINT; |
|
868 |
||
869 |
// dismiss the waitdialog |
|
870 |
if(iWaitDialog) |
|
871 |
{ |
|
872 |
iWaitDialog->ProcessFinishedL(); |
|
873 |
} |
|
874 |
||
875 |
if(iMutlipleContextIdsCount) |
|
876 |
{ |
|
877 |
// get the context |
|
878 |
MCalenContext& context = iGlobalData->Context(); |
|
879 |
// reset the multiple contexts |
|
880 |
context.ResetMultipleContextIds(); |
|
881 |
} |
|
882 |
// notify marked entries deleted |
|
883 |
iController.BroadcastNotification( ECalenNotifyMarkedEntryCompleted ); |
|
884 |
||
885 |
TRACE_EXIT_POINT; |
|
886 |
} |
|
887 |
||
888 |
void CCalenEditUi::DialogDismissedL( const TInt /*aButtonId*/ ) |
|
889 |
{ |
|
890 |
TRACE_ENTRY_POINT; |
|
891 |
||
892 |
// no more entries to delete |
|
893 |
iMoreEntriesToComplete = EFalse; |
|
894 |
||
895 |
// issue notification cancel delete |
|
896 |
// iController.BroadcastNotification(ECalenNotifyCancelStatusUpdation); |
|
897 |
||
898 |
TRACE_EXIT_POINT; |
|
899 |
} |
|
900 |
||
901 |
// ----------------------------------------------------------------------------- |
|
902 |
// CCalenEditUi::CalculateActiveTimeFromContextL |
|
903 |
// CCalculate active time from context |
|
904 |
// ----------------------------------------------------------------------------- |
|
83 | 905 |
// |
89 | 906 |
TTime CCalenEditUi::CalculateActiveTimeFromContextL() |
83 | 907 |
{ |
89 | 908 |
TRACE_ENTRY_POINT; |
909 |
// The active time is calculated based on the following table |
|
910 |
// Current View |
|
911 |
// Month Day Week ToDo |
|
912 |
||
913 |
// Meeting* CFD (@8am) CFD (@8am) CFD @ FCT Today (@8am) |
|
914 |
// Day Note CFD CFD CFD Today |
|
915 |
// Anniv* CFD CFD CFD Today |
|
916 |
// ToDo* CFD CFD CFD Today |
|
917 |
||
918 |
// CFD = Currently Focused Date, the one shown in Navigator toolbar |
|
919 |
// FCT = Focused Cell's Time, applicable only to Week View |
|
920 |
// (*) Alarm Default times are also set using the values |
|
921 |
||
922 |
TTime activeTime(Time::NullTTime()); // initialize with NULL time |
|
923 |
TTime& activeTimeRef = activeTime; |
|
924 |
MCalenContext &context = iGlobalData->Context(); |
|
925 |
TUid currentView = iController.ViewManager().CurrentView(); |
|
926 |
if((currentView == KUidCalenWeekView ) && |
|
927 |
(FeatureManager::FeatureSupported(KFeatureIdFfCalScrollablePreview ))) |
|
928 |
{ |
|
929 |
// use CFD |
|
930 |
activeTime = CalenDateUtils::BeginningOfDay( |
|
931 |
context.FocusDateAndTimeL().TimeLocalL()); // CFD |
|
932 |
||
933 |
// CFD @ FCT |
|
934 |
// focus on empty nontimed cell |
|
935 |
if( context.FocusDateAndTimeL().TimeUtcL() == Time::NullTTime() ) |
|
936 |
{ |
|
937 |
activeTime = CalenDateUtils::DefaultTime( activeTimeRef ); |
|
938 |
} |
|
939 |
else if(context.InstanceId().iType != CCalEntry::EAppt) |
|
940 |
{ |
|
941 |
activeTime = CalenDateUtils::DefaultTime( activeTimeRef ); |
|
942 |
} |
|
943 |
else |
|
944 |
{ |
|
945 |
activeTime += CalenDateUtils::TimeOfDay( |
|
946 |
context.FocusDateAndTimeL().TimeLocalL().DateTime() ); |
|
947 |
} |
|
948 |
} |
|
949 |
else |
|
950 |
{ |
|
951 |
// use Today @ 8 am |
|
952 |
activeTime = CalenDateUtils::Today(); |
|
953 |
activeTime = CalenDateUtils::DefaultTime(context.FocusDateAndTimeL().TimeLocalL()); // 8 am |
|
954 |
} |
|
955 |
||
956 |
TRACE_EXIT_POINT; |
|
957 |
return activeTime; |
|
958 |
} |
|
959 |
||
960 |
// ----------------------------------------------------------------------------- |
|
961 |
// CCalenEditUi::IsEditorActive |
|
962 |
// Tells framework whether editor is active or not |
|
963 |
// ----------------------------------------------------------------------------- |
|
964 |
// |
|
965 |
TBool CCalenEditUi::IsEditorActive() |
|
966 |
{ |
|
967 |
return isEditorActive; |
|
55 | 968 |
} |
0
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
969 |
// End of file |