iaupdate/IAD/ui/src/iaupdateautomaticcheck.cpp
changeset 42 d17dc5398051
parent 33 8110bf1194d1
child 77 d1838696558c
--- a/iaupdate/IAD/ui/src/iaupdateautomaticcheck.cpp	Thu May 27 12:58:35 2010 +0300
+++ b/iaupdate/IAD/ui/src/iaupdateautomaticcheck.cpp	Fri Jun 11 13:45:18 2010 +0300
@@ -24,10 +24,9 @@
 #include "iaupdatefirsttimeinfo.h"
 #include "iaupdate.hrh"
 #include "iaupdateprivatecrkeys.h"
+#include "iaupdatedialogutil.h"
 
-//#include <avkon.hrh>
 #include <centralrepository.h> 
-#include <hbmessagebox.h>
 #include <hbaction.h>
 
 
@@ -81,6 +80,10 @@
 //
 CIAUpdateAutomaticCheck::~CIAUpdateAutomaticCheck()
     {
+    if ( mDialogUtil )
+        {
+        delete mDialogUtil;
+        }
     }
 
 
@@ -89,9 +92,8 @@
 // 
 // ---------------------------------------------------------------------------
 //
-TBool CIAUpdateAutomaticCheck::AcceptAutomaticCheckL()
+void CIAUpdateAutomaticCheck::AcceptAutomaticCheckL()
     {
-    TBool acceptChecks = ETrue;
 	CIAUpdateFirstTimeInfo* firstTimeInfo = CIAUpdateFirstTimeInfo::NewLC();
 	if ( !firstTimeInfo->AutomaticUpdateChecksAskedL() )
 	    {
@@ -102,24 +104,21 @@
 	        }
 	    else
 	        {
-	        HbMessageBox messageBox(HbMessageBox::MessageTypeQuestion); 
-	        messageBox.setText(QString("Turn on setting for Automatic update checks?"));
-	        HbAction yesAction("Yes");
-	        HbAction noAction("No");
-	        messageBox.setPrimaryAction(&yesAction);
-	        messageBox.setSecondaryAction(&noAction);
-	        messageBox.setTimeout(HbPopup::NoTimeout);
-	        messageBox.show();
-	        //HbAction *selectedAction = messageBox.exec();
-	        firstTimeInfo->SetAutomaticUpdatesAskedL();
-	        //if ( selectedAction == messageBox.primaryAction() )
-	        //    {
-                //EnableAutoUpdateCheckL( ETrue ); // TEMP
-            //    }
-	        }
+	        if ( !mDialogUtil )
+	            {
+	        	mDialogUtil = new IAUpdateDialogUtil(NULL, this);
+	            }
+	        if ( mDialogUtil )
+	            {
+	            mPrimaryAction = NULL;
+	            mPrimaryAction = new HbAction("Yes");
+	            HbAction *secondaryAction = NULL;
+	            secondaryAction = new HbAction("No");
+	            mDialogUtil->showQuestion(QString("Turn on setting for Automatic update checks?"), mPrimaryAction, secondaryAction);
+	            }
+ 	        }
 	    }
 	CleanupStack::PopAndDestroy( firstTimeInfo ); 
-    return acceptChecks;
     }
 
 // ---------------------------------------------------------------------------
@@ -173,5 +172,19 @@
     CleanupStack::PopAndDestroy( cenrep );
     }
 
-    
+// ---------------------------------------------------------------------------
+// CIAUpdateAutomaticCheck::dialogFinished
+// 
+// ---------------------------------------------------------------------------
+//
+void CIAUpdateAutomaticCheck::dialogFinished(HbAction *action)
+    {
+    if ( action == mPrimaryAction )
+        {
+        EnableAutoUpdateCheckL( ETrue ); 
+        }
+    CIAUpdateFirstTimeInfo* firstTimeInfo = CIAUpdateFirstTimeInfo::NewLC();
+    firstTimeInfo->SetAutomaticUpdatesAskedL();
+    CleanupStack::PopAndDestroy( firstTimeInfo );
+    }
 // End of File