20 #include "cntfetchcontactpopup.h" |
20 #include "cntfetchcontactpopup.h" |
21 #include "cntextensionmanager.h" |
21 #include "cntextensionmanager.h" |
22 #include "cntglobal.h" |
22 #include "cntglobal.h" |
23 #include "cntdebug.h" |
23 #include "cntdebug.h" |
24 #include "cntapplication.h" |
24 #include "cntapplication.h" |
|
25 #include "cntfavourite.h" |
25 #include <cntabstractengine.h> |
26 #include <cntabstractengine.h> |
26 |
27 |
27 #include <cntuiextensionfactory.h> |
28 #include <cntuiextensionfactory.h> |
28 #include <cntuisocialextension.h> |
29 #include <cntuisocialextension.h> |
29 |
30 |
49 |
50 |
50 #include <QInputContext> |
51 #include <QInputContext> |
51 |
52 |
52 const char *CNT_CONTACTLIST_XML = ":/xml/contacts_namelist.docml"; |
53 const char *CNT_CONTACTLIST_XML = ":/xml/contacts_namelist.docml"; |
53 static const int CNT_MIN_ROW_COUNT = 2; |
54 static const int CNT_MIN_ROW_COUNT = 2; |
|
55 bool CntNamesViewPrivate::mIsFirstTimeUse = true; |
54 |
56 |
55 CntNamesViewPrivate::CntNamesViewPrivate() : |
57 CntNamesViewPrivate::CntNamesViewPrivate() : |
56 QObject(), |
58 QObject(), |
57 mViewManager(NULL), |
59 mViewManager(NULL), |
58 mListModel(NULL), |
60 mListModel(NULL), |
140 connect(win, SIGNAL(viewReady()), cntApp, SIGNAL(applicationReady())); |
140 connect(win, SIGNAL(viewReady()), cntApp, SIGNAL(applicationReady())); |
141 |
141 |
142 #ifdef __WINS__ |
142 #ifdef __WINS__ |
143 mView->menu()->addAction("Change Orientation", this, SLOT(switchOrientation()) ); |
143 mView->menu()->addAction("Change Orientation", this, SLOT(switchOrientation()) ); |
144 #endif |
144 #endif |
|
145 CNT_EXIT |
|
146 } |
|
147 |
|
148 void CntNamesViewPrivate::handleImportContacts( HbAction *aAction ) |
|
149 { |
|
150 CNT_ENTRY |
|
151 |
|
152 HbDialog *popup = static_cast<HbDialog*>(sender()); |
|
153 |
|
154 if (popup && aAction == popup->actions().first()) |
|
155 { |
|
156 CntViewParameters args; |
|
157 args.insert(EViewId, importsView); |
|
158 mViewManager->changeView(args); |
|
159 } |
|
160 |
145 CNT_EXIT |
161 CNT_EXIT |
146 } |
162 } |
147 |
163 |
148 void CntNamesViewPrivate::switchOrientation() |
164 void CntNamesViewPrivate::switchOrientation() |
149 { |
165 { |
232 if ( aArgs.value( EExtraAction ).toString() == CNT_FIND_ACTION ) |
248 if ( aArgs.value( EExtraAction ).toString() == CNT_FIND_ACTION ) |
233 { |
249 { |
234 showFinder(); |
250 showFinder(); |
235 } |
251 } |
236 |
252 |
|
253 if (mIsFirstTimeUse) |
|
254 { |
|
255 // Disable FTU flag |
|
256 mIsFirstTimeUse = false; |
|
257 |
|
258 // Show import contacts popup only if there no local contacts |
|
259 // Check row count from list model and exclude dummy mycard |
|
260 if (mListModel->rowCount()==1 && mListModel->myCardId()<= 0) |
|
261 { |
|
262 // Default filter to fetch all contacts and groups |
|
263 QContactFilter filter; |
|
264 QList<QContactLocalId> contactIds = contactManager->contactIds(filter); |
|
265 |
|
266 // Check if favourite group contact exists |
|
267 // Favourite group contact is created by default in phonebook |
|
268 int favouriteId = CntFavourite::favouriteGroupId(contactManager); |
|
269 if ( (contactIds.isEmpty() ) |
|
270 || (contactIds.count() == 1 && contactIds.at(0) == favouriteId) ) |
|
271 { |
|
272 HbMessageBox *note = new HbMessageBox(); |
|
273 note->setDismissPolicy(HbDialog::NoDismiss); |
|
274 note->setTimeout(HbPopup::NoTimeout); |
|
275 note->setBackgroundFaded(true); |
|
276 note->setAttribute(Qt::WA_DeleteOnClose, true); |
|
277 note->setStandardButtons(HbMessageBox::NoButton); |
|
278 note->addAction(new HbAction(hbTrId("txt_phob_button_import"), note)); |
|
279 note->addAction(new HbAction(hbTrId("txt_common_button_cancel"), note)); |
|
280 |
|
281 HbLabel *headingLabel = new HbLabel( note ); |
|
282 headingLabel->setPlainText(hbTrId("txt_phob_title_import_contacts")); |
|
283 note->setHeadingWidget(headingLabel); |
|
284 |
|
285 note->setIcon(HbIcon("qtg_large_sim")); |
|
286 note->setText(hbTrId("txt_phob_info_your_phonebook_is_empty_do_you_wish")); |
|
287 |
|
288 note->open(this, SLOT(handleImportContacts(HbAction*))); |
|
289 } |
|
290 } |
|
291 } |
|
292 |
237 CNT_EXIT |
293 CNT_EXIT |
238 } |
294 } |
239 |
295 |
240 void CntNamesViewPrivate::deactivate() |
296 void CntNamesViewPrivate::deactivate() |
241 { |
297 { |