50
|
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),
|
61
|
31 |
mCurrentRequestIndex(0),
|
|
32 |
mAllowExit(true)
|
50
|
33 |
{
|
|
34 |
CNT_ENTRY
|
|
35 |
publishAll();
|
|
36 |
connect(this, SIGNAL(clientDisconnected()), &mServices, SLOT(quitApp()));
|
|
37 |
CNT_EXIT
|
|
38 |
}
|
|
39 |
|
|
40 |
CntServiceProviderViewing::~CntServiceProviderViewing()
|
|
41 |
{
|
|
42 |
CNT_ENTRY
|
|
43 |
CNT_EXIT
|
|
44 |
}
|
|
45 |
|
|
46 |
void CntServiceProviderViewing::openContactCard( int aContactId )
|
61
|
47 |
{
|
50
|
48 |
CNT_ENTRY
|
|
49 |
mCurrentRequestIndex = setCurrentRequestAsync();
|
53
|
50 |
mServices.setQuittable(requestInfo().isEmbedded());
|
50
|
51 |
mServices.launchContactCard( aContactId, *this );
|
|
52 |
CNT_EXIT
|
61
|
53 |
}
|
50
|
54 |
|
|
55 |
void CntServiceProviderViewing::openTemporaryContactCard( QString aFieldName, QString aFieldValue )
|
61
|
56 |
{
|
50
|
57 |
CNT_ENTRY
|
|
58 |
mCurrentRequestIndex = setCurrentRequestAsync();
|
53
|
59 |
mServices.setQuittable(requestInfo().isEmbedded());
|
50
|
60 |
mServices.launchTemporaryContactCard( aFieldName, aFieldValue, *this );
|
|
61 |
CNT_EXIT
|
61
|
62 |
}
|
50
|
63 |
|
54
|
64 |
void CntServiceProviderViewing::openGroup( int aContactId )
|
61
|
65 |
{
|
54
|
66 |
CNT_ENTRY
|
|
67 |
mCurrentRequestIndex = setCurrentRequestAsync();
|
61
|
68 |
mAllowExit = false;
|
54
|
69 |
mServices.setQuittable(requestInfo().isEmbedded());
|
|
70 |
mServices.launchGroupMemberView( aContactId, *this );
|
|
71 |
CNT_EXIT
|
61
|
72 |
}
|
54
|
73 |
|
50
|
74 |
void CntServiceProviderViewing::CompleteServiceAndCloseApp(const QVariant& retValue)
|
61
|
75 |
{
|
50
|
76 |
CNT_ENTRY
|
|
77 |
connect(this, SIGNAL(returnValueDelivered()), qApp, SLOT(quit()));
|
|
78 |
if ( mCurrentRequestIndex != 0 )
|
54
|
79 |
{
|
61
|
80 |
bool success = false;
|
|
81 |
|
|
82 |
if (!mOverriddenReturnValue.isNull() && retValue.value<int>() != KCntServicesReturnValueContactDeleted)
|
|
83 |
{
|
|
84 |
CNT_LOG_ARGS(mOverriddenReturnValue.value<int>());
|
|
85 |
success = completeRequest(mCurrentRequestIndex, mOverriddenReturnValue);
|
|
86 |
}
|
|
87 |
else
|
|
88 |
{
|
|
89 |
CNT_LOG_ARGS(retValue.value<int>());
|
|
90 |
success = completeRequest(mCurrentRequestIndex, retValue);
|
|
91 |
}
|
|
92 |
|
50
|
93 |
if ( !success )
|
|
94 |
{
|
|
95 |
CNT_LOG_ARGS("Failed to complete highway request.");
|
|
96 |
}
|
|
97 |
mCurrentRequestIndex = 0;
|
54
|
98 |
}
|
50
|
99 |
CNT_EXIT
|
61
|
100 |
}
|
|
101 |
|
|
102 |
void CntServiceProviderViewing::overrideReturnValue(const QVariant& retValue)
|
|
103 |
{
|
|
104 |
CNT_ENTRY
|
|
105 |
|
|
106 |
if (mOverriddenReturnValue.isNull() || mOverriddenReturnValue.value<int>() != KCntServicesReturnValueContactSaved)
|
|
107 |
{
|
|
108 |
mOverriddenReturnValue = retValue;
|
50
|
109 |
}
|
61
|
110 |
|
|
111 |
CNT_EXIT
|
|
112 |
}
|
|
113 |
|
|
114 |
bool CntServiceProviderViewing::allowSubViewsExit()
|
|
115 |
{
|
|
116 |
return mAllowExit;
|
|
117 |
}
|