|
1 /* |
|
2 * Copyright (c) 2005-2007 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: Logs app launch handler for Active Idle WS Plug-in. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #include "logslaunchhandler.h" |
|
20 #include "uistate.h" |
|
21 #include <e32property.h> |
|
22 #include <e32event.h> |
|
23 #include <e32keys.h> |
|
24 #include <activeidle2internalpskeys.h> |
|
25 #include <activeidle2domainpskeys.h> |
|
26 |
|
27 namespace AiWsPlugin { |
|
28 |
|
29 |
|
30 CLogsLaunchHandler::CLogsLaunchHandler() |
|
31 { |
|
32 } |
|
33 |
|
34 void CLogsLaunchHandler::ConstructL() |
|
35 { |
|
36 // Read capability: ReadDeviceData. |
|
37 _LIT_SECURITY_POLICY_C1( KReadDevicePolicy, ECapabilityReadDeviceData ); |
|
38 // Write capability: WriteDeviceData. |
|
39 _LIT_SECURITY_POLICY_C1( KWriteDevicePolicy, ECapabilityWriteDeviceData ); |
|
40 |
|
41 // Initialize Shortcut Plug-in command API |
|
42 RProperty::Define( |
|
43 KUidSystemCategory, |
|
44 KPSUidShortcutCmd, |
|
45 RProperty::EText, |
|
46 KReadDevicePolicy, |
|
47 KWriteDevicePolicy |
|
48 ); |
|
49 |
|
50 iTimer = CKeyHandlerTimer::NewL( this ); |
|
51 } |
|
52 |
|
53 CLogsLaunchHandler* CLogsLaunchHandler::NewLC() |
|
54 { |
|
55 CLogsLaunchHandler* self = new(ELeave) CLogsLaunchHandler; |
|
56 CleanupStack::PushL( self ); |
|
57 self->ConstructL(); |
|
58 return self; |
|
59 } |
|
60 |
|
61 CLogsLaunchHandler::~CLogsLaunchHandler() |
|
62 { |
|
63 if ( iTimer) |
|
64 { |
|
65 iTimer->Cancel(); |
|
66 delete iTimer; |
|
67 } |
|
68 } |
|
69 |
|
70 void CLogsLaunchHandler::SetUiStateQuery( MUiState& aUiState ) |
|
71 { |
|
72 iUiState = &aUiState; |
|
73 } |
|
74 |
|
75 void CLogsLaunchHandler::FocusChanged( TBool /*aState*/ ) |
|
76 { |
|
77 // Focus status is queried from iUiState |
|
78 } |
|
79 |
|
80 TBool CLogsLaunchHandler::OfferRawEvent(const TRawEvent& aRawEvent) |
|
81 { |
|
82 TInt reactOnSendKey = 1; |
|
83 TInt err = RProperty::Get( KPSUidAiInformation, KActiveIdleActOnSendKey, reactOnSendKey ); |
|
84 if ( err != KErrNone ) |
|
85 { |
|
86 reactOnSendKey = 1; |
|
87 } |
|
88 |
|
89 TBool consumed = EFalse; |
|
90 |
|
91 if ( reactOnSendKey ) |
|
92 { |
|
93 switch( aRawEvent.Type() ) |
|
94 { |
|
95 case TRawEvent::EKeyDown: |
|
96 { |
|
97 if ( iUiState->HasFocus() && aRawEvent.ScanCode() == EStdKeyYes ) |
|
98 { |
|
99 const TTimeIntervalMicroSeconds32 KLongKeyPress(600000); |
|
100 iTimer->Cancel(); |
|
101 iTimer->After(KLongKeyPress); |
|
102 consumed = ETrue; |
|
103 } |
|
104 break; |
|
105 } |
|
106 case TRawEvent::EKeyUp: |
|
107 { |
|
108 if ( iUiState->HasFocus() && aRawEvent.ScanCode() == EStdKeyYes && iTimer->IsActive() ) |
|
109 { |
|
110 iTimer->Cancel(); |
|
111 RProperty::Set( |
|
112 KUidSystemCategory, |
|
113 KPSUidShortcutCmd, |
|
114 KAiPSLaunchLogs ); |
|
115 consumed = ETrue; |
|
116 } |
|
117 break; |
|
118 } |
|
119 } |
|
120 } |
|
121 |
|
122 return consumed; |
|
123 } |
|
124 |
|
125 void CLogsLaunchHandler::TimerDone() |
|
126 { |
|
127 RProperty::Set( |
|
128 KUidSystemCategory, |
|
129 KPSUidShortcutCmd, |
|
130 KAiPSLaunchNameDialer ); |
|
131 } |
|
132 |
|
133 } // namespace AiWsPlugin |