ipsservices/ipssosplugin/src/ipsplgeventhandler.cpp
changeset 20 ecc8def7944a
parent 18 578830873419
child 23 2dc6caa42ec3
equal deleted inserted replaced
18:578830873419 20:ecc8def7944a
   243 
   243 
   244     }
   244     }
   245 
   245 
   246 // ----------------------------------------------------------------------------
   246 // ----------------------------------------------------------------------------
   247 // ----------------------------------------------------------------------------
   247 // ----------------------------------------------------------------------------
   248 void CIpsPlgEventHandler::NotifyPropertyEventL(
   248 void CIpsPlgEventHandler::NotifyPropertyEventL( TIpsPlgPropertyEvent aEvent )
   249         TIpsPlgPropertyEvent aEvent )
   249     {
   250     {
   250     FUNC_LOG;
   251     FUNC_LOG;
   251     INFO_1("pluginid == 0x%x", iPluginId);
   252     TBool doNotify = ETrue;
   252    //<qmail> not used: TBool doNotify = ETrue;
   253     switch ( aEvent.iEvent )
   253     switch ( aEvent.iEvent )
   254         {
   254         {
   255         case KIpsSosEmailSyncStarted:
   255         case KIpsSosEmailSyncStarted:
   256             SignalStartSyncL( TFSMailMsgId( aEvent.iPluginId,
   256             SignalStartSyncL( TFSMailMsgId( aEvent.iPluginId,
   257                     aEvent.iMailbox ) );
   257                     aEvent.iMailbox ) );
   263                 }
   263                 }
   264             break;
   264             break;
   265         default:
   265         default:
   266             break;
   266             break;
   267         }
   267         }
   268 
   268     // <qmail> removed doNotify bool below
   269     for ( TInt i = 0; doNotify && i < iPropertyObservers.Count(); i++ )
   269     for ( TInt i = 0; i < iPropertyObservers.Count(); i++ )
   270         {
   270         {
   271         TRAP_IGNORE( iPropertyObservers[i]->HandlePropertyEventL(
   271         TRAP_IGNORE( iPropertyObservers[i]->HandlePropertyEventL(
   272                 aEvent.iEvent,  aEvent.iMailbox,
   272                 aEvent.iEvent,  aEvent.iMailbox,
   273                 aEvent.iPluginId, aEvent.iError ) );
   273                 aEvent.iPluginId, aEvent.iError ) );
   274         }
   274         }
  1475 // ----------------------------------------------------------------------------
  1475 // ----------------------------------------------------------------------------
  1476 // ----------------------------------------------------------------------------
  1476 // ----------------------------------------------------------------------------
  1477 void CIpsPlgEventHandler::SignalStartSyncL( const TFSMailMsgId& aAccount )
  1477 void CIpsPlgEventHandler::SignalStartSyncL( const TFSMailMsgId& aAccount )
  1478     {
  1478     {
  1479     FUNC_LOG;
  1479     FUNC_LOG;
  1480     TFSMailEvent event = TFSEventMailboxSyncStateChanged;
  1480     // <qmail> no need to create event variable here
  1481     TSSMailSyncState state = StartingSync;
  1481     //    TFSMailEvent event = TFSEventMailboxSyncStateChanged;
  1482 
  1482     // <qmail> renamed variable
  1483     SaveSyncStatusL( aAccount.Id(), TInt( state ) );
  1483     TSSMailSyncState syncState( StartingSync );
       
  1484 
       
  1485     // <qmail> remove SaveSyncStatusL as it does nothing
       
  1486     // SaveSyncStatusL( aAccount.Id(), TInt( syncState ) );
  1484 
  1487 
  1485     SendDelayedEventL(
  1488     SendDelayedEventL(
  1486         event,
  1489         TFSEventMailboxSyncStateChanged,
  1487         aAccount,
  1490         aAccount,
  1488         &state,
  1491         &syncState,
  1489         NULL,
  1492         NULL,
  1490         NULL );
  1493         NULL );
  1491     }
  1494     }
  1492 
  1495 
  1493 // ----------------------------------------------------------------------------
  1496 // ----------------------------------------------------------------------------
  1494 // ----------------------------------------------------------------------------
  1497 // ----------------------------------------------------------------------------
  1495 void CIpsPlgEventHandler::SignalSyncCompletedL(
  1498 void CIpsPlgEventHandler::SignalSyncCompletedL( const TFSMailMsgId& aAccount, TInt aError )
  1496     const TFSMailMsgId& aAccount,
  1499     {
  1497     TInt aError )
  1500     FUNC_LOG;
  1498     {
  1501     // <qmail> no need to create event variable here
  1499     FUNC_LOG;
  1502     //    TFSMailEvent event = TFSEventMailboxSyncStateChanged;
  1500     TFSMailEvent event = TFSEventMailboxSyncStateChanged;
  1503     // <qmail> renamed variable, and setting value in new func
  1501 
  1504     TSSMailSyncState syncState = ConvertCompletionCode( aError );
  1502     TSSMailSyncState state = FinishedSuccessfully;
  1505 
  1503 
  1506     // <qmail> remove SaveSyncStatusL as it does nothing
  1504     if ( aError == KErrCancel )
  1507     //    SaveSyncStatusL( aAccount.Id(), TInt( syncState ) );
  1505         {
       
  1506         state = SyncCancelled;
       
  1507         }
       
  1508     else if ( aError != KErrNone && aError != KErrCancel )
       
  1509         {
       
  1510         state = SyncError;
       
  1511         }
       
  1512 
       
  1513     SaveSyncStatusL( aAccount.Id(), TInt( state ) );
       
  1514 
  1508 
  1515     SendDelayedEventL(
  1509     SendDelayedEventL(
  1516         event,
  1510         TFSEventMailboxSyncStateChanged,
  1517         aAccount,
  1511         aAccount,
  1518         &state,
  1512         &syncState,
  1519         NULL,
  1513         NULL,
  1520         NULL );
  1514         NULL );
  1521     }
  1515     }
  1522 
  1516 
  1523 // ----------------------------------------------------------------------------
  1517 // <qmail> new function
  1524 // ----------------------------------------------------------------------------
  1518 // ----------------------------------------------------------------------------
  1525 void CIpsPlgEventHandler::SignalMailboxOfflineStateL(
  1519 // ----------------------------------------------------------------------------
  1526     const TFSMailMsgId& aAccount )
  1520 TSSMailSyncState CIpsPlgEventHandler::ConvertCompletionCode( TInt aCompletionCode )
  1527     {
  1521     {
  1528     FUNC_LOG;
  1522     FUNC_LOG;
  1529     SendDelayedEventL(
  1523     switch ( aCompletionCode )
  1530         TFSEventMailboxOffline,
  1524         {
  1531         aAccount,
  1525         case KErrNone:
  1532         NULL,
  1526             return FinishedSuccessfully;
  1533         NULL,
  1527         case KErrCancel:
  1534         NULL );
  1528             return SyncCancelled;
  1535     }
  1529         case KErrImapBadLogon:
       
  1530         case KPop3InvalidUser:
       
  1531         case KPop3InvalidLogin:
       
  1532         case KPop3InvalidApopLogin:
       
  1533             return PasswordNotVerified;
       
  1534         default:
       
  1535             return SyncError;
       
  1536         }
       
  1537     }
       
  1538 // </qmail>
       
  1539 
       
  1540 //<qmail> not used at all
       
  1541 // ----------------------------------------------------------------------------
       
  1542 // ----------------------------------------------------------------------------
       
  1543 //void CIpsPlgEventHandler::SignalMailboxOfflineStateL(
       
  1544 //    const TFSMailMsgId& aAccount )
       
  1545 //    {
       
  1546 //    FUNC_LOG;
       
  1547 //    SendDelayedEventL(
       
  1548 //        TFSEventMailboxOffline,
       
  1549 //        aAccount,
       
  1550 //        NULL,
       
  1551 //        NULL,
       
  1552 //        NULL );
       
  1553 //    }
       
  1554 // </qmail>
  1536 
  1555 
  1537 // ----------------------------------------------------------------------------
  1556 // ----------------------------------------------------------------------------
  1538 // ----------------------------------------------------------------------------
  1557 // ----------------------------------------------------------------------------
  1539 void CIpsPlgEventHandler::SettingsChangedL( TFSMailMsgId /*aAccount*/ )
  1558 void CIpsPlgEventHandler::SettingsChangedL( TFSMailMsgId /*aAccount*/ )
  1540     {
  1559     {
  1541     FUNC_LOG;
  1560     FUNC_LOG;
  1542     }
  1561     }
  1543 
  1562 
  1544 // ----------------------------------------------------------------------------
  1563 //<qmail> not used at all
  1545 // ----------------------------------------------------------------------------
  1564 // ----------------------------------------------------------------------------
  1546 void CIpsPlgEventHandler::SaveSyncStatusL( TMsvId aMailboxId, TInt /*aState*/ )
  1565 // ----------------------------------------------------------------------------
  1547     {
  1566 //void CIpsPlgEventHandler::SaveSyncStatusL( TMsvId aMailboxId, TInt /*aState*/ )
  1548     FUNC_LOG;
  1567 //    {
  1549     TMsvEntry tEntry;
  1568 //    FUNC_LOG;
  1550     TMsvId service;
  1569 //    TMsvEntry tEntry;
  1551     if( !iSession )
  1570 //    TMsvId service;
  1552         {
  1571 //    if( !iSession )
  1553         User::Leave( KErrNotReady );
  1572 //        {
  1554         }
  1573 //        User::Leave( KErrNotReady );
  1555     TInt err = iSession->GetEntry( aMailboxId, service, tEntry );
  1574 //        }
  1556 
  1575 //    TInt err = iSession->GetEntry( aMailboxId, service, tEntry );
  1557     if( err == KErrNone )
  1576 //
  1558         {
  1577 //    if( err == KErrNone )
  1559         }
  1578 //        {
  1560     }
  1579 //        }
       
  1580 //    }
       
  1581 // </qmail>
  1561 
  1582 
  1562 // ----------------------------------------------------------------------------
  1583 // ----------------------------------------------------------------------------
  1563 // ----------------------------------------------------------------------------
  1584 // ----------------------------------------------------------------------------
  1564 void CIpsPlgEventHandler::HandlePropertyEventL(
  1585 void CIpsPlgEventHandler::HandlePropertyEventL(
  1565         TInt aEvent,
  1586     TInt aEvent,
  1566         TInt aMailbox,
  1587     TInt aMailbox,
  1567         TInt /*aPluginId*/,
  1588     TInt /*aPluginId*/,
  1568         TInt aError )
  1589     TInt /*aError*/ )
  1569     {
  1590     {
  1570     FUNC_LOG;
  1591     FUNC_LOG;
  1571     RProcess process;
  1592 //  <qmail> remove these events 
  1572     if ( aEvent == EIPSSosPswErr && process.SecureId() == FREESTYLE_FSSERVER_SID )
  1593 //    RProcess process;
  1573         {
  1594 //    if ( aEvent == EIPSSosPswErr && process.SecureId() == FREESTYLE_FSSERVER_SID )
  1574         TFSMailMsgId mbox = SymId2FsId( aMailbox,
  1595 //        {
  1575                         iBasePlugin.MtmId().iUid );
  1596 //        TFSMailMsgId mbox = SymId2FsId( aMailbox,
  1576         TFSMailEvent event = TFSEventException;
  1597 //                        iBasePlugin.MtmId().iUid );
  1577         TFsEmailNotifierSystemMessageType msg = EFsEmailNotifErrLoginUnsuccesfull;
  1598 //        TFSMailEvent event = TFSEventException;
  1578         SendDelayedEventL( event, mbox, &msg, NULL , (MFSMailExceptionEventCallback*)this );
  1599 //        TFsEmailNotifierSystemMessageType msg = EFsEmailNotifErrLoginUnsuccesfull;
  1579         }
  1600 //        SendDelayedEventL( event, mbox, &msg, NULL , (MFSMailExceptionEventCallback*)this );
  1580     else if ( aEvent == EIPSSosCredientialsSet || aEvent == EIPSSosCredientialsCancelled )
  1601 //        }
  1581         {
  1602 //    else if ( aEvent == EIPSSosCredientialsSet || aEvent == EIPSSosCredientialsCancelled )
  1582         if ( iConnOpCallback )
  1603 //        {
  1583             {
  1604 //        if ( iConnOpCallback )
  1584             iConnOpCallback->CredientialsSetL( aEvent );
  1605 //            {
  1585 
  1606 //            iConnOpCallback->CredientialsSetL( aEvent );
  1586             //Set to null after we have used this.
  1607 //
  1587             //don't delete, we don't own this.
  1608 //            //Set to null after we have used this.
  1588             iConnOpCallback=NULL;
  1609 //            //don't delete, we don't own this.
  1589             }
  1610 //            iConnOpCallback=NULL;
  1590         //if password was changed, we need to send settings changed event also.
  1611 //            }
  1591         if( aEvent == EIPSSosCredientialsSet )
  1612 //        //if password was changed, we need to send settings changed event also.
  1592             {
  1613 //        if( aEvent == EIPSSosCredientialsSet )
  1593             TFSMailMsgId mbox = SymId2FsId( aMailbox,
  1614 //            {
  1594                     iBasePlugin.MtmId().iUid );
  1615 //            TFSMailMsgId mbox = SymId2FsId( aMailbox,
  1595             TFSMailEvent event = TFSEventMailboxSettingsChanged;
  1616 //                    iBasePlugin.MtmId().iUid );
  1596             SendDelayedEventL( event, mbox, NULL, NULL , NULL );
  1617 //            TFSMailEvent event = TFSEventMailboxSettingsChanged;
  1597             }
  1618 //            SendDelayedEventL( event, mbox, NULL, NULL , NULL );
  1598         }
  1619 //            }
  1599     else if ( aEvent == EIPSSosSettingsChanged )
  1620 //        }
       
  1621 //    else
       
  1622 // </qmail>
       
  1623     if ( aEvent == EIPSSosSettingsChanged )
  1600         {
  1624         {
  1601         TFSMailMsgId mbox = SymId2FsId( aMailbox,
  1625         TFSMailMsgId mbox = SymId2FsId( aMailbox,
  1602                 iBasePlugin.MtmId().iUid );
  1626                 iBasePlugin.MtmId().iUid );
  1603         TFSMailEvent event = TFSEventMailboxSettingsChanged;
  1627         TFSMailEvent event = TFSEventMailboxSettingsChanged;
  1604         SendDelayedEventL( event, mbox, NULL, NULL , NULL );
  1628         SendDelayedEventL( event, mbox, NULL, NULL , NULL );
  1605         }
  1629         }
  1606     else if ( aEvent == KIpsSosEmailSyncCompleted &&
  1630 
  1607             aError == KErrImapBadLogon )
  1631 // <qmail> no need for KIpsSosEmailSyncCompleted event handling here,
  1608         {
  1632 // because it has just been sent in NotifyPropertyEventL()
  1609         TFSMailMsgId mbox = SymId2FsId( aMailbox,
  1633     }
  1610                         iBasePlugin.MtmId().iUid );
  1634 
  1611         TFSMailEvent event = TFSEventException;
  1635 // <qmail> removing unused functions
  1612         TFsEmailNotifierSystemMessageType msg = EFsEmailNotifErrLoginUnsuccesfull;
  1636 // ----------------------------------------------------------------------------
  1613         SendDelayedEventL( event, mbox, &msg, NULL , this );
  1637 // ----------------------------------------------------------------------------
  1614         }
  1638 //void CIpsPlgEventHandler::QueryUsrPassL( TMsvId aMbox, MIpsPlgConnectOpCallback* aCallback )
  1615     }
  1639 //    {
  1616 
  1640 //    FUNC_LOG;
  1617 // ----------------------------------------------------------------------------
  1641 //    iConnOpCallback = aCallback;//can be null, doesn't matter.
  1618 // ----------------------------------------------------------------------------
  1642 //    SetNewPropertyEvent( aMbox, EIPSSosPswErr, 0 );
  1619 void CIpsPlgEventHandler::QueryUsrPassL( TMsvId aMbox, MIpsPlgConnectOpCallback* aCallback )
  1643 //    }
  1620     {
  1644 
  1621     FUNC_LOG;
  1645 // ----------------------------------------------------------------------------
  1622     iConnOpCallback = aCallback;//can be null, doesn't matter.
  1646 // ----------------------------------------------------------------------------
  1623     SetNewPropertyEvent( aMbox, EIPSSosPswErr, 0 );
  1647 //void CIpsPlgEventHandler::SignalCredientialsSetL( TInt aMailboxId, TBool aCancelled )
  1624     }
  1648 //    {
  1625 
  1649 //    FUNC_LOG;
  1626 // ----------------------------------------------------------------------------
  1650 //    TInt event = EIPSSosCredientialsSet;
  1627 // ----------------------------------------------------------------------------
  1651 //    if ( aCancelled )
  1628 void CIpsPlgEventHandler::SignalCredientialsSetL( TInt aMailboxId, TBool aCancelled )
  1652 //        {
  1629     {
  1653 //        event = EIPSSosCredientialsCancelled;
  1630     FUNC_LOG;
  1654 //        }
  1631     TInt event = EIPSSosCredientialsSet;
  1655 //
  1632     if ( aCancelled )
  1656 //    SetNewPropertyEvent( aMailboxId, event, 0 );
  1633         {
  1657 //    }
  1634         event = EIPSSosCredientialsCancelled;
  1658 // </qmail>
  1635         }
       
  1636 
       
  1637     SetNewPropertyEvent( aMailboxId, event, 0 );
       
  1638     }
       
  1639 
  1659 
  1640 // ----------------------------------------------------------------------------
  1660 // ----------------------------------------------------------------------------
  1641 // ----------------------------------------------------------------------------
  1661 // ----------------------------------------------------------------------------
  1642 void CIpsPlgEventHandler::SetFolderIdToArrayL( TMsvId aNewId )
  1662 void CIpsPlgEventHandler::SetFolderIdToArrayL( TMsvId aNewId )
  1643     {
  1663     {
  1677 // ----------------------------------------------------------------------------
  1697 // ----------------------------------------------------------------------------
  1678 // ----------------------------------------------------------------------------
  1698 // ----------------------------------------------------------------------------
  1679 void CIpsPlgEventHandler::CollectSubscribedFoldersL( TMsvId /*aMailboxId*/ )
  1699 void CIpsPlgEventHandler::CollectSubscribedFoldersL( TMsvId /*aMailboxId*/ )
  1680     {
  1700     {
  1681     FUNC_LOG;
  1701     FUNC_LOG;
  1682     if ( iSession )
  1702 // <qmail> code removed as it does nothing; keeping the func as it probably will be needed
  1683         {
  1703     }
  1684         }
  1704 
  1685     }
  1705 // <qmail> not needed
  1686 
  1706 // ----------------------------------------------------------------------------
  1687 // ----------------------------------------------------------------------------
  1707 // ----------------------------------------------------------------------------
  1688 // ----------------------------------------------------------------------------
  1708 //void CIpsPlgEventHandler::ExceptionEventCallbackL(
  1689 void CIpsPlgEventHandler::ExceptionEventCallbackL(
  1709 //        TFSMailMsgId aMailboxId,
  1690         TFSMailMsgId aMailboxId,
  1710 //        TInt /*aEventType*/,
  1691         TInt /*aEventType*/,
  1711 //        TBool /*aResponse*/ )
  1692         TBool /*aResponse*/ )
  1712 //    {
  1693     {
  1713 //    FUNC_LOG;
  1694     FUNC_LOG;
  1714 //    TFSMailEvent event = TFSEventMailboxSyncStateChanged;
  1695     TFSMailEvent event = TFSEventMailboxSyncStateChanged;
  1715 //    TSSMailSyncState state = PasswordNotVerified;
  1696     TSSMailSyncState state = PasswordNotVerified;
  1716 //
  1697 
  1717 //    SendDelayedEventL( event, aMailboxId, &state, NULL , NULL );
  1698     SendDelayedEventL( event, aMailboxId, &state, NULL , NULL );
  1718 //    }
  1699     }
  1719 // </qmail>
  1700 
       
  1701 // End of File
       
  1702