browserutilities/downloadmgr/DownloadMgrUiLib/Src/CDownloadsListDlg.cpp
branchRCL_3
changeset 94 919f36ff910f
parent 93 79859ed3eea9
--- a/browserutilities/downloadmgr/DownloadMgrUiLib/Src/CDownloadsListDlg.cpp	Tue Aug 31 16:17:46 2010 +0300
+++ b/browserutilities/downloadmgr/DownloadMgrUiLib/Src/CDownloadsListDlg.cpp	Wed Sep 01 12:28:30 2010 +0100
@@ -15,12 +15,10 @@
 *
 */
 
-
-
 // INCLUDE FILES
 #include    "CDownloadsListDlg.h"
 #include    "CDownloadUtils.h"
-#include    "DownloadsListDlgObserver.h"
+#include    <downloadslistdlgobserver.h>
 #include    "CDownloadsListArray.h"
 #include    "DownloadMgrUiLib.hrh"
 #include    "DMgrUiLibPanic.h"
@@ -35,10 +33,12 @@
 #include    <StringLoader.h>
 #include    <eikenv.h>
 #include    <DocumentHandler.h>
-
+#ifdef BRDO_SINGLE_CLICK_ENABLED_FF
+#include  "CDownloadsStylusPopupMenu.h"
+#define   pixelOffset   36
+#endif
 #include "eikon.hrh"
 
-
 // ============================ MEMBER FUNCTIONS ===============================
 
 // -----------------------------------------------------------------------------
@@ -110,6 +110,9 @@
 
     iDownloadUtils = CDownloadUtils::NewL();
 
+#ifdef BRDO_SINGLE_CLICK_ENABLED_FF      
+    iStylusMenu = CDlStylusPopupMenu::NewL();
+#endif    
     CLOG_LEAVEFN("CDownloadsListDlg::ConstructL");
     }
 
@@ -158,7 +161,13 @@
     iListBox = NULL;
     delete iDownloadUtils;
     iDownloadUtils = NULL;
-
+#ifdef BRDO_SINGLE_CLICK_ENABLED_FF    
+	 if (iStylusMenu)
+	 	{
+	 		delete iStylusMenu;
+	 		iStylusMenu = NULL;
+	 	}
+#endif    
     CLOG_LEAVEFN("CDownloadsListDlg::~CDownloadsListDlg");
     }
 
@@ -198,6 +207,23 @@
         CLOG_WRITE(" aModel.Count() == 0");
         }
 
+#ifdef BRDO_SINGLE_CLICK_ENABLED_FF    
+    TInt Inprogress = iDownloadsListArray->DownloadsCount
+                      ( MASKED_DL_STATE(EHttpDlCreated) |
+                        MASKED_DL_STATE(EHttpDlPaused) |
+                        MASKED_DL_STATE(EHttpDlInprogress) |
+                        MASKED_DL_STATE(EHttpDlMultipleMOFailed));
+    
+    if (  Inprogress > 1   )
+        {
+        ButtonGroupContainer()->MakeCommandVisible( EAknSoftkeyOptions, ETrue );
+        } 
+    else
+        {
+        ButtonGroupContainer()->MakeCommandVisible( EAknSoftkeyOptions, EFalse );
+        }
+#endif       
+   
     CLOG_LEAVEFN("CDownloadsListDlg::SetModelL");
     }
 
@@ -280,6 +306,18 @@
             }
         }
 
+#ifdef BRDO_SINGLE_CLICK_ENABLED_FF    
+    TInt inProgressCount = iDownloadsListArray->DownloadsCount
+                      ( MASKED_DL_STATE(EHttpDlCreated) |
+                        MASKED_DL_STATE(EHttpDlPaused) |
+                        MASKED_DL_STATE(EHttpDlInprogress) |
+                        MASKED_DL_STATE(EHttpDlMultipleMOFailed));
+    
+    if ( inProgressCount <= 1 )
+        {
+        ButtonGroupContainer()->MakeCommandVisible( EAknSoftkeyOptions, EFalse );
+        }
+#endif
     // Close the dialog, if necessary
     if ( iListBox->Model()->NumberOfItems() == 0 )
         {
@@ -617,13 +655,35 @@
                 break;
                 }
             case MEikListBoxObserver::EEventItemDoubleClicked:
+#ifdef BRDO_SINGLE_CLICK_ENABLED_FF
+            case MEikListBoxObserver::EEventItemSingleClicked:
+#endif			
                 {
+                TDownloadUiData& dlData = iDownloadsListArray->DlUiData( CurrentItemIndex() );
+                TInt32 state( dlData.iProgressState );
+                if(state == EHttpProgContentFileMoved)
+                    {
+                      if (!ButtonGroupContainer()->IsCommandVisible(EAknSoftkeyOpen))
+                          {
+                          ButtonGroupContainer()->MakeCommandVisible(EAknSoftkeyOpen,ETrue);
+                          }
+                    }
                 // If EAknSoftkeyOpen is visible, then we can activate the selected download
                 if (ButtonGroupContainer()->IsCommandVisible(EAknSoftkeyOpen))
                     {
                     ProcessCommandL(EAknSoftkeyOpen);
                     }
                 }
+#ifdef BRDO_SINGLE_CLICK_ENABLED_FF
+            case MEikListBoxObserver::EEventPenDownOnItem:
+                {
+                if ( iPointerEvent.iType == TPointerEvent::EButton1Down)
+                    {
+                    iStylusMenu->HandlePointerEventL(iPointerEvent, this);	
+                    }
+                 break;
+                }
+#endif
             default:
                 {
                 break;
@@ -683,6 +743,36 @@
 //
 void CDownloadsListDlg::HandlePointerEventL(const TPointerEvent& aPointerEvent)
     {
+#ifdef BRDO_SINGLE_CLICK_ENABLED_FF    	
+    if ( aPointerEvent.iType == TPointerEvent::EButton1Down)
+        {
+        iPointerEvent =  aPointerEvent;
+        }
+    else if ( aPointerEvent.iType == TPointerEvent::EButton1Up )
+        {
+        iPointerEvent =  aPointerEvent;
+        iStylusMenu->cancelLongTapL();
+            if(iStylusMenu->islongtapRunning())
+                {
+                iStylusMenu->reSetLongTapFlag();
+                return;
+                }
+        }
+    else if ( aPointerEvent.iType == TPointerEvent::EDrag )
+        {
+        if((Abs(iPointerEvent.iPosition.iX - aPointerEvent.iPosition.iX) > pixelOffset ) ||
+        (Abs(iPointerEvent.iPosition.iY - aPointerEvent.iPosition.iY) > pixelOffset ))
+            {
+            iStylusMenu->cancelLongTapL();
+            if(iStylusMenu->islongtapRunning())
+                {
+                iStylusMenu->reSetLongTapFlag();
+                return;
+                }
+            }
+        }
+#endif    
+    
     CAknPopupList::HandlePointerEventL(aPointerEvent);
     }
 
@@ -918,4 +1008,21 @@
     return KErrNone;
     }
 
+#ifdef BRDO_SINGLE_CLICK_ENABLED_FF
+void CDownloadsListDlg::AddAiwItemsL()
+    {
+    iMenuBar->MenuPane()->AddMenuItemsL(R_DMUL_AIW_POPUP);
+    iDlgObserver.AIWPlugInMenusL(R_DMUL_AIW_POPUP,iMenuBar->MenuPane());
+    TInt pos(0);
+    if (iMenuBar->MenuPane()->MenuItemExists(EAiwCmdContact,pos))
+        {
+        iMenuBar->MenuPane()->DeleteMenuItem(EAiwCmdContact);
+        }
+    if (iMenuBar->MenuPane()->MenuItemExists(EAiwCmdRingtone,pos))
+        {
+        iMenuBar->MenuPane()->DeleteMenuItem(EAiwCmdRingtone);
+        }
+        
+    }
+#endif
 /* End of file. */