70 new HbAction(hbTrId("txt_common_button_cancel"), popup)); |
70 new HbAction(hbTrId("txt_common_button_cancel"), popup)); |
71 |
71 |
72 HbWidget* buttonWidget = new HbWidget(popup); |
72 HbWidget* buttonWidget = new HbWidget(popup); |
73 QGraphicsLinearLayout* layout = new QGraphicsLinearLayout(Qt::Vertical); |
73 QGraphicsLinearLayout* layout = new QGraphicsLinearLayout(Qt::Vertical); |
74 |
74 |
75 HbPushButton* addButton = new HbPushButton(buttonWidget); |
75 mAddButton = new HbPushButton(buttonWidget); |
76 addButton->setStretched(true); |
76 mAddButton->setStretched(true); |
77 addButton->setText(hbTrId("txt_phob_button_save_as_a_new_contact")); |
77 mAddButton->setText(hbTrId("txt_phob_button_save_as_a_new_contact")); |
78 HbIcon plusIcon("qtg_mono_plus"); |
78 HbIcon plusIcon("qtg_mono_plus"); |
79 addButton->setIcon(plusIcon); |
79 mAddButton->setIcon(plusIcon); |
80 connect(addButton, SIGNAL(clicked()), popup, SLOT(close())); |
80 connect(mAddButton, SIGNAL(released()), popup, SLOT(close())); |
81 connect(addButton, SIGNAL(clicked()), this, SLOT(saveNew())); |
81 connect(mAddButton, SIGNAL(released()), this, SLOT(saveNew())); |
82 connect(addButton, SIGNAL(longPress(QPointF)), popup, SLOT(close())); |
|
83 connect(addButton, SIGNAL(longPress(QPointF)), this, SLOT(saveNew())); |
|
84 |
82 |
85 HbPushButton* updateButton = new HbPushButton(buttonWidget); |
83 mUpdateButton = new HbPushButton(buttonWidget); |
86 updateButton->setStretched(true); |
84 mUpdateButton->setStretched(true); |
87 updateButton->setText(hbTrId("txt_phob_button_update_existing_contact")); |
85 mUpdateButton->setText(hbTrId("txt_phob_button_update_existing_contact")); |
88 updateButton->setIcon(plusIcon); |
86 mUpdateButton->setIcon(plusIcon); |
89 connect(updateButton, SIGNAL(clicked()), popup, SLOT(close())); |
87 connect(mUpdateButton, SIGNAL(released()), popup, SLOT(close())); |
90 connect(updateButton, SIGNAL(clicked()), this, SLOT(updateExisting())); |
88 connect(mUpdateButton, SIGNAL(released()), this, SLOT(updateExisting())); |
91 connect(updateButton, SIGNAL(longPress(QPointF)), popup, SLOT(close())); |
|
92 connect(updateButton, SIGNAL(longPress(QPointF)), this, SLOT(updateExisting())); |
|
93 |
89 |
94 |
90 layout->addItem(mAddButton); |
95 layout->addItem(addButton); |
91 layout->addItem(mUpdateButton); |
96 layout->addItem(updateButton); |
|
97 |
92 |
98 buttonWidget->setLayout(layout); |
93 buttonWidget->setLayout(layout); |
99 popup->setContentWidget(buttonWidget); |
94 popup->setContentWidget(buttonWidget); |
100 |
95 |
101 popup->open(); |
96 popup->open(); |
107 Create a new contact with the detail |
102 Create a new contact with the detail |
108 */ |
103 */ |
109 void CntServiceAssignContactCardView::saveNew() |
104 void CntServiceAssignContactCardView::saveNew() |
110 { |
105 { |
111 CNT_ENTRY |
106 CNT_ENTRY |
112 CntViewParameters viewParameters; |
107 if(mAddButton->isUnderMouse()) |
113 viewParameters.insert(EViewId, serviceEditView); |
108 { |
114 QContactName contactName = mContact.detail<QContactName>(); |
109 CntViewParameters viewParameters; |
115 mContact.removeDetail(&contactName); |
110 viewParameters.insert(EViewId, serviceEditView); |
116 QVariant var; |
111 QContactName contactName = mContact.detail<QContactName>(); |
117 var.setValue(mContact); |
112 mContact.removeDetail(&contactName); |
118 viewParameters.insert(ESelectedContact, var); |
113 QVariant var; |
119 mViewManager->changeView(viewParameters); |
114 var.setValue(mContact); |
|
115 viewParameters.insert(ESelectedContact, var); |
|
116 mViewManager->changeView(viewParameters); |
|
117 } |
120 CNT_EXIT |
118 CNT_EXIT |
121 } |
119 } |
122 |
120 |
123 /*! |
121 /*! |
124 Update an existing contact with the detail |
122 Update an existing contact with the detail |
125 */ |
123 */ |
126 void CntServiceAssignContactCardView::updateExisting() |
124 void CntServiceAssignContactCardView::updateExisting() |
127 { |
125 { |
128 CNT_ENTRY |
126 CNT_ENTRY |
129 CntViewParameters viewParameters; |
127 if(mUpdateButton->isUnderMouse()) |
130 viewParameters.insert(EViewId, serviceContactSelectionView); |
128 { |
131 QVariant var; |
129 CntViewParameters viewParameters; |
132 var.setValue(mDetail); |
130 viewParameters.insert(EViewId, serviceContactSelectionView); |
133 viewParameters.insert(ESelectedDetail, var); |
131 QVariant var; |
134 mViewManager->changeView(viewParameters); |
132 var.setValue(mDetail); |
|
133 viewParameters.insert(ESelectedDetail, var); |
|
134 mViewManager->changeView(viewParameters); |
|
135 } |
135 CNT_EXIT |
136 CNT_EXIT |
136 } |
137 } |
137 |
138 |
138 /*! |
139 /*! |
139 Called after the view has been activated |
140 Called after the view has been activated |