37
|
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: dial service
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
#include <xqserviceutil.h>
|
|
19 |
#include <e32base.h>
|
|
20 |
#include <qregexp.h>
|
|
21 |
#include "dialservice.h"
|
|
22 |
#include "qtphonelog.h"
|
|
23 |
|
|
24 |
|
|
25 |
DialService::DialService(MPECallControlIF &call, MPECallSettersIF ¶meters, QObject* parent) :
|
|
26 |
XQServiceProvider(QLatin1String("com.nokia.symbian.ICallDial"), parent), m_call (call), m_parameters (parameters)
|
|
27 |
{
|
|
28 |
publishAll();
|
|
29 |
}
|
|
30 |
|
|
31 |
DialService::~DialService()
|
|
32 |
{
|
|
33 |
}
|
|
34 |
|
|
35 |
int DialService::dial(const QString& number)
|
|
36 |
{
|
|
37 |
PHONE_DEBUG2("DialService::dial number:", number);
|
|
38 |
QString simplifiedNumber = simplified(number);
|
|
39 |
TPtrC16 numberPtr(reinterpret_cast<const TUint16*>(simplifiedNumber.utf16()));
|
|
40 |
m_parameters.SetPhoneNumber (numberPtr);
|
|
41 |
m_parameters.SetCallTypeCommand (EPECallTypeCSVoice);
|
|
42 |
return m_call.HandleDialServiceCall ();
|
|
43 |
}
|
|
44 |
|
|
45 |
int DialService::dial(const QString& number, int contactId)
|
|
46 |
{
|
|
47 |
PHONE_DEBUG4("DialService::dial number:", number, "contactId:", contactId);
|
|
48 |
QString simplifiedNumber = simplified(number);
|
|
49 |
TPtrC16 numberPtr (reinterpret_cast<const TUint16*>(simplifiedNumber.utf16()));
|
|
50 |
m_parameters.SetPhoneNumber (numberPtr);
|
|
51 |
m_parameters.SetCallTypeCommand (EPECallTypeCSVoice);
|
|
52 |
m_parameters.SetContactId2 (contactId);
|
|
53 |
return m_call.HandleDialServiceCall ();
|
|
54 |
}
|
|
55 |
|
|
56 |
void DialService::dialVideo(const QString& number)
|
|
57 |
{
|
|
58 |
PHONE_DEBUG2("DialService::dialVideo number:", number);
|
|
59 |
QString simplifiedNumber = simplified(number);
|
|
60 |
TPtrC16 numberPtr(reinterpret_cast<const TUint16*>(simplifiedNumber.utf16()));
|
|
61 |
m_parameters.SetPhoneNumber (numberPtr);
|
|
62 |
m_parameters.SetCallTypeCommand (EPECallTypeVideo);
|
|
63 |
m_call.HandleDialServiceCall ();
|
|
64 |
}
|
|
65 |
|
|
66 |
void DialService::dialVideo(const QString& number, int contactId)
|
|
67 |
{
|
|
68 |
PHONE_DEBUG4("DialService::dialVideo number:", number, "contactId:", contactId);
|
|
69 |
QString simplifiedNumber = simplified(number);
|
|
70 |
TPtrC16 numberPtr (reinterpret_cast<const TUint16*>(simplifiedNumber.utf16()));
|
|
71 |
m_parameters.SetPhoneNumber (numberPtr);
|
|
72 |
m_parameters.SetCallTypeCommand (EPECallTypeVideo);
|
|
73 |
m_parameters.SetContactId2 (contactId);
|
|
74 |
m_call.HandleDialServiceCall ();
|
|
75 |
}
|
|
76 |
|
|
77 |
void DialService::dialVoip(const QString& address)
|
|
78 |
{
|
|
79 |
PHONE_DEBUG2("DialService::dialVoip number:", address);
|
|
80 |
TPtrC16 numberPtr(reinterpret_cast<const TUint16*>(address.utf16 ()));
|
|
81 |
m_parameters.SetPhoneNumber(numberPtr);
|
|
82 |
m_parameters.SetCallTypeCommand(EPECallTypeVoIP);
|
|
83 |
m_call.HandleDialServiceCall();
|
|
84 |
}
|
|
85 |
|
|
86 |
void DialService::dialVoip(const QString& address, int contactId)
|
|
87 |
{
|
|
88 |
PHONE_DEBUG4("DialService::dialVoip number:", address, "contactId:", contactId);
|
|
89 |
TPtrC16 numberPtr (reinterpret_cast<const TUint16*>(address.utf16 ()));
|
|
90 |
m_parameters.SetPhoneNumber(numberPtr);
|
|
91 |
m_parameters.SetCallTypeCommand(EPECallTypeVoIP);
|
|
92 |
m_parameters.SetContactId2(contactId);
|
|
93 |
m_call.HandleDialServiceCall();
|
|
94 |
}
|
|
95 |
|
|
96 |
void DialService::dialVoipService(const QString& address, int serviceId)
|
|
97 |
{
|
|
98 |
PHONE_DEBUG4("DialService::dialVoipService number:", address, "serviceId:", serviceId);
|
|
99 |
TPtrC16 numberPtr (reinterpret_cast<const TUint16*>(address.utf16 ()));
|
|
100 |
m_parameters.SetPhoneNumber(numberPtr);
|
|
101 |
m_parameters.SetCallTypeCommand(EPECallTypeVoIP);
|
|
102 |
m_parameters.SetServiceIdCommand(serviceId);
|
|
103 |
m_call.HandleDialServiceCall();
|
|
104 |
}
|
|
105 |
|
|
106 |
void DialService::dialVoipService(
|
|
107 |
const QString& address, int serviceId, int contactId)
|
|
108 |
{
|
|
109 |
PHONE_DEBUG2("DialService::dialVoipService number:", address);
|
|
110 |
PHONE_DEBUG2("DialService::dialVoipService serviceId:", serviceId);
|
|
111 |
PHONE_DEBUG2("DialService::dialVoipService contactId:", contactId);
|
|
112 |
TPtrC16 numberPtr (reinterpret_cast<const TUint16*>(address.utf16 ()));
|
|
113 |
m_parameters.SetPhoneNumber(numberPtr);
|
|
114 |
m_parameters.SetCallTypeCommand(EPECallTypeVoIP);
|
|
115 |
m_parameters.SetServiceIdCommand(serviceId);
|
|
116 |
m_parameters.SetContactId2(contactId);
|
|
117 |
m_call.HandleDialServiceCall();
|
|
118 |
}
|
|
119 |
|
|
120 |
QString DialService::simplified(const QString &number)
|
|
121 |
{
|
|
122 |
QString simplifiedNumber = number;
|
|
123 |
QRegExp rx(QString("[\\s,.\\[\\]\\(\\)\\-]"));
|
|
124 |
simplifiedNumber.remove(rx);
|
|
125 |
return simplifiedNumber;
|
|
126 |
}
|