--- a/phonebookui/phonebookservices/src/cntserviceassigncontactcardview.cpp Tue Jul 06 14:05:47 2010 +0300
+++ b/phonebookui/phonebookservices/src/cntserviceassigncontactcardview.cpp Wed Aug 18 09:39:00 2010 +0300
@@ -16,7 +16,8 @@
*/
#include "cntserviceassigncontactcardview.h"
-#include "cntservicehandler.h"
+#include "cntabstractserviceprovider.h"
+#include "cntdebug.h"
#include <hbaction.h>
#include <hbdialog.h>
@@ -32,14 +33,15 @@
Constructor, initialize member variables.
\a viewManager is the parent that creates this view. \a parent is a pointer to parent QGraphicsItem (by default this is 0)
*/
-CntServiceAssignContactCardView::CntServiceAssignContactCardView(CntServiceHandler *aServiceHandler) :
- CntContactCardView(),
- mServiceHandler(aServiceHandler)
+CntServiceAssignContactCardView::CntServiceAssignContactCardView( CntAbstractServiceProvider& aServiceProvider ) :
+ CntContactCardView(true),
+ mProvider( aServiceProvider )
{
+ CNT_ENTRY
connect(this, SIGNAL(backPressed()), this, SLOT(doCloseView()));
- connect(this, SIGNAL(viewActivated(CntAbstractViewManager*, QContactDetail)), this, SLOT(doViewActivated(CntAbstractViewManager*,QContactDetail)));
-
- addActionsToToolBar();
+ connect(this, SIGNAL(viewActivated(CntAbstractViewManager*, const CntViewParameters)), this, SLOT(doViewActivated(CntAbstractViewManager*,const CntViewParameters)));
+ connect(this, SIGNAL(addToContacts()), this, SLOT(addToContacts()));
+ CNT_EXIT
}
/*!
@@ -47,17 +49,8 @@
*/
CntServiceAssignContactCardView::~CntServiceAssignContactCardView()
{
-
-}
-
-/*!
-Add actions to the toolbar
-*/
-void CntServiceAssignContactCardView::addActionsToToolBar()
-{
- view()->toolBar()->clearActions();
- HbAction* addToContact = view()->toolBar()->addAction("txt_phob_button_add_to_contacts");
- connect(addToContact, SIGNAL(triggered()), this, SLOT(addToContacts()));
+ CNT_ENTRY
+ CNT_EXIT
}
/*!
@@ -65,23 +58,44 @@
*/
void CntServiceAssignContactCardView::addToContacts()
{
- HbDialog *popup = new HbDialog();
+ CNT_ENTRY
+
+ HbDialog* popup = new HbDialog();
popup->setDismissPolicy(HbDialog::NoDismiss);
- popup->setHeadingWidget(new HbLabel(hbTrId("txt_phob_title_add_to_contacts"), popup));
+ popup->setHeadingWidget(
+ new HbLabel(hbTrId("txt_phob_title_add_to_contacts"), popup));
popup->setAttribute(Qt::WA_DeleteOnClose);
+ popup->setTimeout( HbPopup::NoTimeout );
+ popup->addAction(
+ new HbAction(hbTrId("txt_common_button_cancel"), popup));
- HbWidget *buttonWidget = new HbWidget(popup);
- QGraphicsLinearLayout *layout = new QGraphicsLinearLayout(Qt::Vertical);
- HbPushButton *addButton = new HbPushButton(hbTrId("txt_missing_list_save_as_a_new_contact"), buttonWidget);
+ HbWidget* buttonWidget = new HbWidget(popup);
+ QGraphicsLinearLayout* layout = new QGraphicsLinearLayout(Qt::Vertical);
+
+ HbPushButton* addButton = new HbPushButton(buttonWidget);
+ addButton->setStretched(true);
+ addButton->setText(hbTrId("txt_phob_button_save_as_a_new_contact"));
+ HbIcon plusIcon("qtg_mono_plus");
+ addButton->setIcon(plusIcon);
+ connect(addButton, SIGNAL(clicked()), popup, SLOT(close()));
connect(addButton, SIGNAL(clicked()), this, SLOT(saveNew()));
- HbPushButton *updateButton = new HbPushButton(hbTrId("txt_missing_list_update_existing_contact"), buttonWidget);
+
+ HbPushButton* updateButton = new HbPushButton(buttonWidget);
+ updateButton->setStretched(true);
+ updateButton->setText(hbTrId("txt_phob_button_update_existing_contact"));
+ updateButton->setIcon(plusIcon);
+ connect(updateButton, SIGNAL(clicked()), popup, SLOT(close()));
connect(updateButton, SIGNAL(clicked()), this, SLOT(updateExisting()));
+
layout->addItem(addButton);
layout->addItem(updateButton);
+
buttonWidget->setLayout(layout);
popup->setContentWidget(buttonWidget);
+
+ popup->open();
- popup->setSecondaryAction(new HbAction(hbTrId("txt_common_button_cancel"), popup));
+ CNT_EXIT
}
/*!
@@ -89,12 +103,16 @@
*/
void CntServiceAssignContactCardView::saveNew()
{
+ CNT_ENTRY
CntViewParameters viewParameters;
viewParameters.insert(EViewId, serviceEditView);
+ QContactName contactName = mContact.detail<QContactName>();
+ mContact.removeDetail(&contactName);
QVariant var;
var.setValue(mContact);
viewParameters.insert(ESelectedContact, var);
mViewManager->changeView(viewParameters);
+ CNT_EXIT
}
/*!
@@ -102,12 +120,14 @@
*/
void CntServiceAssignContactCardView::updateExisting()
{
+ CNT_ENTRY
CntViewParameters viewParameters;
viewParameters.insert(EViewId, serviceContactSelectionView);
QVariant var;
var.setValue(mDetail);
viewParameters.insert(ESelectedDetail, var);
mViewManager->changeView(viewParameters);
+ CNT_EXIT
}
/*!
@@ -115,9 +135,11 @@
*/
void CntServiceAssignContactCardView::doViewActivated(CntAbstractViewManager* aMgr, const CntViewParameters aArgs)
{
+ CNT_ENTRY
mViewManager = aMgr;
mContact = aArgs.value(ESelectedContact).value<QContact>();
mDetail = aArgs.value(ESelectedDetail).value<QContactDetail>();
+ CNT_EXIT
}
/*!
@@ -125,7 +147,9 @@
*/
void CntServiceAssignContactCardView::doCloseView()
{
+ CNT_ENTRY
qApp->quit();
+ CNT_EXIT
}
// end of file