14 * Description: |
14 * Description: |
15 * |
15 * |
16 */ |
16 */ |
17 |
17 |
18 #include "cntserviceviewmanager.h" |
18 #include "cntserviceviewmanager.h" |
19 |
|
20 #include "cntservicehandler.h" |
|
21 |
|
22 #include "cntservicecontactfetchview.h" |
|
23 #include "cntservicecontactselectionview.h" |
|
24 #include "cntserviceeditview.h" |
|
25 #include "cntservicecontactcardview.h" |
|
26 #include "cntservicesubeditview.h" |
|
27 #include "cntserviceassigncontactcardview.h" |
|
28 #include "cntserviceviewfactory.h" |
19 #include "cntserviceviewfactory.h" |
29 |
20 |
30 #include <hbabstractitemview.h> |
|
31 /*! |
21 /*! |
32 Constructor |
22 Constructor |
33 */ |
23 */ |
34 CntServiceViewManager::CntServiceViewManager(HbMainWindow *mainWindow, CntServiceHandler *aHandler): |
24 CntServiceViewManager::CntServiceViewManager( HbMainWindow *mainWindow, |
35 CntDefaultViewManager(mainWindow), |
25 CntAbstractServiceProvider& aProvider ): |
36 mServiceHandler(aHandler) |
26 CntDefaultViewManager(mainWindow) |
37 { |
27 { |
38 |
28 // ownership of the factory is given to the base class. |
39 setViewFactory( new CntServiceViewFactory(mServiceHandler) ); |
29 setViewFactory( new CntServiceViewFactory( aProvider ) ); |
40 connect(mServiceHandler, SIGNAL(launchFetch(const QString&, const QString&, const QString&)), |
30 } |
41 this, SLOT(handleFetch(const QString&, const QString&, const QString&))); |
|
42 |
|
43 // Handles signal with mode selected. |
|
44 connect(mServiceHandler, SIGNAL(launchFetchVerified(const QString&, const QString&, const QString&, const QString&)), |
|
45 this, SLOT(launchFetch(const QString&, const QString&, const QString&, const QString&))); |
|
46 |
|
47 connect(mServiceHandler, SIGNAL(launchEditor(QContact)), this, SLOT(launchEditor(QContact))); |
|
48 connect(mServiceHandler, SIGNAL(launchContactSelection(QContactDetail)), this, SLOT(launchContactSelection(QContactDetail))); |
|
49 connect(mServiceHandler, SIGNAL(launchContactCard(QContact)), this, SLOT(launchContactCard(QContact))); |
|
50 connect(mServiceHandler, SIGNAL(launchAssignContactCard(QContact, QContactDetail)), this, |
|
51 SLOT(launchAssignContactCard(QContact, QContactDetail))); |
|
52 } |
|
53 |
31 |
54 /*! |
32 /*! |
55 Destructor |
33 Destructor |
56 */ |
34 */ |
57 CntServiceViewManager::~CntServiceViewManager() |
35 CntServiceViewManager::~CntServiceViewManager() |
59 /*Remove all views*/ |
37 /*Remove all views*/ |
60 } |
38 } |
61 |
39 |
62 void CntServiceViewManager::closeApp() |
40 void CntServiceViewManager::closeApp() |
63 { |
41 { |
64 // quit happens when returnValueDelivered signal is returned |
42 // Quit happens when returnValueDelivered signal from XQServiceProver |
65 // from service handler, see constructor. |
43 // is caught from service handler. |
66 } |
44 emit applicationClosed(); |
67 |
|
68 /*! |
|
69 Launch fetch service view. |
|
70 */ |
|
71 void CntServiceViewManager::handleFetch(const QString &title, const QString &action, const QString &filter) |
|
72 { |
|
73 launchFetch(title,action,filter); |
|
74 } |
|
75 |
|
76 /*! |
|
77 Launch fetch service view. Uses a mode to determine fetching type. |
|
78 */ |
|
79 void CntServiceViewManager::launchFetch(const QString &title, const QString &action, const QString &filter, const QString &mode) |
|
80 { |
|
81 CntViewParameters params; |
|
82 params.insert(EViewId, serviceContactFetchView); |
|
83 params.insert(CntServiceHandler::EAction, action); |
|
84 params.insert(CntServiceHandler::EFilter, filter); |
|
85 params.insert(CntServiceHandler::ETitle, title); |
|
86 |
|
87 if (!mode.compare(KCntSingleSelectionMode, Qt::CaseSensitive)) { |
|
88 params.insert(ESelectionMode, HbAbstractItemView::SingleSelection); |
|
89 } |
|
90 else { |
|
91 params.insert(ESelectionMode, HbAbstractItemView::MultiSelection); |
|
92 } |
|
93 changeView(params); |
|
94 } |
|
95 |
|
96 /*! |
|
97 Launch editor service view |
|
98 */ |
|
99 void CntServiceViewManager::launchEditor(QContact contact) |
|
100 { |
|
101 CntViewParameters params; |
|
102 params.insert(EViewId, serviceEditView); |
|
103 QVariant var; |
|
104 var.setValue(contact); |
|
105 params.insert(ESelectedContact, var); |
|
106 changeView(params); |
|
107 } |
|
108 |
|
109 /*! |
|
110 Launch contact selection service view (update existing contact with detail) |
|
111 */ |
|
112 void CntServiceViewManager::launchContactSelection(QContactDetail detail) |
|
113 { |
|
114 CntViewParameters params; |
|
115 params.insert(EViewId, serviceContactSelectionView); |
|
116 QVariant var; |
|
117 var.setValue(detail); |
|
118 params.insert(ESelectedDetail, var); |
|
119 changeView(params); |
|
120 } |
|
121 |
|
122 /*! |
|
123 Launch contact card service view |
|
124 */ |
|
125 void CntServiceViewManager::launchContactCard(QContact contact) |
|
126 { |
|
127 CntViewParameters params; |
|
128 params.insert(EViewId, serviceContactCardView); |
|
129 QVariant var; |
|
130 var.setValue(contact); |
|
131 params.insert(ESelectedContact, var); |
|
132 changeView(params); |
|
133 } |
|
134 |
|
135 /*! |
|
136 Launch assign (temporary) contact card service view |
|
137 */ |
|
138 void CntServiceViewManager::launchAssignContactCard(QContact contact, QContactDetail detail) |
|
139 { |
|
140 CntViewParameters params; |
|
141 params.insert(EViewId, serviceAssignContactCardView); |
|
142 QVariant var; |
|
143 var.setValue(contact); |
|
144 params.insert(ESelectedContact, var); |
|
145 QVariant varDetail; |
|
146 varDetail.setValue(detail); |
|
147 params.insert(ESelectedDetail, varDetail); |
|
148 changeView(params); |
|
149 } |
45 } |
150 |
46 |
151 // end of file |
47 // end of file |