deviceupdatesui/deviceupdatesqtsp/src/DmTelServiceHandler.cpp
changeset 67 fdbfe0a95492
parent 33 7464c1e21dae
equal deleted inserted replaced
62:03849bd79877 67:fdbfe0a95492
     9  * Initial Contributors:
     9  * Initial Contributors:
    10  * Nokia Corporation - initial contribution.
    10  * Nokia Corporation - initial contribution.
    11  *
    11  *
    12  * Contributors:
    12  * Contributors:
    13  *
    13  *
    14  * Description:
    14  * Description: Service Handler for dialer launch of DM
    15  *
    15  *
    16  */
    16  */
    17 
    17 
       
    18 #include <hbapplication.h>
       
    19 #include <coemain.h>
       
    20 #include <apgtask.h>
       
    21 #include <e32property.h>
       
    22 #include <qdebug.h>
    18 #include "DmTelServiceHandler.h"
    23 #include "DmTelServiceHandler.h"
    19 #include <hbapplication.h>
       
    20 
    24 
    21 DmTelServiceHandler::DmTelServiceHandler(QObject *parent):
    25 DmTelServiceHandler::DmTelServiceHandler(QObject *parent):
    22     XQServiceProvider("com.nokia.services.devicemanager", parent)
    26     XQServiceProvider("com.nokia.services.devicemanager", parent)
    23 {
    27 {
    24     publishAll();
    28     publishAll();
    27 DmTelServiceHandler::~DmTelServiceHandler()
    31 DmTelServiceHandler::~DmTelServiceHandler()
    28 {
    32 {
    29 }
    33 }
    30 
    34 
    31 void DmTelServiceHandler::showVersionNumber()
    35 void DmTelServiceHandler::showVersionNumber()
    32 {
    36     {
    33 // Create DM UI Process
    37     qDebug("DmTelServiceHandler::showVersionNumber >> ");
    34 RProcess rp;
    38     // Create DM UI Process
    35 TInt err = rp.Create(KDMUIProcess,KNullDesC);
    39     RWsSession ws;
    36 User::LeaveIfError(err);  
    40     User::LeaveIfError(ws.Connect());
    37 rp.SetPriority(EPriorityForeground);
    41     CleanupClosePushL(ws);
    38 rp.Resume();    // logon OK - start the server
    42     // Find the task with uid
       
    43     TApaTaskList taskList(ws);
       
    44     TApaTask task = taskList.FindApp(KPSUidNSmlDMSyncApp);
       
    45     TInt dmLaunch=NULL;
       
    46     TInt err = NULL;
       
    47     RProperty::Get(KPSUidNSmlDMSyncApp, KDMLaunched, dmLaunch);
       
    48     if (task.Exists())
       
    49         {
       
    50         if (dmLaunch == EDMLaunchedFromDialer)
       
    51             {
       
    52             task.BringToForeground();
       
    53             }
       
    54         else if(dmLaunch == EDMLaunchedFromCP)
       
    55             {
       
    56             TApaTask task1 = taskList.FindApp(KControlPanelAppUid);
       
    57             if (task1.Exists())
       
    58                 {
       
    59                 task1.BringToForeground();
       
    60                 }
       
    61             }
       
    62         }
       
    63     else
       
    64         {
       
    65         RProcess rp;
       
    66         err = rp.Create(KDMUIProcess, KNullDesC);
       
    67         qDebug()<<"process creation error "<<err;
       
    68         rp.SetPriority(EPriorityForeground);
       
    69         rp.Resume(); // logon OK - start the server
       
    70         // quit the service provider app.
       
    71         rp.Close();
       
    72         }
       
    73     int requestId = setCurrentRequestAsync();
       
    74     CleanupStack::PopAndDestroy(); //for ws
    39 
    75 
    40 // quit the service provider app.
    76     completeRequest(requestId,0);
    41 //QCoreApplication::quit();	
    77     connect(this, SIGNAL(returnValueDelivered()), qApp, SLOT(quit()));
    42 QCoreApplication::exit(0);		  
    78     //QApplication::exit(0);
       
    79 	qDebug("DmTelServiceHandler::showVersionNumber >> end");
    43 }
    80 }