iaupdate/IAD/ui/src/iaupdatedialogutil.cpp
branchRCL_3
changeset 66 8b7f4e561641
parent 65 7333d7932ef7
--- a/iaupdate/IAD/ui/src/iaupdatedialogutil.cpp	Tue Aug 31 15:21:33 2010 +0300
+++ b/iaupdate/IAD/ui/src/iaupdatedialogutil.cpp	Wed Sep 01 12:22:02 2010 +0100
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies).
 * All rights reserved.
 * This component and the accompanying materials are made available
 * under the terms of "Eclipse Public License v1.0"
@@ -11,114 +11,147 @@
 *
 * Contributors:
 *
-* Description:   This module contains the implementation of IAUpdateDialogUtil class 
-*                member functions.
+* Description:    
 *
 */
-#include <hblabel.h>
-#include <hbmessagebox.h>
-
-#include "iaupdatedialogutil.h"
-#include "iaupdatedialogobserver.h"
-#include "iaupdatedebug.h"
 
 
 
-IAUpdateDialogUtil::IAUpdateDialogUtil(QObject *parent, IAUpdateDialogObserver *observer)
-: QObject(parent),
-  mObserver(observer)
-{
-    IAUPDATE_TRACE("[IAUPDATE] IAUpdateDialogUtil::IAUpdateDialogUtil()");
-}
+// INCLUDE FILES
+
+#include "iaupdatedialogutil.h"
+#include "iaupdatedebug.h"
+#include <iaupdate.rsg>
 
-IAUpdateDialogUtil::~IAUpdateDialogUtil()
-{
-    IAUPDATE_TRACE("[IAUPDATE] IAUpdateDialogUtil::~IAUpdateDialogUtil()");
-}
+#include <aknmessagequerydialog.h>      // CAknMessageQueryDialog
+#include <aknnotewrappers.h>    // CAknInformationNote
+#include <StringLoader.h>
+
+
+/*******************************************************************************
+ * class TIAUpdateDialogParam
+ *******************************************************************************/
 
 
-void IAUpdateDialogUtil::showInformation(const QString &text, HbAction *primaryAction)
-{    
-    HbMessageBox *messageBox = new HbMessageBox(HbMessageBox::MessageTypeInformation); 
-    messageBox->setText(text);
-    int actionCount = messageBox->actions().count();
-    for (int i=actionCount-1; i >= 0; i--)
-    { 
-        messageBox->removeAction(messageBox->actions().at(i));
+// -------------------------------------------------------------------------------
+// TIAUpdateDialogParam::TIAUpdateDialogParam
+//
+// -------------------------------------------------------------------------------
+//
+TIAUpdateDialogParam::TIAUpdateDialogParam()
+ : iCountSuccessfull( KErrNotFound ), iCountCancelled( KErrNotFound ),
+   iCountFailed( KErrNotFound ), iResourceId( KErrNotFound ), iNode( NULL ), 
+   iLinkObserver( NULL )
+    {
     }
-    if (primaryAction)
-    {    
-        messageBox->addAction(primaryAction);
-    }  
-    messageBox->setTimeout(HbPopup::NoTimeout); 
-    messageBox->setAttribute(Qt::WA_DeleteOnClose);
-    messageBox->open(this,SLOT(finished(HbAction*)));
-}
+
+
+/*******************************************************************************
+ * class IAUpdateDialogUtil
+ *******************************************************************************/
+
+
+//------------------------------------------------------------------------------
+// IAUpdateDialogUtil::ShowMessageQueryL
+//
+//------------------------------------------------------------------------------
+//
+void IAUpdateDialogUtil::ShowMessageQueryL(const TDesC& aTitle, const TDesC& aText)
+	{
+	TPtrC ptr = aText;
+	CAknMessageQueryDialog* query = CAknMessageQueryDialog::NewL( ptr );
+	query->PrepareLC( R_IAUPDATE_MESSAGE_QUERY );
+
+	if ( aTitle.Length() != 0 )
+		{
+		CAknPopupHeadingPane* headingPane = query->Heading();
+		headingPane->SetTextL( aTitle );
+		}
+	query->RunLD();
+	}
 
 
-void IAUpdateDialogUtil::showQuestion(const QString &text, HbAction *primaryAction, HbAction *secondaryAction)
-{
-    HbMessageBox *messageBox = new HbMessageBox(HbMessageBox::MessageTypeQuestion); 
-    messageBox->setIconVisible(false);
-    messageBox->setText(text);
-    int actionCount = messageBox->actions().count();
-    for (int i=actionCount-1; i >= 0; i--)
-    { 
-        messageBox->removeAction(messageBox->actions().at(i));
-    }
-    if (primaryAction)
-    {    
-        messageBox->addAction(primaryAction);
-    }
-    if (secondaryAction)
-    {    
-        messageBox->addAction(secondaryAction);
-    } 
-    messageBox->setTimeout(HbPopup::NoTimeout); 
-    messageBox->setAttribute(Qt::WA_DeleteOnClose);
-    messageBox->open(this,SLOT(finished(HbAction*)));
-}
+//------------------------------------------------------------------------------
+// IAUpdateDialogUtil::ShowMessageQueryL
+//
+//------------------------------------------------------------------------------
+//
+void IAUpdateDialogUtil::ShowMessageQueryL( const TDesC& aTitle, TInt aResource )
+	{
+	HBufC* hBuf = StringLoader::LoadLC( aResource );
+	ShowMessageQueryL( aTitle, hBuf->Des() );
+	CleanupStack::PopAndDestroy( hBuf );
+	}
+
+
+//------------------------------------------------------------------------------
+// IAUpdateDialogUtil::ShowInformationQueryL
+//
+//------------------------------------------------------------------------------
+//
+void IAUpdateDialogUtil::ShowInformationQueryL(const TDesC& aText)
+	{
+	CAknQueryDialog* queryDialog = new (ELeave) CAknQueryDialog;
+	queryDialog->ExecuteLD(R_IAUPDATE_INFORMATION_QUERY, aText);
+	}
 
 
-void IAUpdateDialogUtil::showAgreement(HbAction *primaryAction, HbAction *secondaryAction)
-{
-    HbMessageBox *agreementDialog = new HbMessageBox(HbMessageBox::MessageTypeQuestion); 
-    HbLabel *label = new HbLabel(agreementDialog);
-    label->setHtml(QString("Disclaimer"));
-    agreementDialog->setHeadingWidget(label);
-    agreementDialog->setIconVisible(false);
-    agreementDialog->setText("This application allows you to download and use applications and services provided by Nokia or third parties. Service Terms and Privacy Policy will apply. Nokia will not assume any liability or responsibility for the availability or third party applications or services. Before using the third party application or service, read the applicable terms of use.<br /><br />Use of this application involves transmission of data. Contact your network service provider for information about data transmission charges.<br /><br />(c) 2007-2010 Nokia. All rights reserved.");
+//------------------------------------------------------------------------------
+// IAUpdateDialogUtil::ShowInformationQueryL
+//
+//------------------------------------------------------------------------------
+//
+void IAUpdateDialogUtil::ShowInformationQueryL(TInt aResource)
+	{
+	HBufC* hBuf = StringLoader::LoadLC(aResource);
+	ShowInformationQueryL( hBuf->Des() );
+	CleanupStack::PopAndDestroy( hBuf );
+	}
 
-    int actionCount = agreementDialog->actions().count();
-    for (int i=actionCount-1; i >= 0; i--)
-    { 
-        agreementDialog->removeAction(agreementDialog->actions().at(i));
-    }
-    if (primaryAction)
-    {    
-        agreementDialog->addAction(primaryAction);
-    }    
-    if (secondaryAction)
-    {
-        agreementDialog->addAction(secondaryAction);
-    }
-    agreementDialog->setTimeout(HbPopup::NoTimeout);
-    agreementDialog->setAttribute(Qt::WA_DeleteOnClose);
-    agreementDialog->open(this,SLOT(finished(HbAction*)));
-}
+//------------------------------------------------------------------------------
+// IAUpdateDialogUtil::ShowConfirmationQueryL
+//
+//------------------------------------------------------------------------------
+//
+TInt IAUpdateDialogUtil::ShowConfirmationQueryL( const TDesC& aText, 
+                                          TInt aSoftkeyResourceId )
+	{
+	CAknQueryDialog* queryDialog = CAknQueryDialog::NewL( 
+	                               CAknQueryDialog::EConfirmationTone );
 
-
+    queryDialog->PrepareLC( R_IAUPDATE_CONFIRMATION_QUERY );
+    queryDialog->SetPromptL( aText );
+    queryDialog->ButtonGroupContainer().SetCommandSetL( aSoftkeyResourceId );
+    return ( queryDialog->RunLD() );
+	}
 
-void IAUpdateDialogUtil::finished(HbAction *action)
-{
-    if (mObserver)
-    {
-        mObserver->dialogFinished(action);
-    }
-}
+//------------------------------------------------------------------------------
+// IAUpdateDialogUtil::ShowConfirmationQueryL
+//
+//------------------------------------------------------------------------------
+//
+TInt IAUpdateDialogUtil::ShowConfirmationQueryL( TInt aResource, 
+                                          TInt aSoftkeyResourceId )
+	{
+	HBufC* hBuf = StringLoader::LoadLC( aResource) ;
+	TInt ret = ShowConfirmationQueryL( *hBuf, aSoftkeyResourceId );
+	CleanupStack::PopAndDestroy( hBuf );
+	return ret;
+	}
 
 
 
 
-
-
+// -----------------------------------------------------------------------------
+// IAUpdateDialogUtil::Panic
+//
+// -----------------------------------------------------------------------------
+//
+void IAUpdateDialogUtil::Panic( TInt aReason ) 
+    {
+	_LIT(KPanicCategory, "IAUpdateDialogUtil");
+	
+	User::Panic(KPanicCategory, aReason); 
+    }
+    
+//  End of File