30 |
31 |
31 /*! |
32 /*! |
32 Constructor, initialize member variables. |
33 Constructor, initialize member variables. |
33 \a viewManager is the parent that creates this view. \a parent is a pointer to parent QGraphicsItem (by default this is 0) |
34 \a viewManager is the parent that creates this view. \a parent is a pointer to parent QGraphicsItem (by default this is 0) |
34 */ |
35 */ |
35 CntServiceAssignContactCardView::CntServiceAssignContactCardView(CntServiceHandler *aServiceHandler) : |
36 CntServiceAssignContactCardView::CntServiceAssignContactCardView( CntAbstractServiceProvider& aServiceProvider ) : |
36 CntContactCardView(), |
37 CntContactCardView(), |
37 mServiceHandler(aServiceHandler) |
38 mProvider( aServiceProvider ) |
38 { |
39 { |
|
40 CNT_ENTRY |
39 connect(this, SIGNAL(backPressed()), this, SLOT(doCloseView())); |
41 connect(this, SIGNAL(backPressed()), this, SLOT(doCloseView())); |
40 connect(this, SIGNAL(viewActivated(CntAbstractViewManager*, QContactDetail)), this, SLOT(doViewActivated(CntAbstractViewManager*,QContactDetail))); |
42 connect(this, SIGNAL(viewActivated(CntAbstractViewManager*, QContactDetail)), this, SLOT(doViewActivated(CntAbstractViewManager*,QContactDetail))); |
41 |
43 |
42 addActionsToToolBar(); |
44 addActionsToToolBar(); |
|
45 CNT_EXIT |
43 } |
46 } |
44 |
47 |
45 /*! |
48 /*! |
46 Destructor |
49 Destructor |
47 */ |
50 */ |
48 CntServiceAssignContactCardView::~CntServiceAssignContactCardView() |
51 CntServiceAssignContactCardView::~CntServiceAssignContactCardView() |
49 { |
52 { |
50 |
53 CNT_ENTRY |
|
54 CNT_EXIT |
51 } |
55 } |
52 |
56 |
53 /*! |
57 /*! |
54 Add actions to the toolbar |
58 Add actions to the toolbar |
55 */ |
59 */ |
56 void CntServiceAssignContactCardView::addActionsToToolBar() |
60 void CntServiceAssignContactCardView::addActionsToToolBar() |
57 { |
61 { |
|
62 CNT_ENTRY |
58 view()->toolBar()->clearActions(); |
63 view()->toolBar()->clearActions(); |
59 HbAction* addToContact = view()->toolBar()->addAction("txt_phob_button_add_to_contacts"); |
64 HbAction* addToContact = view()->toolBar()->addAction("txt_phob_button_add_to_contacts"); |
60 connect(addToContact, SIGNAL(triggered()), this, SLOT(addToContacts())); |
65 connect(addToContact, SIGNAL(triggered()), this, SLOT(addToContacts())); |
|
66 CNT_EXIT |
61 } |
67 } |
62 |
68 |
63 /*! |
69 /*! |
64 Opens the Add to Contacts popup |
70 Opens the Add to Contacts popup |
65 */ |
71 */ |
66 void CntServiceAssignContactCardView::addToContacts() |
72 void CntServiceAssignContactCardView::addToContacts() |
67 { |
73 { |
|
74 CNT_ENTRY |
68 HbDialog *popup = new HbDialog(); |
75 HbDialog *popup = new HbDialog(); |
69 popup->setDismissPolicy(HbDialog::NoDismiss); |
76 popup->setDismissPolicy(HbDialog::NoDismiss); |
70 popup->setHeadingWidget(new HbLabel(hbTrId("txt_phob_title_add_to_contacts"), popup)); |
77 popup->setHeadingWidget(new HbLabel(hbTrId("txt_phob_title_add_to_contacts"), popup)); |
71 popup->setAttribute(Qt::WA_DeleteOnClose); |
78 popup->setAttribute(Qt::WA_DeleteOnClose); |
72 |
79 |
80 layout->addItem(updateButton); |
87 layout->addItem(updateButton); |
81 buttonWidget->setLayout(layout); |
88 buttonWidget->setLayout(layout); |
82 popup->setContentWidget(buttonWidget); |
89 popup->setContentWidget(buttonWidget); |
83 |
90 |
84 popup->setSecondaryAction(new HbAction(hbTrId("txt_common_button_cancel"), popup)); |
91 popup->setSecondaryAction(new HbAction(hbTrId("txt_common_button_cancel"), popup)); |
|
92 CNT_EXIT |
85 } |
93 } |
86 |
94 |
87 /*! |
95 /*! |
88 Create a new contact with the detail |
96 Create a new contact with the detail |
89 */ |
97 */ |
90 void CntServiceAssignContactCardView::saveNew() |
98 void CntServiceAssignContactCardView::saveNew() |
91 { |
99 { |
|
100 CNT_ENTRY |
92 CntViewParameters viewParameters; |
101 CntViewParameters viewParameters; |
93 viewParameters.insert(EViewId, serviceEditView); |
102 viewParameters.insert(EViewId, serviceEditView); |
94 QVariant var; |
103 QVariant var; |
95 var.setValue(mContact); |
104 var.setValue(mContact); |
96 viewParameters.insert(ESelectedContact, var); |
105 viewParameters.insert(ESelectedContact, var); |
97 mViewManager->changeView(viewParameters); |
106 mViewManager->changeView(viewParameters); |
|
107 CNT_EXIT |
98 } |
108 } |
99 |
109 |
100 /*! |
110 /*! |
101 Update an existing contact with the detail |
111 Update an existing contact with the detail |
102 */ |
112 */ |
103 void CntServiceAssignContactCardView::updateExisting() |
113 void CntServiceAssignContactCardView::updateExisting() |
104 { |
114 { |
|
115 CNT_ENTRY |
105 CntViewParameters viewParameters; |
116 CntViewParameters viewParameters; |
106 viewParameters.insert(EViewId, serviceContactSelectionView); |
117 viewParameters.insert(EViewId, serviceContactSelectionView); |
107 QVariant var; |
118 QVariant var; |
108 var.setValue(mDetail); |
119 var.setValue(mDetail); |
109 viewParameters.insert(ESelectedDetail, var); |
120 viewParameters.insert(ESelectedDetail, var); |
110 mViewManager->changeView(viewParameters); |
121 mViewManager->changeView(viewParameters); |
|
122 CNT_EXIT |
111 } |
123 } |
112 |
124 |
113 /*! |
125 /*! |
114 Called after the view has been activated |
126 Called after the view has been activated |
115 */ |
127 */ |
116 void CntServiceAssignContactCardView::doViewActivated(CntAbstractViewManager* aMgr, const CntViewParameters aArgs) |
128 void CntServiceAssignContactCardView::doViewActivated(CntAbstractViewManager* aMgr, const CntViewParameters aArgs) |
117 { |
129 { |
|
130 CNT_ENTRY |
118 mViewManager = aMgr; |
131 mViewManager = aMgr; |
119 mContact = aArgs.value(ESelectedContact).value<QContact>(); |
132 mContact = aArgs.value(ESelectedContact).value<QContact>(); |
120 mDetail = aArgs.value(ESelectedDetail).value<QContactDetail>(); |
133 mDetail = aArgs.value(ESelectedDetail).value<QContactDetail>(); |
|
134 CNT_EXIT |
121 } |
135 } |
122 |
136 |
123 /*! |
137 /*! |
124 Close the view (quits the service as well) |
138 Close the view (quits the service as well) |
125 */ |
139 */ |
126 void CntServiceAssignContactCardView::doCloseView() |
140 void CntServiceAssignContactCardView::doCloseView() |
127 { |
141 { |
|
142 CNT_ENTRY |
128 qApp->quit(); |
143 qApp->quit(); |
|
144 CNT_EXIT |
129 } |
145 } |
130 |
146 |
131 // end of file |
147 // end of file |