1311 } |
1303 } |
1312 |
1304 |
1313 // MAIN MENU *************************************************************************** |
1305 // MAIN MENU *************************************************************************** |
1314 if ( aResourceId == R_FSEMAILUI_MAILLIST_MENUPANE ) |
1306 if ( aResourceId == R_FSEMAILUI_MAILLIST_MENUPANE ) |
1315 { |
1307 { |
|
1308 // Saves a focus visibility. |
|
1309 iLastFocus = EFalse; |
|
1310 if( iFocusedControl == EMailListComponent && IsFocusShown() ) |
|
1311 { |
|
1312 iLastFocus = ETrue; |
|
1313 } |
1316 if (FeatureManager::FeatureSupported( KFeatureIdFfCmailIntegration )) |
1314 if (FeatureManager::FeatureSupported( KFeatureIdFfCmailIntegration )) |
1317 { |
1315 { |
1318 // remove help support in pf5250 |
1316 // remove help support in pf5250 |
1319 aMenuPane->SetItemDimmed( EFsEmailUiCmdHelp, ETrue); |
1317 aMenuPane->SetItemDimmed( EFsEmailUiCmdHelp, ETrue); |
1320 } |
1318 } |
1321 |
1319 |
1322 // Checks if a device has a keyboard or not. |
1320 // Checks if a device has a keyboard or not. |
1323 if( !iKeyboardFlipOpen ) |
1321 if( !iLastFocus ) |
1324 { |
1322 { |
1325 aMenuPane->SetItemDimmed( EFsEmailUiCmdActionsOpen, ETrue ); |
1323 // Hide all the normal email message specific actions |
|
1324 aMenuPane->SetItemDimmed( EFsEmailUiCmdActionsReply, ETrue ); |
|
1325 aMenuPane->SetItemDimmed( EFsEmailUiCmdActionsReplyAll, ETrue ); |
|
1326 aMenuPane->SetItemDimmed( EFsEmailUiCmdActionsForward, ETrue ); |
1326 aMenuPane->SetItemDimmed( EFsEmailUiCmdMailActions, ETrue); |
1327 aMenuPane->SetItemDimmed( EFsEmailUiCmdMailActions, ETrue); |
1327 aMenuPane->SetItemDimmed( EFsEmailUiCmdReadEmail, ETrue ); |
1328 |
1328 } |
1329 TInt markedCount = CountMarkedItemsL(); |
1329 |
1330 // Hide mark/unmark all when not applicable |
1330 // OFFLINE/ONLINE MENU SELECTION |
1331 if ( markedCount == EmailsInModelL() ) // Hide mark all |
1331 TFSMailBoxStatus onlineStatus = iAppUi.GetActiveMailbox()->GetMailBoxStatus(); |
1332 { |
1332 aMenuPane->SetItemDimmed( EFsEmailUiCmdGoOnline, onlineStatus == EFSMailBoxOnline ); |
1333 aMenuPane->SetItemDimmed( EFsEmailUiCmdSubMenuMark, ETrue ); |
1333 aMenuPane->SetItemDimmed( EFsEmailUiCmdGoOffline, onlineStatus == EFSMailBoxOffline ); |
1334 } |
1334 |
1335 if ( markedCount == 0 ) // Hide unmark all |
1335 // Sync/cancel sync |
1336 { |
1336 TBool supportsSync = iAppUi.GetActiveMailbox()->HasCapability( EFSMBoxCapaSupportsSync ); |
1337 aMenuPane->SetItemDimmed( EFsEmailUiCmdSubMenuUnmark, ETrue ); |
1337 if ( !supportsSync ) |
1338 } |
1338 { |
1339 |
1339 aMenuPane->SetItemDimmed( EFsEmailUiCmdCancelSync, ETrue ); |
|
1340 aMenuPane->SetItemDimmed( EFsEmailUiCmdSync, ETrue ); |
|
1341 } |
|
1342 else if ( GetLatestSyncState() ) |
|
1343 { |
|
1344 aMenuPane->SetItemDimmed( EFsEmailUiCmdSync, ETrue ); |
|
1345 } |
1340 } |
1346 else |
1341 else |
1347 { |
1342 { |
1348 aMenuPane->SetItemDimmed( EFsEmailUiCmdCancelSync, ETrue ); |
1343 CFSMailMessage* targetMessage = NULL; |
1349 } |
1344 if ( targetEntries.Count() == 1 ) |
1350 |
1345 { |
1351 //MESSAGEREADER MENU SELECTION |
1346 targetMessage = &MsgPtrFromListIdL( targetEntries[0] ); |
1352 if ( iAppUi.MessageReaderSupportsFreestyle() ) |
1347 } |
1353 { |
1348 |
1354 aMenuPane->SetItemDimmed( EFsEmailUiCmdReadEmail, EFalse ); |
1349 // Hide the irrelevant reply / reply all / forward commands |
1355 } |
1350 TInt numRecipients(0); |
1356 else |
1351 if ( targetMessage ) |
1357 { |
1352 { |
1358 aMenuPane->SetItemDimmed( EFsEmailUiCmdReadEmail, ETrue ); |
1353 //Get # of recipients |
1359 } |
1354 numRecipients = TFsEmailUiUtility::CountRecipientsSmart( iAppUi, targetMessage ); |
1360 // Disable read in outbox and drafts |
1355 } |
1361 if ( currentFolderType == EFSDraftsFolder || |
1356 // All reply/forward options are hidden when multiple marked messages or folder is outbox or drafts |
1362 currentFolderType == EFSOutbox ) |
1357 if ( targetEntries.Count() != 1 || |
1363 { |
1358 currentFolderType == EFSOutbox || |
1364 aMenuPane->SetItemDimmed( EFsEmailUiCmdReadEmail, ETrue ); |
1359 currentFolderType == EFSDraftsFolder ) |
1365 } |
1360 { |
|
1361 aMenuPane->SetItemDimmed( EFsEmailUiCmdActionsReply, ETrue ); |
|
1362 aMenuPane->SetItemDimmed( EFsEmailUiCmdActionsReplyAll, ETrue ); |
|
1363 aMenuPane->SetItemDimmed( EFsEmailUiCmdActionsForward, ETrue ); |
|
1364 } |
|
1365 |
|
1366 // Reply all is hidden also when the single target message has multiple recipients |
|
1367 else if ( !targetMessage || numRecipients <= 1 ) |
|
1368 { |
|
1369 aMenuPane->SetItemDimmed( EFsEmailUiCmdActionsReplyAll, ETrue ); |
|
1370 } |
|
1371 |
|
1372 aMenuPane->SetItemDimmed( EFsEmailUiCmdSubMenuUnmark, ETrue); |
|
1373 } |
1366 |
1374 |
1367 // EMPTY LIST, MOST OPTIONS ARE HIDDEN |
1375 // EMPTY LIST, MOST OPTIONS ARE HIDDEN |
1368 if ( !iModel->Count() || !iMailFolder ) |
1376 if ( !iModel->Count() || !iMailFolder ) |
1369 { |
1377 { |
1370 aMenuPane->SetItemDimmed( EFsEmailUiCmdActionsOpen, ETrue ); |
|
1371 aMenuPane->SetItemDimmed( EFsEmailUiCmdMailActions, ETrue ); |
1378 aMenuPane->SetItemDimmed( EFsEmailUiCmdMailActions, ETrue ); |
1372 aMenuPane->SetItemDimmed( EFsEmailUiCmdMore, ETrue ); |
1379 aMenuPane->SetItemDimmed( EFsEmailUiCmdSubMenuMark, ETrue ); |
|
1380 aMenuPane->SetItemDimmed( EFsEmailUiCmdSubMenuUnmark, ETrue ); |
1373 aMenuPane->SetItemDimmed( EFsEmailUiCmdSearch, ETrue ); |
1381 aMenuPane->SetItemDimmed( EFsEmailUiCmdSearch, ETrue ); |
1374 aMenuPane->SetItemDimmed( EFsEmailUiCmdReadEmail, ETrue ); |
|
1375 } |
1382 } |
1376 |
1383 |
1377 // NO TARGET ITEMS, E.G FOCUS ON DIVIDER AND NO MARKED ITEMS, ITEM RELATED OPTIONS ARE HIDDEN |
|
1378 else if ( !targetEntries.Count() ) |
|
1379 { |
|
1380 aMenuPane->SetItemDimmed( EFsEmailUiCmdMailActions, ETrue ); |
|
1381 aMenuPane->SetItemDimmed( EFsEmailUiCmdReadEmail, ETrue ); |
|
1382 } |
|
1383 |
|
1384 // Open command is available only if there's exactly one target item |
|
1385 if ( targetEntries.Count() != 1 ) |
|
1386 { |
|
1387 aMenuPane->SetItemDimmed( EFsEmailUiCmdActionsOpen, ETrue ); |
|
1388 } |
|
1389 |
|
1390 // FOLDER SPECIFIC COMMAND HIDING |
1384 // FOLDER SPECIFIC COMMAND HIDING |
1391 // In the outbox folder, Open command is inavailable in any case |
|
1392 if ( currentFolderType == EFSOutbox ) |
|
1393 { |
|
1394 aMenuPane->SetItemDimmed( EFsEmailUiCmdActionsOpen, ETrue ); |
|
1395 } |
|
1396 |
|
1397 // "Clear deleted folder" command is available only in Deleted folder |
1385 // "Clear deleted folder" command is available only in Deleted folder |
1398 if ( currentFolderType != EFSDeleted || !iModel->Count() ) |
1386 if ( currentFolderType != EFSDeleted || !iModel->Count() ) |
1399 { |
1387 { |
1400 aMenuPane->SetItemDimmed( EFsEmailUiCmdActionsEmptyDeleted, ETrue ); |
1388 aMenuPane->SetItemDimmed( EFsEmailUiCmdActionsEmptyDeleted, ETrue ); |
1401 } |
1389 } |
1404 |
1392 |
1405 |
1393 |
1406 // ACTIONS SUBMENU ********************************************************************* |
1394 // ACTIONS SUBMENU ********************************************************************* |
1407 if ( aResourceId == R_FSEMAILUI_MAILLIST_SUBMENU_MAIL_ACTIONS ) |
1395 if ( aResourceId == R_FSEMAILUI_MAILLIST_SUBMENU_MAIL_ACTIONS ) |
1408 { |
1396 { |
1409 // Actions menu should never be available when there's no marked or focused item(s) |
|
1410 __ASSERT_DEBUG( targetEntries.Count(), Panic(EFSEmailUiUnexpectedValue) ); |
|
1411 |
|
1412 CFSMailMessage* targetMessage = NULL; |
|
1413 if ( targetEntries.Count() == 1 ) |
|
1414 { |
|
1415 targetMessage = &MsgPtrFromListIdL( targetEntries[0] ); |
|
1416 } |
|
1417 |
|
1418 // Meeting request mode is in use when there's exactly one target item and it's a |
|
1419 // calendar message and MRUI is available. |
|
1420 TBool showMrActions = EFalse; |
|
1421 |
|
1422 if ( targetMessage && targetMessage->IsFlagSet( EFSMsgFlag_CalendarMsg ) && |
|
1423 iAppUi.MrViewerInstanceL() && |
|
1424 iAppUi.MrViewerInstanceL()->CanViewMessage( *targetMessage ) && |
|
1425 currentFolderType != EFSOutbox && |
|
1426 currentFolderType != EFSDraftsFolder ) |
|
1427 { |
|
1428 showMrActions = ETrue; |
|
1429 } |
|
1430 |
|
1431 // CALENDAR EVENT ACTIONS SUBMENU |
|
1432 if ( showMrActions ) |
|
1433 { |
|
1434 // Hide all the normal email message specific actions |
|
1435 aMenuPane->SetItemDimmed( EFsEmailUiCmdActionsReply, ETrue ); |
|
1436 aMenuPane->SetItemDimmed( EFsEmailUiCmdActionsReplyAll, ETrue ); |
|
1437 aMenuPane->SetItemDimmed( EFsEmailUiCmdActionsForward, ETrue ); |
|
1438 |
|
1439 // Hide the irrelevant MR actions |
|
1440 TESMRMeetingRequestMethod mrMethod( EESMRMeetingRequestMethodUnknown ); |
|
1441 if ( iAppUi.MrViewerInstanceL() ) |
|
1442 { |
|
1443 TRAP_IGNORE( mrMethod = iAppUi.MrViewerInstanceL()->ResolveMeetingRequestMethodL( *targetMessage ) ); |
|
1444 } |
|
1445 switch ( mrMethod ) |
|
1446 { |
|
1447 case EESMRMeetingRequestMethodRequest: |
|
1448 { |
|
1449 aMenuPane->SetItemDimmed(EFsEmailUiCmdCalRemoveFromCalendar, ETrue); |
|
1450 } |
|
1451 break; |
|
1452 case EESMRMeetingRequestMethodCancellation: |
|
1453 { |
|
1454 aMenuPane->SetItemDimmed(EFsEmailUiCmdCalActionsAccept, ETrue); |
|
1455 aMenuPane->SetItemDimmed(EFsEmailUiCmdCalActionsTentative, ETrue); |
|
1456 aMenuPane->SetItemDimmed(EFsEmailUiCmdCalActionsDecline, ETrue); |
|
1457 |
|
1458 TBool supportsRemove = iAppUi.GetActiveMailbox()->HasCapability( EFSMBoxCapaRemoveFromCalendar ); |
|
1459 if( !supportsRemove ) |
|
1460 { |
|
1461 aMenuPane->SetItemDimmed(EFsEmailUiCmdCalRemoveFromCalendar, ETrue); |
|
1462 } |
|
1463 } |
|
1464 break; |
|
1465 case EESMRMeetingRequestMethodResponse: |
|
1466 case EESMRMeetingRequestMethodUnknown: |
|
1467 { |
|
1468 aMenuPane->SetItemDimmed(EFsEmailUiCmdCalRemoveFromCalendar, ETrue); |
|
1469 aMenuPane->SetItemDimmed(EFsEmailUiCmdCalActionsAccept, ETrue); |
|
1470 aMenuPane->SetItemDimmed(EFsEmailUiCmdCalActionsTentative, ETrue); |
|
1471 aMenuPane->SetItemDimmed(EFsEmailUiCmdCalActionsDecline, ETrue); |
|
1472 } |
|
1473 break; |
|
1474 default: |
|
1475 break; |
|
1476 } |
|
1477 } |
|
1478 |
|
1479 // MAIL MESSAGE ACTIONS SUBMENU |
|
1480 else |
|
1481 { |
|
1482 // Hide all the calendar event options |
|
1483 aMenuPane->SetItemDimmed( EFsEmailUiCmdCalActionsAccept, ETrue ); |
|
1484 aMenuPane->SetItemDimmed( EFsEmailUiCmdCalActionsTentative, ETrue ); |
|
1485 aMenuPane->SetItemDimmed( EFsEmailUiCmdCalActionsDecline, ETrue ); |
|
1486 aMenuPane->SetItemDimmed( EFsEmailUiCmdCalRemoveFromCalendar, ETrue ); |
|
1487 |
|
1488 // Hide the irrelevant reply / reply all / forward commands |
|
1489 TInt numRecipients(0); |
|
1490 if ( targetMessage ) |
|
1491 { |
|
1492 //Get # of recipients |
|
1493 numRecipients = TFsEmailUiUtility::CountRecipientsSmart( iAppUi, targetMessage ); |
|
1494 } |
|
1495 // All reply/forward options are hidden when multiple marked messages or folder is outbox or drafts |
|
1496 if ( targetEntries.Count() > 1 || |
|
1497 currentFolderType == EFSOutbox || |
|
1498 currentFolderType == EFSDraftsFolder ) |
|
1499 { |
|
1500 aMenuPane->SetItemDimmed( EFsEmailUiCmdActionsReply, ETrue ); |
|
1501 aMenuPane->SetItemDimmed( EFsEmailUiCmdActionsReplyAll, ETrue ); |
|
1502 aMenuPane->SetItemDimmed( EFsEmailUiCmdActionsForward, ETrue ); |
|
1503 } |
|
1504 |
|
1505 // Reply all is hidden also when the single target message has multiple recipients |
|
1506 else if ( !targetMessage || numRecipients <= 1 ) |
|
1507 { |
|
1508 aMenuPane->SetItemDimmed( EFsEmailUiCmdActionsReplyAll, ETrue ); |
|
1509 } |
|
1510 } |
|
1511 |
|
1512 // COMMON PART OF ACTIONS SUBMENU |
1397 // COMMON PART OF ACTIONS SUBMENU |
1513 aMenuPane->SetItemDimmed( EFsEmailUiCmdMarkAsRead, !IsMarkAsReadAvailableL() ); |
1398 aMenuPane->SetItemDimmed( EFsEmailUiCmdMarkAsRead, !IsMarkAsReadAvailableL() ); |
1514 aMenuPane->SetItemDimmed( EFsEmailUiCmdMarkAsUnread, !IsMarkAsUnreadAvailableL() ); |
1399 aMenuPane->SetItemDimmed( EFsEmailUiCmdMarkAsUnread, !IsMarkAsUnreadAvailableL() ); |
1515 |
1400 |
1516 if ( !supportsMoving || !iMailFolder ) // Hide move from actions if not supported |
1401 if ( !supportsMoving || !iMailFolder ) // Hide move from actions if not supported |
1517 { |
1402 { |
1518 aMenuPane->SetItemDimmed( EFsEmailUiCmdActionsMove, ETrue ); |
1403 aMenuPane->SetItemDimmed( EFsEmailUiCmdActionsMove, ETrue ); |
1519 aMenuPane->SetItemDimmed( EFsEmailUiCmdActionsMoveToDrafts, ETrue ); |
|
1520 } |
1404 } |
1521 else |
1405 else |
1522 { |
1406 { |
1523 // Moving supported, show/hide moving options depending on the current folder |
1407 // Moving supported, show/hide moving options depending on the current folder |
1524 // First check deleted items case, IMS does not support deleted sync |
1408 // Check for outbox case |
1525 if ( currentFolderType == EFSDeleted ) |
1409 if ( currentFolderType == EFSOutbox ) |
1526 { |
1410 { |
1527 aMenuPane->SetItemDimmed( EFsEmailUiCmdActionsMoveToDrafts, ETrue ); // Dim in deleted |
|
1528 } |
|
1529 // Then check for outbox case, move to drafts is allowed, other moves not |
|
1530 else if ( currentFolderType == EFSOutbox ) |
|
1531 { |
|
1532 // move from outbox to drafts is allowed |
|
1533 aMenuPane->SetItemDimmed( EFsEmailUiCmdActionsMoveToDrafts, EFalse ); // Allow in outbox |
|
1534 // moving from outbox is not allowed otherwise |
1411 // moving from outbox is not allowed otherwise |
1535 aMenuPane->SetItemDimmed( EFsEmailUiCmdActionsMove, ETrue ); |
1412 aMenuPane->SetItemDimmed( EFsEmailUiCmdActionsMove, ETrue ); |
1536 } |
1413 } |
1537 else if ( currentFolderType == EFSDraftsFolder ) |
|
1538 { |
|
1539 // move from drafts to drafts is not allowed |
|
1540 aMenuPane->SetItemDimmed( EFsEmailUiCmdActionsMoveToDrafts, ETrue ); |
|
1541 // moving from drafts folder is not allowed |
|
1542 aMenuPane->SetItemDimmed( EFsEmailUiCmdActionsMove, ETrue ); |
|
1543 } |
|
1544 |
|
1545 // Handle rest of the folders |
1414 // Handle rest of the folders |
1546 else |
1415 else |
1547 { |
1416 { |
1548 aMenuPane->SetItemDimmed( EFsEmailUiCmdActionsMoveToDrafts, ETrue ); // Dim in other folders |
|
1549 aMenuPane->SetItemDimmed( EFsEmailUiCmdActionsMove, EFalse ); |
1417 aMenuPane->SetItemDimmed( EFsEmailUiCmdActionsMove, EFalse ); |
1550 } |
1418 } |
1551 } |
1419 } |
1552 } |
1420 |
1553 // ACTIONS SUBMENU ********************************************************************* |
|
1554 |
|
1555 |
|
1556 // MORE SUBMENU ************************************************************************ |
|
1557 if ( aResourceId == R_FSEMAILUI_MAILLIST_SUBMENU_MORE ) |
|
1558 { |
|
1559 TInt markedCount = CountMarkedItemsL(); |
1421 TInt markedCount = CountMarkedItemsL(); |
1560 |
|
1561 // Checks if a device has a keyboard or not. |
|
1562 if( !iKeyboardFlipOpen ) |
|
1563 { |
|
1564 aMenuPane->SetItemDimmed( EFsEmailUiCmdMarkMark, ETrue ); |
|
1565 aMenuPane->SetItemDimmed( EFsEmailUiCmdActionsCallSender, ETrue ); |
|
1566 aMenuPane->SetItemDimmed( EFsEmailUiCmdActionsAddContact, ETrue ); |
|
1567 aMenuPane->SetItemDimmed( EFsEmailUiCmdMessageDetails, ETrue ); |
|
1568 } |
|
1569 |
1422 |
1570 // Hide expand/collapse all when not applicable |
1423 // Hide expand/collapse all when not applicable |
1571 if ( iNodesInUse == EListControlSeparatorDisabled || !iModel->Count() ) |
1424 if ( iNodesInUse == EListControlSeparatorDisabled || !iModel->Count() ) |
1572 { |
1425 { |
1573 aMenuPane->SetItemDimmed(EFsEmailUiCmdActionsCollapseAll, ETrue); |
1426 aMenuPane->SetItemDimmed(EFsEmailUiCmdActionsCollapseAll, ETrue); |
1576 else |
1429 else |
1577 { |
1430 { |
1578 aMenuPane->SetItemDimmed( EFsEmailUiCmdActionsCollapseAll, AllNodesCollapsed() ); |
1431 aMenuPane->SetItemDimmed( EFsEmailUiCmdActionsCollapseAll, AllNodesCollapsed() ); |
1579 aMenuPane->SetItemDimmed( EFsEmailUiCmdActionsExpandAll, AllNodesExpanded() ); |
1432 aMenuPane->SetItemDimmed( EFsEmailUiCmdActionsExpandAll, AllNodesExpanded() ); |
1580 } |
1433 } |
1581 |
|
1582 // Some commands are available only when there's exactly one target message |
|
1583 if ( targetEntries.Count() != 1 ) |
|
1584 { |
|
1585 aMenuPane->SetItemDimmed( EFsEmailUiCmdActionsCallSender, ETrue ); |
|
1586 aMenuPane->SetItemDimmed( EFsEmailUiCmdActionsAddContact, ETrue ); |
|
1587 aMenuPane->SetItemDimmed( EFsEmailUiCmdMessageDetails, ETrue ); |
|
1588 } |
|
1589 |
|
1590 // Hide mark/unmark all when not applicable |
|
1591 if ( markedCount == EmailsInModelL() ) // Hide mark all |
|
1592 { |
|
1593 aMenuPane->SetItemDimmed( EFsEmailUiCmdMarkMarkAll, ETrue ); |
|
1594 //aMenuPane->SetItemDimmed( EFsEmailUiCmdMarkUnmarkAll, EFalse ); |
|
1595 } |
|
1596 else if ( !markedCount ) // hide unmark all |
|
1597 { |
|
1598 //aMenuPane->SetItemDimmed( EFsEmailUiCmdMarkMarkAll, EFalse ); |
|
1599 aMenuPane->SetItemDimmed( EFsEmailUiCmdMarkUnmarkAll, ETrue ); |
|
1600 } |
|
1601 |
1434 |
1602 // Hide followup flagging if not applicable |
1435 // Hide followup flagging if not applicable |
1603 if ( !supportsFlag || !targetEntries.Count() ) |
1436 if ( !supportsFlag || !targetEntries.Count() ) |
1604 { |
1437 { |
1605 aMenuPane->SetItemDimmed(EFsEmailUiCmdActionsFlag, ETrue); |
1438 aMenuPane->SetItemDimmed(EFsEmailUiCmdActionsFlag, ETrue); |
1606 } |
1439 } |
1607 |
1440 |
1608 // Hide Download Manager if no downloads present |
|
1609 // <cmail> Prevent Download Manager opening with attachments |
|
1610 // if ( !iAppUi.DownloadInfoMediator() || !iAppUi.DownloadInfoMediator()->IsAnyAttachmentDownloads() ) |
|
1611 // { |
|
1612 // aMenuPane->SetItemDimmed(EFsEmailUiCmdDownloadManager, ETrue); |
|
1613 // } |
|
1614 // </cmail> |
|
1615 |
|
1616 // Availability of the mark/unmark commands depends only on the focused item |
|
1617 if ( !iMailList || iMailList->FocusedItem() == KFsTreeNoneID || |
|
1618 iMailList->IsNode( iMailList->FocusedItem() ) ) |
|
1619 { |
|
1620 aMenuPane->SetItemDimmed( EFsEmailUiCmdMarkMark, ETrue ); |
|
1621 aMenuPane->SetItemDimmed( EFsEmailUiCmdMarkUnmark, ETrue ); |
|
1622 } |
|
1623 else if ( iMailList->IsMarked( iMailList->FocusedItem() ) ) // Item was already marked |
|
1624 { |
|
1625 aMenuPane->SetItemDimmed( EFsEmailUiCmdMarkMark, ETrue ); |
|
1626 } |
|
1627 else |
|
1628 { |
|
1629 aMenuPane->SetItemDimmed( EFsEmailUiCmdMarkUnmark, ETrue ); |
|
1630 } |
|
1631 |
|
1632 // Some commands are hidden in the outbox and drafts folders |
1441 // Some commands are hidden in the outbox and drafts folders |
1633 if ( currentFolderType == EFSOutbox || |
1442 if ( currentFolderType == EFSOutbox || |
1634 currentFolderType == EFSDraftsFolder ) |
1443 currentFolderType == EFSDraftsFolder ) |
1635 { |
1444 { |
1636 aMenuPane->SetItemDimmed( EFsEmailUiCmdActionsCallSender, ETrue ); |
|
1637 aMenuPane->SetItemDimmed( EFsEmailUiCmdActionsAddContact, ETrue ); |
|
1638 aMenuPane->SetItemDimmed( EFsEmailUiCmdActionsFlag, ETrue ); |
1445 aMenuPane->SetItemDimmed( EFsEmailUiCmdActionsFlag, ETrue ); |
1639 } |
1446 } |
1640 } |
1447 } |
1641 // MORE SUBMENU ************************************************************************ |
1448 // ACTIONS SUBMENU ********************************************************************* |
1642 |
1449 |
1643 |
1450 |
1644 // SETTINGS SUBMENU ******************************************************************** |
1451 // MARK SUBMENU ************************************************************************ |
1645 if ( aResourceId == R_FSEMAILUI_MAILLIST_SUBMENU_MAIL_SETTINGS ) |
1452 // Mark submenu show only when focus is visible |
|
1453 if ( aResourceId == R_FSEMAILUI_MAILLIST_SUBMENU_MARK) |
1646 { |
1454 { |
1647 TUid pluginUid = iAppUi.GetActiveMailbox()->GetSettingsUid(); |
1455 // Checks if a device has a keyboard or not. |
1648 |
1456 if( !iLastFocus ) |
1649 CESMailSettingsPlugin* settingsPlugin = |
1457 { |
1650 static_cast<CESMailSettingsPlugin*>( iAppUi.View( pluginUid ) ); |
1458 aMenuPane->SetItemDimmed( EFsEmailUiCmdMarkMark, ETrue ); |
1651 |
1459 aMenuPane->SetItemDimmed( EFsEmailUiCmdMarkMarkAll, ETrue ); |
1652 if ( !settingsPlugin ) |
1460 } |
1653 { |
1461 else |
1654 settingsPlugin = CESMailSettingsPlugin::NewL( pluginUid ); |
1462 { |
1655 CleanupStack::PushL( settingsPlugin ); |
1463 aMenuPane->SetItemDimmed( EFsEmailUiCmdMarkSubAll, ETrue ); |
1656 iAppUi.AddViewL( settingsPlugin ); |
1464 } |
1657 CleanupStack::Pop( settingsPlugin ); // ownership transferred |
|
1658 } |
|
1659 TInt count( settingsPlugin->MailSettingsSubviewCount() ); |
|
1660 if ( count > 0 ) |
|
1661 { |
|
1662 TInt index = 0; |
|
1663 while ( index < count ) |
|
1664 { |
|
1665 CEikMenuPaneItem::SData newMenuItem; |
|
1666 newMenuItem.iCommandId = EFsEmailUiCmdSettingsBaseCommandId + index; |
|
1667 newMenuItem.iCascadeId = 0; |
|
1668 newMenuItem.iFlags = 0; |
|
1669 newMenuItem.iText = settingsPlugin->MailSettingsSubviewCaption( |
|
1670 iAppUi.GetActiveMailboxId(), |
|
1671 index, |
|
1672 EFalse |
|
1673 ); |
|
1674 aMenuPane->InsertMenuItemL( |
|
1675 newMenuItem, |
|
1676 aMenuPane->NumberOfItemsInPane() ); |
|
1677 ++index; |
|
1678 } |
|
1679 } |
|
1680 else |
|
1681 { |
|
1682 // POP/IMAP mailbox settings |
|
1683 HBufC* ipsText = StringLoader::LoadLC( R_FREESTYLE_EMAIL_UI_SETTINGS_IPS_TEXT ); |
|
1684 CEikMenuPaneItem::SData newMenuItem; |
|
1685 newMenuItem.iCommandId = EFsEmailUiCmdSettingsBaseCommandId; |
|
1686 newMenuItem.iCascadeId = 0; |
|
1687 newMenuItem.iFlags = 0; |
|
1688 newMenuItem.iText = *ipsText; |
|
1689 aMenuPane->InsertMenuItemL( |
|
1690 newMenuItem, |
|
1691 aMenuPane->NumberOfItemsInPane() ); |
|
1692 CleanupStack::PopAndDestroy( ipsText ); |
|
1693 } |
|
1694 } |
1465 } |
1695 // SETTINGS SUBMENU ******************************************************************** |
1466 |
|
1467 // MARK SUBMENU ************************************************************************ |
|
1468 |
|
1469 |
|
1470 // UNMARK SUBMENU ************************************************************************ |
|
1471 // Unmark submenu show only when focus is not visible |
|
1472 if ( aResourceId == R_FSEMAILUI_MAILLIST_SUBMENU_UNMARK) |
|
1473 { |
|
1474 // Nothing to do yet |
|
1475 } |
|
1476 // UNMARK SUBMENU ************************************************************************ |
|
1477 |
1696 |
1478 |
1697 CleanupStack::PopAndDestroy( &targetEntries ); |
1479 CleanupStack::PopAndDestroy( &targetEntries ); |
1698 |
1480 |
1699 // Add shortcut hints |
1481 // Add shortcut hints |
1700 iAppUi.ShortcutBinding().AppendShortcutHintsL( *aMenuPane, |
1482 iAppUi.ShortcutBinding().AppendShortcutHintsL( *aMenuPane, |
2540 return contains; |
2327 return contains; |
2541 } |
2328 } |
2542 |
2329 |
2543 // --------------------------------------------------------------------------- |
2330 // --------------------------------------------------------------------------- |
2544 // |
2331 // |
|
2332 // --------------------------------------------------------------------------- |
|
2333 // |
|
2334 TBool CFSEmailUiMailListVisualiser::HandleArrowEventInPortraitL( |
|
2335 const TInt aScancode, |
|
2336 const TAlfEvent& aEvent, |
|
2337 const TBool aShiftState ) |
|
2338 { |
|
2339 FUNC_LOG; |
|
2340 TBool result( EFalse ); |
|
2341 |
|
2342 if( aScancode == EStdKeyLeftArrow ) |
|
2343 { |
|
2344 if( ( iControlBarControl ) && |
|
2345 ( iFocusedControl == EMailListComponent ) ) |
|
2346 { |
|
2347 // Move focus to control bar (focused button is |
|
2348 // sort button). |
|
2349 HandleCommandL( EFsEmailUiCmdGoToSwitchSorting ); |
|
2350 result = ETrue; |
|
2351 } |
|
2352 else if( ( iControlBarControl ) && |
|
2353 ( iFocusedControl == EControlBarComponent ) ) |
|
2354 { |
|
2355 TInt focusedButtonId( iControlBarControl->GetFocusedButton()->Id() ); |
|
2356 if ( focusedButtonId == iNewEmailButtonId ) |
|
2357 { |
|
2358 // Change focus to mail list if there are any |
|
2359 // emails in it. |
|
2360 if( iModel->Count() ) |
|
2361 { |
|
2362 iFocusedControl = EMailListComponent; |
|
2363 result = EFalse; |
|
2364 } |
|
2365 // Leave focus to control bar because there are no |
|
2366 // mails in mail list. |
|
2367 else |
|
2368 { |
|
2369 iControlBarControl->MakeSelectorVisible( IsFocusShown() ); |
|
2370 iFocusedControl = EControlBarComponent; |
|
2371 result = ETrue; // Do not set focus to empty list |
|
2372 } |
|
2373 } |
|
2374 else |
|
2375 { |
|
2376 iControlBarControl->MakeSelectorVisible( IsFocusShown() ); |
|
2377 iFocusedControl = EControlBarComponent; |
|
2378 result = EFalse; |
|
2379 } |
|
2380 } |
|
2381 else |
|
2382 { |
|
2383 iFocusedControl = EMailListComponent; |
|
2384 result = EFalse; |
|
2385 } |
|
2386 SetMskL(); |
|
2387 } |
|
2388 else if( aScancode == EStdKeyRightArrow ) |
|
2389 { |
|
2390 // Show toolbar if there is data on the list |
|
2391 const TInt modelCount( iModel->Count() ); |
|
2392 TBool focusShown( IsFocusShown() ); |
|
2393 |
|
2394 // If control bar is focused. |
|
2395 if( ( iControlBarControl ) && |
|
2396 ( iFocusedControl == EControlBarComponent ) ) |
|
2397 { |
|
2398 TInt focusedButtonId( iControlBarControl->GetFocusedButton()->Id() ); |
|
2399 |
|
2400 // If sort button is focused and there are mails in mail |
|
2401 // list then focus is moved to mail list, otherwise |
|
2402 // leave focus to control bar |
|
2403 if( focusedButtonId == iSortButtonId ) |
|
2404 { |
|
2405 if ( modelCount > 0 ) // Check for empty folder |
|
2406 { |
|
2407 iFocusedControl = EMailListComponent; |
|
2408 result = EFalse; |
|
2409 } |
|
2410 else |
|
2411 { |
|
2412 iFocusedControl = EControlBarComponent; |
|
2413 iControlBarControl->MakeSelectorVisible( focusShown ); |
|
2414 result = ETrue; // Do not set focus to empty list |
|
2415 } |
|
2416 } |
|
2417 else |
|
2418 { |
|
2419 iFocusedControl = EControlBarComponent; |
|
2420 iControlBarControl->MakeSelectorVisible( focusShown ); |
|
2421 result = EFalse; |
|
2422 } |
|
2423 } |
|
2424 else if( ( iControlBarControl ) && |
|
2425 ( iFocusedControl == EMailListComponent ) ) |
|
2426 { |
|
2427 HandleCommandL( EFsEmailUiCmdGoToSwitchNewEmail ); |
|
2428 result = ETrue; |
|
2429 } |
|
2430 else |
|
2431 { |
|
2432 iFocusedControl = EMailListComponent; |
|
2433 result = EFalse; |
|
2434 } |
|
2435 SetMskL(); |
|
2436 } |
|
2437 else if( aScancode == EStdKeyDownArrow ) |
|
2438 { |
|
2439 const TInt itemCount( iModel->Count() ); |
|
2440 if ( iFocusedControl == EMailListComponent ) |
|
2441 { |
|
2442 result = iMailList->TreeControl()->OfferEventL( aEvent ); |
|
2443 if ( aShiftState ) |
|
2444 { |
|
2445 DoScrollMarkUnmarkL(); // marking is done after moving the cursor |
|
2446 } |
|
2447 } |
|
2448 else if( ( iFocusedControl == EControlBarComponent ) && |
|
2449 ( itemCount == 0 ) ) |
|
2450 { |
|
2451 result = ETrue; // Do not set focus to empty list |
|
2452 } |
|
2453 else if( ( iFocusedControl == EControlBarComponent ) && |
|
2454 ( itemCount > 0 ) ) |
|
2455 { |
|
2456 iFocusedControl = EMailListComponent; |
|
2457 |
|
2458 result = iMailList->TreeControl()->OfferEventL(aEvent); |
|
2459 if ( aShiftState ) |
|
2460 { |
|
2461 DoScrollMarkUnmarkL(); // marking is done after moving the cursor |
|
2462 } |
|
2463 } |
|
2464 else |
|
2465 { |
|
2466 result = EFalse; |
|
2467 } |
|
2468 SetMskL(); |
|
2469 } |
|
2470 else if( aScancode == EStdKeyUpArrow ) |
|
2471 { |
|
2472 iControlBarControl->MakeSelectorVisible( IsFocusShown() ); |
|
2473 if ( iFocusedControl == EMailListComponent ) |
|
2474 { |
|
2475 if ( HighlightedIndex() == 0 ) |
|
2476 { |
|
2477 HandleCommandL( EFsEmailUiCmdGoToSwitchFolder ); |
|
2478 result = ETrue; |
|
2479 } |
|
2480 else |
|
2481 { |
|
2482 result = iMailList->TreeControl()->OfferEventL( aEvent ); |
|
2483 if ( aShiftState ) |
|
2484 { |
|
2485 // marking is done after moving the cursor |
|
2486 DoScrollMarkUnmarkL(); |
|
2487 } |
|
2488 SetMskL(); |
|
2489 } |
|
2490 } |
|
2491 else if( iFocusedControl == EControlBarComponent ) |
|
2492 { |
|
2493 result = ETrue; |
|
2494 } |
|
2495 else |
|
2496 { |
|
2497 result = EFalse; |
|
2498 } |
|
2499 } |
|
2500 |
|
2501 return result; |
|
2502 } |
|
2503 |
|
2504 // --------------------------------------------------------------------------- |
|
2505 // |
|
2506 // --------------------------------------------------------------------------- |
|
2507 // |
|
2508 TBool CFSEmailUiMailListVisualiser::HandleArrowEventInLandscapeL( |
|
2509 const TInt aScancode, |
|
2510 const TAlfEvent& aEvent, |
|
2511 const TBool aShiftState ) |
|
2512 { |
|
2513 FUNC_LOG; |
|
2514 TBool result( EFalse ); |
|
2515 if( aScancode == EStdKeyRightArrow ) |
|
2516 { |
|
2517 if ( iFocusedControl == EMailListComponent ) |
|
2518 { |
|
2519 HandleCommandL( EFsEmailUiCmdGoToSwitchFolder ); |
|
2520 result = ETrue; |
|
2521 } |
|
2522 else if( iFocusedControl == EControlBarComponent ) |
|
2523 { |
|
2524 iControlBarControl->MakeSelectorVisible( IsFocusShown() ); |
|
2525 result = ETrue; |
|
2526 } |
|
2527 } |
|
2528 else if( aScancode == EStdKeyLeftArrow ) |
|
2529 { |
|
2530 if ( iFocusedControl == EControlBarComponent ) |
|
2531 { |
|
2532 const TInt modelCount( iModel->Count() ); |
|
2533 if( modelCount > 0 ) |
|
2534 { |
|
2535 iFocusedControl = EMailListComponent; |
|
2536 result = iMailList->TreeControl()->OfferEventL( aEvent ); |
|
2537 if( aShiftState ) |
|
2538 { |
|
2539 // marking is done after moving the cursor |
|
2540 DoScrollMarkUnmarkL(); |
|
2541 } |
|
2542 } |
|
2543 else |
|
2544 { |
|
2545 iControlBarControl->MakeSelectorVisible( IsFocusShown() ); |
|
2546 // Do not set focus to empty list |
|
2547 result = ETrue; |
|
2548 } |
|
2549 } |
|
2550 else if( iFocusedControl == EMailListComponent ) |
|
2551 { |
|
2552 result = iMailList->TreeControl()->OfferEventL( aEvent ); |
|
2553 if ( aShiftState ) |
|
2554 { |
|
2555 // marking is done after moving the cursor |
|
2556 DoScrollMarkUnmarkL(); |
|
2557 } |
|
2558 } |
|
2559 SetMskL(); |
|
2560 } |
|
2561 if( aScancode == EStdKeyUpArrow ) |
|
2562 { |
|
2563 if( iFocusedControl == EMailListComponent ) |
|
2564 { |
|
2565 result = iMailList->TreeControl()->OfferEventL( aEvent ); |
|
2566 if ( aShiftState ) |
|
2567 { |
|
2568 // marking is done after moving the cursor |
|
2569 DoScrollMarkUnmarkL(); |
|
2570 } |
|
2571 } |
|
2572 else if( iFocusedControl == EControlBarComponent ) |
|
2573 { |
|
2574 TInt focusedButtonId( iControlBarControl->GetFocusedButton()->Id() ); |
|
2575 if ( focusedButtonId == iNewEmailButtonId ) |
|
2576 { |
|
2577 // Change focus to mail list if there are any |
|
2578 // mails in it. |
|
2579 if( iModel->Count() > 0 ) |
|
2580 { |
|
2581 iFocusedControl = EMailListComponent; |
|
2582 result = EFalse; |
|
2583 } |
|
2584 // Leave focus to control bar because there are no |
|
2585 // mails in mail list. |
|
2586 else |
|
2587 { |
|
2588 // Do not set focus to empty list |
|
2589 iControlBarControl->MakeSelectorVisible( IsFocusShown() ); |
|
2590 result = ETrue; |
|
2591 } |
|
2592 } |
|
2593 else |
|
2594 { |
|
2595 iControlBarControl->MakeSelectorVisible( IsFocusShown() ); |
|
2596 result = static_cast<CAlfControl*>( iControlBarControl )->OfferEventL( aEvent ); |
|
2597 } |
|
2598 } |
|
2599 SetMskL(); |
|
2600 } |
|
2601 else if( aScancode == EStdKeyDownArrow ) |
|
2602 { |
|
2603 if( iFocusedControl == EMailListComponent ) |
|
2604 { |
|
2605 result = iMailList->TreeControl()->OfferEventL( aEvent ); |
|
2606 if( aShiftState ) |
|
2607 { |
|
2608 // marking is done after moving the cursor |
|
2609 DoScrollMarkUnmarkL(); |
|
2610 } |
|
2611 } |
|
2612 else if( iFocusedControl == EControlBarComponent ) |
|
2613 { |
|
2614 const TInt modelCount( iModel->Count() ); |
|
2615 TInt focusedButtonId( iControlBarControl->GetFocusedButton()->Id() ); |
|
2616 // If sort button is focused and there are mails in mail |
|
2617 // list then focus is moved to mail list, otherwise |
|
2618 // leave focus to control bar |
|
2619 if( focusedButtonId == iSortButtonId ) |
|
2620 { |
|
2621 if ( modelCount > 0 ) // Check for empty folder |
|
2622 { |
|
2623 iFocusedControl = EMailListComponent; |
|
2624 result = EFalse; |
|
2625 } |
|
2626 else |
|
2627 { |
|
2628 iControlBarControl->MakeSelectorVisible( IsFocusShown() ); |
|
2629 result = ETrue; // Do not set focus to empty list |
|
2630 } |
|
2631 } |
|
2632 else |
|
2633 { |
|
2634 iControlBarControl->MakeSelectorVisible( IsFocusShown() ); |
|
2635 result = static_cast<CAlfControl*>( iControlBarControl )->OfferEventL( aEvent ); |
|
2636 } |
|
2637 } |
|
2638 SetMskL(); |
|
2639 } |
|
2640 |
|
2641 return result; |
|
2642 } |
|
2643 |
|
2644 // --------------------------------------------------------------------------- |
2545 // |
2645 // |
2546 // --------------------------------------------------------------------------- |
2646 // --------------------------------------------------------------------------- |
2547 // |
2647 // |
2548 void CFSEmailUiMailListVisualiser::UpdateTheme() |
2648 void CFSEmailUiMailListVisualiser::UpdateTheme() |
2549 { |
2649 { |
2679 RFsTreeItemIdList actionTargetItems; |
2779 RFsTreeItemIdList actionTargetItems; |
2680 CleanupClosePushL( actionTargetItems ); |
2780 CleanupClosePushL( actionTargetItems ); |
2681 GetActionsTargetEntriesL( actionTargetItems ); |
2781 GetActionsTargetEntriesL( actionTargetItems ); |
2682 |
2782 |
2683 // Check if the focus needs to be removed. |
2783 // Check if the focus needs to be removed. |
2684 if ( aCommand == KErrCancel || aCommand == EFsEmailUiCmdActionsDelete || |
2784 if ( ( iStylusPopUpMenuVisible ) && |
2685 aCommand == EFsEmailUiCmdMarkAsRead || |
2785 ( aCommand == KErrCancel || |
2686 aCommand == EFsEmailUiCmdMarkAsUnread || |
2786 aCommand == EFsEmailUiCmdActionsDelete || |
2687 aCommand == EFsEmailUiCmdActionsMove || |
2787 aCommand == EFsEmailUiCmdMarkAsRead || |
2688 aCommand == EFsEmailUiCmdMarkUnmarkToggle ) |
2788 aCommand == EFsEmailUiCmdMarkAsUnread || |
|
2789 aCommand == EFsEmailUiCmdActionsMove || |
|
2790 aCommand == EFsEmailUiCmdActionsMoveMessage || |
|
2791 aCommand == EFsEmailUiCmdMarkUnmarkToggle || |
|
2792 aCommand == EFsEmailUiCmdActionsCollapseAll || |
|
2793 aCommand == EFsEmailUiCmdActionsExpandAll ) ) |
2689 { |
2794 { |
2690 // We end up here if the user selects an option from the pop up menu |
2795 // We end up here if the user selects an option from the pop up menu |
2691 // or exits the menu by tapping outside of it's area. |
2796 // or exits the menu by tapping outside of it's area. |
2692 // Remove the focus from a list item if an item is focused. |
2797 // Remove the focus from a list item if an item is focused. |
2693 iStylusPopUpMenuLaunched = EFalse; |
2798 iStylusPopUpMenuVisible = EFalse; |
2694 FocusVisibilityChange( EFalse ); |
2799 iAppUi.SetFocusVisibility( EFalse ); |
2695 } |
2800 } |
2696 |
2801 |
2697 switch ( aCommand ) |
2802 switch( aCommand ) |
2698 { |
2803 { |
2699 case EAknSoftkeyOpen: |
2804 case EAknSoftkeyOpen: |
2700 { |
2805 { |
2701 if( !iAppUi.IsFocusShown() ) |
2806 if( !iAppUi.IsFocusShown() ) |
2702 { |
2807 { |
2703 iAppUi.SetFocusVisibility( ETrue ); |
2808 iAppUi.SetFocusVisibility( ETrue ); |
2704 break; |
2809 break; |
2705 } |
2810 } |
2706 } |
2811 } |
2707 case EAknSoftkeySelect: |
2812 case EAknSoftkeySelect: |
2708 { |
2813 { |
2709 if ( iFocusedControl == EMailListComponent ) |
2814 if ( iFocusedControl == EMailListComponent ) |
2710 { |
2815 { |
2711 CFSEmailUiMailListModelItem* item = dynamic_cast<CFSEmailUiMailListModelItem*>(iModel->Item(HighlightedIndex())); |
2816 CFSEmailUiMailListModelItem* item = dynamic_cast<CFSEmailUiMailListModelItem*>(iModel->Item(HighlightedIndex())); |
3912 folderType = EFSInbox; |
4053 folderType = EFSInbox; |
3913 } |
4054 } |
3914 // Show sort if model has data. |
4055 // Show sort if model has data. |
3915 if ( iModel->Count() ) |
4056 if ( iModel->Count() ) |
3916 { |
4057 { |
3917 //<cmail> |
4058 // Set touchmanager not active for preventing getting events. |
3918 //Set touchmanager not active for preventing getting events. |
|
3919 DisableMailList(ETrue); |
4059 DisableMailList(ETrue); |
3920 //</cmail> |
|
3921 iAppUi.ShowSortListInPopupL( iCurrentSortCriteria, folderType, this, iSortButton ); |
4060 iAppUi.ShowSortListInPopupL( iCurrentSortCriteria, folderType, this, iSortButton ); |
3922 } |
4061 } |
3923 else |
4062 else |
3924 { |
4063 { |
3925 // hide selector focus if popup is not opened |
4064 // hide selector focus if popup is not opened |
3926 // and selection was not made via HW-keys |
4065 // and selection was not made via HW-keys |
3927 iControlBarControl->MakeSelectorVisible( |
4066 iControlBarControl->MakeSelectorVisible( |
3928 IsFocusShown() ); |
4067 IsFocusShown() ); |
3929 } |
4068 } |
3930 } |
4069 } |
3931 return ETrue;//iControlBar->OfferEventL( aEvent ); |
4070 return ETrue; // iControlBar->OfferEventL( aEvent ); |
3932 } |
4071 } |
3933 } |
4072 } |
3934 break; |
4073 break; |
3935 case EStdKeyLeftArrow: |
4074 case EStdKeyLeftArrow: |
|
4075 case EStdKeyRightArrow: |
|
4076 case EStdKeyDownArrow: |
|
4077 case EStdKeyUpArrow: |
3936 { |
4078 { |
3937 if( iControlBarControl && iFocusedControl == EMailListComponent ) |
4079 if( Layout_Meta_Data::IsLandscapeOrientation() ) |
3938 { |
4080 { |
3939 HandleCommandL( EFsEmailUiCmdGoToSwitchSorting ); |
4081 result = HandleArrowEventInLandscapeL( scanCode, |
3940 result = ETrue; |
4082 aEvent, shiftState ); |
3941 } |
|
3942 else if( ( iControlBarControl ) && |
|
3943 ( iFocusedControl == EControlBarComponent ) ) |
|
3944 { |
|
3945 TInt focusedButtonId = iControlBarControl->GetFocusedButton()->Id(); |
|
3946 iControlBarControl->MakeSelectorVisible( IsFocusShown() ); |
|
3947 if ( focusedButtonId == iFolderListButtonId ) |
|
3948 { |
|
3949 if ( iModel->Count() ) |
|
3950 { |
|
3951 iFocusedControl = EMailListComponent; |
|
3952 result = EFalse; |
|
3953 } |
|
3954 else |
|
3955 { |
|
3956 iFocusedControl = EControlBarComponent; |
|
3957 result = ETrue; // Do not set focus to empty list |
|
3958 } |
|
3959 } |
|
3960 else |
|
3961 { |
|
3962 iFocusedControl = EControlBarComponent; |
|
3963 result = EFalse; |
|
3964 } |
|
3965 } |
4083 } |
3966 else |
4084 else |
3967 { |
4085 { |
3968 iFocusedControl = EMailListComponent; |
4086 result = HandleArrowEventInPortraitL( scanCode, |
3969 result = EFalse; |
4087 aEvent, shiftState ); |
3970 } |
4088 } |
3971 SetMskL(); |
4089 break; |
3972 } |
4090 } |
3973 break; |
|
3974 case EStdKeyRightArrow: |
|
3975 { |
|
3976 // Show toolbar if there is data on the list |
|
3977 // <cmail> |
|
3978 if ( iFocusedControl == EMailListComponent && iModel->Count() ) |
|
3979 // </cmail> |
|
3980 { |
|
3981 RFsTreeItemIdList targetEntries; |
|
3982 CleanupClosePushL( targetEntries ); |
|
3983 GetActionsTargetEntriesL( targetEntries ); |
|
3984 TInt targetCount = targetEntries.Count(); |
|
3985 CleanupStack::PopAndDestroy( &targetEntries ); |
|
3986 |
|
3987 if ( targetCount ) |
|
3988 { |
|
3989 LaunchStylusPopupMenuL(); |
|
3990 result = ETrue; |
|
3991 } |
|
3992 } |
|
3993 else if( ( iControlBarControl ) && |
|
3994 ( iFocusedControl == EControlBarComponent ) ) |
|
3995 { |
|
3996 TInt focusedButtonId = iControlBarControl->GetFocusedButton()->Id(); |
|
3997 iControlBarControl->MakeSelectorVisible( IsFocusShown() ); |
|
3998 if ( focusedButtonId == iFolderListButtonId ) |
|
3999 { |
|
4000 iFocusedControl = EControlBarComponent; |
|
4001 result = EFalse; |
|
4002 } |
|
4003 else |
|
4004 { |
|
4005 if ( iModel->Count() ) // Check for empty folder |
|
4006 { |
|
4007 iFocusedControl = EMailListComponent; |
|
4008 result = EFalse; |
|
4009 } |
|
4010 else |
|
4011 { |
|
4012 iFocusedControl = EControlBarComponent; |
|
4013 result = ETrue; // Do not set focus to empty list |
|
4014 } |
|
4015 } ; |
|
4016 } |
|
4017 else |
|
4018 { |
|
4019 iFocusedControl = EMailListComponent; |
|
4020 result = EFalse; |
|
4021 } |
|
4022 SetMskL(); |
|
4023 } |
|
4024 break; |
|
4025 case EStdKeyDownArrow: |
|
4026 { |
|
4027 if ( iFocusedControl == EMailListComponent ) |
|
4028 { |
|
4029 result = iMailList->TreeControl()->OfferEventL(aEvent); |
|
4030 if ( shiftState ) |
|
4031 { |
|
4032 DoScrollMarkUnmarkL(); // marking is done after moving the cursor |
|
4033 } |
|
4034 } |
|
4035 // <cmail> |
|
4036 else if ( iFocusedControl == EControlBarComponent && iModel->Count() == 0 ) |
|
4037 { |
|
4038 iControlBarControl->MakeSelectorVisible( IsFocusShown() ); |
|
4039 result = ETrue; // Do not set focus to empty list |
|
4040 } |
|
4041 else if ( iFocusedControl == EControlBarComponent && iModel->Count() != 0 ) |
|
4042 // </cmail> |
|
4043 { |
|
4044 iFocusedControl = EMailListComponent; |
|
4045 |
|
4046 result = iMailList->TreeControl()->OfferEventL(aEvent); |
|
4047 if ( shiftState ) |
|
4048 { |
|
4049 DoScrollMarkUnmarkL(); // marking is done after moving the cursor |
|
4050 } |
|
4051 } |
|
4052 else |
|
4053 { |
|
4054 result = EFalse; |
|
4055 } |
|
4056 SetMskL(); |
|
4057 } |
|
4058 break; |
|
4059 case EStdKeyUpArrow: |
|
4060 { |
|
4061 iControlBarControl->MakeSelectorVisible( IsFocusShown() ); |
|
4062 if ( iFocusedControl == EMailListComponent ) |
|
4063 { |
|
4064 if ( HighlightedIndex() == 0 ) |
|
4065 { |
|
4066 HandleCommandL( EFsEmailUiCmdGoToSwitchFolder ); |
|
4067 result = ETrue; |
|
4068 } |
|
4069 else |
|
4070 { |
|
4071 result = iMailList->TreeControl()->OfferEventL(aEvent); |
|
4072 if ( shiftState ) |
|
4073 { |
|
4074 DoScrollMarkUnmarkL(); // marking is done after moving the cursor |
|
4075 } |
|
4076 SetMskL(); |
|
4077 } |
|
4078 } |
|
4079 else if (iFocusedControl == EControlBarComponent) |
|
4080 { |
|
4081 result = ETrue; |
|
4082 } |
|
4083 else |
|
4084 { |
|
4085 result = EFalse; |
|
4086 } |
|
4087 } |
|
4088 break; |
|
4089 case EStdKeyYes: |
4091 case EStdKeyYes: |
4090 { |
4092 { |
4091 if ( !iAppUi.ViewSwitchingOngoing() ) |
4093 if ( !iAppUi.ViewSwitchingOngoing() ) |
4092 { |
4094 { |
4093 if ( iMailFolder && iMailFolder->GetFolderType() != EFSOutbox && |
4095 if ( iMailFolder && iMailFolder->GetFolderType() != EFSOutbox && |
6208 } |
6219 } |
6209 return ret; |
6220 return ret; |
6210 } |
6221 } |
6211 |
6222 |
6212 // --------------------------------------------------------------------------- |
6223 // --------------------------------------------------------------------------- |
6213 // LaunchActionMenuL |
|
6214 // Function launches action menu based on the highlighted or marked messages |
|
6215 // --------------------------------------------------------------------------- |
|
6216 // |
|
6217 void CFSEmailUiMailListVisualiser::LaunchActionMenuL() |
|
6218 { |
|
6219 FUNC_LOG; |
|
6220 // Get marked entries |
|
6221 RFsTreeItemIdList markedEntries; |
|
6222 CleanupClosePushL( markedEntries ); |
|
6223 iMailList->GetMarkedItemsL( markedEntries ); |
|
6224 TInt markedCount = markedEntries.Count(); |
|
6225 |
|
6226 // Remove old items from action menu |
|
6227 CFSEmailUiActionMenu::RemoveAllL(); |
|
6228 // Construct item list |
|
6229 RFsEActionMenuIdList itemList; |
|
6230 CleanupClosePushL( itemList ); |
|
6231 // Check support for object mail iten moving |
|
6232 TBool supportsMoving = iAppUi.GetActiveMailbox()->HasCapability( EFSMBoxCapaMoveToFolder ); |
|
6233 |
|
6234 if ( markedCount == 0 || markedCount == 1 ) // Action menu for a single item |
|
6235 { |
|
6236 // Get pointer to the single message we are dealing with |
|
6237 TFsTreeItemId listItemId; |
|
6238 if ( markedCount == 0 ) |
|
6239 { |
|
6240 listItemId = iMailList->FocusedItem(); |
|
6241 } |
|
6242 else // ( markedCount == 1) |
|
6243 { |
|
6244 listItemId = markedEntries[0]; |
|
6245 } |
|
6246 CFSMailMessage* msgPtr = &MsgPtrFromListIdL( listItemId ); |
|
6247 |
|
6248 if ( iMailFolder->GetFolderType() == EFSOutbox ) |
|
6249 { |
|
6250 if ( supportsMoving ) |
|
6251 { |
|
6252 itemList.AppendL( FsEActionMenuMoveToDrafts ); |
|
6253 } |
|
6254 } |
|
6255 else if( iMailFolder->GetFolderType() == EFSDraftsFolder ) |
|
6256 { |
|
6257 // Create mark unread / mark read flag |
|
6258 if ( msgPtr->IsFlagSet( EFSMsgFlag_Read ) ) |
|
6259 { |
|
6260 itemList.AppendL( FsEActionMenuMarkUnread ); |
|
6261 } |
|
6262 else |
|
6263 { |
|
6264 itemList.AppendL( FsEActionMenuMarkRead ); |
|
6265 } |
|
6266 // Add Move message item if applicable |
|
6267 if ( supportsMoving ) |
|
6268 { |
|
6269 itemList.AppendL( FsEActionMenuMove ); |
|
6270 } |
|
6271 } |
|
6272 else |
|
6273 { |
|
6274 // Construct menu for calendar message based on resolved mr object |
|
6275 // and whether the MRUI object is available |
|
6276 if ( msgPtr->IsFlagSet( EFSMsgFlag_CalendarMsg ) && iAppUi.MrViewerInstanceL() ) |
|
6277 { |
|
6278 TESMRMeetingRequestMethod mrMethod( EESMRMeetingRequestMethodUnknown ); |
|
6279 TRAP_IGNORE( mrMethod = iAppUi.MrViewerInstanceL()->ResolveMeetingRequestMethodL( *msgPtr ) ); |
|
6280 switch ( mrMethod ) |
|
6281 { |
|
6282 case EESMRMeetingRequestMethodRequest: |
|
6283 { |
|
6284 if ( iMailFolder && iMailFolder->GetFolderType() != EFSOutbox && |
|
6285 iMailFolder->GetFolderType() != EFSDraftsFolder ) |
|
6286 { |
|
6287 // No choices in outbox in outbox or drafts |
|
6288 itemList.AppendL( FsEActionMenuAccept ); |
|
6289 itemList.AppendL( FsEActionMenuTentative ); |
|
6290 itemList.AppendL( FsEActionMenuDecline ); |
|
6291 } |
|
6292 } |
|
6293 break; |
|
6294 case EESMRMeetingRequestMethodCancellation: |
|
6295 { |
|
6296 // No "remove from calendar" in outbox or drafts |
|
6297 if ( iMailFolder && iMailFolder->GetFolderType() != EFSOutbox && |
|
6298 iMailFolder->GetFolderType() != EFSDraftsFolder ) |
|
6299 { |
|
6300 TBool supportsRemove = iAppUi.GetActiveMailbox()->HasCapability( EFSMBoxCapaRemoveFromCalendar ); |
|
6301 if( supportsRemove ) |
|
6302 { |
|
6303 itemList.AppendL( FsEActionMenuRemoveFormCal ); |
|
6304 } |
|
6305 } |
|
6306 } |
|
6307 break; |
|
6308 case EESMRMeetingRequestMethodUnknown: |
|
6309 case EESMRMeetingRequestMethodResponse: |
|
6310 default: |
|
6311 { |
|
6312 // Only "Open" options is available for responses and when MR method |
|
6313 // cannot be resolved without opening the message (this is the case with IMAP) |
|
6314 itemList.AppendL( FsEActionMenuOpenCalendarEvent ); |
|
6315 } |
|
6316 break; |
|
6317 } |
|
6318 } |
|
6319 // No mrui object or message is typical mail |
|
6320 // Append normal menu commands |
|
6321 else |
|
6322 { |
|
6323 itemList.AppendL( FsEActionMenuReply ); |
|
6324 // Show ReplyAll if more than 1 recepient |
|
6325 TInt numRecipients(0); |
|
6326 if ( msgPtr ) |
|
6327 { |
|
6328 //Get # of recipients |
|
6329 numRecipients =TFsEmailUiUtility::CountRecepients( msgPtr ); |
|
6330 if ( numRecipients == 1 ) |
|
6331 { |
|
6332 //check if the malbox ownmailaddress is same as the recipients email address. If not, then assume that the |
|
6333 //email is a distribution list and we need to inc num of Recipients so that "Reply ALL" option appears in UI. |
|
6334 if ( msgPtr->GetToRecipients().Count() ) |
|
6335 { |
|
6336 if( iAppUi.GetActiveMailbox()->OwnMailAddress().GetEmailAddress().Compare(msgPtr->GetToRecipients()[0]->GetEmailAddress()) ) |
|
6337 { |
|
6338 numRecipients++; |
|
6339 } |
|
6340 } |
|
6341 if ( msgPtr->GetCCRecipients().Count() ) |
|
6342 { |
|
6343 if ( iAppUi.GetActiveMailbox()->OwnMailAddress().GetEmailAddress().Compare(msgPtr->GetCCRecipients()[0]->GetEmailAddress()) ) |
|
6344 { |
|
6345 numRecipients++; |
|
6346 } |
|
6347 } |
|
6348 if( msgPtr->GetBCCRecipients().Count() ) |
|
6349 { |
|
6350 if ( iAppUi.GetActiveMailbox()->OwnMailAddress().GetEmailAddress().Compare(msgPtr->GetBCCRecipients()[0]->GetEmailAddress()) ) |
|
6351 { |
|
6352 numRecipients++; |
|
6353 } |
|
6354 } |
|
6355 } |
|
6356 } |
|
6357 |
|
6358 if ( numRecipients > 1 ) |
|
6359 { |
|
6360 itemList.AppendL( FsEActionMenuReplyAll ); |
|
6361 } |
|
6362 itemList.AppendL( FsEActionMenuForward ); |
|
6363 } |
|
6364 |
|
6365 // Add mark as read/unread options |
|
6366 if ( IsMarkAsUnreadAvailableL() ) |
|
6367 { |
|
6368 itemList.AppendL( FsEActionMenuMarkUnread ); |
|
6369 } |
|
6370 if ( IsMarkAsReadAvailableL() ) |
|
6371 { |
|
6372 itemList.AppendL( FsEActionMenuMarkRead ); |
|
6373 } |
|
6374 |
|
6375 // Add Move message item if applicable |
|
6376 if ( supportsMoving ) |
|
6377 { |
|
6378 itemList.AppendL( FsEActionMenuMove ); |
|
6379 } |
|
6380 } |
|
6381 itemList.AppendL( FsEActionMenuDelete ); |
|
6382 |
|
6383 // Execute action list and handle the menu command |
|
6384 TFSMailMsgId oldMsgId = msgPtr->GetMessageId(); |
|
6385 |
|
6386 // <cmail> Touch |
|
6387 TActionMenuCustomItemId itemId = CFSEmailUiActionMenu::ExecuteL( itemList, EFscCustom, 0, this ); |
|
6388 // </cmail> |
|
6389 |
|
6390 // Make sure that focus or marking is still on the same item as when Action menu was launched. |
|
6391 // This is beacause message added/deleted event migh have occured and deleted the original meessage or |
|
6392 // resulted in complete redraw of the message list. |
|
6393 TInt newItemIdx = ItemIndexFromMessageId( oldMsgId ); |
|
6394 if ( newItemIdx >= 0 ) // items still exists |
|
6395 { |
|
6396 TFsTreeItemId newItemListId = iTreeItemArray[ newItemIdx ].iListItemId; |
|
6397 if ( markedCount ) |
|
6398 { |
|
6399 // Item was marked. Make sure it's marked now. |
|
6400 iMailList->MarkItemL( newItemListId, ETrue ); |
|
6401 } |
|
6402 else |
|
6403 { |
|
6404 // No items were marked. Make sure the focus is on the same item as before. |
|
6405 if ( iMailList->FocusedItem() != newItemListId ) |
|
6406 { |
|
6407 iMailList->SetFocusedItemL( newItemListId ); |
|
6408 } |
|
6409 } |
|
6410 HandleActionMenuCommandL( itemId ); |
|
6411 } |
|
6412 } |
|
6413 else // Multiple items marked |
|
6414 { |
|
6415 // Add mark as read/unread options |
|
6416 if ( IsMarkAsUnreadAvailableL() ) |
|
6417 { |
|
6418 itemList.AppendL( FsEActionMenuMarkUnread ); |
|
6419 } |
|
6420 if ( IsMarkAsReadAvailableL() ) |
|
6421 { |
|
6422 itemList.AppendL( FsEActionMenuMarkRead ); |
|
6423 } |
|
6424 |
|
6425 if ( iMailFolder->GetFolderType() == EFSOutbox ) // Append move to drafts in outbox |
|
6426 { |
|
6427 if ( supportsMoving ) |
|
6428 { |
|
6429 itemList.AppendL( FsEActionMenuMoveToDrafts ); |
|
6430 } |
|
6431 } |
|
6432 else // Append move in any other cases dirtectly if supported |
|
6433 { |
|
6434 if ( supportsMoving ) |
|
6435 { |
|
6436 itemList.AppendL( FsEActionMenuMove ); |
|
6437 } |
|
6438 } |
|
6439 itemList.AppendL( FsEActionMenuDelete ); |
|
6440 TActionMenuCustomItemId itemId = CFSEmailUiActionMenu::ExecuteL( itemList ); |
|
6441 iMailList->GetMarkedItemsL( markedEntries ); |
|
6442 if ( markedEntries.Count() ) // Safety check |
|
6443 { |
|
6444 HandleActionMenuCommandL( itemId ); |
|
6445 } |
|
6446 } |
|
6447 CleanupStack::PopAndDestroy( &itemList ); |
|
6448 CleanupStack::PopAndDestroy( &markedEntries ); |
|
6449 } |
|
6450 |
|
6451 // --------------------------------------------------------------------------- |
|
6452 // HandleActionMenuCommandL |
|
6453 // Action menu command callback handler |
|
6454 // --------------------------------------------------------------------------- |
|
6455 // |
|
6456 void CFSEmailUiMailListVisualiser::HandleActionMenuCommandL( TActionMenuCustomItemId itemId ) |
|
6457 { |
|
6458 FUNC_LOG; |
|
6459 // Map each Action Menu ID to correcponding command ID. |
|
6460 TInt commandId = KErrNotFound; |
|
6461 |
|
6462 switch( itemId ) |
|
6463 { |
|
6464 case FsEActionMenuOpenCalendarEvent: |
|
6465 case FsEActionMenuOpen: |
|
6466 commandId = EFsEmailUiCmdOpen; |
|
6467 break; |
|
6468 case FsEActionMenuAccept: |
|
6469 commandId = EFsEmailUiCmdCalActionsAccept; |
|
6470 break; |
|
6471 case FsEActionMenuTentative: |
|
6472 commandId = EFsEmailUiCmdCalActionsTentative; |
|
6473 break; |
|
6474 case FsEActionMenuDecline: |
|
6475 commandId = EFsEmailUiCmdCalActionsDecline; |
|
6476 break; |
|
6477 case FsEActionMenuRemoveFormCal: |
|
6478 commandId = EFsEmailUiCmdCalRemoveFromCalendar; |
|
6479 break; |
|
6480 case FsEActionMenuMarkRead: |
|
6481 commandId = EFsEmailUiCmdMarkAsRead; |
|
6482 break; |
|
6483 case FsEActionMenuMarkUnread: |
|
6484 commandId = EFsEmailUiCmdMarkAsUnread; |
|
6485 break; |
|
6486 case FsEActionMenuDelete: |
|
6487 commandId = EFsEmailUiCmdActionsDelete; |
|
6488 break; |
|
6489 case FsEActionMenuReply: |
|
6490 commandId = EFsEmailUiCmdActionsReply; |
|
6491 break; |
|
6492 case FsEActionMenuReplyAll: |
|
6493 commandId = EFsEmailUiCmdActionsReplyAll; |
|
6494 break; |
|
6495 case FsEActionMenuForward: |
|
6496 commandId = EFsEmailUiCmdActionsForward; |
|
6497 break; |
|
6498 case FsEActionMenuMove: |
|
6499 commandId = EFsEmailUiCmdActionsMoveMessage; |
|
6500 break; |
|
6501 case FsEActionMenuMoveToDrafts: |
|
6502 commandId = EFsEmailUiCmdActionsMoveToDrafts; |
|
6503 break; |
|
6504 case FsEActionMenuDismissed: |
|
6505 commandId = KErrCancel; |
|
6506 break; |
|
6507 default: |
|
6508 __ASSERT_DEBUG( EFalse, Panic(EFSEmailUiUnexpectedValue) ); |
|
6509 break; |
|
6510 } |
|
6511 |
|
6512 if ( commandId >= 0 ) |
|
6513 { |
|
6514 HandleCommandL( commandId ); |
|
6515 } |
|
6516 } |
|
6517 |
|
6518 // --------------------------------------------------------------------------- |
|
6519 // LaunchStylusPopupMenuL |
6224 // LaunchStylusPopupMenuL |
6520 // Function launches avkon stylus popup menu based on the selected message item/items |
6225 // Function launches avkon stylus popup menu based on the selected message item/items |
6521 // --------------------------------------------------------------------------- |
6226 // --------------------------------------------------------------------------- |
6522 // |
6227 // |
6523 void CFSEmailUiMailListVisualiser::LaunchStylusPopupMenuL() |
6228 void CFSEmailUiMailListVisualiser::LaunchStylusPopupMenuL( const TPoint& aPoint ) |
6524 { |
6229 { |
6525 // Irrelevant items for focused mail list item get dimmed at runtime |
6230 // Irrelevant items for focused mail list item get dimmed at runtime |
6526 |
6231 |
6527 // Check mail list item's type |
6232 // Check mail list item's type |
6528 CFSEmailUiMailListModelItem* item = |
6233 CFSEmailUiMailListModelItem* item = |