1 /* |
|
2 * Copyright (c) 2009 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: |
|
15 * |
|
16 */ |
|
17 |
|
18 #include "logsforegroundwatcher.h" |
|
19 #include "logslogger.h" |
|
20 |
|
21 // ----------------------------------------------------------------------------- |
|
22 // Currently no other way to monitor app foreground/background switches. |
|
23 // HbForegroundWatcher might become public at some point which could be then |
|
24 // used instead. |
|
25 // ----------------------------------------------------------------------------- |
|
26 // |
|
27 LogsForegroundWatcher::LogsForegroundWatcher(QObject* parent) : QObject(parent) |
|
28 { |
|
29 CCoeEnv* env = CCoeEnv::Static(); |
|
30 if (env) { |
|
31 TRAP_IGNORE(env->AddForegroundObserverL(*this)); |
|
32 } |
|
33 } |
|
34 |
|
35 // ----------------------------------------------------------------------------- |
|
36 // |
|
37 // ----------------------------------------------------------------------------- |
|
38 // |
|
39 void LogsForegroundWatcher::HandleGainingForeground() |
|
40 { |
|
41 LOGS_QDEBUG( "logs [UI] -> LogsForegroundWatcher::HandleGainingForeground" ); |
|
42 emit gainingForeground(); |
|
43 LOGS_QDEBUG( "logs [UI] <- LogsForegroundWatcher::HandleGainingForeground" ); |
|
44 } |
|
45 |
|
46 // ----------------------------------------------------------------------------- |
|
47 // |
|
48 // ----------------------------------------------------------------------------- |
|
49 // |
|
50 void LogsForegroundWatcher::HandleLosingForeground() |
|
51 { |
|
52 LOGS_QDEBUG( "logs [UI] -> LogsForegroundWatcher::HandleLosingForeground" ); |
|
53 emit losingForeground(); |
|
54 LOGS_QDEBUG( "logs [UI] <- LogsForegroundWatcher::HandleLosingForeground" ); |
|
55 } |
|
56 |
|