|
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: |
|
15 * |
|
16 */ |
|
17 |
|
18 #include "cntservicesubeditview.h" |
|
19 |
|
20 #include "cntservicehandler.h" |
|
21 |
|
22 CntServiceSubEditView::CntServiceSubEditView(CntServiceHandler *aServiceHandler, CntViewManager *aViewManager, QGraphicsItem *aParent) : |
|
23 CntEditView(aViewManager, aParent), |
|
24 mServiceHandler(aServiceHandler) |
|
25 { |
|
26 |
|
27 } |
|
28 |
|
29 CntServiceSubEditView::~CntServiceSubEditView() |
|
30 { |
|
31 |
|
32 } |
|
33 |
|
34 /*! |
|
35 Saves the contact |
|
36 */ |
|
37 void CntServiceSubEditView::aboutToCloseView() |
|
38 { |
|
39 // save contact if there is one |
|
40 if (contact()) |
|
41 { |
|
42 contactManager()->saveContact(contact()); |
|
43 } |
|
44 |
|
45 CntViewParameters viewParameters(CntViewParameters::serviceContactCardView); |
|
46 viewParameters.setSelectedContact(*contact()); |
|
47 viewManager()->onActivateView(viewParameters); |
|
48 } |
|
49 |
|
50 /*! |
|
51 Cancel all changes made and return to comm launcher view |
|
52 */ |
|
53 void CntServiceSubEditView::discardAllChanges() |
|
54 { |
|
55 QContact oldContact = contactManager()->contact(contact()->localId()); |
|
56 CntViewParameters viewParameters(CntViewParameters::serviceContactCardView); |
|
57 viewParameters.setSelectedContact(oldContact); |
|
58 viewManager()->onActivateView(viewParameters); |
|
59 } |
|
60 |
|
61 /* |
|
62 Handle signals emitted from CntCommands, only used for delete command for now. |
|
63 */ |
|
64 int CntServiceSubEditView::handleExecutedCommand(QString aCommand, const QContact &aContact) |
|
65 { |
|
66 Q_UNUSED(aContact); |
|
67 int result = -1; |
|
68 if (aCommand == "delete") |
|
69 { |
|
70 connect(mServiceHandler, SIGNAL(returnValueDelivered()), qApp, SLOT(quit())); |
|
71 mServiceHandler->completeEdit(result); |
|
72 result = 0; |
|
73 } |
|
74 return result; |
|
75 } |
|
76 |
|
77 // EOF |