|
1 /* |
|
2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * |
|
5 * This program is free software: you can redistribute it and/or modify |
|
6 * it under the terms of the GNU Lesser General Public License as published by |
|
7 * the Free Software Foundation, version 2.1 of the License. |
|
8 * |
|
9 * This program is distributed in the hope that it will be useful, |
|
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
12 * GNU Lesser General Public License for more details. |
|
13 * |
|
14 * You should have received a copy of the GNU Lesser General Public License |
|
15 * along with this program. If not, |
|
16 * see "http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html/". |
|
17 * |
|
18 * Description: |
|
19 * |
|
20 */ |
|
21 |
|
22 #include "xqservicelog.h" |
|
23 #include "xqrequestutil.h" |
|
24 #include "xqserviceutil.h" |
|
25 |
|
26 #include <QCoreApplication> |
|
27 #include <QStringList> |
|
28 |
|
29 #include <apgcli.h> |
|
30 #include <apacmdln.h> |
|
31 #include <apgtask.h> |
|
32 #include <coemain.h> |
|
33 #include <e32std.h> |
|
34 #include <w32std.h> // RWsSession |
|
35 #include <apacmdln.h> |
|
36 #include <eikenv.h> |
|
37 /* |
|
38 void XQServiceUtil::hideFromFsw( bool hide ) |
|
39 { |
|
40 RAknUiServer uiServer; |
|
41 int sid = RProcess().SecureId().iId; |
|
42 uiServer.Connect(); |
|
43 uiServer.HideApplicationFromFsw( hide, sid ); |
|
44 uiServer.Close(); |
|
45 } |
|
46 */ |
|
47 |
|
48 void XQServiceUtil::toBackground( bool value ) |
|
49 { |
|
50 XQSERVICE_DEBUG_PRINT("XQServiceUtil::toBackground"); |
|
51 XQSERVICE_DEBUG_PRINT("value: %d", value); |
|
52 RWsSession ws; |
|
53 int sid = RProcess().SecureId().iId; |
|
54 XQSERVICE_DEBUG_PRINT("sid: %d", sid); |
|
55 if (ws.Connect() == KErrNone) { |
|
56 XQSERVICE_DEBUG_PRINT("Connected to window server"); |
|
57 TApaTaskList tasklist(ws); |
|
58 TApaTask task = tasklist.FindApp(TUid::Uid(sid)); |
|
59 XQSERVICE_DEBUG_PRINT("task.Exists(): %x", task.Exists()); |
|
60 if (task.Exists()) { |
|
61 if (value) { |
|
62 task.SendToBackground(); |
|
63 } |
|
64 else { |
|
65 task.BringToForeground(); |
|
66 } |
|
67 } |
|
68 |
|
69 ws.Close(); |
|
70 } |
|
71 } |
|
72 |
|
73 bool XQServiceUtil::isEmbedded() |
|
74 { |
|
75 XQSERVICE_DEBUG_PRINT("XQServiceUtil::isEmbedded"); |
|
76 QStringList args = QCoreApplication::arguments(); |
|
77 foreach (QString arg, args) { |
|
78 XQSERVICE_DEBUG_PRINT("arg: %s", qPrintable(arg)); |
|
79 if (!arg.compare(QString::fromLatin1(XQServiceUtils::StartupArgEmbedded),Qt::CaseInsensitive)) { |
|
80 XQSERVICE_DEBUG_PRINT("Is embedded"); |
|
81 return true; |
|
82 } |
|
83 } |
|
84 XQSERVICE_DEBUG_PRINT("Not embedded"); |
|
85 return false; |
|
86 } |
|
87 |
|
88 bool XQServiceUtil::isService() |
|
89 { |
|
90 XQSERVICE_DEBUG_PRINT("XQServiceUtil::isService"); |
|
91 QStringList args = QCoreApplication::arguments(); |
|
92 foreach (QString arg, args) { |
|
93 XQSERVICE_DEBUG_PRINT("arg: %s", qPrintable(arg)); |
|
94 if (!arg.compare(QString::fromLatin1(XQServiceUtils::StartupArgService),Qt::CaseInsensitive)) { |
|
95 XQSERVICE_DEBUG_PRINT("Is service"); |
|
96 return true; |
|
97 } |
|
98 } |
|
99 XQSERVICE_DEBUG_PRINT("Not service"); |
|
100 return false; |
|
101 } |
|
102 |