|
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: This class offers contact viewing UI services. |
|
15 * |
|
16 */ |
|
17 |
|
18 #include "cntserviceproviderviewing.h" |
|
19 #include "cntservices.h" |
|
20 #include "cntservicestrings.h" |
|
21 #include "cntdebug.h" |
|
22 |
|
23 #include <qapplication.h> |
|
24 #include <QPixmap> |
|
25 #include <QFile> |
|
26 #include <QUrl> |
|
27 |
|
28 CntServiceProviderViewing::CntServiceProviderViewing(CntServices& aServices, QObject *parent): |
|
29 XQServiceProvider(QLatin1String(KCntServiceInterfaceView), parent), |
|
30 mServices(aServices), |
|
31 mCurrentRequestIndex(0) |
|
32 { |
|
33 CNT_ENTRY |
|
34 publishAll(); |
|
35 connect(this, SIGNAL(clientDisconnected()), &mServices, SLOT(quitApp())); |
|
36 CNT_EXIT |
|
37 } |
|
38 |
|
39 CntServiceProviderViewing::~CntServiceProviderViewing() |
|
40 { |
|
41 CNT_ENTRY |
|
42 CNT_EXIT |
|
43 } |
|
44 |
|
45 void CntServiceProviderViewing::openContactCard( int aContactId ) |
|
46 { |
|
47 CNT_ENTRY |
|
48 mCurrentRequestIndex = setCurrentRequestAsync(); |
|
49 mServices.setQuittable(requestInfo().isEmbedded()); |
|
50 mServices.launchContactCard( aContactId, *this ); |
|
51 CNT_EXIT |
|
52 } |
|
53 |
|
54 void CntServiceProviderViewing::openTemporaryContactCard( QString aFieldName, QString aFieldValue ) |
|
55 { |
|
56 CNT_ENTRY |
|
57 mCurrentRequestIndex = setCurrentRequestAsync(); |
|
58 mServices.setQuittable(requestInfo().isEmbedded()); |
|
59 mServices.launchTemporaryContactCard( aFieldName, aFieldValue, *this ); |
|
60 CNT_EXIT |
|
61 } |
|
62 |
|
63 void CntServiceProviderViewing::openGroup( int aContactId ) |
|
64 { |
|
65 CNT_ENTRY |
|
66 mCurrentRequestIndex = setCurrentRequestAsync(); |
|
67 mServices.setQuittable(requestInfo().isEmbedded()); |
|
68 mServices.launchGroupMemberView( aContactId, *this ); |
|
69 CNT_EXIT |
|
70 } |
|
71 |
|
72 void CntServiceProviderViewing::CompleteServiceAndCloseApp(const QVariant& retValue) |
|
73 { |
|
74 CNT_ENTRY |
|
75 connect(this, SIGNAL(returnValueDelivered()), qApp, SLOT(quit())); |
|
76 if ( mCurrentRequestIndex != 0 ) |
|
77 { |
|
78 const bool success = completeRequest(mCurrentRequestIndex, retValue); |
|
79 if ( !success ) |
|
80 { |
|
81 CNT_LOG_ARGS("Failed to complete highway request."); |
|
82 } |
|
83 mCurrentRequestIndex = 0; |
|
84 } |
|
85 CNT_EXIT |
|
86 } |