phonebookui/pbkcommonui/src/cntimportsview.cpp
changeset 59 a642906a277a
parent 47 7cbcb2896f0e
child 65 ae724a111993
--- a/phonebookui/pbkcommonui/src/cntimportsview.cpp	Tue Jul 06 14:05:47 2010 +0300
+++ b/phonebookui/pbkcommonui/src/cntimportsview.cpp	Wed Aug 18 09:39:00 2010 +0300
@@ -37,6 +37,8 @@
 #include <hbparameterlengthlimiter.h>
 #include <hblistviewitem.h>
 #include <hbstringutil.h>
+#include <QCoreApplication>
+#include <hbdevicenotificationdialog.h>
 
 const char *CNT_IMPORT_UI_XML = ":/xml/contacts_sim.docml";
 const int KTimerValue = 1; // used as 1 msec timer for saving ADN contacts from SIM   
@@ -59,7 +61,8 @@
     mAdnStoreEntries(0),
     mSdnStoreEntries(0),
     mSimError(0),
-    mWaitingForAdnCache(0)
+    mWaitingForAdnCache(0),
+    mImportInProgress(false)
 {
     bool ok = false;
     mDocumentLoader.load(CNT_IMPORT_UI_XML, &ok);
@@ -111,6 +114,7 @@
     Q_UNUSED(aArgs);
     //back button
     HbMainWindow* window = mView->mainWindow();
+          
     if (mView->navigationAction() != mSoftkey)
     {
         mView->setNavigationAction(mSoftkey);
@@ -168,7 +172,7 @@
                     mAdnStorePresent = true;
                     mAdnEntriesPresent = true;
                     mWaitingForAdnCache = true;
-                    connect(mAdnSimUtility, SIGNAL(adnCacheStatusReady(SimUtility::CacheStatus&, int)), this, SLOT(adnCacheStatusReady(SimUtility::CacheStatus&, int)));
+                    connect(mAdnSimUtility, SIGNAL(adnCacheStatusReady(CntSimUtility::CacheStatus&, int)), this, SLOT(adnCacheStatusReady(CntSimUtility::CacheStatus&, int)));
                     if (!mAdnSimUtility->notifyAdnCacheStatus()) {
                         mAdnStorePresent = false;
                         mAdnEntriesPresent = false;
@@ -290,6 +294,7 @@
     
     mListView->setModel(mModel);
     mListView->setSelectionMode(HbAbstractItemView::NoSelection);
+    connect(qApp, SIGNAL(aboutToQuit()), this, SLOT(endKeyPressed()));
 }
 
 void CntImportsView::simInfoErrorMessage(int infoError)
@@ -322,7 +327,9 @@
 
 bool CntImportsView::startSimImport()
 {
+
     bool started = false;
+    mImportInProgress = true;
 
     delete mFetchRequestADN;
     mContactSimManagerADN = mViewManager->contactManager(SIM_BACKEND_ADN);
@@ -370,6 +377,7 @@
 void CntImportsView::stopSimImport()
 {
     mImportSimPopup->close();
+    mImportInProgress = false;
     if (mFetchIsDone)
     {
         // indicates that timer has been started
@@ -422,6 +430,7 @@
             mListView->reset();
         }
     }
+   
 }
 
 void CntImportsView::importFetchResultReceivedADN()
@@ -584,6 +593,7 @@
         // no SDN contacts to fetch
         showSimImportResults();
         mImportSimPopup->close();
+        mImportInProgress = false;
         // Importing finished, go back to NamesView
         showPreviousView();
     }
@@ -602,6 +612,7 @@
         showSimImportResults();
         mSaveSimContactsListSDN.clear(); 
         mImportSimPopup->close();
+        mImportInProgress = false;
         // Importing finished, go back to NamesView
         showPreviousView();
     }
@@ -668,6 +679,7 @@
         showSimImportResults();
         mSaveSimContactsListSDN.clear(); 
         mImportSimPopup->close();
+        mImportInProgress = false;
         // Importing finished, go back to NamesView
         showPreviousView();
     }   
@@ -707,6 +719,7 @@
         {
             //dismiss wait note
             mImportSimPopup->close();
+            mImportInProgress = false;
             //and show error note
             simInfoErrorMessage(KErrAccessDenied);
         }
@@ -734,4 +747,14 @@
     }
 }
 
+void CntImportsView::endKeyPressed()
+{   
+    if(mImportInProgress && !mSimError)
+    {
+        QString results = hbTrId("txt_phob_dpophead_ln_contacts_imported").arg(mSaveCount).arg(mAdnStoreEntries + mSdnStoreEntries);
+        HbDeviceNotificationDialog::notification(QString(),results);
+    }    
+}
+
+
 // EOF