|
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 "cntserviceprovideredit.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 CntServiceProviderEdit::CntServiceProviderEdit(CntServices& aServices, QObject *parent): |
|
29 XQServiceProvider(QLatin1String(KCntServiceInterfaceEdit), 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 CntServiceProviderEdit::~CntServiceProviderEdit() |
|
40 { |
|
41 CNT_ENTRY |
|
42 CNT_EXIT |
|
43 } |
|
44 |
|
45 void CntServiceProviderEdit::editCreateNew(const QString& definitionName, const QString& value) |
|
46 { |
|
47 CNT_ENTRY |
|
48 mCurrentRequestIndex = setCurrentRequestAsync(); |
|
49 mServices.setQuitable(requestInfo().isEmbedded()); |
|
50 mServices.editCreateNew( definitionName, value, *this ); |
|
51 CNT_EXIT |
|
52 } |
|
53 |
|
54 void CntServiceProviderEdit::editCreateNewFromVCard(const QString &vCardFile) |
|
55 { |
|
56 CNT_ENTRY |
|
57 mCurrentRequestIndex = setCurrentRequestAsync(); |
|
58 mServices.setQuitable(requestInfo().isEmbedded()); |
|
59 mServices.editCreateNewFromVCard( vCardFile, *this ); |
|
60 CNT_EXIT |
|
61 } |
|
62 |
|
63 void CntServiceProviderEdit::editExisting(int contactId) |
|
64 { |
|
65 CNT_ENTRY |
|
66 mCurrentRequestIndex = setCurrentRequestAsync(); |
|
67 mServices.setQuitable(requestInfo().isEmbedded()); |
|
68 mServices.editExisting( contactId, *this ); |
|
69 CNT_EXIT |
|
70 } |
|
71 |
|
72 void CntServiceProviderEdit::editUpdateExisting(const QString &definitionName, const QString &value) |
|
73 { |
|
74 CNT_ENTRY |
|
75 mCurrentRequestIndex = setCurrentRequestAsync(); |
|
76 mServices.setQuitable(requestInfo().isEmbedded()); |
|
77 mServices.editUpdateExisting( definitionName, value, *this ); |
|
78 CNT_EXIT |
|
79 } |
|
80 |
|
81 |
|
82 void CntServiceProviderEdit::CompleteServiceAndCloseApp(const QVariant& retValue) |
|
83 { |
|
84 CNT_ENTRY |
|
85 connect(this, SIGNAL(returnValueDelivered()), qApp, SLOT(quit())); |
|
86 if ( mCurrentRequestIndex != 0 ) |
|
87 { |
|
88 const bool success = completeRequest(mCurrentRequestIndex, retValue); |
|
89 if ( !success ) |
|
90 { |
|
91 CNT_LOG_ARGS("Failed to complete highway request."); |
|
92 } |
|
93 mCurrentRequestIndex = 0; |
|
94 } |
|
95 CNT_EXIT |
|
96 } |