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 #ifndef AUTOLOCKSRV_H |
|
23 #define AUTOLOCKSRV_H |
|
24 |
|
25 #define RDEBUG( x, y ) RDebug::Printf( "%s %s (%u) %s=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, x, y ); |
|
26 // #define RDEBUG( x, y ) |
|
27 |
|
28 #include <QWidget> |
|
29 #include <QEvent> |
|
30 #include <QModelIndex> |
|
31 #include <QMap> |
|
32 #include <QStringList> |
|
33 #include <xqserviceprovider.h> |
|
34 #include <xqsharablefile.h> |
|
35 #include <QToolButton> |
|
36 #include <qmobilityglobal.h> |
|
37 |
|
38 #include "autolockuseractivityservice.h" |
|
39 #include "../../SecUi/inc/SecQueryUi.h" |
|
40 |
|
41 QTM_BEGIN_NAMESPACE |
|
42 class QValueSpacePublisher; |
|
43 class QValueSpaceSubscriber; |
|
44 QTM_END_NAMESPACE |
|
45 QTM_USE_NAMESPACE |
|
46 |
|
47 #include <hbwidget.h> |
|
48 #include <qapplication.h> |
|
49 #include <hbdevicedialog.h> |
|
50 |
|
51 enum TLockStatus |
|
52 { |
|
53 ELockNotActive = 0, |
|
54 EKeyguardActive, |
|
55 EDevicelockActive |
|
56 }; |
|
57 |
|
58 enum TDevicelockReason |
|
59 { |
|
60 EDevicelockManual = 1, |
|
61 EDevicelockRemote, |
|
62 EDevicelockTimer |
|
63 }; |
|
64 |
|
65 |
|
66 class QLineEdit; |
|
67 class QPushButton; |
|
68 class AutolockSrvService; |
|
69 class QLabel; |
|
70 class HbLabel; |
|
71 class XQSharableFile; |
|
72 |
|
73 class AutolockSrv : public QWidget |
|
74 { |
|
75 Q_OBJECT |
|
76 |
|
77 public: |
|
78 AutolockSrv( QWidget *parent = 0, Qt::WFlags f = 0 ); |
|
79 ~AutolockSrv(); |
|
80 |
|
81 void setLabelNumber(QString label,QString number); |
|
82 void setLabelIcon(int value); |
|
83 int CheckIfLegal(int value); |
|
84 void DebugRequest(int value); |
|
85 void DebugError(int value); |
|
86 void DebugStatus(int value); |
|
87 void adjustInactivityTimers(int aReason); |
|
88 int updateIndicator(int aReason); |
|
89 int AskValidSecCode(int aReason); |
|
90 int publishStatus(int aReason); |
|
91 int TryChangeStatus(int aReason); |
|
92 int setLockDialog(int aReason, int status); |
|
93 int showNoteIfRequested(int aReason); |
|
94 |
|
95 bool event(QEvent *event); |
|
96 bool eventFilter(QObject *, QEvent *); |
|
97 |
|
98 int callerHasECapabilityWriteDeviceData; |
|
99 int iShowKeyguardNote; |
|
100 int mParam1; |
|
101 int mParam2; |
|
102 |
|
103 public slots: |
|
104 void endCall(); |
|
105 void quit(); |
|
106 void unlockAction(); |
|
107 void unguardAction(); |
|
108 void lockAction(); |
|
109 void test1Action(); |
|
110 void test2Action(); |
|
111 void handleAnswerDelivered(); |
|
112 void subscriberKSettingsAutolockStatusChanged(); |
|
113 void subscriberKSettingsAutoLockTimeChanged(); |
|
114 void subscriberKSettingsAutomaticKeyguardTimeChanged(); |
|
115 void subscriberKDisplayLightsTimeoutChanged(); |
|
116 void subscriberKProEngActiveProfileChanged(); |
|
117 |
|
118 private slots: |
|
119 void activeKeyguard(); |
|
120 void notActiveKeyguard(); |
|
121 void activeDevicelock(); |
|
122 void notActiveDevicelock(); |
|
123 |
|
124 private: |
|
125 QLabel *mLabel; |
|
126 QLineEdit *mNumberEdit; |
|
127 QToolButton *mLabelIcon; |
|
128 int mLabelIcon_visible; |
|
129 //QPushButton *mEndCallButton; |
|
130 AutolockSrvService* mService; |
|
131 // int mKeyCode; |
|
132 // int mKeyCaptureHandle; |
|
133 QValueSpaceSubscriber *subscriberKSettingsAutolockStatus; |
|
134 QValueSpaceSubscriber *subscriberKSettingsAutoLockTime; |
|
135 QValueSpaceSubscriber *subscriberKSettingsAutomaticKeyguardTime; |
|
136 QValueSpaceSubscriber *subscriberKDisplayLightsTimeout; |
|
137 QValueSpaceSubscriber *subscriberKProEngActiveProfile; |
|
138 |
|
139 AutolockUserActivityService* serviceKeyguard; |
|
140 AutolockUserActivityService* serviceDevicelock; |
|
141 |
|
142 int iLockStatus; |
|
143 int iLockStatusPrev; |
|
144 CSecQueryUi *iSecQueryUi; |
|
145 int iSecQueryUiCreated; |
|
146 HbDeviceDialog *iDeviceDialog; |
|
147 int iDeviceDialogCreated; |
|
148 }; |
|
149 |
|
150 class AutolockSrvService : public XQServiceProvider |
|
151 { |
|
152 Q_OBJECT |
|
153 public: |
|
154 AutolockSrvService( AutolockSrv *parent = 0 ); |
|
155 ~AutolockSrvService(); |
|
156 |
|
157 void complete(QString number); |
|
158 bool asyncAnswer() {return mAsyncAnswer;} |
|
159 public slots: |
|
160 int service(const QString& number, const QString& aParam1, const QString& aParam2 ); |
|
161 |
|
162 private slots: |
|
163 void handleClientDisconnect(); |
|
164 |
|
165 private: |
|
166 AutolockSrv* mAutolockSrv; |
|
167 QString mNumber; |
|
168 bool mAsyncAnswer; |
|
169 int mAsyncReqId; |
|
170 }; |
|
171 |
|
172 class CWait : public CActive |
|
173 { |
|
174 public: |
|
175 /** |
|
176 * Creates instance of the CWait class. |
|
177 * |
|
178 * @return Returns the instance just created. |
|
179 */ |
|
180 static CWait* NewL(); |
|
181 /** |
|
182 * Destructor. |
|
183 */ |
|
184 ~CWait(); |
|
185 public: |
|
186 /** |
|
187 * Starts waiting for aReqStatus. |
|
188 */ |
|
189 TInt WaitForRequestL(); |
|
190 public: |
|
191 /** |
|
192 * Sets active request type. |
|
193 */ |
|
194 void SetRequestType(TInt aRequestType); |
|
195 /** |
|
196 * Gets active request type. |
|
197 */ |
|
198 TInt GetRequestType(); |
|
199 private: |
|
200 /** |
|
201 * C++ default constructor. |
|
202 */ |
|
203 CWait(); |
|
204 /** |
|
205 * Symbian OS constructor. |
|
206 */ |
|
207 void ConstructL(); |
|
208 private: // from CActive |
|
209 /** @see CActive::RunL() */ |
|
210 void RunL(); |
|
211 /** @see CActive::DoCancel() */ |
|
212 void DoCancel(); |
|
213 RTimer iTimer; |
|
214 CActiveSchedulerWait iWait; |
|
215 // Used if there is a need to cancel an active request; |
|
216 // namely in situations where destructor is called when Wait |
|
217 // is active. |
|
218 TInt iRequestType; |
|
219 }; |
|
220 |
|
221 |
|
222 #endif // AUTOLOCKSRV_H |
|