equal
deleted
inserted
replaced
30 #include <apacmdln.h> |
30 #include <apacmdln.h> |
31 #include <apgtask.h> |
31 #include <apgtask.h> |
32 #include <apacmdln.h> |
32 #include <apacmdln.h> |
33 #include <eikenv.h> |
33 #include <eikenv.h> |
34 |
34 |
|
35 namespace |
|
36 { |
|
37 const TInt KWinPosForeground = 0; |
|
38 const TInt KWinPosBackground = -1; |
|
39 } |
35 |
40 |
36 // ======== LOCAL FUNCTIONS ======== |
41 // ======== LOCAL FUNCTIONS ======== |
37 static bool isKeySet(const QString &key) |
42 static bool isKeySet(const QString &key) |
38 { |
43 { |
39 XQSERVICE_DEBUG_PRINT("XQServiceUtil isKeySet %s", qPrintable(key)); |
44 XQSERVICE_DEBUG_PRINT("XQServiceUtil isKeySet %s", qPrintable(key)); |
113 */ |
118 */ |
114 void XQServiceUtil::toBackground( bool value ) |
119 void XQServiceUtil::toBackground( bool value ) |
115 { |
120 { |
116 XQSERVICE_DEBUG_PRINT("XQServiceUtil::toBackground"); |
121 XQSERVICE_DEBUG_PRINT("XQServiceUtil::toBackground"); |
117 XQSERVICE_DEBUG_PRINT("value: %d", value); |
122 XQSERVICE_DEBUG_PRINT("value: %d", value); |
118 RWsSession ws; |
123 |
119 int sid = RProcess().SecureId().iId; // Assumes UID3 == SID !!! |
124 if (CEikonEnv::Static()) { |
120 XQSERVICE_DEBUG_PRINT("sid: %d", sid); |
125 CEikonEnv::Static()->RootWin().SetOrdinalPosition(value ? KWinPosBackground : KWinPosForeground); |
121 if (ws.Connect() == KErrNone) { |
126 CEikonEnv::Static()->RootWin().EnableReceiptOfFocus(!value); |
122 XQSERVICE_DEBUG_PRINT("Connected to window server"); |
|
123 TApaTaskList tasklist(ws); |
|
124 TApaTask task = tasklist.FindApp(TUid::Uid(sid)); |
|
125 XQSERVICE_DEBUG_PRINT("task.Exists(): %x", task.Exists()); |
|
126 if (task.Exists()) { |
|
127 if (value) { |
|
128 task.SendToBackground(); |
|
129 } |
|
130 else { |
|
131 task.BringToForeground(); |
|
132 } |
|
133 } |
|
134 |
|
135 ws.Close(); |
|
136 } |
127 } |
137 } |
128 } |
138 |
129 |
139 /*! |
130 /*! |
140 Check if service application is being launched as an embedded application. |
131 Check if service application is being launched as an embedded application. |