|
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 //USER |
|
18 #include "logsservicehandler.h" |
|
19 #include "logslogger.h" |
|
20 #include "logsmainwindow.h" |
|
21 #include <xqserviceutil.h> |
|
22 |
|
23 //SYSTEM |
|
24 |
|
25 // ----------------------------------------------------------------------------- |
|
26 // LogsService::LogsService |
|
27 // ----------------------------------------------------------------------------- |
|
28 // |
|
29 LogsServiceHandler::LogsServiceHandler(LogsMainWindow& mainWindow) |
|
30 : XQServiceProvider(QLatin1String("com.nokia.services.logsservices.starter"),0), |
|
31 mActivatedView(0), |
|
32 mMainWindow(mainWindow) |
|
33 { |
|
34 LOGS_QDEBUG( "logs [UI] -> LogsServiceHandler::LogsServiceHandler()" ) |
|
35 |
|
36 publishAll(); |
|
37 mIsAppStartedUsingService = XQServiceUtil::isService(); |
|
38 |
|
39 LOGS_QDEBUG_2( |
|
40 "logs [UI] <- LogsServiceHandler::LogsServiceHandler(), is service", |
|
41 mIsAppStartedUsingService ) |
|
42 } |
|
43 |
|
44 // ----------------------------------------------------------------------------- |
|
45 // LogsServiceHandler::~LogsServiceHandler |
|
46 // ----------------------------------------------------------------------------- |
|
47 // |
|
48 LogsServiceHandler::~LogsServiceHandler() |
|
49 { |
|
50 LOGS_QDEBUG( "logs [UI] <-> LogsServiceHandler::~LogsServiceHandler()" ) |
|
51 } |
|
52 |
|
53 // ----------------------------------------------------------------------------- |
|
54 // LogsServiceHandler::start |
|
55 // ----------------------------------------------------------------------------- |
|
56 // |
|
57 int LogsServiceHandler::start(int activatedView, bool showDialpad) |
|
58 { |
|
59 LOGS_QDEBUG_2( "logs [UI] -> LogsServiceHandler::start(), view:", activatedView ) |
|
60 |
|
61 if ( activatedView < LogsServices::ViewAll || |
|
62 activatedView > LogsServices::ViewMissed ){ |
|
63 LOGS_QDEBUG( "logs [UI] <- LogsServiceHandler::start(), incorrect view" ) |
|
64 return -1; |
|
65 } |
|
66 mIsAppStartedUsingService = true; |
|
67 mActivatedView = activatedView; |
|
68 |
|
69 LOGS_QDEBUG( "logs [UI] Bring app to foreground" ) |
|
70 mMainWindow.bringAppToForeground(); |
|
71 |
|
72 emit activateView((LogsServices::LogsView)mActivatedView, showDialpad); |
|
73 |
|
74 LOGS_QDEBUG( "logs [UI] <- LogsServiceHandler::start()" ) |
|
75 return 0; |
|
76 } |
|
77 |
|
78 // ----------------------------------------------------------------------------- |
|
79 // LogsServiceHandler::startWithNum |
|
80 // ----------------------------------------------------------------------------- |
|
81 // |
|
82 int LogsServiceHandler::startWithNum(int activatedView, bool showDialpad, QString dialpadText) |
|
83 { |
|
84 LOGS_QDEBUG_2( "logs [UI] -> LogsServiceHandler::startWithNum(), view:", activatedView ) |
|
85 |
|
86 Q_UNUSED(showDialpad); |
|
87 |
|
88 if ( activatedView < LogsServices::ViewAll || |
|
89 activatedView > LogsServices::ViewMissed ){ |
|
90 LOGS_QDEBUG( "logs [UI] <- LogsServiceHandler::startWithNum(), incorrect view" ) |
|
91 return -1; |
|
92 } |
|
93 mIsAppStartedUsingService = true; |
|
94 mActivatedView = activatedView; |
|
95 |
|
96 LOGS_QDEBUG( "logs [UI] Bring app to foreground" ) |
|
97 mMainWindow.bringAppToForeground(); |
|
98 |
|
99 emit activateView(dialpadText); |
|
100 |
|
101 LOGS_QDEBUG( "logs [UI] <- LogsServiceHandler::startWithNum()" ) |
|
102 return 0; |
|
103 } |
|
104 |
|
105 // ----------------------------------------------------------------------------- |
|
106 // LogsServiceHandler::currentlyActivatedView |
|
107 // ----------------------------------------------------------------------------- |
|
108 // |
|
109 LogsServices::LogsView LogsServiceHandler::currentlyActivatedView() |
|
110 { |
|
111 return (LogsServices::LogsView)mActivatedView; |
|
112 } |
|
113 |
|
114 // ----------------------------------------------------------------------------- |
|
115 // LogsServiceHandler::isStartedUsingService |
|
116 // ----------------------------------------------------------------------------- |
|
117 // |
|
118 bool LogsServiceHandler::isStartedUsingService() const |
|
119 { |
|
120 return mIsAppStartedUsingService; |
|
121 } |