107 } |
109 } |
108 |
110 |
109 /* |
111 /* |
110 Activates a default view |
112 Activates a default view |
111 */ |
113 */ |
112 void CntImportsView::activate(CntAbstractViewManager* aMgr, const CntViewParameters aArgs) |
114 void CntImportsView::activate(const CntViewParameters aArgs) |
113 { |
115 { |
114 Q_UNUSED(aArgs); |
116 Q_UNUSED(aArgs); |
115 //back button |
117 //back button |
116 HbMainWindow* window = mView->mainWindow(); |
|
117 |
118 |
118 if (mView->navigationAction() != mSoftkey) |
119 if (mView->navigationAction() != mSoftkey) |
119 { |
120 { |
120 mView->setNavigationAction(mSoftkey); |
121 mView->setNavigationAction(mSoftkey); |
121 } |
122 } |
122 |
123 |
123 mViewManager = aMgr; |
124 mViewManager = &mEngine->viewManager(); |
124 mContactSymbianManager = mViewManager->contactManager(SYMBIAN_BACKEND); |
125 mContactSymbianManager = &mEngine->contactManager(SYMBIAN_BACKEND); |
125 |
126 |
126 // Sim Utility info fetch |
127 // Sim Utility info fetch |
127 int getSimInfoError(0); |
128 int getSimInfoError(0); |
128 int storesError(0); |
129 int storesError(0); |
129 int getSdnSimInfoError(0); |
130 int getSdnSimInfoError(0); |
189 |
190 |
190 //SDN store |
191 //SDN store |
191 if (mSdnStorePresent && !mWaitingForAdnCache) |
192 if (mSdnStorePresent && !mWaitingForAdnCache) |
192 { |
193 { |
193 int sdnError = -1; |
194 int sdnError = -1; |
194 mSdnSimUtility = new CntSimUtility(CntSimUtility::SdnStore, sdnError); |
195 mSdnStorePresent = false; |
195 if (sdnError != 0) |
196 if (!mSdnSimUtility) |
196 { |
197 { |
197 delete mSdnSimUtility; |
198 mSdnSimUtility = new CntSimUtility(CntSimUtility::SdnStore, sdnError); |
198 mSdnSimUtility = 0; |
199 if (sdnError != 0) |
199 } |
200 { |
200 else |
201 delete mSdnSimUtility; |
|
202 mSdnSimUtility = 0; |
|
203 } |
|
204 } |
|
205 if (mSdnSimUtility) |
201 { |
206 { |
202 //get number of SDN contacts |
207 //get number of SDN contacts |
203 CntSimUtility::SimInfo sdnSimInfo = mSdnSimUtility->getSimInfo(getSdnSimInfoError); |
208 CntSimUtility::SimInfo sdnSimInfo = mSdnSimUtility->getSimInfo(getSdnSimInfoError); |
204 if (!getSdnSimInfoError) |
209 if (!getSdnSimInfoError) |
205 { |
210 { |
206 // sim entries are present |
211 // sim entries are present |
207 mSdnStoreEntries = sdnSimInfo.usedEntries; |
212 mSdnStoreEntries = sdnSimInfo.usedEntries; |
|
213 if (mSdnStoreEntries > 0) { |
|
214 mSdnStorePresent = true; |
|
215 } |
208 } |
216 } |
209 } |
217 } |
210 } |
218 } |
211 // end SDN store |
219 // end SDN store |
212 |
|
213 |
|
214 |
220 |
215 mListView = static_cast<HbListView*>(mDocumentLoader.findWidget(QString("listView"))); |
221 mListView = static_cast<HbListView*>(mDocumentLoader.findWidget(QString("listView"))); |
216 |
222 |
217 HbFrameBackground frame; |
223 HbFrameBackground frame; |
218 frame.setFrameGraphicsName("qtg_fr_list_normal"); |
224 frame.setFrameGraphicsName("qtg_fr_list_normal"); |
330 |
336 |
331 bool started = false; |
337 bool started = false; |
332 mImportInProgress = true; |
338 mImportInProgress = true; |
333 |
339 |
334 delete mFetchRequestADN; |
340 delete mFetchRequestADN; |
335 mContactSimManagerADN = mViewManager->contactManager(SIM_BACKEND_ADN); |
341 mContactSimManagerADN = &mEngine->contactManager(SIM_BACKEND_ADN); |
336 mFetchRequestADN = new QContactFetchRequest; |
342 mFetchRequestADN = new QContactFetchRequest; |
337 mFetchRequestADN->setManager(mContactSimManagerADN); |
343 mFetchRequestADN->setManager(mContactSimManagerADN); |
338 |
344 |
339 delete mFetchRequestSDN; |
345 delete mFetchRequestSDN; |
340 mContactSimManagerSDN = mViewManager->contactManager(SIM_BACKEND_SDN); |
346 mContactSimManagerSDN = &mEngine->contactManager(SIM_BACKEND_SDN); |
341 mFetchRequestSDN = new QContactFetchRequest; |
347 mFetchRequestSDN = new QContactFetchRequest; |
342 mFetchRequestSDN->setManager(mContactSimManagerSDN); |
348 mFetchRequestSDN->setManager(mContactSimManagerSDN); |
343 |
349 |
344 if (mWaitingForAdnCache) |
350 if (mWaitingForAdnCache) |
345 { |
351 { |
691 //update ADN store info... |
697 //update ADN store info... |
692 if (error != 0 || cacheStatus == CntSimUtility::ECacheFailed) |
698 if (error != 0 || cacheStatus == CntSimUtility::ECacheFailed) |
693 { |
699 { |
694 mAdnStorePresent = false; |
700 mAdnStorePresent = false; |
695 mAdnEntriesPresent = false; |
701 mAdnEntriesPresent = false; |
|
702 mSdnStorePresent = false; |
696 } |
703 } |
697 else |
704 else |
698 { |
705 { |
699 //check if there are ADN contacts |
706 //check if there are ADN contacts |
700 mAdnStorePresent = true; |
707 mAdnStorePresent = true; |
708 if (mAdnStoreEntries > 0) |
715 if (mAdnStoreEntries > 0) |
709 { |
716 { |
710 mAdnEntriesPresent = true; |
717 mAdnEntriesPresent = true; |
711 } |
718 } |
712 } |
719 } |
713 } |
720 |
714 |
721 //get number of SDN contacts |
715 //and start SIM contacts import, if user tapped "SIM import" |
722 int sdnError = -1; |
|
723 mSdnStorePresent = false; |
|
724 if (!mSdnSimUtility) |
|
725 { |
|
726 mSdnSimUtility = new CntSimUtility(CntSimUtility::SdnStore, sdnError); |
|
727 if (sdnError != 0) |
|
728 { |
|
729 delete mSdnSimUtility; |
|
730 mSdnSimUtility = 0; |
|
731 } |
|
732 } |
|
733 if (mSdnSimUtility) |
|
734 { |
|
735 int getSdnSimInfoError = 0; |
|
736 CntSimUtility::SimInfo sdnSimInfo = mSdnSimUtility->getSimInfo(getSdnSimInfoError); |
|
737 if (!getSdnSimInfoError) |
|
738 { |
|
739 mSdnStoreEntries = sdnSimInfo.usedEntries; |
|
740 if (mSdnStoreEntries > 0) |
|
741 { |
|
742 mSdnStorePresent = true; |
|
743 } |
|
744 } |
|
745 } |
|
746 } |
|
747 |
|
748 //dismiss progress dialog, if there are no SIM contacts |
|
749 if(mImportSimPopup != NULL && mImportSimPopup->isActive() && |
|
750 !mAdnEntriesPresent && !mSdnStorePresent) |
|
751 { |
|
752 mImportSimPopup->close(); |
|
753 showSimImportResults(); |
|
754 } |
|
755 |
|
756 //disable sim import item, if there are no SIM contacts |
|
757 if(!mAdnEntriesPresent && !mSdnStorePresent && mModel) |
|
758 { |
|
759 QList<QStandardItem*> importSimItems = mModel->takeRow(0); |
|
760 QStandardItem* importSimItem = 0; |
|
761 if (importSimItems.count() > 0) |
|
762 { |
|
763 importSimItem = importSimItems.at(0); |
|
764 } |
|
765 |
|
766 if (importSimItem != 0) |
|
767 { |
|
768 QStringList simList; |
|
769 QString simImport(hbTrId("txt_phob_dblist_import_from_sim")); |
|
770 simList << simImport; |
|
771 QString simNoContacts(hbTrId("txt_phob_dblist_import_from_1_val_no_sim_contacts")); |
|
772 simList << simNoContacts; |
|
773 |
|
774 importSimItem->setData(simList, Qt::DisplayRole); |
|
775 importSimItem->setData(HbIcon("qtg_large_sim"), Qt::DecorationRole); |
|
776 importSimItem->setEnabled(false); |
|
777 mModel->insertRow(0, importSimItem); |
|
778 mListView->reset(); |
|
779 } |
|
780 } |
|
781 |
|
782 //start SIM contacts import, if user tapped "SIM import" |
716 if(mImportSimPopup != NULL && mImportSimPopup->isActive()) |
783 if(mImportSimPopup != NULL && mImportSimPopup->isActive()) |
717 { |
784 { |
718 if (!startSimImport()) |
785 if (!startSimImport()) |
719 { |
786 { |
720 //dismiss wait note |
787 //dismiss wait note |