|
1 /* |
|
2 * Copyright (c) 2008 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 <QGraphicsLinearLayout> |
|
19 #include <HbIconItem> |
|
20 #include "hsdialerwidget.h" |
|
21 #ifdef Q_OS_SYMBIAN |
|
22 #include <xqservicerequest.h> |
|
23 #include <XQSettingsManager> |
|
24 #include <xqpublishandsubscribeutils.h> |
|
25 #include <ctsydomainpskeys.h> |
|
26 #include <logsservices.h> |
|
27 #endif |
|
28 |
|
29 namespace |
|
30 { |
|
31 const char KDialerWidgetIcon[] = "qtg_graf_hs_dialer"; |
|
32 } |
|
33 |
|
34 /*! |
|
35 \class HsDialerWidget |
|
36 |
|
37 \ingroup group_hsdialerwidgetplugin |
|
38 \brief Implementation for the homescreen dialer launcher. |
|
39 |
|
40 */ |
|
41 |
|
42 /*! |
|
43 Constructs dialer widget with given \a parent and given window \a flags. |
|
44 */ |
|
45 HsDialerWidget::HsDialerWidget(QGraphicsItem *parent, Qt::WindowFlags flags) |
|
46 : HbWidget(parent, flags), |
|
47 mSetManager(0) |
|
48 { |
|
49 HbIconItem *iconItem = new HbIconItem; |
|
50 HbIcon icon(KDialerWidgetIcon); |
|
51 iconItem->setIcon(icon); |
|
52 |
|
53 QGraphicsLinearLayout *layout = new QGraphicsLinearLayout; |
|
54 layout->addItem(iconItem); |
|
55 setLayout(layout); |
|
56 |
|
57 setPreferredSize(icon.size()); |
|
58 resize(preferredSize()); |
|
59 } |
|
60 |
|
61 /*! |
|
62 Destructor. |
|
63 */ |
|
64 HsDialerWidget::~HsDialerWidget() |
|
65 { |
|
66 #ifdef Q_OS_SYMBIAN |
|
67 delete mSetManager; |
|
68 #endif |
|
69 } |
|
70 |
|
71 /*! |
|
72 \fn void HsDialerWidget::startDialer() |
|
73 |
|
74 Starts dialer widget via view activation service. |
|
75 */ |
|
76 void HsDialerWidget::startDialer() |
|
77 { |
|
78 #ifdef Q_OS_SYMBIAN |
|
79 const quint32 KKCTsyCallState = 0x00000001; |
|
80 const qint32 KKPSUidCtsyCallInformation = {0x102029AC}; |
|
81 if (!mSetManager) { |
|
82 mSetManager = new XQSettingsManager(); |
|
83 } |
|
84 |
|
85 XQPublishAndSubscribeSettingsKey callStateKey(KKPSUidCtsyCallInformation, KKCTsyCallState); |
|
86 int callState = mSetManager->readItemValue(callStateKey).toInt(); |
|
87 if( (callState != EPSCTsyCallStateNone ) && (callState != EPSCTsyCallStateUninitialized) ) { |
|
88 int dialer(1); |
|
89 |
|
90 // ToDo: should telephone + dialpad be opened when there is a waiting call? |
|
91 //if (callState == EPSCTsyCallStateRinging) { |
|
92 //dialer = 0; |
|
93 //} |
|
94 XQServiceRequest snd("com.nokia.services.telephony.uistarter", "start(int)", false); |
|
95 snd << dialer; |
|
96 QVariant retValue; |
|
97 snd.send(retValue); |
|
98 } |
|
99 else { |
|
100 XQServiceRequest snd("com.nokia.services.logsservices.starter", |
|
101 "start(int,bool)", false); |
|
102 snd << (int)LogsServices::ViewAll; |
|
103 snd << true; |
|
104 int retValue; |
|
105 snd.send(retValue); |
|
106 |
|
107 //LogsServices::start(LogsServices::ViewAll, true); |
|
108 } |
|
109 #endif |
|
110 } |
|
111 |
|
112 /*! |
|
113 \fn void HsDialerWidget::onShow() |
|
114 |
|
115 Shows the widget |
|
116 */ |
|
117 void HsDialerWidget::onShow() |
|
118 { |
|
119 } |
|
120 |
|
121 /*! |
|
122 \fn void HsDialerWidget::onHide() |
|
123 |
|
124 Hides the widget |
|
125 */ |
|
126 void HsDialerWidget::onHide() |
|
127 { |
|
128 } |
|
129 |
|
130 /*! |
|
131 \fn void HsDialerWidget::mouseReleaseEvent(QGraphicsSceneMouseEvent* event) |
|
132 |
|
133 Dialer widget start is triggered from release \a event. |
|
134 \sa startDialer() |
|
135 */ |
|
136 void HsDialerWidget::mouseReleaseEvent(QGraphicsSceneMouseEvent* event) |
|
137 { |
|
138 Q_UNUSED(event); |
|
139 startDialer(); |
|
140 } |