browserutilities/downloadmgr/DownloadMgrUiLib/Src/CDownloadsListDlg.cpp
branchRCL_3
changeset 93 79859ed3eea9
parent 92 e1bea15f9a39
child 94 919f36ff910f
equal deleted inserted replaced
92:e1bea15f9a39 93:79859ed3eea9
    13 *
    13 *
    14 * Description:  Dialog containing the Downloads List
    14 * Description:  Dialog containing the Downloads List
    15 *
    15 *
    16 */
    16 */
    17 
    17 
       
    18 
       
    19 
    18 // INCLUDE FILES
    20 // INCLUDE FILES
    19 #include    "CDownloadsListDlg.h"
    21 #include    "CDownloadsListDlg.h"
    20 #include    "CDownloadUtils.h"
    22 #include    "CDownloadUtils.h"
    21 #include    <downloadslistdlgobserver.h>
    23 #include    "DownloadsListDlgObserver.h"
    22 #include    "CDownloadsListArray.h"
    24 #include    "CDownloadsListArray.h"
    23 #include    "DownloadMgrUiLib.hrh"
    25 #include    "DownloadMgrUiLib.hrh"
    24 #include    "DMgrUiLibPanic.h"
    26 #include    "DMgrUiLibPanic.h"
    25 #include    "UiLibLogger.h"
    27 #include    "UiLibLogger.h"
    26 #include    <DownloadMgrUiLib.rsg>
    28 #include    <DownloadMgrUiLib.rsg>
    31 #include    <eikfrlbd.h>
    33 #include    <eikfrlbd.h>
    32 #include    <aknlists.h>
    34 #include    <aknlists.h>
    33 #include    <StringLoader.h>
    35 #include    <StringLoader.h>
    34 #include    <eikenv.h>
    36 #include    <eikenv.h>
    35 #include    <DocumentHandler.h>
    37 #include    <DocumentHandler.h>
    36 #ifdef BRDO_SINGLE_CLICK_ENABLED_FF
    38 
    37 #include  "CDownloadsStylusPopupMenu.h"
       
    38 #define   pixelOffset   36
       
    39 #endif
       
    40 #include "eikon.hrh"
    39 #include "eikon.hrh"
       
    40 
    41 
    41 
    42 // ============================ MEMBER FUNCTIONS ===============================
    42 // ============================ MEMBER FUNCTIONS ===============================
    43 
    43 
    44 // -----------------------------------------------------------------------------
    44 // -----------------------------------------------------------------------------
    45 // CDownloadsListDlg::CDownloadsListDlg
    45 // CDownloadsListDlg::CDownloadsListDlg
   108     iRefreshTimer = CPeriodic::NewL( KRefreshTimerPriority );
   108     iRefreshTimer = CPeriodic::NewL( KRefreshTimerPriority );
   109     CLOG_WRITE(" iRefreshTimer created");
   109     CLOG_WRITE(" iRefreshTimer created");
   110 
   110 
   111     iDownloadUtils = CDownloadUtils::NewL();
   111     iDownloadUtils = CDownloadUtils::NewL();
   112 
   112 
   113 #ifdef BRDO_SINGLE_CLICK_ENABLED_FF      
       
   114     iStylusMenu = CDlStylusPopupMenu::NewL();
       
   115 #endif    
       
   116     CLOG_LEAVEFN("CDownloadsListDlg::ConstructL");
   113     CLOG_LEAVEFN("CDownloadsListDlg::ConstructL");
   117     }
   114     }
   118 
   115 
   119 // -----------------------------------------------------------------------------
   116 // -----------------------------------------------------------------------------
   120 // CDownloadsListDlg::NewL
   117 // CDownloadsListDlg::NewL
   159     iRefreshTimer = 0;
   156     iRefreshTimer = 0;
   160     delete iListBox;
   157     delete iListBox;
   161     iListBox = NULL;
   158     iListBox = NULL;
   162     delete iDownloadUtils;
   159     delete iDownloadUtils;
   163     iDownloadUtils = NULL;
   160     iDownloadUtils = NULL;
   164 #ifdef BRDO_SINGLE_CLICK_ENABLED_FF    
   161 
   165 	 if (iStylusMenu)
       
   166 	 	{
       
   167 	 		delete iStylusMenu;
       
   168 	 		iStylusMenu = NULL;
       
   169 	 	}
       
   170 #endif    
       
   171     CLOG_LEAVEFN("CDownloadsListDlg::~CDownloadsListDlg");
   162     CLOG_LEAVEFN("CDownloadsListDlg::~CDownloadsListDlg");
   172     }
   163     }
   173 
   164 
   174 // -----------------------------------------------------------------------------
   165 // -----------------------------------------------------------------------------
   175 // CDownloadsListDlg::SetModelL
   166 // CDownloadsListDlg::SetModelL
   205         // Disable Options softkey.
   196         // Disable Options softkey.
   206         ButtonGroupContainer()->MakeCommandVisible( EAknSoftkeyOptions, EFalse );
   197         ButtonGroupContainer()->MakeCommandVisible( EAknSoftkeyOptions, EFalse );
   207         CLOG_WRITE(" aModel.Count() == 0");
   198         CLOG_WRITE(" aModel.Count() == 0");
   208         }
   199         }
   209 
   200 
   210 #ifdef BRDO_SINGLE_CLICK_ENABLED_FF    
       
   211     TInt Inprogress = iDownloadsListArray->DownloadsCount
       
   212                       ( MASKED_DL_STATE(EHttpDlCreated) |
       
   213                         MASKED_DL_STATE(EHttpDlPaused) |
       
   214                         MASKED_DL_STATE(EHttpDlInprogress) |
       
   215                         MASKED_DL_STATE(EHttpDlMultipleMOFailed));
       
   216     
       
   217     if (  Inprogress > 1   )
       
   218         {
       
   219         ButtonGroupContainer()->MakeCommandVisible( EAknSoftkeyOptions, ETrue );
       
   220         } 
       
   221     else
       
   222         {
       
   223         ButtonGroupContainer()->MakeCommandVisible( EAknSoftkeyOptions, EFalse );
       
   224         }
       
   225 #endif       
       
   226    
       
   227     CLOG_LEAVEFN("CDownloadsListDlg::SetModelL");
   201     CLOG_LEAVEFN("CDownloadsListDlg::SetModelL");
   228     }
   202     }
   229 
   203 
   230 // -----------------------------------------------------------------------------
   204 // -----------------------------------------------------------------------------
   231 // CDownloadsListDlg::HandleModelChangeL
   205 // CDownloadsListDlg::HandleModelChangeL
   304             iRefreshTimer->Cancel();
   278             iRefreshTimer->Cancel();
   305             CLOG_WRITE(" iRefreshTimer cancelled");
   279             CLOG_WRITE(" iRefreshTimer cancelled");
   306             }
   280             }
   307         }
   281         }
   308 
   282 
   309 #ifdef BRDO_SINGLE_CLICK_ENABLED_FF    
       
   310     TInt inProgressCount = iDownloadsListArray->DownloadsCount
       
   311                       ( MASKED_DL_STATE(EHttpDlCreated) |
       
   312                         MASKED_DL_STATE(EHttpDlPaused) |
       
   313                         MASKED_DL_STATE(EHttpDlInprogress) |
       
   314                         MASKED_DL_STATE(EHttpDlMultipleMOFailed));
       
   315     
       
   316     if ( inProgressCount <= 1 )
       
   317         {
       
   318         ButtonGroupContainer()->MakeCommandVisible( EAknSoftkeyOptions, EFalse );
       
   319         }
       
   320 #endif
       
   321     // Close the dialog, if necessary
   283     // Close the dialog, if necessary
   322     if ( iListBox->Model()->NumberOfItems() == 0 )
   284     if ( iListBox->Model()->NumberOfItems() == 0 )
   323         {
   285         {
   324         CancelPopup();
   286         CancelPopup();
   325         }
   287         }
   653                 {
   615                 {
   654                 HandleMiddleSoftKeyChangeL();
   616                 HandleMiddleSoftKeyChangeL();
   655                 break;
   617                 break;
   656                 }
   618                 }
   657             case MEikListBoxObserver::EEventItemDoubleClicked:
   619             case MEikListBoxObserver::EEventItemDoubleClicked:
   658 #ifdef BRDO_SINGLE_CLICK_ENABLED_FF
   620                 {
   659             case MEikListBoxObserver::EEventItemSingleClicked:
       
   660 #endif			
       
   661                 {
       
   662                 TDownloadUiData& dlData = iDownloadsListArray->DlUiData( CurrentItemIndex() );
       
   663                 TInt32 state( dlData.iProgressState );
       
   664                 if(state == EHttpProgContentFileMoved)
       
   665                     {
       
   666                       if (!ButtonGroupContainer()->IsCommandVisible(EAknSoftkeyOpen))
       
   667                           {
       
   668                           ButtonGroupContainer()->MakeCommandVisible(EAknSoftkeyOpen,ETrue);
       
   669                           }
       
   670                     }
       
   671                 // If EAknSoftkeyOpen is visible, then we can activate the selected download
   621                 // If EAknSoftkeyOpen is visible, then we can activate the selected download
   672                 if (ButtonGroupContainer()->IsCommandVisible(EAknSoftkeyOpen))
   622                 if (ButtonGroupContainer()->IsCommandVisible(EAknSoftkeyOpen))
   673                     {
   623                     {
   674                     ProcessCommandL(EAknSoftkeyOpen);
   624                     ProcessCommandL(EAknSoftkeyOpen);
   675                     }
   625                     }
   676                 }
   626                 }
   677 #ifdef BRDO_SINGLE_CLICK_ENABLED_FF
       
   678             case MEikListBoxObserver::EEventPenDownOnItem:
       
   679                 {
       
   680                 if ( iPointerEvent.iType == TPointerEvent::EButton1Down)
       
   681                     {
       
   682                     iStylusMenu->HandlePointerEventL(iPointerEvent, this);	
       
   683                     }
       
   684                  break;
       
   685                 }
       
   686 #endif
       
   687             default:
   627             default:
   688                 {
   628                 {
   689                 break;
   629                 break;
   690                 }
   630                 }
   691             }
   631             }
   741 // CDownloadsListDlg::HandlePointerEventL
   681 // CDownloadsListDlg::HandlePointerEventL
   742 // -----------------------------------------------------------------------------
   682 // -----------------------------------------------------------------------------
   743 //
   683 //
   744 void CDownloadsListDlg::HandlePointerEventL(const TPointerEvent& aPointerEvent)
   684 void CDownloadsListDlg::HandlePointerEventL(const TPointerEvent& aPointerEvent)
   745     {
   685     {
   746 #ifdef BRDO_SINGLE_CLICK_ENABLED_FF    	
       
   747     if ( aPointerEvent.iType == TPointerEvent::EButton1Down)
       
   748         {
       
   749         iPointerEvent =  aPointerEvent;
       
   750         }
       
   751     else if ( aPointerEvent.iType == TPointerEvent::EButton1Up )
       
   752         {
       
   753         iPointerEvent =  aPointerEvent;
       
   754         iStylusMenu->cancelLongTapL();
       
   755             if(iStylusMenu->islongtapRunning())
       
   756                 {
       
   757                 iStylusMenu->reSetLongTapFlag();
       
   758                 return;
       
   759                 }
       
   760         }
       
   761     else if ( aPointerEvent.iType == TPointerEvent::EDrag )
       
   762         {
       
   763         if((Abs(iPointerEvent.iPosition.iX - aPointerEvent.iPosition.iX) > pixelOffset ) ||
       
   764         (Abs(iPointerEvent.iPosition.iY - aPointerEvent.iPosition.iY) > pixelOffset ))
       
   765             {
       
   766             iStylusMenu->cancelLongTapL();
       
   767             if(iStylusMenu->islongtapRunning())
       
   768                 {
       
   769                 iStylusMenu->reSetLongTapFlag();
       
   770                 return;
       
   771                 }
       
   772             }
       
   773         }
       
   774 #endif    
       
   775     
       
   776     CAknPopupList::HandlePointerEventL(aPointerEvent);
   686     CAknPopupList::HandlePointerEventL(aPointerEvent);
   777     }
   687     }
   778 
   688 
   779 // -----------------------------------------------------------------------------
   689 // -----------------------------------------------------------------------------
   780 // CDownloadsListDlg::OfferKeyEventL
   690 // CDownloadsListDlg::OfferKeyEventL
  1006         }
   916         }
  1007 
   917 
  1008     return KErrNone;
   918     return KErrNone;
  1009     }
   919     }
  1010 
   920 
  1011 #ifdef BRDO_SINGLE_CLICK_ENABLED_FF
       
  1012 void CDownloadsListDlg::AddAiwItemsL()
       
  1013     {
       
  1014     iMenuBar->MenuPane()->AddMenuItemsL(R_DMUL_AIW_POPUP);
       
  1015     iDlgObserver.AIWPlugInMenusL(R_DMUL_AIW_POPUP,iMenuBar->MenuPane());
       
  1016     TInt pos(0);
       
  1017     if (iMenuBar->MenuPane()->MenuItemExists(EAiwCmdContact,pos))
       
  1018         {
       
  1019         iMenuBar->MenuPane()->DeleteMenuItem(EAiwCmdContact);
       
  1020         }
       
  1021     if (iMenuBar->MenuPane()->MenuItemExists(EAiwCmdRingtone,pos))
       
  1022         {
       
  1023         iMenuBar->MenuPane()->DeleteMenuItem(EAiwCmdRingtone);
       
  1024         }
       
  1025         
       
  1026     }
       
  1027 #endif
       
  1028 /* End of file. */
   921 /* End of file. */