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