24 |
24 |
25 //SYSTEM |
25 //SYSTEM |
26 #include <QVariant> |
26 #include <QVariant> |
27 #include <xqservicerequest.h> |
27 #include <xqservicerequest.h> |
28 #include <xqrequestinfo.h> |
28 #include <xqrequestinfo.h> |
|
29 #include <hbnotificationdialog.h> |
29 |
30 |
30 // ----------------------------------------------------------------------------- |
31 // ----------------------------------------------------------------------------- |
31 // |
32 // |
32 // ----------------------------------------------------------------------------- |
33 // ----------------------------------------------------------------------------- |
33 // |
34 // |
34 LogsCall::LogsCall(LogsEvent& event) |
35 LogsCall::LogsCall(LogsEvent& event) |
35 : QObject(), mDefaultCall( TypeLogsCallNotAvailable ) |
36 : QObject(), mDefaultCall( TypeLogsCallNotAvailable ), mServiceId(0), mContactId(0) |
36 { |
37 { |
37 if ( event.logsEventData() ) { |
38 if ( event.logsEventData() ) { |
38 mServiceId = event.logsEventData()->serviceId(); |
39 mServiceId = event.logsEventData()->serviceId(); |
39 } |
40 } |
40 |
41 |
41 if (event.eventType() == LogsEvent::TypeVoIPCall ) { |
42 mNumber = event.getNumberForCalling(); |
|
43 bool communicationPossible = !mNumber.isEmpty(); |
|
44 if ( !communicationPossible ){ |
|
45 LOGS_QDEBUG( "logs [ENG] <-> LogsCall::LogsCall(), communication not possible" ) |
|
46 } else if (event.eventType() == LogsEvent::TypeVoIPCall ) { |
42 mCalls.append(LogsCall::TypeLogsVoIPCall); |
47 mCalls.append(LogsCall::TypeLogsVoIPCall); |
43 if ( event.logsEventData() && event.logsEventData()->isCsCompatible()){ |
48 if ( event.logsEventData() && event.logsEventData()->isCsCompatible()){ |
44 mCalls.append(LogsCall::TypeLogsVoiceCall); |
49 mCalls.append(LogsCall::TypeLogsVoiceCall); |
45 mCalls.append(LogsCall::TypeLogsVideoCall); |
50 mCalls.append(LogsCall::TypeLogsVideoCall); |
46 } |
51 } |
48 event.eventType() == LogsEvent::TypeVideoCall ) { |
53 event.eventType() == LogsEvent::TypeVideoCall ) { |
49 mCalls.append(LogsCall::TypeLogsVoiceCall); |
54 mCalls.append(LogsCall::TypeLogsVoiceCall); |
50 mCalls.append(LogsCall::TypeLogsVideoCall); |
55 mCalls.append(LogsCall::TypeLogsVideoCall); |
51 } |
56 } |
52 |
57 |
53 if (event.eventType() == LogsEvent::TypeVoiceCall){ |
58 if ( !communicationPossible ){ |
|
59 mDefaultCall = TypeLogsCallNotAvailable; |
|
60 } else if (event.eventType() == LogsEvent::TypeVoiceCall){ |
54 mDefaultCall = TypeLogsVoiceCall; |
61 mDefaultCall = TypeLogsVoiceCall; |
55 } else if (event.eventType() == LogsEvent::TypeVideoCall) { |
62 } else if (event.eventType() == LogsEvent::TypeVideoCall) { |
56 mDefaultCall = TypeLogsVideoCall; |
63 mDefaultCall = TypeLogsVideoCall; |
57 } else if (event.eventType() == LogsEvent::TypeVoIPCall) { |
64 } else if (event.eventType() == LogsEvent::TypeVoIPCall) { |
58 mDefaultCall = TypeLogsVoIPCall; |
65 mDefaultCall = TypeLogsVoIPCall; |
59 } |
66 } |
60 mNumber = event.getNumberForCalling(); |
67 |
61 } |
68 } |
62 |
69 |
63 // ----------------------------------------------------------------------------- |
70 // ----------------------------------------------------------------------------- |
64 // |
71 // |
65 // ----------------------------------------------------------------------------- |
72 // ----------------------------------------------------------------------------- |
66 // |
73 // |
67 LogsCall::LogsCall(unsigned int contactId, const QString& number) |
74 LogsCall::LogsCall(unsigned int contactId, const QString& number) |
68 : QObject(), mDefaultCall( TypeLogsCallNotAvailable ), mServiceId(0) |
75 : QObject(), mDefaultCall( TypeLogsCallNotAvailable ), mServiceId(0), mContactId(contactId) |
69 { |
76 { |
70 Q_UNUSED(contactId); |
77 Q_UNUSED(contactId); |
71 mNumber = number; |
78 mNumber = number; |
72 |
79 |
73 if ( mNumber.length() > 0 ) { |
80 if ( mNumber.length() > 0 ) { |
121 // ---------------------------------------------------------------------------- |
128 // ---------------------------------------------------------------------------- |
122 // |
129 // |
123 // ---------------------------------------------------------------------------- |
130 // ---------------------------------------------------------------------------- |
124 // |
131 // |
125 void LogsCall::callToNumber(LogsCall::CallType callType, const QString& number, |
132 void LogsCall::callToNumber(LogsCall::CallType callType, const QString& number, |
126 unsigned int serviceId) |
133 unsigned int serviceId, unsigned int contactId) |
127 { |
134 { |
128 LOGS_QDEBUG_2( "logs [ENG] -> LogsCall::callToNumber(), type", callType ) |
135 LOGS_QDEBUG_2( "logs [ENG] -> LogsCall::callToNumber(), type", callType ) |
|
136 QString service("phoneui.com.nokia.symbian.ICallDial"); |
129 |
137 |
130 if (callType == TypeLogsVoiceCall) { |
138 if ( number.isEmpty() || callType == TypeLogsCallNotAvailable ){ |
131 createcall("com.nokia.symbian.ICallDial", "dial(QString)", number, false); |
139 LOGS_QDEBUG( "logs [ENG] Calling not possible!" ) |
|
140 if ( contactId ){ |
|
141 HbNotificationDialog::launchDialog( |
|
142 hbTrId("txt_dial_dpopinfo_no_saved_number_for_this_contact")); |
|
143 } else { |
|
144 // Will fail but intention is to get error notification from phone |
|
145 createcall(service, "dial(QString)", number, false); |
|
146 } |
|
147 } else if (callType == TypeLogsVoiceCall) { |
|
148 createcall(service, "dial(QString)", number, false); |
132 } else if (callType == TypeLogsVideoCall) { |
149 } else if (callType == TypeLogsVideoCall) { |
133 createcall("com.nokia.symbian.ICallDial", "dialVideo(QString)", number, false); |
150 createcall(service, "dialVideo(QString)", number, false); |
134 } else if (callType == TypeLogsVoIPCall){ |
151 } else if (callType == TypeLogsVoIPCall){ |
135 if ( serviceId ){ |
152 if ( serviceId ){ |
136 |
153 |
137 // Service id should(?) be used with every call type. If logs entry |
154 // Service id should(?) be used with every call type. If logs entry |
138 // is from xsp with video call support, then the executed |
155 // is from xsp with video call support, then the executed |
139 // video call should be mapped to the right xsp? |
156 // video call should be mapped to the right xsp? |
140 // also contact must be passed if available if change service is |
157 // also contact must be passed if available if change service is |
141 // provided (no point change service and try to call service specific |
158 // provided (no point change service and try to call service specific |
142 // uri with another service)? |
159 // uri with another service)? |
143 createCallWithService("com.nokia.symbian.ICallDial", |
160 createCallWithService(service, |
144 "dialVoipService(QString,int)", number, false, serviceId); |
161 "dialVoipService(QString,int)", number, false, serviceId); |
145 } |
162 } |
146 else { |
163 else { |
147 // This is likely to fail as long as telephony does not |
164 // This is likely to fail as long as telephony does not |
148 // offer any kind of service selection. Normally voip call |
165 // offer any kind of service selection. Normally voip call |
149 // should always have service id set but if it's missing |
166 // should always have service id set but if it's missing |
150 // for some reason, then this provides call failure UI. |
167 // for some reason, then this provides call failure UI. |
151 createcall("com.nokia.symbian.ICallDial", |
168 createcall(service, "dialVoip(QString)", number, false); |
152 "dialVoip(QString)", number, false); |
|
153 } |
169 } |
154 } |
170 } |
155 LOGS_QDEBUG( "logs [ENG] <- LogsCall::callToNumber()" ) |
171 LOGS_QDEBUG( "logs [ENG] <- LogsCall::callToNumber()" ) |
156 } |
172 } |
157 |
173 |