applicationmanagement/server/src/appmgmtdownloadmgr.cpp
changeset 53 1273bf2c520c
parent 42 aa33c2cb9a50
equal deleted inserted replaced
42:aa33c2cb9a50 53:1273bf2c520c
    16  */
    16  */
    17 
    17 
    18 #include <nsmldmconst.h>
    18 #include <nsmldmconst.h>
    19 #include <downloadmanager.h>
    19 #include <downloadmanager.h>
    20 #include <download.h>
    20 #include <download.h>
    21 #include <e32Property.h>
       
    22 #include <serviceipc.h>
    21 #include <serviceipc.h>
    23 #include <hbdialog.h>
    22 #include <hbdialog.h>
    24 #include <hblabel.h>
    23 #include <hblabel.h>
    25 #include <HbMessageBox.h>
    24 #include <hbmessagebox.h>
    26 #include <hbapplication.h>
    25 #include <hbapplication.h>
    27 #include <hbdevicenotificationdialog.h>
    26 #include <hbdevicenotificationdialog.h>
    28 #include <hbaction.h>
    27 #include <hbaction.h>
    29 #include <apgtask.h>
    28 #include <apgtask.h>
    30 #include <coemain.h>
    29 #include <coemain.h>
    31 #include <e32base.h>
    30 #include <e32base.h>
    32 #include <eikenv.h>
    31 #include <eikenv.h>
    33 #include <Driveinfo.h>
    32 #include <driveinfo.h>
    34 #include <e32property.h>
    33 #include <e32property.h>
    35 #include "ApplicationManagementUtility.h"
    34 #include "ApplicationManagementUtility.h"
    36 #include "debug.h"
    35 #include "debug.h"
    37 #include "dmcommon.h"
    36 #include "dmcommon.h"
    38 #include "amstorage.h"
    37 #include "amstorage.h"
    39 #include "appmgmtnotifier.h"
    38 #include "appmgmtnotifier.h"
    40 #include "appmgmtdownloadmgr.h"
    39 #include "appmgmtdownloadmgr.h"
    41 #include "ServicePluginLogger.h"
    40 #include "ServicePluginLogger.h"
       
    41 
       
    42 #include <cmmanager.h>
       
    43 #include <cmconnectionmethod.h>
    42 using namespace NApplicationManagement;
    44 using namespace NApplicationManagement;
    43 
    45 
    44 // ------------------------------------------------------------------------------------------------
    46 // ------------------------------------------------------------------------------------------------
    45 // appmgmtdownloadmgr::appmgmtdownloadmgr
    47 // appmgmtdownloadmgr::appmgmtdownloadmgr
    46 // ------------------------------------------------------------------------------------------------ 
    48 // ------------------------------------------------------------------------------------------------ 
    82     }
    84     }
    83 
    85 
    84 // ------------------------------------------------------------------------------------------------
    86 // ------------------------------------------------------------------------------------------------
    85 // appmgmtdownloadmgr::startDownload
    87 // appmgmtdownloadmgr::startDownload
    86 // ------------------------------------------------------------------------------------------------ 
    88 // ------------------------------------------------------------------------------------------------ 
    87 void appmgmtdownloadmgr::startDownload(CDeploymentComponent *aComponent)
    89 void appmgmtdownloadmgr::startDownload(CDeploymentComponent *aComponent, int aIapid)
    88     {
    90     {
    89 
    91 
    90     RDEBUG( "appmgmtdownloadmgr::startDownload Start" );
    92     RDEBUG( "appmgmtdownloadmgr::startDownload Start" );
    91 
    93 
    92     QString m_appName = "ApplicationManagementServer";
    94     QString m_appName = "ApplicationManagementServer";
   114     
   116     
   115     TInt silentsession = 0;
   117     TInt silentsession = 0;
   116     RProperty::Get(KPSUidNSmlSOSServerKey,KNSmlDMSilentJob,silentsession);
   118     RProperty::Get(KPSUidNSmlSOSServerKey,KNSmlDMSilentJob,silentsession);
   117     
   119     
   118     CApplicationManagementUtility::iSilentSession = silentsession;
   120     CApplicationManagementUtility::iSilentSession = silentsession;
       
   121     
       
   122     QString name = GetIapNameWithIdL(aIapid);
       
   123     
       
   124     int ret = iDownloadManager->setAttribute(AccessPoint, name);
   119 
   125 
   120     iDl = iDownloadManager->createDownload(url, m_type);
   126     iDl = iDownloadManager->createDownload(url, m_type);
   121 
   127 
   122     bool t = connect(iDl, SIGNAL(downloadEvent(DownloadEvent *)), this,
   128     bool t = connect(iDl, SIGNAL(downloadEvent(DownloadEvent *)), this,
   123             SLOT(downloadEventRecieved(DownloadEvent *)));
   129             SLOT(downloadEventRecieved(DownloadEvent *)));
   823         task.SendToBackground();
   829         task.SendToBackground();
   824         }
   830         }
   825     }
   831     }
   826 }
   832 }
   827 
   833 
   828 
   834 // --------------------------------------------------------------------------
       
   835 //  Gets the access point name for a given access point id.
       
   836 // --------------------------------------------------------------------------
       
   837 QString appmgmtdownloadmgr::GetIapNameWithIdL(TInt aIapId)
       
   838     {
       
   839     QString name(NULL);
       
   840 
       
   841     RCmManager cmManager;
       
   842     cmManager.OpenL();
       
   843 
       
   844     RCmConnectionMethod conn;
       
   845     conn = cmManager.ConnectionMethodL(aIapId);
       
   846 
       
   847     HBufC* temp = conn.GetStringAttributeL(CMManager::ECmName);
       
   848     name = QString::fromUtf16(temp->Ptr(), temp->Length());
       
   849     delete temp;
       
   850     temp = NULL;
       
   851 
       
   852     conn.Close();
       
   853 
       
   854     cmManager.Close();
       
   855 
       
   856     return name;
       
   857     }
   829 
   858 
   830 //---------------------------------------------------------------------------------
   859 //---------------------------------------------------------------------------------
   831 // CDialogWait::CDialogWait
   860 // CDialogWait::CDialogWait
   832 //---------------------------------------------------------------------------------
   861 //---------------------------------------------------------------------------------
   833 CDialogWait::CDialogWait()
   862 CDialogWait::CDialogWait()