calendarui/controller/src/calendeleteui.cpp
author hgs
Mon, 09 Aug 2010 18:30:52 +0530
changeset 57 bb2d3e476f29
parent 55 2c54b51f39c4
child 70 a5ed90760192
permissions -rw-r--r--
201031
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
/*
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
     2
* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
0
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:  Handles deletion
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
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
    18
// System includes
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
    19
#include <QString>
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
    20
#include <QtGui>
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
    21
#include <hbdatetimepicker.h>
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
    22
#include <hbdialog.h>
45
hgs
parents: 23
diff changeset
    23
#include <hbmessagebox.h>
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
    24
#include <hbaction.h>
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
    25
#include <hblabel.h>
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
    26
#include <hbradiobuttonlist.h>
0
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    27
#include <centralrepository.h>
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
    28
#include <agendaentry.h>
0
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    29
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
    30
// User includes
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
    31
#include "calendarui_debug.h"
0
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    32
#include "calendeleteui.h"
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
    33
#include "calencontext.h"
0
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    34
#include "calencontroller.h"
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    35
#include "CleanupResetAndDestroy.h"
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
    36
#include "caleninstanceid.h"
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
    37
#include "calenactionuiutils.h"
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
    38
#include "calendateutils.h"
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
    39
#include "calenagendautils.h"
51
hgs
parents: 45
diff changeset
    40
#include "OstTraceDefinitions.h"
hgs
parents: 45
diff changeset
    41
#ifdef OST_TRACE_COMPILER_IN_USE
hgs
parents: 45
diff changeset
    42
#include "calendeleteuiTraces.h"
hgs
parents: 45
diff changeset
    43
#endif
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
    44
0
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    45
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    46
// Local constants
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    47
const TInt KEntriesToDelete = 1;
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    48
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    49
// ----------------------------------------------------------------------------
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
    50
// CalenDeleteUi::NewL
0
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    51
// Two phased constructor
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    52
// (other items were commented in a header).
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    53
// ----------------------------------------------------------------------------
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    54
//
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
    55
CalenDeleteUi* CalenDeleteUi::NewL( CCalenController& aController )
0
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    56
    {
51
hgs
parents: 45
diff changeset
    57
    OstTraceFunctionEntry0( CALENDELETEUI_NEWL_ENTRY );
hgs
parents: 45
diff changeset
    58
    
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
    59
    CalenDeleteUi* self = new( ELeave ) CalenDeleteUi( aController, NULL );
0
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    60
    CleanupStack::PushL( self );
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    61
    self->ConstructL();
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    62
    CleanupStack::Pop( self );
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    63
51
hgs
parents: 45
diff changeset
    64
    OstTraceFunctionExit0( CALENDELETEUI_NEWL_EXIT );
0
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    65
    return self;
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    66
    }
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    67
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    68
// ----------------------------------------------------------------------------
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
    69
// CalenDeleteUi::CalenDeleteUi
0
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    70
// ?implementation_description
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    71
// (other items were commented in a header).
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
//
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
    74
CalenDeleteUi::CalenDeleteUi( CCalenController& aController, QObject *parent )
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
    75
    :QObject(parent), iController( aController )
0
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    76
    {
51
hgs
parents: 45
diff changeset
    77
    OstTraceFunctionEntry0( CALENDELETEUI_CALENDELETEUI_ENTRY );
hgs
parents: 45
diff changeset
    78
    
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
    79
    iIsDeleting = false;
51
hgs
parents: 45
diff changeset
    80
    
hgs
parents: 45
diff changeset
    81
    OstTraceFunctionExit0( CALENDELETEUI_CALENDELETEUI_EXIT );
0
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    82
    }
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    83
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    84
// ----------------------------------------------------------------------------
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
    85
// CalenDeleteUi::~CalenDeleteUi
0
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    86
// Destructor
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    87
// (other items were commented in a header).
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    88
// ----------------------------------------------------------------------------
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    89
//
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
    90
CalenDeleteUi::~CalenDeleteUi()
0
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    91
    {
51
hgs
parents: 45
diff changeset
    92
    OstTraceFunctionEntry0( DUP1_CALENDELETEUI_CALENDELETEUI_ENTRY );
hgs
parents: 45
diff changeset
    93
    
hgs
parents: 45
diff changeset
    94
    OstTraceFunctionExit0( DUP1_CALENDELETEUI_CALENDELETEUI_EXIT );
0
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    95
    }
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    96
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    97
// ----------------------------------------------------------------------------
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
    98
// CalenDeleteUi::ConstructL
0
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    99
// Second phase of construction
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   100
// (other items were commented in a header).
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
//
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   103
void CalenDeleteUi::ConstructL()
0
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   104
    {
51
hgs
parents: 45
diff changeset
   105
    OstTraceFunctionEntry0( CALENDELETEUI_CONSTRUCTL_ENTRY );
hgs
parents: 45
diff changeset
   106
    
0
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   107
    iController.RegisterForNotificationsL( this, ECalenNotifyCancelDelete );
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   108
    iMoreEntriesToDelete = EFalse;
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   109
    iDisplayQuery = EFalse;
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   110
    iEntriesToDelete = KEntriesToDelete;
51
hgs
parents: 45
diff changeset
   111
    
hgs
parents: 45
diff changeset
   112
    OstTraceFunctionExit0( CALENDELETEUI_CONSTRUCTL_EXIT );
0
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
// ----------------------------------------------------------------------------
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   116
// CalenDeleteUi::HandleNotification
0
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   117
// Handles notifications.
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   118
// (other items were commented in a header).
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
//
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   121
void CalenDeleteUi::HandleNotification(const TCalenNotification aNotification )
0
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   122
    {
51
hgs
parents: 45
diff changeset
   123
    OstTraceFunctionEntry0( CALENDELETEUI_HANDLENOTIFICATION_ENTRY );
0
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   124
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   125
    if( aNotification == ECalenNotifyCancelDelete)
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   126
        {
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   127
        if(iMutlipleContextIdsCount)
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   128
            {
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   129
            // get the context
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   130
            MCalenContext& context = iController.context();
0
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   131
            // reset the multiple contexts
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   132
            context.resetMultipleContextIds();          
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   133
           
0
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
        }
51
hgs
parents: 45
diff changeset
   136
    
hgs
parents: 45
diff changeset
   137
    OstTraceFunctionExit0( CALENDELETEUI_HANDLENOTIFICATION_EXIT );
0
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
// ----------------------------------------------------------------------------
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   141
// CalenDeleteUi::HandleCommandL
0
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   142
// Handles action ui commands
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   143
// (other items were commented in a header).
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   144
// ----------------------------------------------------------------------------
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   145
//
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   146
TBool CalenDeleteUi::HandleCommandL( const TCalenCommand& aCommand )
0
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   147
    {
51
hgs
parents: 45
diff changeset
   148
    OstTraceFunctionEntry0( CALENDELETEUI_HANDLECOMMANDL_ENTRY );
hgs
parents: 45
diff changeset
   149
    
0
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   150
    TBool continueCommand(EFalse);
45
hgs
parents: 23
diff changeset
   151
    
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   152
    switch( aCommand.Command() )
0
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   153
        {
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   154
        case ECalenDeleteCurrentEntry:
45
hgs
parents: 23
diff changeset
   155
        	mDeleteCommand = ECalenDeleteCurrentEntry;
hgs
parents: 23
diff changeset
   156
        	DeleteCurrentEntryL(); // Entry & instance
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   157
            break;
0
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   158
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   159
        case ECalenDeleteSeries:
45
hgs
parents: 23
diff changeset
   160
        	mDeleteCommand = ECalenDeleteSeries;
hgs
parents: 23
diff changeset
   161
        	DeleteThisOrAllL( AgendaUtil::ThisAndAll );
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   162
            break;
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   163
            
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   164
        case ECalenDeleteCurrentOccurrence:
45
hgs
parents: 23
diff changeset
   165
        	mDeleteCommand = ECalenDeleteCurrentOccurrence;
hgs
parents: 23
diff changeset
   166
        	DeleteThisOrAllL( AgendaUtil::ThisOnly );
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   167
            break;
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   168
            
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   169
        case ECalenDeleteEntryWithoutQuery:
45
hgs
parents: 23
diff changeset
   170
        	//TODO:
hgs
parents: 23
diff changeset
   171
        	// This case is not handled currently as no such commands
hgs
parents: 23
diff changeset
   172
        	// has been issued. So this has to be handled once we start 
hgs
parents: 23
diff changeset
   173
        	// issuing the command. 
hgs
parents: 23
diff changeset
   174
        	/*continueCommand = DeleteEntryWithoutQueryL();*/
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   175
            break;
0
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   176
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   177
        case ECalenDeleteAllEntries:
45
hgs
parents: 23
diff changeset
   178
        	mDeleteCommand = ECalenDeleteAllEntries;
hgs
parents: 23
diff changeset
   179
        	DeleteAllEntriesL(); // EntryView & instance
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   180
            break;
0
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   181
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   182
        case ECalenDeleteEntriesBeforeDate:
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   183
            DeleteEntriesBeforeDateL(); // EntryView & instance
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   184
            break;
0
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   185
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   186
        default:
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   187
            // Controller decided this class was the place to handle this
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   188
            // command but it wasn't in our list; something has gone wrong.
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   189
            //ASSERT( EFalse );
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   190
            break;
0
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   191
        }
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   192
        
51
hgs
parents: 45
diff changeset
   193
    OstTraceFunctionExit0( CALENDELETEUI_HANDLECOMMANDL_EXIT );
0
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   194
    return continueCommand;
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   195
    }
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   196
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   197
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   198
// ----------------------------------------------------------------------------
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   199
// CalenDeleteUi::DeleteThisOrAllL
0
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   200
// Deletes series repeating entry
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   201
// (other items were commented in a header).
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   202
// ----------------------------------------------------------------------------
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   203
//
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   204
void CalenDeleteUi::DeleteThisOrAllL( AgendaUtil::RecurrenceRange aRepeatType )
45
hgs
parents: 23
diff changeset
   205
{
51
hgs
parents: 45
diff changeset
   206
    OstTraceFunctionEntry0( CALENDELETEUI_DELETETHISORALLL_ENTRY );
45
hgs
parents: 23
diff changeset
   207
hgs
parents: 23
diff changeset
   208
	if( iController.context().instanceId().mEntryLocalUid )
hgs
parents: 23
diff changeset
   209
	{
hgs
parents: 23
diff changeset
   210
		AgendaEntry instance = CalenActionUiUtils::findPossibleInstanceL(
hgs
parents: 23
diff changeset
   211
									iController.context().instanceId(),
hgs
parents: 23
diff changeset
   212
									iController.Services().agendaInterface() );
hgs
parents: 23
diff changeset
   213
		if( !instance.isNull() )
hgs
parents: 23
diff changeset
   214
		{
hgs
parents: 23
diff changeset
   215
			DeleteSingleInstanceL( instance, aRepeatType );
hgs
parents: 23
diff changeset
   216
		}
hgs
parents: 23
diff changeset
   217
	}
51
hgs
parents: 45
diff changeset
   218
	
hgs
parents: 45
diff changeset
   219
	OstTraceFunctionExit0( CALENDELETEUI_DELETETHISORALLL_EXIT );
45
hgs
parents: 23
diff changeset
   220
}
0
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   221
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   222
// ----------------------------------------------------------------------------
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   223
// CalenDeleteUi::DeleteEntryWithoutQueryL()
0
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   224
// Deletes the current entry
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   225
// (other items were commented in a header).
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   226
// ----------------------------------------------------------------------------
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   227
//
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   228
TBool CalenDeleteUi::DeleteEntryWithoutQueryL()
0
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   229
    {
51
hgs
parents: 45
diff changeset
   230
    OstTraceFunctionEntry0( CALENDELETEUI_DELETEENTRYWITHOUTQUERYL_ENTRY );
hgs
parents: 45
diff changeset
   231
    
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   232
	bool continueCommand(EFalse);
0
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   233
    
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   234
	// get the context
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   235
	MCalenContext& context = iController.context();
0
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   236
	
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   237
	// get the multliple context ids count
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   238
	iMutlipleContextIdsCount = context.mutlipleContextIdsCount();
0
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   239
	
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   240
	ASSERT( iMutlipleContextIdsCount );
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   241
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   242
	    if(!iMoreEntriesToDelete)
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   243
		    {
45
hgs
parents: 23
diff changeset
   244
		    //iDisplayQuery = ShowMultipleEntriesDeleteQueryL(iMutlipleContextIdsCount);
0
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   245
		    }
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   246
		
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   247
		if(iDisplayQuery)
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   248
			{
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   249
			if(!iMoreEntriesToDelete)	
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   250
			    {
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   251
			    DisplayWaitDialogL();
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   252
			    }
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   253
			// get the multiple context instance ids
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   254
			QList<TCalenInstanceId>& multipleContextIds = context.getMutlipleContextIds();
0
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   255
			
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   256
			if(iMutlipleContextIdsCount <= iEntriesToDelete )
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   257
			    {
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   258
			    iMoreEntriesToDelete = EFalse; 
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   259
			    iEntriesToDelete = iMutlipleContextIdsCount;
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   260
			    }
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   261
			else
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   262
			    {
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   263
			    iMoreEntriesToDelete = ETrue;
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   264
	            // set the continue command flag if more entries are there to delete
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   265
			    continueCommand = ETrue;
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
			TInt index(0);
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   269
			while(index<iEntriesToDelete)
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   270
			    {
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   271
			    // get the local uid of the entry through multiple context list
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   272
			    ulong entryLocalUid = multipleContextIds[0].mEntryLocalUid;
0
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   273
			    if(entryLocalUid)
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   274
			        {
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   275
			        DeleteEntryL(entryLocalUid);
0
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   276
			        }
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   277
			    // remove mutliple context based on the instanceid
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   278
			    context.removeMultipleContextId(multipleContextIds[0]);
0
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   279
			    index++;
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   280
			   }
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   281
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   282
			if(!iMoreEntriesToDelete)
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   283
			    {
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   284
			    MarkedEntriesDeletedL();    
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   285
			    }
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   286
			}
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   287
        else
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   288
            {
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   289
            context.resetMultipleContextIds();
0
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   290
            // notify delete failed
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   291
            iController.BroadcastNotification(ECalenNotifyDeleteFailed);    
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   292
            }
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   293
	
51
hgs
parents: 45
diff changeset
   294
    OstTraceFunctionExit0( CALENDELETEUI_DELETEENTRYWITHOUTQUERYL_EXIT );
0
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   295
    return continueCommand;
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   296
    }
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   297
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   298
// ----------------------------------------------------------------------------
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   299
// CalenDeleteUi::DeleteCurrentEntryL
0
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   300
// Deletes the current entry
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   301
// (other items were commented in a header).
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   302
// ----------------------------------------------------------------------------
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   303
//
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   304
void CalenDeleteUi::DeleteCurrentEntryL()
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   305
{
51
hgs
parents: 45
diff changeset
   306
    OstTraceFunctionEntry0( CALENDELETEUI_DELETECURRENTENTRYL_ENTRY );
hgs
parents: 45
diff changeset
   307
    
45
hgs
parents: 23
diff changeset
   308
	// Make sure we're focused on an entry.
hgs
parents: 23
diff changeset
   309
	if (iController.context().instanceId().mEntryLocalUid) {
hgs
parents: 23
diff changeset
   310
		// Fetch the entry
hgs
parents: 23
diff changeset
   311
		AgendaEntry entry = iController.Services().agendaInterface()->fetchById(
hgs
parents: 23
diff changeset
   312
				iController.context().instanceId().mEntryLocalUid);
hgs
parents: 23
diff changeset
   313
			// Check if the entry is a To-Do
hgs
parents: 23
diff changeset
   314
			if (AgendaEntry::TypeTodo == entry.type()) {
hgs
parents: 23
diff changeset
   315
				showDeleteQuery(EDeleteToDo);
hgs
parents: 23
diff changeset
   316
			} else {
hgs
parents: 23
diff changeset
   317
				// Show the repeat entry delete query for repeating entries except Anniversary
hgs
parents: 23
diff changeset
   318
				// Even though the anniversary is repeating 
hgs
parents: 23
diff changeset
   319
				// all the instances will be deleted
hgs
parents: 23
diff changeset
   320
				if ((entry.isRepeating() || !entry.recurrenceId().isNull()) 
hgs
parents: 23
diff changeset
   321
							&& (AgendaEntry::TypeAnniversary != entry.type())) {
hgs
parents: 23
diff changeset
   322
					// Show a confirmation note whether the user
hgs
parents: 23
diff changeset
   323
					// wants to delete the single instance or all of them
hgs
parents: 23
diff changeset
   324
					showRepeatingEntryDeleteQuery();
57
hgs
parents: 55
diff changeset
   325
				} else if (CalenAgendaUtils::isAlldayEvent(entry)) {
hgs
parents: 55
diff changeset
   326
					showDeleteQuery(EDeleteEvent);
45
hgs
parents: 23
diff changeset
   327
				} else {
hgs
parents: 23
diff changeset
   328
					// If the entry is not a repeating entry,
hgs
parents: 23
diff changeset
   329
					// delete it directly
hgs
parents: 23
diff changeset
   330
					// Save the entry for later reference in the slot
hgs
parents: 23
diff changeset
   331
					showDeleteQuery(EDeleteEntry);
hgs
parents: 23
diff changeset
   332
				}
hgs
parents: 23
diff changeset
   333
			}
hgs
parents: 23
diff changeset
   334
	}
51
hgs
parents: 45
diff changeset
   335
	OstTraceFunctionExit0( CALENDELETEUI_DELETECURRENTENTRYL_EXIT );
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   336
}
0
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   337
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   338
// ----------------------------------------------------------------------------
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   339
// CalenDeleteUi::DeleteAllEntriesL
0
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   340
// Deletes all entries
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   341
// (other items were commented in a header).
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   342
// ----------------------------------------------------------------------------
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   343
//
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   344
void CalenDeleteUi::DeleteAllEntriesL()
0
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   345
    {
51
hgs
parents: 45
diff changeset
   346
    OstTraceFunctionEntry0( CALENDELETEUI_DELETEALLENTRIESL_ENTRY );
hgs
parents: 45
diff changeset
   347
    
45
hgs
parents: 23
diff changeset
   348
	if(iIsDeleting) {
51
hgs
parents: 45
diff changeset
   349
		OstTraceFunctionExit0( CALENDELETEUI_DELETEALLENTRIESL_EXIT );
45
hgs
parents: 23
diff changeset
   350
		return;
hgs
parents: 23
diff changeset
   351
	}
0
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   352
45
hgs
parents: 23
diff changeset
   353
    showDeleteQuery(EDeleteAll );
51
hgs
parents: 45
diff changeset
   354
	OstTraceFunctionExit0( DUP1_CALENDELETEUI_DELETEALLENTRIESL_EXIT );
45
hgs
parents: 23
diff changeset
   355
	}
0
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   356
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   357
// ----------------------------------------------------------------------------
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   358
// CalenDeleteUi::DeleteEntriesBeforeDateL
0
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   359
// Deletes all entries before a set date.
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   360
// (other items were commented in a header).
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   361
// ----------------------------------------------------------------------------
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   362
//
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   363
void CalenDeleteUi::DeleteEntriesBeforeDateL()
0
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   364
    {
51
hgs
parents: 45
diff changeset
   365
    OstTraceFunctionEntry0( CALENDELETEUI_DELETEENTRIESBEFOREDATEL_ENTRY );
hgs
parents: 45
diff changeset
   366
    
45
hgs
parents: 23
diff changeset
   367
	if(iIsDeleting) {
51
hgs
parents: 45
diff changeset
   368
		OstTraceFunctionExit0( CALENDELETEUI_DELETEENTRIESBEFOREDATEL_EXIT );
45
hgs
parents: 23
diff changeset
   369
		return;
hgs
parents: 23
diff changeset
   370
	}    
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   371
    // launch the datepicker
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   372
    dateQuery();
51
hgs
parents: 45
diff changeset
   373
    OstTraceFunctionExit0( DUP1_CALENDELETEUI_DELETEENTRIESBEFOREDATEL_EXIT );
0
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   374
    }
45
hgs
parents: 23
diff changeset
   375
hgs
parents: 23
diff changeset
   376
// ----------------------------------------------------------------------------
hgs
parents: 23
diff changeset
   377
// CalenDeleteUi::dateQuery
hgs
parents: 23
diff changeset
   378
// Launches the popup for the date selection
hgs
parents: 23
diff changeset
   379
// (other items were commented in a header).
hgs
parents: 23
diff changeset
   380
// ----------------------------------------------------------------------------
hgs
parents: 23
diff changeset
   381
//
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   382
void CalenDeleteUi::dateQuery()
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   383
	{
51
hgs
parents: 45
diff changeset
   384
    OstTraceFunctionEntry0( CALENDELETEUI_DATEQUERY_ENTRY );
hgs
parents: 45
diff changeset
   385
    
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   386
	// Create a popup with datepicker to select the date.
45
hgs
parents: 23
diff changeset
   387
	HbDialog *popUp = new HbDialog();
hgs
parents: 23
diff changeset
   388
	popUp->setDismissPolicy(HbDialog::NoDismiss);
hgs
parents: 23
diff changeset
   389
	popUp->setTimeout(HbDialog::NoTimeout );
hgs
parents: 23
diff changeset
   390
	popUp->setAttribute( Qt::WA_DeleteOnClose, true );
hgs
parents: 23
diff changeset
   391
	popUp->setHeadingWidget(new HbLabel(hbTrId("txt_calendar_title_set_date")));
hgs
parents: 23
diff changeset
   392
	
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   393
	QDateTime currentDateTime(CalenDateUtils::today());
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   394
	QDate currentDate(currentDateTime.date());
45
hgs
parents: 23
diff changeset
   395
	if(mDatePicker) {
hgs
parents: 23
diff changeset
   396
		mDatePicker = NULL;
hgs
parents: 23
diff changeset
   397
	}
hgs
parents: 23
diff changeset
   398
	mDatePicker = new  HbDateTimePicker(popUp);
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   399
	mDatePicker->setMinimumDate(CalenDateUtils::minTime().date());
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   400
	mDatePicker->setMaximumDate(currentDate);
45
hgs
parents: 23
diff changeset
   401
	mDatePicker->setDate(currentDate);
hgs
parents: 23
diff changeset
   402
hgs
parents: 23
diff changeset
   403
	popUp->setContentWidget(mDatePicker);  
hgs
parents: 23
diff changeset
   404
	mDeleteAction = new HbAction(
55
hgs
parents: 51
diff changeset
   405
						hbTrId("txt_common_button_delete"), popUp);
45
hgs
parents: 23
diff changeset
   406
	popUp->addAction(mDeleteAction);
hgs
parents: 23
diff changeset
   407
	mCancelAction = new HbAction(hbTrId("txt_common_button_cancel"),popUp);
hgs
parents: 23
diff changeset
   408
	popUp->addAction(mCancelAction);
hgs
parents: 23
diff changeset
   409
	// Show the popup
hgs
parents: 23
diff changeset
   410
	popUp->open(this, SLOT(handleDateQuery(HbAction*)));
51
hgs
parents: 45
diff changeset
   411
	
hgs
parents: 45
diff changeset
   412
	OstTraceFunctionExit0( CALENDELETEUI_DATEQUERY_EXIT );
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   413
	}
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   414
45
hgs
parents: 23
diff changeset
   415
// ----------------------------------------------------------------------------
hgs
parents: 23
diff changeset
   416
// CalenDeleteUi::handleDateQuery
hgs
parents: 23
diff changeset
   417
// Handles the selection for the date query
hgs
parents: 23
diff changeset
   418
// (other items were commented in a header).
hgs
parents: 23
diff changeset
   419
// ----------------------------------------------------------------------------
hgs
parents: 23
diff changeset
   420
//
hgs
parents: 23
diff changeset
   421
void CalenDeleteUi::handleDateQuery(HbAction* action)
hgs
parents: 23
diff changeset
   422
{
51
hgs
parents: 45
diff changeset
   423
    OstTraceFunctionEntry0( CALENDELETEUI_HANDLEDATEQUERY_ENTRY );
hgs
parents: 45
diff changeset
   424
    
45
hgs
parents: 23
diff changeset
   425
	if(action == mDeleteAction) {
hgs
parents: 23
diff changeset
   426
		// User selected the date before which all the entries has to be deleted
hgs
parents: 23
diff changeset
   427
		QDate selectedDate(mDatePicker->date());
hgs
parents: 23
diff changeset
   428
		// Check if the date is within the range.
hgs
parents: 23
diff changeset
   429
		if(selectedDate.isValid()) {
hgs
parents: 23
diff changeset
   430
			QTime time(0,0,0,0);
hgs
parents: 23
diff changeset
   431
			QDateTime dateTime;
hgs
parents: 23
diff changeset
   432
			dateTime.setDate(selectedDate);
hgs
parents: 23
diff changeset
   433
			dateTime.setTime(time);
hgs
parents: 23
diff changeset
   434
			// Do delete only if inputted day is after beginning of range
hgs
parents: 23
diff changeset
   435
			if(dateTime > AgendaUtil::minTime()) {
hgs
parents: 23
diff changeset
   436
				// Two pass delete:
hgs
parents: 23
diff changeset
   437
				// 1. pass
hgs
parents: 23
diff changeset
   438
				// To prevent destroying entries starting and ending midnight
hgs
parents: 23
diff changeset
   439
				// subtract one second and do delete on that range.
hgs
parents: 23
diff changeset
   440
				dateTime = dateTime.addSecs(-1);
hgs
parents: 23
diff changeset
   441
				dateTime = ( dateTime > AgendaUtil::minTime()? 
hgs
parents: 23
diff changeset
   442
											dateTime :  AgendaUtil::minTime());
hgs
parents: 23
diff changeset
   443
hgs
parents: 23
diff changeset
   444
				HandleDeleteMultipleEventsL( AgendaUtil::minTime(), 
hgs
parents: 23
diff changeset
   445
																 dateTime, 1);
hgs
parents: 23
diff changeset
   446
			}else {
hgs
parents: 23
diff changeset
   447
				iController.BroadcastNotification(ECalenNotifyDeleteFailed);
hgs
parents: 23
diff changeset
   448
			}
hgs
parents: 23
diff changeset
   449
		}
hgs
parents: 23
diff changeset
   450
	}else {
hgs
parents: 23
diff changeset
   451
		// User pressed cancel
hgs
parents: 23
diff changeset
   452
		handleDeleteCancel();
hgs
parents: 23
diff changeset
   453
	}
hgs
parents: 23
diff changeset
   454
	// Reset the member variables
hgs
parents: 23
diff changeset
   455
	mDeleteAction = NULL;
hgs
parents: 23
diff changeset
   456
	mCancelAction = NULL;
51
hgs
parents: 45
diff changeset
   457
	
hgs
parents: 45
diff changeset
   458
	OstTraceFunctionExit0( CALENDELETEUI_HANDLEDATEQUERY_EXIT );
45
hgs
parents: 23
diff changeset
   459
}
hgs
parents: 23
diff changeset
   460
// ----------------------------------------------------------------------------
hgs
parents: 23
diff changeset
   461
// CalenDeleteUi::showRepeatingEntryDeleteQuery
hgs
parents: 23
diff changeset
   462
// Launches the popup for deleting the repeating entry
hgs
parents: 23
diff changeset
   463
// (other items were commented in a header).
hgs
parents: 23
diff changeset
   464
// ----------------------------------------------------------------------------
hgs
parents: 23
diff changeset
   465
//
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   466
void CalenDeleteUi::showRepeatingEntryDeleteQuery()
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   467
{
51
hgs
parents: 45
diff changeset
   468
    OstTraceFunctionEntry0( CALENDELETEUI_SHOWREPEATINGENTRYDELETEQUERY_ENTRY );
hgs
parents: 45
diff changeset
   469
    
45
hgs
parents: 23
diff changeset
   470
    HbDialog *popUp = new HbDialog();
hgs
parents: 23
diff changeset
   471
    popUp->setDismissPolicy(HbDialog::NoDismiss);
hgs
parents: 23
diff changeset
   472
    popUp->setTimeout(HbDialog::NoTimeout);
hgs
parents: 23
diff changeset
   473
    popUp->setAttribute( Qt::WA_DeleteOnClose, true );
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   474
    
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   475
    QGraphicsLinearLayout *layout = new QGraphicsLinearLayout(Qt::Vertical);
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   476
    HbWidget *editWidget = new HbWidget();
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   477
    editWidget->setLayout(layout);
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   478
    
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   479
    HbRadioButtonList *editButtonList = new HbRadioButtonList();
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   480
    
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   481
    QStringList list;
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   482
    list << hbTrId("txt_calendar_info_this_occurrence_only")
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   483
    		<< hbTrId("txt_calendar_info_all_occurences");
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   484
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   485
    editButtonList->setItems(list);
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   486
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   487
    layout->addItem(editButtonList);
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   488
    
45
hgs
parents: 23
diff changeset
   489
    popUp->setContentWidget(editWidget);
hgs
parents: 23
diff changeset
   490
    popUp->setHeadingWidget(new HbLabel(
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   491
						hbTrId("txt_calendar_title_delete_repeated_entry")));
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   492
45
hgs
parents: 23
diff changeset
   493
    // Add cancel action
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   494
    HbAction *cancelAction = new HbAction(
55
hgs
parents: 51
diff changeset
   495
							hbTrId("txt_common_button_cancel_singledialog"));
45
hgs
parents: 23
diff changeset
   496
    popUp->addAction(cancelAction);
hgs
parents: 23
diff changeset
   497
    connect(editButtonList, SIGNAL(itemSelected(int)), this,
hgs
parents: 23
diff changeset
   498
										SLOT(handleRepeatedEntryDelete(int)));
hgs
parents: 23
diff changeset
   499
    connect(editButtonList, SIGNAL(itemSelected(int)), popUp, SLOT(close()));
hgs
parents: 23
diff changeset
   500
    connect(cancelAction, SIGNAL(triggered()), this, 
hgs
parents: 23
diff changeset
   501
										SLOT(handleDeleteCancel()));
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   502
    
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   503
    // Show the popup
45
hgs
parents: 23
diff changeset
   504
    popUp->open();
51
hgs
parents: 45
diff changeset
   505
    
hgs
parents: 45
diff changeset
   506
    OstTraceFunctionExit0( CALENDELETEUI_SHOWREPEATINGENTRYDELETEQUERY_EXIT );
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   507
}
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   508
45
hgs
parents: 23
diff changeset
   509
// ----------------------------------------------------------------------------
hgs
parents: 23
diff changeset
   510
// CalenDeleteUi::handleDeleteCancel
hgs
parents: 23
diff changeset
   511
// Handles the cancel action
hgs
parents: 23
diff changeset
   512
// (other items were commented in a header).
hgs
parents: 23
diff changeset
   513
// ----------------------------------------------------------------------------
hgs
parents: 23
diff changeset
   514
//
hgs
parents: 23
diff changeset
   515
void CalenDeleteUi::handleDeleteCancel()
hgs
parents: 23
diff changeset
   516
{
51
hgs
parents: 45
diff changeset
   517
    OstTraceFunctionEntry0( CALENDELETEUI_HANDLEDELETECANCEL_ENTRY );
hgs
parents: 45
diff changeset
   518
    
45
hgs
parents: 23
diff changeset
   519
	iController.BroadcastNotification(ECalenNotifyDeleteFailed);
51
hgs
parents: 45
diff changeset
   520
	
hgs
parents: 45
diff changeset
   521
	OstTraceFunctionExit0( CALENDELETEUI_HANDLEDELETECANCEL_EXIT );
45
hgs
parents: 23
diff changeset
   522
}
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   523
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   524
void CalenDeleteUi::handleRepeatedEntryDelete(int index)
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   525
{
51
hgs
parents: 45
diff changeset
   526
    OstTraceFunctionEntry0( CALENDELETEUI_HANDLEREPEATEDENTRYDELETE_ENTRY );
hgs
parents: 45
diff changeset
   527
    
45
hgs
parents: 23
diff changeset
   528
	// Fetch the entry
hgs
parents: 23
diff changeset
   529
	// Find all possible instances
hgs
parents: 23
diff changeset
   530
	AgendaEntry instance = CalenActionUiUtils::findPossibleInstanceL(
hgs
parents: 23
diff changeset
   531
									iController.context().instanceId(),
hgs
parents: 23
diff changeset
   532
									iController.Services().agendaInterface());
hgs
parents: 23
diff changeset
   533
hgs
parents: 23
diff changeset
   534
	if (!instance.isNull()) {
hgs
parents: 23
diff changeset
   535
		connect(iController.Services().agendaInterface(), 
hgs
parents: 23
diff changeset
   536
									SIGNAL(entryDeleted(ulong)),
hgs
parents: 23
diff changeset
   537
									this, SLOT(entryDeleted(ulong)));
hgs
parents: 23
diff changeset
   538
		switch(index) {
hgs
parents: 23
diff changeset
   539
			case 0:
hgs
parents: 23
diff changeset
   540
				// User wants to delete only this occurence
hgs
parents: 23
diff changeset
   541
				iController.Services().agendaInterface()->deleteRepeatedEntry(
hgs
parents: 23
diff changeset
   542
									instance, AgendaUtil::ThisOnly);
hgs
parents: 23
diff changeset
   543
				break;
hgs
parents: 23
diff changeset
   544
			case 1:
hgs
parents: 23
diff changeset
   545
				// User wants to delete all the occurences
hgs
parents: 23
diff changeset
   546
				iController.Services().agendaInterface()->deleteRepeatedEntry(
hgs
parents: 23
diff changeset
   547
									instance, AgendaUtil::ThisAndAll);
hgs
parents: 23
diff changeset
   548
				break;
hgs
parents: 23
diff changeset
   549
		}
57
hgs
parents: 55
diff changeset
   550
	}else {
hgs
parents: 55
diff changeset
   551
	    iController.BroadcastNotification(ECalenNotifyDeleteFailed);
45
hgs
parents: 23
diff changeset
   552
	}
51
hgs
parents: 45
diff changeset
   553
	OstTraceFunctionExit0( CALENDELETEUI_HANDLEREPEATEDENTRYDELETE_EXIT );
45
hgs
parents: 23
diff changeset
   554
}
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   555
45
hgs
parents: 23
diff changeset
   556
// ----------------------------------------------------------------------------
hgs
parents: 23
diff changeset
   557
// CalenDeleteUi::showDeleteQuery
hgs
parents: 23
diff changeset
   558
// Launches the popup for deleting the instance/instances
hgs
parents: 23
diff changeset
   559
// (other items were commented in a header).
hgs
parents: 23
diff changeset
   560
// ----------------------------------------------------------------------------
hgs
parents: 23
diff changeset
   561
//
hgs
parents: 23
diff changeset
   562
void CalenDeleteUi::showDeleteQuery(const TDeleteConfirmationType type,
hgs
parents: 23
diff changeset
   563
                                                     const int count)
hgs
parents: 23
diff changeset
   564
    {
51
hgs
parents: 45
diff changeset
   565
    OstTraceFunctionEntry0( CALENDELETEUI_SHOWDELETEQUERY_ENTRY );
hgs
parents: 45
diff changeset
   566
    
45
hgs
parents: 23
diff changeset
   567
    HbMessageBox *popup = new HbMessageBox(HbMessageBox::MessageTypeQuestion);
hgs
parents: 23
diff changeset
   568
    popup->setDismissPolicy(HbDialog::NoDismiss);
hgs
parents: 23
diff changeset
   569
    popup->setTimeout(HbDialog::NoTimeout);
hgs
parents: 23
diff changeset
   570
    popup->setAttribute( Qt::WA_DeleteOnClose, true );
hgs
parents: 23
diff changeset
   571
    
hgs
parents: 23
diff changeset
   572
    QString text = 0;
hgs
parents: 23
diff changeset
   573
    
hgs
parents: 23
diff changeset
   574
    switch(type)
hgs
parents: 23
diff changeset
   575
        {
hgs
parents: 23
diff changeset
   576
        case EDeleteEntry:
hgs
parents: 23
diff changeset
   577
            {
hgs
parents: 23
diff changeset
   578
            text.append(hbTrId("txt_calendar_info_delete_meeting"));
hgs
parents: 23
diff changeset
   579
            break;
hgs
parents: 23
diff changeset
   580
            }
hgs
parents: 23
diff changeset
   581
        case EDeleteToDo:
hgs
parents: 23
diff changeset
   582
            {
hgs
parents: 23
diff changeset
   583
            text.append(hbTrId("txt_calendar_info_delete_todo_note"));
hgs
parents: 23
diff changeset
   584
            break;
hgs
parents: 23
diff changeset
   585
            }
hgs
parents: 23
diff changeset
   586
        case EDeleteToDos:
hgs
parents: 23
diff changeset
   587
            {//"Delete %N to-do notes?"
hgs
parents: 23
diff changeset
   588
            // TODO: Add the text id
hgs
parents: 23
diff changeset
   589
            text.append("Delete %N to-do's?").arg(count);
hgs
parents: 23
diff changeset
   590
            break;
hgs
parents: 23
diff changeset
   591
            }
hgs
parents: 23
diff changeset
   592
        case EDeleteAll:
hgs
parents: 23
diff changeset
   593
            {
hgs
parents: 23
diff changeset
   594
            text.append(hbTrId("txt_calendar_info_delete_all_calendar_entries"));
hgs
parents: 23
diff changeset
   595
            break;
hgs
parents: 23
diff changeset
   596
            }
57
hgs
parents: 55
diff changeset
   597
        case EDeleteEvent:
hgs
parents: 55
diff changeset
   598
            {
hgs
parents: 55
diff changeset
   599
            text.append(hbTrId("txt_calendar_info_delete_allday_event"));
hgs
parents: 55
diff changeset
   600
            break;
hgs
parents: 55
diff changeset
   601
            }
45
hgs
parents: 23
diff changeset
   602
        default:
hgs
parents: 23
diff changeset
   603
            break;
hgs
parents: 23
diff changeset
   604
        }
hgs
parents: 23
diff changeset
   605
    
hgs
parents: 23
diff changeset
   606
    popup->setText(text);
hgs
parents: 23
diff changeset
   607
    	
hgs
parents: 23
diff changeset
   608
    QList<QAction*> list = popup->actions();
hgs
parents: 23
diff changeset
   609
    for(int i=0; i < list.count(); i++)
hgs
parents: 23
diff changeset
   610
        {
hgs
parents: 23
diff changeset
   611
        popup->removeAction(list[i]);
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   612
        }
45
hgs
parents: 23
diff changeset
   613
    mDeleteAction = new HbAction(
55
hgs
parents: 51
diff changeset
   614
						hbTrId("txt_common_button_delete"), popup);
45
hgs
parents: 23
diff changeset
   615
    popup->addAction(mDeleteAction);
51
hgs
parents: 45
diff changeset
   616
    mCancelAction = new HbAction(hbTrId("txt_common_button_cancel"), popup); 
45
hgs
parents: 23
diff changeset
   617
    popup->addAction(mCancelAction);
hgs
parents: 23
diff changeset
   618
    popup->open(this, SLOT(handleDeletion(HbAction*)));
51
hgs
parents: 45
diff changeset
   619
    
hgs
parents: 45
diff changeset
   620
    OstTraceFunctionExit0( CALENDELETEUI_SHOWDELETEQUERY_EXIT );
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   621
    }
45
hgs
parents: 23
diff changeset
   622
hgs
parents: 23
diff changeset
   623
// ----------------------------------------------------------------------------
hgs
parents: 23
diff changeset
   624
// CalenDeleteUi::handleDeletion
hgs
parents: 23
diff changeset
   625
// Deletes the entries based on the user selection
hgs
parents: 23
diff changeset
   626
// (other items were commented in a header).
hgs
parents: 23
diff changeset
   627
// ----------------------------------------------------------------------------
hgs
parents: 23
diff changeset
   628
//
hgs
parents: 23
diff changeset
   629
void CalenDeleteUi::handleDeletion(HbAction* action)
hgs
parents: 23
diff changeset
   630
{
51
hgs
parents: 45
diff changeset
   631
    OstTraceFunctionEntry0( CALENDELETEUI_HANDLEDELETION_ENTRY );
hgs
parents: 45
diff changeset
   632
    
45
hgs
parents: 23
diff changeset
   633
	TCalenNotification notification = ECalenNotifyDeleteFailed;
hgs
parents: 23
diff changeset
   634
	
hgs
parents: 23
diff changeset
   635
	if(action == mDeleteAction) {
hgs
parents: 23
diff changeset
   636
		
hgs
parents: 23
diff changeset
   637
		switch (mDeleteCommand) {
hgs
parents: 23
diff changeset
   638
			
hgs
parents: 23
diff changeset
   639
			case ECalenDeleteCurrentEntry:
hgs
parents: 23
diff changeset
   640
			{
hgs
parents: 23
diff changeset
   641
				// Get the entry id
hgs
parents: 23
diff changeset
   642
				ulong id = iController.context().instanceId().mEntryLocalUid;
hgs
parents: 23
diff changeset
   643
				connect(iController.Services().agendaInterface(), 
hgs
parents: 23
diff changeset
   644
												SIGNAL(entryDeleted(ulong)),
hgs
parents: 23
diff changeset
   645
												this, SLOT(entryDeleted(ulong)));
hgs
parents: 23
diff changeset
   646
				// Delete the entry if the delete button is been pressed
hgs
parents: 23
diff changeset
   647
				iController.Services().agendaInterface()->deleteEntry(id);
hgs
parents: 23
diff changeset
   648
			}
hgs
parents: 23
diff changeset
   649
				break;
hgs
parents: 23
diff changeset
   650
			
hgs
parents: 23
diff changeset
   651
			case ECalenDeleteSeries:
hgs
parents: 23
diff changeset
   652
			case ECalenDeleteCurrentOccurrence:
hgs
parents: 23
diff changeset
   653
			{
hgs
parents: 23
diff changeset
   654
				AgendaEntry instance = 
hgs
parents: 23
diff changeset
   655
						CalenActionUiUtils::findPossibleInstanceL(
hgs
parents: 23
diff changeset
   656
								iController.context().instanceId(),
hgs
parents: 23
diff changeset
   657
								iController.Services().agendaInterface() );
hgs
parents: 23
diff changeset
   658
				if(!instance.isNull()) {
hgs
parents: 23
diff changeset
   659
					QDateTime recId = instance.recurrenceId().toUTC();
hgs
parents: 23
diff changeset
   660
					const bool child = recId.isNull();
hgs
parents: 23
diff changeset
   661
					connect(iController.Services().agendaInterface(), 
hgs
parents: 23
diff changeset
   662
					        SIGNAL(entryDeleted(ulong)),
hgs
parents: 23
diff changeset
   663
					        this, SLOT(entryDeleted(ulong)));
hgs
parents: 23
diff changeset
   664
					if( !child || mRecurrenceRange == AgendaUtil::ThisOnly 
hgs
parents: 23
diff changeset
   665
							|| mRecurrenceRange == AgendaUtil::ThisAndAll) {
hgs
parents: 23
diff changeset
   666
						iController.Services().agendaInterface()->deleteRepeatedEntry( 
hgs
parents: 23
diff changeset
   667
								instance, mRecurrenceRange );
hgs
parents: 23
diff changeset
   668
					}
57
hgs
parents: 55
diff changeset
   669
				}else {
hgs
parents: 55
diff changeset
   670
				    iController.BroadcastNotification(ECalenNotifyDeleteFailed); 
45
hgs
parents: 23
diff changeset
   671
				}
hgs
parents: 23
diff changeset
   672
			}
hgs
parents: 23
diff changeset
   673
				break;
hgs
parents: 23
diff changeset
   674
			
hgs
parents: 23
diff changeset
   675
			case ECalenDeleteAllEntries:
hgs
parents: 23
diff changeset
   676
			{
hgs
parents: 23
diff changeset
   677
				HandleDeleteMultipleEventsL( AgendaUtil::minTime(), 
hgs
parents: 23
diff changeset
   678
											AgendaUtil::maxTime(),1 );
hgs
parents: 23
diff changeset
   679
			}
hgs
parents: 23
diff changeset
   680
				break;
hgs
parents: 23
diff changeset
   681
			
hgs
parents: 23
diff changeset
   682
			default:
hgs
parents: 23
diff changeset
   683
				break;
hgs
parents: 23
diff changeset
   684
				
hgs
parents: 23
diff changeset
   685
		}
57
hgs
parents: 55
diff changeset
   686
	} else {
hgs
parents: 55
diff changeset
   687
		// If the user presses cancel button the notification will be
hgs
parents: 55
diff changeset
   688
		// ECalenNotifyDeleteFailed as default.
hgs
parents: 55
diff changeset
   689
		// Notify the status
hgs
parents: 55
diff changeset
   690
		iController.BroadcastNotification(notification);
45
hgs
parents: 23
diff changeset
   691
	}
hgs
parents: 23
diff changeset
   692
	
hgs
parents: 23
diff changeset
   693
	// Reset the member variables
hgs
parents: 23
diff changeset
   694
	mDeleteAction = NULL;
hgs
parents: 23
diff changeset
   695
	mCancelAction = NULL;
51
hgs
parents: 45
diff changeset
   696
	
hgs
parents: 45
diff changeset
   697
	OstTraceFunctionExit0( CALENDELETEUI_HANDLEDELETION_EXIT );
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   698
}
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   699
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   700
void CalenDeleteUi::entryDeleted(ulong id)
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   701
{
51
hgs
parents: 45
diff changeset
   702
    OstTraceFunctionEntry0( CALENDELETEUI_ENTRYDELETED_ENTRY );
hgs
parents: 45
diff changeset
   703
    
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   704
    if (iController.context().instanceId().mEntryLocalUid == id) {
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   705
        iController.BroadcastNotification(ECalenNotifyEntryDeleted);
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   706
    }
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   707
    disconnect(iController.Services().agendaInterface(), SIGNAL(entryDeleted(ulong)),
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   708
               this, SLOT(entryDeleted(ulong)));
51
hgs
parents: 45
diff changeset
   709
    
hgs
parents: 45
diff changeset
   710
    OstTraceFunctionExit0( CALENDELETEUI_ENTRYDELETED_EXIT );
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   711
}
0
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   712
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   713
// ----------------------------------------------------------------------------
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   714
// CalenDeleteUi::HandleDeleteMultipleEventsL
0
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   715
// Handles multiple delete events
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   716
// (other items were commented in a header).
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   717
// ----------------------------------------------------------------------------
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   718
//
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   719
void CalenDeleteUi::HandleDeleteMultipleEventsL( const QDateTime& aFirstDay,
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   720
                                                 const QDateTime& aLastDay,
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   721
                                                 int aConfNoteId )
0
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   722
    {
51
hgs
parents: 45
diff changeset
   723
    OstTraceFunctionEntry0( CALENDELETEUI_HANDLEDELETEMULTIPLEEVENTSL_ENTRY );
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   724
    
45
hgs
parents: 23
diff changeset
   725
	if(iIsDeleting) {
51
hgs
parents: 45
diff changeset
   726
		OstTraceFunctionExit0( CALENDELETEUI_HANDLEDELETEMULTIPLEEVENTSL_EXIT );
45
hgs
parents: 23
diff changeset
   727
		return;
hgs
parents: 23
diff changeset
   728
	}
0
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   729
    iConfirmationNoteId = aConfNoteId;
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   730
    
0
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   731
    DeleteDayRangeL( aFirstDay, aLastDay );
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   732
51
hgs
parents: 45
diff changeset
   733
    OstTraceFunctionExit0( DUP1_CALENDELETEUI_HANDLEDELETEMULTIPLEEVENTSL_EXIT );
0
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   734
    }
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   735
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   736
// ----------------------------------------------------------------------------
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   737
// CalenDeleteUi::DeleteDayRangeL
0
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   738
// Deletes all entries in a given range.
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   739
// (other items were commented in a header).
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   740
// ----------------------------------------------------------------------------
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   741
//
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   742
void CalenDeleteUi::DeleteDayRangeL( const QDateTime& aStart,
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   743
                                                      const QDateTime& aEnd )
0
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   744
    {
51
hgs
parents: 45
diff changeset
   745
    OstTraceFunctionEntry0( CALENDELETEUI_DELETEDAYRANGEL_ENTRY );
hgs
parents: 45
diff changeset
   746
    
0
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   747
    iStartTime = aStart;
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   748
    iEndTime = aEnd;
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   749
    
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   750
    iIsDeleting = ETrue;
0
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   751
    
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   752
    //AgendaUtil& agendaInterface = iController.agendaInterface();
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   753
    // Connect to the signal that gets generated when deletion is completed
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   754
    connect(iController.agendaInterface(), SIGNAL(entriesDeleted(int)), this,
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   755
            SLOT(doCompleted(int)));
23
fd30d51f876b Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 18
diff changeset
   756
    AgendaUtil::FilterFlags filter =
fd30d51f876b Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 18
diff changeset
   757
    	        AgendaUtil::FilterFlags(AgendaUtil::IncludeAnniversaries
fd30d51f876b Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 18
diff changeset
   758
    	                | AgendaUtil::IncludeAppointments
fd30d51f876b Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 18
diff changeset
   759
    	                | AgendaUtil::IncludeEvents
fd30d51f876b Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 18
diff changeset
   760
    	                | AgendaUtil::IncludeReminders
55
hgs
parents: 51
diff changeset
   761
    	                | AgendaUtil::IncludeIncompletedTodos
hgs
parents: 51
diff changeset
   762
    	                | AgendaUtil::IncludeCompletedTodos
hgs
parents: 51
diff changeset
   763
    	                | AgendaUtil::IncludeAnniversaries);
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   764
    // 1: First pass, delete all entries.
23
fd30d51f876b Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 18
diff changeset
   765
    iController.agendaInterface()->deleteEntries(iStartTime, iEndTime, filter);
0
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   766
51
hgs
parents: 45
diff changeset
   767
    OstTraceFunctionExit0( CALENDELETEUI_DELETEDAYRANGEL_EXIT );
0
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   768
    }
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   769
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   770
// ----------------------------------------------------------------------------
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   771
// CalenDeleteUi::DoCompletedL
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   772
// Handles delete callback
0
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   773
// (other items were commented in a header).
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   774
// ----------------------------------------------------------------------------
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   775
//
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   776
void CalenDeleteUi::doCompleted( int aFirstPassError )
0
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   777
    {
51
hgs
parents: 45
diff changeset
   778
    OstTraceFunctionEntry0( CALENDELETEUI_DOCOMPLETED_ENTRY );
0
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   779
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   780
    if( aFirstPassError == KErrNone )
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   781
        {
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   782
        // 2: Second pass, delete notes that end 00:00 of next day of iEndTime
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   783
        // We didn't delete them in first pass
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   784
        QDateTime nextMidnight = CalenDateUtils::beginningOfDay( iEndTime.addDays(1) );
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   785
        nextMidnight = ( nextMidnight < AgendaUtil::maxTime()? nextMidnight : AgendaUtil::maxTime() );
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   786
        PIM_TRAPD_HANDLE( deleteEntriesEndingAtMidnight( nextMidnight ) );
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   787
        }
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   788
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   789
    // 3. End deleting, close wait dialog, and show confirmation or error note
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   790
    iIsDeleting = EFalse;
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   791
    
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   792
    iController.BroadcastNotification( ECalenNotifyMultipleEntriesDeleted );
0
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   793
51
hgs
parents: 45
diff changeset
   794
    OstTraceFunctionExit0( CALENDELETEUI_DOCOMPLETED_EXIT );
0
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   795
    }
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   796
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   797
// ----------------------------------------------------------------------------
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   798
// CalenDeleteUi::DeleteEntriesEndingAtMidnightL
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   799
// Deletes entries ending at midnight on the given day
0
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   800
// (other items were commented in a header).
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   801
// ----------------------------------------------------------------------------
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   802
//
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   803
void CalenDeleteUi::deleteEntriesEndingAtMidnight( QDateTime aMidnight )
0
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   804
    {
51
hgs
parents: 45
diff changeset
   805
    OstTraceFunctionEntry0( CALENDELETEUI_DELETEENTRIESENDINGATMIDNIGHT_ENTRY );
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   806
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   807
    QDateTime start, end;
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   808
    QTime startTime(aMidnight.time());
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   809
    startTime.setHMS(startTime.hour(), startTime.minute() - 1,
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   810
                    startTime.second(), startTime.msec());
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   811
    start.setDate(aMidnight.date());
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   812
    start.setTime(startTime);
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   813
    
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   814
    end = aMidnight;
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   815
    
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   816
    QList<AgendaEntry> instances = iController.Services().agendaInterface()->fetchEntriesInRange( start, end );
0
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   817
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   818
    // 2. loop through them and delete those entries that end at midnight
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   819
    for( int i=0; i < instances.count(); ++i )
0
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   820
        {
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   821
        AgendaEntry entry = instances[i];
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   822
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   823
        // Checking that if entry ends at midnight, is quite clumsy, but here goes:
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   824
        // EndsAtStartOfDay takes only CCalInstance, but here we mimic EndsAtStartOfDay
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   825
        // for CCalEntry type.
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   826
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   827
        // First check that if _instance_ ends at midnight, but starts earlier
45
hgs
parents: 23
diff changeset
   828
        if( CalenAgendaUtils::endsAtStartOfDay( entry, aMidnight ) )
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   829
            {
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   830
            // Second, check that _entry's_ endtime is exactly the midnight
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   831
            // This prevents us from destroying repeating entries, that has one
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   832
            // instance falling on given midnight.
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   833
            if( entry.endTime() == aMidnight )
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   834
                {
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   835
                iController.Services().agendaInterface()->deleteRepeatedEntry(entry, AgendaUtil::ThisAndAll);
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   836
                }
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   837
            }
0
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   838
        }
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   839
51
hgs
parents: 45
diff changeset
   840
    OstTraceFunctionExit0( CALENDELETEUI_DELETEENTRIESENDINGATMIDNIGHT_EXIT );
0
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   841
    }
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   842
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   843
// -----------------------------------------------------------------------------
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   844
// CalenDeleteUi::DeleteSingleInstanceL
0
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   845
// Delete the given instance. Ask the user whether to delete the series or the instance.
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   846
// (other items were commented in a header).
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   847
// -----------------------------------------------------------------------------
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   848
//
45
hgs
parents: 23
diff changeset
   849
void CalenDeleteUi::DeleteSingleInstanceL( AgendaEntry& aInstance )
0
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   850
    {
51
hgs
parents: 45
diff changeset
   851
    OstTraceFunctionEntry0( CALENDELETEUI_DELETESINGLEINSTANCEL_ENTRY );
hgs
parents: 45
diff changeset
   852
    
45
hgs
parents: 23
diff changeset
   853
    DoDeleteSingleInstanceL( aInstance, EFalse, AgendaUtil::ThisAndAll );
51
hgs
parents: 45
diff changeset
   854
    
hgs
parents: 45
diff changeset
   855
    OstTraceFunctionExit0( CALENDELETEUI_DELETESINGLEINSTANCEL_EXIT );
0
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   856
    }
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   857
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   858
// -----------------------------------------------------------------------------
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   859
// CalenDeleteUi::DeleteSingleInstanceL
0
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   860
// Delete the given instance. Delete the entry range given by aRepeatType.
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   861
// (other items were commented in a header).
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   862
// -----------------------------------------------------------------------------
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   863
//
45
hgs
parents: 23
diff changeset
   864
void CalenDeleteUi::DeleteSingleInstanceL( AgendaEntry& aInstance, 
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   865
                                AgendaUtil::RecurrenceRange aRepeatType )
0
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   866
    {
51
hgs
parents: 45
diff changeset
   867
    OstTraceFunctionEntry0( DUP1_CALENDELETEUI_DELETESINGLEINSTANCEL_ENTRY );
hgs
parents: 45
diff changeset
   868
    
45
hgs
parents: 23
diff changeset
   869
    DoDeleteSingleInstanceL( aInstance, ETrue, aRepeatType );
hgs
parents: 23
diff changeset
   870
    
51
hgs
parents: 45
diff changeset
   871
    OstTraceFunctionExit0( DUP1_CALENDELETEUI_DELETESINGLEINSTANCEL_EXIT );
0
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   872
    }
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   873
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   874
// -----------------------------------------------------------------------------
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   875
// CalenDeleteUi::DoDeleteSingleInstanceL
0
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   876
// Performs the deletion of the instance. If aHasRepeatType is EFalse, the user
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   877
// is prompted to delete either the instance or the entire series. In this case,
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   878
// aRepeatType is ignored. If aHasRepeatType is ETrue, aRepeatType determines
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   879
// whether to delete the instance or the entire series.
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   880
// (other items were commented in a header).
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   881
// -----------------------------------------------------------------------------
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   882
//
45
hgs
parents: 23
diff changeset
   883
void CalenDeleteUi::DoDeleteSingleInstanceL(
hgs
parents: 23
diff changeset
   884
									AgendaEntry& aInstance,
hgs
parents: 23
diff changeset
   885
									bool aHasRepeatType,
hgs
parents: 23
diff changeset
   886
									AgendaUtil::RecurrenceRange aRepeatType )
hgs
parents: 23
diff changeset
   887
{
51
hgs
parents: 45
diff changeset
   888
    OstTraceFunctionEntry0( CALENDELETEUI_DODELETESINGLEINSTANCEL_ENTRY );
hgs
parents: 45
diff changeset
   889
    
45
hgs
parents: 23
diff changeset
   890
	bool repeating = aInstance.isRepeating();
0
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   891
45
hgs
parents: 23
diff changeset
   892
	if( !repeating ) {
hgs
parents: 23
diff changeset
   893
		// Even though there is no RRule, the entry might
hgs
parents: 23
diff changeset
   894
		// have a list of rdates.
hgs
parents: 23
diff changeset
   895
		QList<QDate> rDates = aInstance.rDates();
hgs
parents: 23
diff changeset
   896
		repeating = ( rDates.count() > 0 );
hgs
parents: 23
diff changeset
   897
	}
hgs
parents: 23
diff changeset
   898
	QDateTime recId = aInstance.recurrenceId().toUTC();
hgs
parents: 23
diff changeset
   899
	const bool child = recId.isNull();
0
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   900
45
hgs
parents: 23
diff changeset
   901
	if( !aHasRepeatType ) {
hgs
parents: 23
diff changeset
   902
		aRepeatType = AgendaUtil::ThisAndAll;
hgs
parents: 23
diff changeset
   903
	}
hgs
parents: 23
diff changeset
   904
	// For later reference in handleDeletion()
hgs
parents: 23
diff changeset
   905
	mRecurrenceRange = aRepeatType;
0
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   906
45
hgs
parents: 23
diff changeset
   907
	if( !aHasRepeatType && ( child || repeating ) && 
hgs
parents: 23
diff changeset
   908
			( aInstance.type() != AgendaEntry::TypeAnniversary ) ) {
hgs
parents: 23
diff changeset
   909
		showRepeatingEntryDeleteQuery();
hgs
parents: 23
diff changeset
   910
	}
hgs
parents: 23
diff changeset
   911
	else
0
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   912
	{
45
hgs
parents: 23
diff changeset
   913
		showDeleteQuery(aInstance.type() == AgendaEntry::TypeTodo ?
hgs
parents: 23
diff changeset
   914
														EDeleteToDo :
hgs
parents: 23
diff changeset
   915
														EDeleteEntry );
0
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   916
	}
51
hgs
parents: 45
diff changeset
   917
	OstTraceFunctionExit0( CALENDELETEUI_DODELETESINGLEINSTANCEL_EXIT );
45
hgs
parents: 23
diff changeset
   918
}
hgs
parents: 23
diff changeset
   919
0
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   920
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   921
// -----------------------------------------------------------------------------
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   922
// CalenDeleteUi::DialogDismissedL
0
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   923
// From MProgressDialogCallback
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   924
// Callback method
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   925
// called when a dialog is dismissed.
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   926
// -----------------------------------------------------------------------------
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   927
//
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   928
void CalenDeleteUi::DialogDismissedL( const TInt /*aButtonId*/ )
0
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   929
    {
51
hgs
parents: 45
diff changeset
   930
    OstTraceFunctionEntry0( CALENDELETEUI_DIALOGDISMISSEDL_ENTRY );
0
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   931
    
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   932
    // no more entries to delete
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   933
    iMoreEntriesToDelete = EFalse;
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   934
    iDisplayQuery = EFalse;
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   935
    
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   936
    // issue notification cancel delete
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   937
    iController.BroadcastNotification(ECalenNotifyCancelDelete);
51
hgs
parents: 45
diff changeset
   938
    
hgs
parents: 45
diff changeset
   939
    OstTraceFunctionExit0( CALENDELETEUI_DIALOGDISMISSEDL_EXIT );
0
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   940
    }
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   941
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   942
// -----------------------------------------------------------------------------
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   943
// CalenDeleteUi::DeleteEntryL
0
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   944
// Delete entry using entry local uid
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   945
// -----------------------------------------------------------------------------
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   946
//
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   947
void CalenDeleteUi::DeleteEntryL(ulong& aEntryLocalUid)
0
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   948
    {
51
hgs
parents: 45
diff changeset
   949
    OstTraceFunctionEntry0( CALENDELETEUI_DELETEENTRYL_ENTRY );
0
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   950
    
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   951
    iController.Services().agendaInterface()->deleteEntry(aEntryLocalUid);
0
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   952
    
51
hgs
parents: 45
diff changeset
   953
    OstTraceFunctionExit0( CALENDELETEUI_DELETEENTRYL_EXIT );
0
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   954
    }
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   955
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   956
// -----------------------------------------------------------------------------
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   957
// CalenDeleteUi::DisplayWaitDialogL
0
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   958
// Display wait dialog
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   959
// -----------------------------------------------------------------------------
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   960
//
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   961
void CalenDeleteUi::DisplayWaitDialogL()
0
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   962
    {
51
hgs
parents: 45
diff changeset
   963
    OstTraceFunctionEntry0( CALENDELETEUI_DISPLAYWAITDIALOGL_ENTRY );
hgs
parents: 45
diff changeset
   964
    
hgs
parents: 45
diff changeset
   965
    OstTraceFunctionExit0( CALENDELETEUI_DISPLAYWAITDIALOGL_EXIT );
0
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   966
    }
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   967
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   968
// -----------------------------------------------------------------------------
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   969
// CalenDeleteUi::MarkedEntriesDeletedL
0
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   970
// Dismiss wait dialog and show information note
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   971
// -----------------------------------------------------------------------------
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   972
//
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   973
void CalenDeleteUi::MarkedEntriesDeletedL()
0
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   974
    {
51
hgs
parents: 45
diff changeset
   975
    OstTraceFunctionEntry0( CALENDELETEUI_MARKEDENTRIESDELETEDL_ENTRY );
hgs
parents: 45
diff changeset
   976
    
0
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   977
    // notify marked entries deleted
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   978
    iController.BroadcastNotification( ECalenNotifyMarkedEntryDeleted );
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   979
    
51
hgs
parents: 45
diff changeset
   980
    OstTraceFunctionExit0( CALENDELETEUI_MARKEDENTRIESDELETEDL_EXIT );
0
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   981
    }
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   982
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   983
// End of File