--- a/deviceupdatesui/deviceupdatesqtsp/src/DmTelServiceHandler.cpp Fri Sep 17 19:58:05 2010 +0530
+++ b/deviceupdatesui/deviceupdatesqtsp/src/DmTelServiceHandler.cpp Fri Oct 15 11:39:02 2010 +0530
@@ -11,12 +11,16 @@
*
* Contributors:
*
- * Description:
+ * Description: Service Handler for dialer launch of DM
*
*/
+#include <hbapplication.h>
+#include <coemain.h>
+#include <apgtask.h>
+#include <e32property.h>
+#include <qdebug.h>
#include "DmTelServiceHandler.h"
-#include <hbapplication.h>
DmTelServiceHandler::DmTelServiceHandler(QObject *parent):
XQServiceProvider("com.nokia.services.devicemanager", parent)
@@ -29,15 +33,48 @@
}
void DmTelServiceHandler::showVersionNumber()
-{
-// Create DM UI Process
-RProcess rp;
-TInt err = rp.Create(KDMUIProcess,KNullDesC);
-User::LeaveIfError(err);
-rp.SetPriority(EPriorityForeground);
-rp.Resume(); // logon OK - start the server
+ {
+ qDebug("DmTelServiceHandler::showVersionNumber >> ");
+ // Create DM UI Process
+ RWsSession ws;
+ User::LeaveIfError(ws.Connect());
+ CleanupClosePushL(ws);
+ // Find the task with uid
+ TApaTaskList taskList(ws);
+ TApaTask task = taskList.FindApp(KPSUidNSmlDMSyncApp);
+ TInt dmLaunch=NULL;
+ TInt err = NULL;
+ RProperty::Get(KPSUidNSmlDMSyncApp, KDMLaunched, dmLaunch);
+ if (task.Exists())
+ {
+ if (dmLaunch == EDMLaunchedFromDialer)
+ {
+ task.BringToForeground();
+ }
+ else if(dmLaunch == EDMLaunchedFromCP)
+ {
+ TApaTask task1 = taskList.FindApp(KControlPanelAppUid);
+ if (task1.Exists())
+ {
+ task1.BringToForeground();
+ }
+ }
+ }
+ else
+ {
+ RProcess rp;
+ err = rp.Create(KDMUIProcess, KNullDesC);
+ qDebug()<<"process creation error "<<err;
+ rp.SetPriority(EPriorityForeground);
+ rp.Resume(); // logon OK - start the server
+ // quit the service provider app.
+ rp.Close();
+ }
+ int requestId = setCurrentRequestAsync();
+ CleanupStack::PopAndDestroy(); //for ws
-// quit the service provider app.
-//QCoreApplication::quit();
-QCoreApplication::exit(0);
+ completeRequest(requestId,0);
+ connect(this, SIGNAL(returnValueDelivered()), qApp, SLOT(quit()));
+ //QApplication::exit(0);
+ qDebug("DmTelServiceHandler::showVersionNumber >> end");
}