calendarui/controller/src/calendeleteui.cpp
changeset 51 0b38fc5b94c6
parent 45 b6db4fd4947b
child 55 2c54b51f39c4
equal deleted inserted replaced
46:ecd7b9840282 51:0b38fc5b94c6
    35 #include "CleanupResetAndDestroy.h"
    35 #include "CleanupResetAndDestroy.h"
    36 #include "caleninstanceid.h"
    36 #include "caleninstanceid.h"
    37 #include "calenactionuiutils.h"
    37 #include "calenactionuiutils.h"
    38 #include "calendateutils.h"
    38 #include "calendateutils.h"
    39 #include "calenagendautils.h"
    39 #include "calenagendautils.h"
       
    40 #include "OstTraceDefinitions.h"
       
    41 #ifdef OST_TRACE_COMPILER_IN_USE
       
    42 #include "calendeleteuiTraces.h"
       
    43 #endif
    40 
    44 
    41 
    45 
    42 // Local constants
    46 // Local constants
    43 const TInt KEntriesToDelete = 1;
    47 const TInt KEntriesToDelete = 1;
    44 
    48 
    48 // (other items were commented in a header).
    52 // (other items were commented in a header).
    49 // ----------------------------------------------------------------------------
    53 // ----------------------------------------------------------------------------
    50 //
    54 //
    51 CalenDeleteUi* CalenDeleteUi::NewL( CCalenController& aController )
    55 CalenDeleteUi* CalenDeleteUi::NewL( CCalenController& aController )
    52     {
    56     {
    53     TRACE_ENTRY_POINT;
    57     OstTraceFunctionEntry0( CALENDELETEUI_NEWL_ENTRY );
    54 
    58     
    55     CalenDeleteUi* self = new( ELeave ) CalenDeleteUi( aController, NULL );
    59     CalenDeleteUi* self = new( ELeave ) CalenDeleteUi( aController, NULL );
    56     CleanupStack::PushL( self );
    60     CleanupStack::PushL( self );
    57     self->ConstructL();
    61     self->ConstructL();
    58     CleanupStack::Pop( self );
    62     CleanupStack::Pop( self );
    59 
    63 
    60     TRACE_EXIT_POINT;
    64     OstTraceFunctionExit0( CALENDELETEUI_NEWL_EXIT );
    61     return self;
    65     return self;
    62     }
    66     }
    63 
    67 
    64 // ----------------------------------------------------------------------------
    68 // ----------------------------------------------------------------------------
    65 // CalenDeleteUi::CalenDeleteUi
    69 // CalenDeleteUi::CalenDeleteUi
    68 // ----------------------------------------------------------------------------
    72 // ----------------------------------------------------------------------------
    69 //
    73 //
    70 CalenDeleteUi::CalenDeleteUi( CCalenController& aController, QObject *parent )
    74 CalenDeleteUi::CalenDeleteUi( CCalenController& aController, QObject *parent )
    71     :QObject(parent), iController( aController )
    75     :QObject(parent), iController( aController )
    72     {
    76     {
    73     TRACE_ENTRY_POINT;
    77     OstTraceFunctionEntry0( CALENDELETEUI_CALENDELETEUI_ENTRY );
       
    78     
    74     iIsDeleting = false;
    79     iIsDeleting = false;
    75     TRACE_EXIT_POINT;
    80     
       
    81     OstTraceFunctionExit0( CALENDELETEUI_CALENDELETEUI_EXIT );
    76     }
    82     }
    77 
    83 
    78 // ----------------------------------------------------------------------------
    84 // ----------------------------------------------------------------------------
    79 // CalenDeleteUi::~CalenDeleteUi
    85 // CalenDeleteUi::~CalenDeleteUi
    80 // Destructor
    86 // Destructor
    81 // (other items were commented in a header).
    87 // (other items were commented in a header).
    82 // ----------------------------------------------------------------------------
    88 // ----------------------------------------------------------------------------
    83 //
    89 //
    84 CalenDeleteUi::~CalenDeleteUi()
    90 CalenDeleteUi::~CalenDeleteUi()
    85     {
    91     {
    86     TRACE_ENTRY_POINT;
    92     OstTraceFunctionEntry0( DUP1_CALENDELETEUI_CALENDELETEUI_ENTRY );
    87 
    93     
    88     TRACE_EXIT_POINT;
    94     OstTraceFunctionExit0( DUP1_CALENDELETEUI_CALENDELETEUI_EXIT );
    89     }
    95     }
    90 
    96 
    91 // ----------------------------------------------------------------------------
    97 // ----------------------------------------------------------------------------
    92 // CalenDeleteUi::ConstructL
    98 // CalenDeleteUi::ConstructL
    93 // Second phase of construction
    99 // Second phase of construction
    94 // (other items were commented in a header).
   100 // (other items were commented in a header).
    95 // ----------------------------------------------------------------------------
   101 // ----------------------------------------------------------------------------
    96 //
   102 //
    97 void CalenDeleteUi::ConstructL()
   103 void CalenDeleteUi::ConstructL()
    98     {
   104     {
    99     TRACE_ENTRY_POINT;
   105     OstTraceFunctionEntry0( CALENDELETEUI_CONSTRUCTL_ENTRY );
       
   106     
   100     iController.RegisterForNotificationsL( this, ECalenNotifyCancelDelete );
   107     iController.RegisterForNotificationsL( this, ECalenNotifyCancelDelete );
   101     iMoreEntriesToDelete = EFalse;
   108     iMoreEntriesToDelete = EFalse;
   102     iDisplayQuery = EFalse;
   109     iDisplayQuery = EFalse;
   103     iEntriesToDelete = KEntriesToDelete;
   110     iEntriesToDelete = KEntriesToDelete;
   104     TRACE_EXIT_POINT;
   111     
       
   112     OstTraceFunctionExit0( CALENDELETEUI_CONSTRUCTL_EXIT );
   105     }
   113     }
   106 
   114 
   107 // ----------------------------------------------------------------------------
   115 // ----------------------------------------------------------------------------
   108 // CalenDeleteUi::HandleNotification
   116 // CalenDeleteUi::HandleNotification
   109 // Handles notifications.
   117 // Handles notifications.
   110 // (other items were commented in a header).
   118 // (other items were commented in a header).
   111 // ----------------------------------------------------------------------------
   119 // ----------------------------------------------------------------------------
   112 //
   120 //
   113 void CalenDeleteUi::HandleNotification(const TCalenNotification aNotification )
   121 void CalenDeleteUi::HandleNotification(const TCalenNotification aNotification )
   114     {
   122     {
   115     TRACE_ENTRY_POINT;
   123     OstTraceFunctionEntry0( CALENDELETEUI_HANDLENOTIFICATION_ENTRY );
   116 
   124 
   117     if( aNotification == ECalenNotifyCancelDelete)
   125     if( aNotification == ECalenNotifyCancelDelete)
   118         {
   126         {
   119         if(iMutlipleContextIdsCount)
   127         if(iMutlipleContextIdsCount)
   120             {
   128             {
   123             // reset the multiple contexts
   131             // reset the multiple contexts
   124             context.resetMultipleContextIds();          
   132             context.resetMultipleContextIds();          
   125            
   133            
   126             }
   134             }
   127         }
   135         }
   128     TRACE_EXIT_POINT;
   136     
       
   137     OstTraceFunctionExit0( CALENDELETEUI_HANDLENOTIFICATION_EXIT );
   129     }
   138     }
   130 
   139 
   131 // ----------------------------------------------------------------------------
   140 // ----------------------------------------------------------------------------
   132 // CalenDeleteUi::HandleCommandL
   141 // CalenDeleteUi::HandleCommandL
   133 // Handles action ui commands
   142 // Handles action ui commands
   134 // (other items were commented in a header).
   143 // (other items were commented in a header).
   135 // ----------------------------------------------------------------------------
   144 // ----------------------------------------------------------------------------
   136 //
   145 //
   137 TBool CalenDeleteUi::HandleCommandL( const TCalenCommand& aCommand )
   146 TBool CalenDeleteUi::HandleCommandL( const TCalenCommand& aCommand )
   138     {
   147     {
   139     TRACE_ENTRY_POINT;
   148     OstTraceFunctionEntry0( CALENDELETEUI_HANDLECOMMANDL_ENTRY );
       
   149     
   140     TBool continueCommand(EFalse);
   150     TBool continueCommand(EFalse);
   141     
   151     
   142     switch( aCommand.Command() )
   152     switch( aCommand.Command() )
   143         {
   153         {
   144         case ECalenDeleteCurrentEntry:
   154         case ECalenDeleteCurrentEntry:
   178             // command but it wasn't in our list; something has gone wrong.
   188             // command but it wasn't in our list; something has gone wrong.
   179             //ASSERT( EFalse );
   189             //ASSERT( EFalse );
   180             break;
   190             break;
   181         }
   191         }
   182         
   192         
   183     TRACE_EXIT_POINT;
   193     OstTraceFunctionExit0( CALENDELETEUI_HANDLECOMMANDL_EXIT );
   184     return continueCommand;
   194     return continueCommand;
   185     }
   195     }
   186 
   196 
   187 
   197 
   188 // ----------------------------------------------------------------------------
   198 // ----------------------------------------------------------------------------
   191 // (other items were commented in a header).
   201 // (other items were commented in a header).
   192 // ----------------------------------------------------------------------------
   202 // ----------------------------------------------------------------------------
   193 //
   203 //
   194 void CalenDeleteUi::DeleteThisOrAllL( AgendaUtil::RecurrenceRange aRepeatType )
   204 void CalenDeleteUi::DeleteThisOrAllL( AgendaUtil::RecurrenceRange aRepeatType )
   195 {
   205 {
   196 	TRACE_ENTRY_POINT;
   206     OstTraceFunctionEntry0( CALENDELETEUI_DELETETHISORALLL_ENTRY );
   197 
   207 
   198 	if( iController.context().instanceId().mEntryLocalUid )
   208 	if( iController.context().instanceId().mEntryLocalUid )
   199 	{
   209 	{
   200 		AgendaEntry instance = CalenActionUiUtils::findPossibleInstanceL(
   210 		AgendaEntry instance = CalenActionUiUtils::findPossibleInstanceL(
   201 									iController.context().instanceId(),
   211 									iController.context().instanceId(),
   203 		if( !instance.isNull() )
   213 		if( !instance.isNull() )
   204 		{
   214 		{
   205 			DeleteSingleInstanceL( instance, aRepeatType );
   215 			DeleteSingleInstanceL( instance, aRepeatType );
   206 		}
   216 		}
   207 	}
   217 	}
   208 	TRACE_EXIT_POINT;
   218 	
       
   219 	OstTraceFunctionExit0( CALENDELETEUI_DELETETHISORALLL_EXIT );
   209 }
   220 }
   210 
   221 
   211 // ----------------------------------------------------------------------------
   222 // ----------------------------------------------------------------------------
   212 // CalenDeleteUi::DeleteEntryWithoutQueryL()
   223 // CalenDeleteUi::DeleteEntryWithoutQueryL()
   213 // Deletes the current entry
   224 // Deletes the current entry
   214 // (other items were commented in a header).
   225 // (other items were commented in a header).
   215 // ----------------------------------------------------------------------------
   226 // ----------------------------------------------------------------------------
   216 //
   227 //
   217 TBool CalenDeleteUi::DeleteEntryWithoutQueryL()
   228 TBool CalenDeleteUi::DeleteEntryWithoutQueryL()
   218     {
   229     {
   219     TRACE_ENTRY_POINT;
   230     OstTraceFunctionEntry0( CALENDELETEUI_DELETEENTRYWITHOUTQUERYL_ENTRY );
       
   231     
   220 	bool continueCommand(EFalse);
   232 	bool continueCommand(EFalse);
   221     
   233     
   222 	// get the context
   234 	// get the context
   223 	MCalenContext& context = iController.context();
   235 	MCalenContext& context = iController.context();
   224 	
   236 	
   277             context.resetMultipleContextIds();
   289             context.resetMultipleContextIds();
   278             // notify delete failed
   290             // notify delete failed
   279             iController.BroadcastNotification(ECalenNotifyDeleteFailed);    
   291             iController.BroadcastNotification(ECalenNotifyDeleteFailed);    
   280             }
   292             }
   281 	
   293 	
   282     TRACE_EXIT_POINT;
   294     OstTraceFunctionExit0( CALENDELETEUI_DELETEENTRYWITHOUTQUERYL_EXIT );
   283     return continueCommand;
   295     return continueCommand;
   284     }
   296     }
   285 
   297 
   286 // ----------------------------------------------------------------------------
   298 // ----------------------------------------------------------------------------
   287 // CalenDeleteUi::DeleteCurrentEntryL
   299 // CalenDeleteUi::DeleteCurrentEntryL
   289 // (other items were commented in a header).
   301 // (other items were commented in a header).
   290 // ----------------------------------------------------------------------------
   302 // ----------------------------------------------------------------------------
   291 //
   303 //
   292 void CalenDeleteUi::DeleteCurrentEntryL()
   304 void CalenDeleteUi::DeleteCurrentEntryL()
   293 {
   305 {
   294 	TRACE_ENTRY_POINT;
   306     OstTraceFunctionEntry0( CALENDELETEUI_DELETECURRENTENTRYL_ENTRY );
   295 
   307     
   296 	// Make sure we're focused on an entry.
   308 	// Make sure we're focused on an entry.
   297 	if (iController.context().instanceId().mEntryLocalUid) {
   309 	if (iController.context().instanceId().mEntryLocalUid) {
   298 		// Fetch the entry
   310 		// Fetch the entry
   299 		AgendaEntry entry = iController.Services().agendaInterface()->fetchById(
   311 		AgendaEntry entry = iController.Services().agendaInterface()->fetchById(
   300 				iController.context().instanceId().mEntryLocalUid);
   312 				iController.context().instanceId().mEntryLocalUid);
   316 					// Save the entry for later reference in the slot
   328 					// Save the entry for later reference in the slot
   317 					showDeleteQuery(EDeleteEntry);
   329 					showDeleteQuery(EDeleteEntry);
   318 				}
   330 				}
   319 			}
   331 			}
   320 	}
   332 	}
   321 	TRACE_EXIT_POINT;
   333 	OstTraceFunctionExit0( CALENDELETEUI_DELETECURRENTENTRYL_EXIT );
   322 }
   334 }
   323 
   335 
   324 // ----------------------------------------------------------------------------
   336 // ----------------------------------------------------------------------------
   325 // CalenDeleteUi::DeleteAllEntriesL
   337 // CalenDeleteUi::DeleteAllEntriesL
   326 // Deletes all entries
   338 // Deletes all entries
   327 // (other items were commented in a header).
   339 // (other items were commented in a header).
   328 // ----------------------------------------------------------------------------
   340 // ----------------------------------------------------------------------------
   329 //
   341 //
   330 void CalenDeleteUi::DeleteAllEntriesL()
   342 void CalenDeleteUi::DeleteAllEntriesL()
   331     {
   343     {
       
   344     OstTraceFunctionEntry0( CALENDELETEUI_DELETEALLENTRIESL_ENTRY );
       
   345     
   332 	if(iIsDeleting) {
   346 	if(iIsDeleting) {
       
   347 		OstTraceFunctionExit0( CALENDELETEUI_DELETEALLENTRIESL_EXIT );
   333 		return;
   348 		return;
   334 	}
   349 	}
   335 
   350 
   336     showDeleteQuery(EDeleteAll );
   351     showDeleteQuery(EDeleteAll );
       
   352 	OstTraceFunctionExit0( DUP1_CALENDELETEUI_DELETEALLENTRIESL_EXIT );
   337 	}
   353 	}
   338 
   354 
   339 // ----------------------------------------------------------------------------
   355 // ----------------------------------------------------------------------------
   340 // CalenDeleteUi::DeleteEntriesBeforeDateL
   356 // CalenDeleteUi::DeleteEntriesBeforeDateL
   341 // Deletes all entries before a set date.
   357 // Deletes all entries before a set date.
   342 // (other items were commented in a header).
   358 // (other items were commented in a header).
   343 // ----------------------------------------------------------------------------
   359 // ----------------------------------------------------------------------------
   344 //
   360 //
   345 void CalenDeleteUi::DeleteEntriesBeforeDateL()
   361 void CalenDeleteUi::DeleteEntriesBeforeDateL()
   346     {
   362     {
   347     TRACE_ENTRY_POINT;
   363     OstTraceFunctionEntry0( CALENDELETEUI_DELETEENTRIESBEFOREDATEL_ENTRY );
       
   364     
   348 	if(iIsDeleting) {
   365 	if(iIsDeleting) {
       
   366 		OstTraceFunctionExit0( CALENDELETEUI_DELETEENTRIESBEFOREDATEL_EXIT );
   349 		return;
   367 		return;
   350 	}    
   368 	}    
   351     // launch the datepicker
   369     // launch the datepicker
   352     dateQuery();
   370     dateQuery();
   353     TRACE_EXIT_POINT;
   371     OstTraceFunctionExit0( DUP1_CALENDELETEUI_DELETEENTRIESBEFOREDATEL_EXIT );
   354     }
   372     }
   355 
   373 
   356 // ----------------------------------------------------------------------------
   374 // ----------------------------------------------------------------------------
   357 // CalenDeleteUi::dateQuery
   375 // CalenDeleteUi::dateQuery
   358 // Launches the popup for the date selection
   376 // Launches the popup for the date selection
   359 // (other items were commented in a header).
   377 // (other items were commented in a header).
   360 // ----------------------------------------------------------------------------
   378 // ----------------------------------------------------------------------------
   361 //
   379 //
   362 void CalenDeleteUi::dateQuery()
   380 void CalenDeleteUi::dateQuery()
   363 	{
   381 	{
       
   382     OstTraceFunctionEntry0( CALENDELETEUI_DATEQUERY_ENTRY );
       
   383     
   364 	// Create a popup with datepicker to select the date.
   384 	// Create a popup with datepicker to select the date.
   365 	HbDialog *popUp = new HbDialog();
   385 	HbDialog *popUp = new HbDialog();
   366 	popUp->setDismissPolicy(HbDialog::NoDismiss);
   386 	popUp->setDismissPolicy(HbDialog::NoDismiss);
   367 	popUp->setTimeout(HbDialog::NoTimeout );
   387 	popUp->setTimeout(HbDialog::NoTimeout );
   368 	popUp->setAttribute( Qt::WA_DeleteOnClose, true );
   388 	popUp->setAttribute( Qt::WA_DeleteOnClose, true );
   384 	popUp->addAction(mDeleteAction);
   404 	popUp->addAction(mDeleteAction);
   385 	mCancelAction = new HbAction(hbTrId("txt_common_button_cancel"),popUp);
   405 	mCancelAction = new HbAction(hbTrId("txt_common_button_cancel"),popUp);
   386 	popUp->addAction(mCancelAction);
   406 	popUp->addAction(mCancelAction);
   387 	// Show the popup
   407 	// Show the popup
   388 	popUp->open(this, SLOT(handleDateQuery(HbAction*)));
   408 	popUp->open(this, SLOT(handleDateQuery(HbAction*)));
       
   409 	
       
   410 	OstTraceFunctionExit0( CALENDELETEUI_DATEQUERY_EXIT );
   389 	}
   411 	}
   390 
   412 
   391 // ----------------------------------------------------------------------------
   413 // ----------------------------------------------------------------------------
   392 // CalenDeleteUi::handleDateQuery
   414 // CalenDeleteUi::handleDateQuery
   393 // Handles the selection for the date query
   415 // Handles the selection for the date query
   394 // (other items were commented in a header).
   416 // (other items were commented in a header).
   395 // ----------------------------------------------------------------------------
   417 // ----------------------------------------------------------------------------
   396 //
   418 //
   397 void CalenDeleteUi::handleDateQuery(HbAction* action)
   419 void CalenDeleteUi::handleDateQuery(HbAction* action)
   398 {
   420 {
       
   421     OstTraceFunctionEntry0( CALENDELETEUI_HANDLEDATEQUERY_ENTRY );
       
   422     
   399 	if(action == mDeleteAction) {
   423 	if(action == mDeleteAction) {
   400 		// User selected the date before which all the entries has to be deleted
   424 		// User selected the date before which all the entries has to be deleted
   401 		QDate selectedDate(mDatePicker->date());
   425 		QDate selectedDate(mDatePicker->date());
   402 		// Check if the date is within the range.
   426 		// Check if the date is within the range.
   403 		if(selectedDate.isValid()) {
   427 		if(selectedDate.isValid()) {
   426 		handleDeleteCancel();
   450 		handleDeleteCancel();
   427 	}
   451 	}
   428 	// Reset the member variables
   452 	// Reset the member variables
   429 	mDeleteAction = NULL;
   453 	mDeleteAction = NULL;
   430 	mCancelAction = NULL;
   454 	mCancelAction = NULL;
       
   455 	
       
   456 	OstTraceFunctionExit0( CALENDELETEUI_HANDLEDATEQUERY_EXIT );
   431 }
   457 }
   432 // ----------------------------------------------------------------------------
   458 // ----------------------------------------------------------------------------
   433 // CalenDeleteUi::showRepeatingEntryDeleteQuery
   459 // CalenDeleteUi::showRepeatingEntryDeleteQuery
   434 // Launches the popup for deleting the repeating entry
   460 // Launches the popup for deleting the repeating entry
   435 // (other items were commented in a header).
   461 // (other items were commented in a header).
   436 // ----------------------------------------------------------------------------
   462 // ----------------------------------------------------------------------------
   437 //
   463 //
   438 void CalenDeleteUi::showRepeatingEntryDeleteQuery()
   464 void CalenDeleteUi::showRepeatingEntryDeleteQuery()
   439 {
   465 {
       
   466     OstTraceFunctionEntry0( CALENDELETEUI_SHOWREPEATINGENTRYDELETEQUERY_ENTRY );
       
   467     
   440     HbDialog *popUp = new HbDialog();
   468     HbDialog *popUp = new HbDialog();
   441     popUp->setDismissPolicy(HbDialog::NoDismiss);
   469     popUp->setDismissPolicy(HbDialog::NoDismiss);
   442     popUp->setTimeout(HbDialog::NoTimeout);
   470     popUp->setTimeout(HbDialog::NoTimeout);
   443     popUp->setAttribute( Qt::WA_DeleteOnClose, true );
   471     popUp->setAttribute( Qt::WA_DeleteOnClose, true );
   444     
   472     
   470     connect(cancelAction, SIGNAL(triggered()), this, 
   498     connect(cancelAction, SIGNAL(triggered()), this, 
   471 										SLOT(handleDeleteCancel()));
   499 										SLOT(handleDeleteCancel()));
   472     
   500     
   473     // Show the popup
   501     // Show the popup
   474     popUp->open();
   502     popUp->open();
       
   503     
       
   504     OstTraceFunctionExit0( CALENDELETEUI_SHOWREPEATINGENTRYDELETEQUERY_EXIT );
   475 }
   505 }
   476 
   506 
   477 // ----------------------------------------------------------------------------
   507 // ----------------------------------------------------------------------------
   478 // CalenDeleteUi::handleDeleteCancel
   508 // CalenDeleteUi::handleDeleteCancel
   479 // Handles the cancel action
   509 // Handles the cancel action
   480 // (other items were commented in a header).
   510 // (other items were commented in a header).
   481 // ----------------------------------------------------------------------------
   511 // ----------------------------------------------------------------------------
   482 //
   512 //
   483 void CalenDeleteUi::handleDeleteCancel()
   513 void CalenDeleteUi::handleDeleteCancel()
   484 {
   514 {
       
   515     OstTraceFunctionEntry0( CALENDELETEUI_HANDLEDELETECANCEL_ENTRY );
       
   516     
   485 	iController.BroadcastNotification(ECalenNotifyDeleteFailed);
   517 	iController.BroadcastNotification(ECalenNotifyDeleteFailed);
       
   518 	
       
   519 	OstTraceFunctionExit0( CALENDELETEUI_HANDLEDELETECANCEL_EXIT );
   486 }
   520 }
   487 
   521 
   488 void CalenDeleteUi::handleRepeatedEntryDelete(int index)
   522 void CalenDeleteUi::handleRepeatedEntryDelete(int index)
   489 {
   523 {
       
   524     OstTraceFunctionEntry0( CALENDELETEUI_HANDLEREPEATEDENTRYDELETE_ENTRY );
       
   525     
   490 	// Fetch the entry
   526 	// Fetch the entry
   491 	// Find all possible instances
   527 	// Find all possible instances
   492 	AgendaEntry instance = CalenActionUiUtils::findPossibleInstanceL(
   528 	AgendaEntry instance = CalenActionUiUtils::findPossibleInstanceL(
   493 									iController.context().instanceId(),
   529 									iController.context().instanceId(),
   494 									iController.Services().agendaInterface());
   530 									iController.Services().agendaInterface());
   508 				iController.Services().agendaInterface()->deleteRepeatedEntry(
   544 				iController.Services().agendaInterface()->deleteRepeatedEntry(
   509 									instance, AgendaUtil::ThisAndAll);
   545 									instance, AgendaUtil::ThisAndAll);
   510 				break;
   546 				break;
   511 		}
   547 		}
   512 	}
   548 	}
       
   549 	OstTraceFunctionExit0( CALENDELETEUI_HANDLEREPEATEDENTRYDELETE_EXIT );
   513 }
   550 }
   514 
   551 
   515 // ----------------------------------------------------------------------------
   552 // ----------------------------------------------------------------------------
   516 // CalenDeleteUi::showDeleteQuery
   553 // CalenDeleteUi::showDeleteQuery
   517 // Launches the popup for deleting the instance/instances
   554 // Launches the popup for deleting the instance/instances
   519 // ----------------------------------------------------------------------------
   556 // ----------------------------------------------------------------------------
   520 //
   557 //
   521 void CalenDeleteUi::showDeleteQuery(const TDeleteConfirmationType type,
   558 void CalenDeleteUi::showDeleteQuery(const TDeleteConfirmationType type,
   522                                                      const int count)
   559                                                      const int count)
   523     {
   560     {
       
   561     OstTraceFunctionEntry0( CALENDELETEUI_SHOWDELETEQUERY_ENTRY );
       
   562     
   524     HbMessageBox *popup = new HbMessageBox(HbMessageBox::MessageTypeQuestion);
   563     HbMessageBox *popup = new HbMessageBox(HbMessageBox::MessageTypeQuestion);
   525     popup->setDismissPolicy(HbDialog::NoDismiss);
   564     popup->setDismissPolicy(HbDialog::NoDismiss);
   526     popup->setTimeout(HbDialog::NoTimeout);
   565     popup->setTimeout(HbDialog::NoTimeout);
   527     popup->setAttribute( Qt::WA_DeleteOnClose, true );
   566     popup->setAttribute( Qt::WA_DeleteOnClose, true );
   528     
   567     
   563         popup->removeAction(list[i]);
   602         popup->removeAction(list[i]);
   564         }
   603         }
   565     mDeleteAction = new HbAction(
   604     mDeleteAction = new HbAction(
   566 						hbTrId("txt_calendar_button_dialog_delete"), popup);
   605 						hbTrId("txt_calendar_button_dialog_delete"), popup);
   567     popup->addAction(mDeleteAction);
   606     popup->addAction(mDeleteAction);
   568     mCancelAction = new HbAction(hbTrId("txt_calendar_button_cancel"), popup);
   607     mCancelAction = new HbAction(hbTrId("txt_common_button_cancel"), popup); 
   569     popup->addAction(mCancelAction);
   608     popup->addAction(mCancelAction);
   570     popup->open(this, SLOT(handleDeletion(HbAction*)));
   609     popup->open(this, SLOT(handleDeletion(HbAction*)));
       
   610     
       
   611     OstTraceFunctionExit0( CALENDELETEUI_SHOWDELETEQUERY_EXIT );
   571     }
   612     }
   572 
   613 
   573 // ----------------------------------------------------------------------------
   614 // ----------------------------------------------------------------------------
   574 // CalenDeleteUi::handleDeletion
   615 // CalenDeleteUi::handleDeletion
   575 // Deletes the entries based on the user selection
   616 // Deletes the entries based on the user selection
   576 // (other items were commented in a header).
   617 // (other items were commented in a header).
   577 // ----------------------------------------------------------------------------
   618 // ----------------------------------------------------------------------------
   578 //
   619 //
   579 void CalenDeleteUi::handleDeletion(HbAction* action)
   620 void CalenDeleteUi::handleDeletion(HbAction* action)
   580 {
   621 {
       
   622     OstTraceFunctionEntry0( CALENDELETEUI_HANDLEDELETION_ENTRY );
       
   623     
   581 	TCalenNotification notification = ECalenNotifyDeleteFailed;
   624 	TCalenNotification notification = ECalenNotifyDeleteFailed;
   582 	
   625 	
   583 	if(action == mDeleteAction) {
   626 	if(action == mDeleteAction) {
   584 		
   627 		
   585 		switch (mDeleteCommand) {
   628 		switch (mDeleteCommand) {
   636 	iController.BroadcastNotification(notification);
   679 	iController.BroadcastNotification(notification);
   637 	
   680 	
   638 	// Reset the member variables
   681 	// Reset the member variables
   639 	mDeleteAction = NULL;
   682 	mDeleteAction = NULL;
   640 	mCancelAction = NULL;
   683 	mCancelAction = NULL;
       
   684 	
       
   685 	OstTraceFunctionExit0( CALENDELETEUI_HANDLEDELETION_EXIT );
   641 }
   686 }
   642 
   687 
   643 void CalenDeleteUi::entryDeleted(ulong id)
   688 void CalenDeleteUi::entryDeleted(ulong id)
   644 {
   689 {
       
   690     OstTraceFunctionEntry0( CALENDELETEUI_ENTRYDELETED_ENTRY );
       
   691     
   645     if (iController.context().instanceId().mEntryLocalUid == id) {
   692     if (iController.context().instanceId().mEntryLocalUid == id) {
   646         iController.BroadcastNotification(ECalenNotifyEntryDeleted);
   693         iController.BroadcastNotification(ECalenNotifyEntryDeleted);
   647     }
   694     }
   648     disconnect(iController.Services().agendaInterface(), SIGNAL(entryDeleted(ulong)),
   695     disconnect(iController.Services().agendaInterface(), SIGNAL(entryDeleted(ulong)),
   649                this, SLOT(entryDeleted(ulong)));
   696                this, SLOT(entryDeleted(ulong)));
       
   697     
       
   698     OstTraceFunctionExit0( CALENDELETEUI_ENTRYDELETED_EXIT );
   650 }
   699 }
   651 
   700 
   652 // ----------------------------------------------------------------------------
   701 // ----------------------------------------------------------------------------
   653 // CalenDeleteUi::HandleDeleteMultipleEventsL
   702 // CalenDeleteUi::HandleDeleteMultipleEventsL
   654 // Handles multiple delete events
   703 // Handles multiple delete events
   657 //
   706 //
   658 void CalenDeleteUi::HandleDeleteMultipleEventsL( const QDateTime& aFirstDay,
   707 void CalenDeleteUi::HandleDeleteMultipleEventsL( const QDateTime& aFirstDay,
   659                                                  const QDateTime& aLastDay,
   708                                                  const QDateTime& aLastDay,
   660                                                  int aConfNoteId )
   709                                                  int aConfNoteId )
   661     {
   710     {
   662     TRACE_ENTRY_POINT;
   711     OstTraceFunctionEntry0( CALENDELETEUI_HANDLEDELETEMULTIPLEEVENTSL_ENTRY );
   663     
   712     
   664 	if(iIsDeleting) {
   713 	if(iIsDeleting) {
       
   714 		OstTraceFunctionExit0( CALENDELETEUI_HANDLEDELETEMULTIPLEEVENTSL_EXIT );
   665 		return;
   715 		return;
   666 	}
   716 	}
   667     iConfirmationNoteId = aConfNoteId;
   717     iConfirmationNoteId = aConfNoteId;
   668     
   718     
   669     DeleteDayRangeL( aFirstDay, aLastDay );
   719     DeleteDayRangeL( aFirstDay, aLastDay );
   670 
   720 
   671     TRACE_EXIT_POINT;
   721     OstTraceFunctionExit0( DUP1_CALENDELETEUI_HANDLEDELETEMULTIPLEEVENTSL_EXIT );
   672     }
   722     }
   673 
   723 
   674 // ----------------------------------------------------------------------------
   724 // ----------------------------------------------------------------------------
   675 // CalenDeleteUi::DeleteDayRangeL
   725 // CalenDeleteUi::DeleteDayRangeL
   676 // Deletes all entries in a given range.
   726 // Deletes all entries in a given range.
   678 // ----------------------------------------------------------------------------
   728 // ----------------------------------------------------------------------------
   679 //
   729 //
   680 void CalenDeleteUi::DeleteDayRangeL( const QDateTime& aStart,
   730 void CalenDeleteUi::DeleteDayRangeL( const QDateTime& aStart,
   681                                                       const QDateTime& aEnd )
   731                                                       const QDateTime& aEnd )
   682     {
   732     {
   683     TRACE_ENTRY_POINT;
   733     OstTraceFunctionEntry0( CALENDELETEUI_DELETEDAYRANGEL_ENTRY );
   684 
   734     
   685     iStartTime = aStart;
   735     iStartTime = aStart;
   686     iEndTime = aEnd;
   736     iEndTime = aEnd;
   687     
   737     
   688     iIsDeleting = ETrue;
   738     iIsDeleting = ETrue;
   689     
   739     
   698     	                | AgendaUtil::IncludeReminders
   748     	                | AgendaUtil::IncludeReminders
   699     	                | AgendaUtil::IncludeIncompletedTodos);
   749     	                | AgendaUtil::IncludeIncompletedTodos);
   700     // 1: First pass, delete all entries.
   750     // 1: First pass, delete all entries.
   701     iController.agendaInterface()->deleteEntries(iStartTime, iEndTime, filter);
   751     iController.agendaInterface()->deleteEntries(iStartTime, iEndTime, filter);
   702 
   752 
   703     TRACE_EXIT_POINT;
   753     OstTraceFunctionExit0( CALENDELETEUI_DELETEDAYRANGEL_EXIT );
   704     }
   754     }
   705 
   755 
   706 // ----------------------------------------------------------------------------
   756 // ----------------------------------------------------------------------------
   707 // CalenDeleteUi::DoCompletedL
   757 // CalenDeleteUi::DoCompletedL
   708 // Handles delete callback
   758 // Handles delete callback
   709 // (other items were commented in a header).
   759 // (other items were commented in a header).
   710 // ----------------------------------------------------------------------------
   760 // ----------------------------------------------------------------------------
   711 //
   761 //
   712 void CalenDeleteUi::doCompleted( int aFirstPassError )
   762 void CalenDeleteUi::doCompleted( int aFirstPassError )
   713     {
   763     {
   714     TRACE_ENTRY_POINT;
   764     OstTraceFunctionEntry0( CALENDELETEUI_DOCOMPLETED_ENTRY );
   715 
   765 
   716     if( aFirstPassError == KErrNone )
   766     if( aFirstPassError == KErrNone )
   717         {
   767         {
   718         // 2: Second pass, delete notes that end 00:00 of next day of iEndTime
   768         // 2: Second pass, delete notes that end 00:00 of next day of iEndTime
   719         // We didn't delete them in first pass
   769         // We didn't delete them in first pass
   725     // 3. End deleting, close wait dialog, and show confirmation or error note
   775     // 3. End deleting, close wait dialog, and show confirmation or error note
   726     iIsDeleting = EFalse;
   776     iIsDeleting = EFalse;
   727     
   777     
   728     iController.BroadcastNotification( ECalenNotifyMultipleEntriesDeleted );
   778     iController.BroadcastNotification( ECalenNotifyMultipleEntriesDeleted );
   729 
   779 
   730     TRACE_EXIT_POINT;
   780     OstTraceFunctionExit0( CALENDELETEUI_DOCOMPLETED_EXIT );
   731     }
   781     }
   732 
   782 
   733 // ----------------------------------------------------------------------------
   783 // ----------------------------------------------------------------------------
   734 // CalenDeleteUi::DeleteEntriesEndingAtMidnightL
   784 // CalenDeleteUi::DeleteEntriesEndingAtMidnightL
   735 // Deletes entries ending at midnight on the given day
   785 // Deletes entries ending at midnight on the given day
   736 // (other items were commented in a header).
   786 // (other items were commented in a header).
   737 // ----------------------------------------------------------------------------
   787 // ----------------------------------------------------------------------------
   738 //
   788 //
   739 void CalenDeleteUi::deleteEntriesEndingAtMidnight( QDateTime aMidnight )
   789 void CalenDeleteUi::deleteEntriesEndingAtMidnight( QDateTime aMidnight )
   740     {
   790     {
   741     TRACE_ENTRY_POINT;
   791     OstTraceFunctionEntry0( CALENDELETEUI_DELETEENTRIESENDINGATMIDNIGHT_ENTRY );
   742 
   792 
   743     QDateTime start, end;
   793     QDateTime start, end;
   744     QTime startTime(aMidnight.time());
   794     QTime startTime(aMidnight.time());
   745     startTime.setHMS(startTime.hour(), startTime.minute() - 1,
   795     startTime.setHMS(startTime.hour(), startTime.minute() - 1,
   746                     startTime.second(), startTime.msec());
   796                     startTime.second(), startTime.msec());
   771                 iController.Services().agendaInterface()->deleteRepeatedEntry(entry, AgendaUtil::ThisAndAll);
   821                 iController.Services().agendaInterface()->deleteRepeatedEntry(entry, AgendaUtil::ThisAndAll);
   772                 }
   822                 }
   773             }
   823             }
   774         }
   824         }
   775 
   825 
   776     TRACE_EXIT_POINT;
   826     OstTraceFunctionExit0( CALENDELETEUI_DELETEENTRIESENDINGATMIDNIGHT_EXIT );
   777     }
   827     }
   778 
   828 
   779 // -----------------------------------------------------------------------------
   829 // -----------------------------------------------------------------------------
   780 // CalenDeleteUi::DeleteSingleInstanceL
   830 // CalenDeleteUi::DeleteSingleInstanceL
   781 // Delete the given instance. Ask the user whether to delete the series or the instance.
   831 // Delete the given instance. Ask the user whether to delete the series or the instance.
   782 // (other items were commented in a header).
   832 // (other items were commented in a header).
   783 // -----------------------------------------------------------------------------
   833 // -----------------------------------------------------------------------------
   784 //
   834 //
   785 void CalenDeleteUi::DeleteSingleInstanceL( AgendaEntry& aInstance )
   835 void CalenDeleteUi::DeleteSingleInstanceL( AgendaEntry& aInstance )
   786     {
   836     {
   787     TRACE_ENTRY_POINT;
   837     OstTraceFunctionEntry0( CALENDELETEUI_DELETESINGLEINSTANCEL_ENTRY );
       
   838     
   788     DoDeleteSingleInstanceL( aInstance, EFalse, AgendaUtil::ThisAndAll );
   839     DoDeleteSingleInstanceL( aInstance, EFalse, AgendaUtil::ThisAndAll );
   789     TRACE_EXIT_POINT;
   840     
       
   841     OstTraceFunctionExit0( CALENDELETEUI_DELETESINGLEINSTANCEL_EXIT );
   790     }
   842     }
   791 
   843 
   792 // -----------------------------------------------------------------------------
   844 // -----------------------------------------------------------------------------
   793 // CalenDeleteUi::DeleteSingleInstanceL
   845 // CalenDeleteUi::DeleteSingleInstanceL
   794 // Delete the given instance. Delete the entry range given by aRepeatType.
   846 // Delete the given instance. Delete the entry range given by aRepeatType.
   796 // -----------------------------------------------------------------------------
   848 // -----------------------------------------------------------------------------
   797 //
   849 //
   798 void CalenDeleteUi::DeleteSingleInstanceL( AgendaEntry& aInstance, 
   850 void CalenDeleteUi::DeleteSingleInstanceL( AgendaEntry& aInstance, 
   799                                 AgendaUtil::RecurrenceRange aRepeatType )
   851                                 AgendaUtil::RecurrenceRange aRepeatType )
   800     {
   852     {
   801     TRACE_ENTRY_POINT;
   853     OstTraceFunctionEntry0( DUP1_CALENDELETEUI_DELETESINGLEINSTANCEL_ENTRY );
       
   854     
   802     DoDeleteSingleInstanceL( aInstance, ETrue, aRepeatType );
   855     DoDeleteSingleInstanceL( aInstance, ETrue, aRepeatType );
   803     TRACE_EXIT_POINT;
   856     
   804     
   857     OstTraceFunctionExit0( DUP1_CALENDELETEUI_DELETESINGLEINSTANCEL_EXIT );
   805     }
   858     }
   806 
   859 
   807 // -----------------------------------------------------------------------------
   860 // -----------------------------------------------------------------------------
   808 // CalenDeleteUi::DoDeleteSingleInstanceL
   861 // CalenDeleteUi::DoDeleteSingleInstanceL
   809 // Performs the deletion of the instance. If aHasRepeatType is EFalse, the user
   862 // Performs the deletion of the instance. If aHasRepeatType is EFalse, the user
   816 void CalenDeleteUi::DoDeleteSingleInstanceL(
   869 void CalenDeleteUi::DoDeleteSingleInstanceL(
   817 									AgendaEntry& aInstance,
   870 									AgendaEntry& aInstance,
   818 									bool aHasRepeatType,
   871 									bool aHasRepeatType,
   819 									AgendaUtil::RecurrenceRange aRepeatType )
   872 									AgendaUtil::RecurrenceRange aRepeatType )
   820 {
   873 {
   821 	TRACE_ENTRY_POINT;
   874     OstTraceFunctionEntry0( CALENDELETEUI_DODELETESINGLEINSTANCEL_ENTRY );
       
   875     
   822 	bool repeating = aInstance.isRepeating();
   876 	bool repeating = aInstance.isRepeating();
   823 
   877 
   824 	if( !repeating ) {
   878 	if( !repeating ) {
   825 		// Even though there is no RRule, the entry might
   879 		// Even though there is no RRule, the entry might
   826 		// have a list of rdates.
   880 		// have a list of rdates.
   844 	{
   898 	{
   845 		showDeleteQuery(aInstance.type() == AgendaEntry::TypeTodo ?
   899 		showDeleteQuery(aInstance.type() == AgendaEntry::TypeTodo ?
   846 														EDeleteToDo :
   900 														EDeleteToDo :
   847 														EDeleteEntry );
   901 														EDeleteEntry );
   848 	}
   902 	}
   849 	TRACE_EXIT_POINT;
   903 	OstTraceFunctionExit0( CALENDELETEUI_DODELETESINGLEINSTANCEL_EXIT );
   850 }
   904 }
   851 
   905 
   852 
   906 
   853 // -----------------------------------------------------------------------------
   907 // -----------------------------------------------------------------------------
   854 // CalenDeleteUi::DialogDismissedL
   908 // CalenDeleteUi::DialogDismissedL
   857 // called when a dialog is dismissed.
   911 // called when a dialog is dismissed.
   858 // -----------------------------------------------------------------------------
   912 // -----------------------------------------------------------------------------
   859 //
   913 //
   860 void CalenDeleteUi::DialogDismissedL( const TInt /*aButtonId*/ )
   914 void CalenDeleteUi::DialogDismissedL( const TInt /*aButtonId*/ )
   861     {
   915     {
   862     TRACE_ENTRY_POINT;
   916     OstTraceFunctionEntry0( CALENDELETEUI_DIALOGDISMISSEDL_ENTRY );
   863     
   917     
   864     // no more entries to delete
   918     // no more entries to delete
   865     iMoreEntriesToDelete = EFalse;
   919     iMoreEntriesToDelete = EFalse;
   866     iDisplayQuery = EFalse;
   920     iDisplayQuery = EFalse;
   867     
   921     
   868     // issue notification cancel delete
   922     // issue notification cancel delete
   869     iController.BroadcastNotification(ECalenNotifyCancelDelete);
   923     iController.BroadcastNotification(ECalenNotifyCancelDelete);
   870     TRACE_EXIT_POINT;
   924     
       
   925     OstTraceFunctionExit0( CALENDELETEUI_DIALOGDISMISSEDL_EXIT );
   871     }
   926     }
   872 
   927 
   873 // -----------------------------------------------------------------------------
   928 // -----------------------------------------------------------------------------
   874 // CalenDeleteUi::DeleteEntryL
   929 // CalenDeleteUi::DeleteEntryL
   875 // Delete entry using entry local uid
   930 // Delete entry using entry local uid
   876 // -----------------------------------------------------------------------------
   931 // -----------------------------------------------------------------------------
   877 //
   932 //
   878 void CalenDeleteUi::DeleteEntryL(ulong& aEntryLocalUid)
   933 void CalenDeleteUi::DeleteEntryL(ulong& aEntryLocalUid)
   879     {
   934     {
   880     TRACE_ENTRY_POINT;
   935     OstTraceFunctionEntry0( CALENDELETEUI_DELETEENTRYL_ENTRY );
   881     
   936     
   882     iController.Services().agendaInterface()->deleteEntry(aEntryLocalUid);
   937     iController.Services().agendaInterface()->deleteEntry(aEntryLocalUid);
   883     
   938     
   884     TRACE_EXIT_POINT;
   939     OstTraceFunctionExit0( CALENDELETEUI_DELETEENTRYL_EXIT );
   885     }
   940     }
   886 
   941 
   887 // -----------------------------------------------------------------------------
   942 // -----------------------------------------------------------------------------
   888 // CalenDeleteUi::DisplayWaitDialogL
   943 // CalenDeleteUi::DisplayWaitDialogL
   889 // Display wait dialog
   944 // Display wait dialog
   890 // -----------------------------------------------------------------------------
   945 // -----------------------------------------------------------------------------
   891 //
   946 //
   892 void CalenDeleteUi::DisplayWaitDialogL()
   947 void CalenDeleteUi::DisplayWaitDialogL()
   893     {
   948     {
   894     TRACE_ENTRY_POINT;   
   949     OstTraceFunctionEntry0( CALENDELETEUI_DISPLAYWAITDIALOGL_ENTRY );
   895     TRACE_EXIT_POINT;
   950     
       
   951     OstTraceFunctionExit0( CALENDELETEUI_DISPLAYWAITDIALOGL_EXIT );
   896     }
   952     }
   897 
   953 
   898 // -----------------------------------------------------------------------------
   954 // -----------------------------------------------------------------------------
   899 // CalenDeleteUi::MarkedEntriesDeletedL
   955 // CalenDeleteUi::MarkedEntriesDeletedL
   900 // Dismiss wait dialog and show information note
   956 // Dismiss wait dialog and show information note
   901 // -----------------------------------------------------------------------------
   957 // -----------------------------------------------------------------------------
   902 //
   958 //
   903 void CalenDeleteUi::MarkedEntriesDeletedL()
   959 void CalenDeleteUi::MarkedEntriesDeletedL()
   904     {
   960     {
   905     TRACE_ENTRY_POINT;    
   961     OstTraceFunctionEntry0( CALENDELETEUI_MARKEDENTRIESDELETEDL_ENTRY );
       
   962     
   906     // notify marked entries deleted
   963     // notify marked entries deleted
   907     iController.BroadcastNotification( ECalenNotifyMarkedEntryDeleted );
   964     iController.BroadcastNotification( ECalenNotifyMarkedEntryDeleted );
   908     
   965     
   909     TRACE_EXIT_POINT;
   966     OstTraceFunctionExit0( CALENDELETEUI_MARKEDENTRIESDELETEDL_EXIT );
   910     }
   967     }
   911 
   968 
   912 // End of File
   969 // End of File