15 * |
15 * |
16 */ |
16 */ |
17 |
17 |
18 #include "cntservicecontactselectionview.h" |
18 #include "cntservicecontactselectionview.h" |
19 |
19 |
|
20 #include <cntservicescontact.h> |
20 #include <QCoreApplication> |
21 #include <QCoreApplication> |
21 #include <QModelIndex> |
22 #include <QModelIndex> |
22 #include "cntservicehandler.h" |
|
23 #include <hblistview.h> |
23 #include <hblistview.h> |
24 #include <cntlistmodel.h> |
24 #include <cntlistmodel.h> |
25 |
25 |
26 CntServiceContactSelectionView::CntServiceContactSelectionView(CntServiceHandler *aServiceHandler): |
26 CntServiceContactSelectionView::CntServiceContactSelectionView( CntAbstractServiceProvider& aServiceProvider ): |
27 CntBaseSelectionView(), |
27 CntBaseSelectionView(), |
28 mServiceHandler(aServiceHandler) |
28 mProvider( aServiceProvider ) |
29 { |
29 { |
30 connect(mListView, SIGNAL(activated(const QModelIndex&)), this, SLOT(onListViewActivated(const QModelIndex&))); |
30 connect(mListView, SIGNAL(activated(const QModelIndex&)), this, SLOT(onListViewActivated(const QModelIndex&))); |
31 connect( this, SIGNAL(viewClosed()), this, SLOT(aboutToCloseView()) ); |
31 connect( this, SIGNAL(viewClosed()), this, SLOT(aboutToCloseView()) ); |
32 connect( this, SIGNAL(viewOpened(CntAbstractViewManager*, const CntViewParameters)), this, SLOT(aboutToOpenView(CntAbstractViewManager*, const CntViewParameters)) ); |
32 connect( this, SIGNAL(viewOpened(CntAbstractViewManager*, const CntViewParameters)), this, SLOT(aboutToOpenView(CntAbstractViewManager*, const CntViewParameters)) ); |
33 } |
33 } |
35 CntServiceContactSelectionView::~CntServiceContactSelectionView() |
35 CntServiceContactSelectionView::~CntServiceContactSelectionView() |
36 { |
36 { |
37 |
37 |
38 } |
38 } |
39 |
39 |
|
40 // An item in the selection list has been clicked |
40 void CntServiceContactSelectionView::onListViewActivated(const QModelIndex &aIndex) |
41 void CntServiceContactSelectionView::onListViewActivated(const QModelIndex &aIndex) |
41 { |
42 { |
42 QContact contact = mListModel->contact(aIndex); |
43 QContact contact = mListModel->contact(aIndex); |
43 contact.saveDetail(&mDetail); |
44 contact.saveDetail(&mDetail); |
44 |
45 |
50 mMgr->changeView(params); |
51 mMgr->changeView(params); |
51 } |
52 } |
52 |
53 |
53 void CntServiceContactSelectionView::aboutToCloseView() |
54 void CntServiceContactSelectionView::aboutToCloseView() |
54 { |
55 { |
55 connect(mServiceHandler, SIGNAL(returnValueDelivered()), qApp, SLOT(quit())); |
56 QVariant variant; |
56 mServiceHandler->completeEdit(0); |
57 variant.setValue(KCntServicesReturnValueContactNotModified); |
|
58 mProvider.CompleteServiceAndCloseApp(variant); |
|
59 CntViewParameters args; |
|
60 mMgr->back( args ); |
57 } |
61 } |
58 |
62 |
59 void CntServiceContactSelectionView::aboutToOpenView(CntAbstractViewManager* aMgr, const CntViewParameters viewParameters) |
63 void CntServiceContactSelectionView::aboutToOpenView(CntAbstractViewManager* aMgr, const CntViewParameters viewParameters) |
60 { |
64 { |
61 mMgr = aMgr; |
65 mMgr = aMgr; |