iaupdate/IAD/ui/src/iaupdatedialogutil.cpp
changeset 42 d17dc5398051
child 44 329d304c1aa1
equal deleted inserted replaced
37:6e7b00453237 42:d17dc5398051
       
     1 /*
       
     2 * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:   This module contains the implementation of IAUpdateDialogUtil class 
       
    15 *                member functions.
       
    16 *
       
    17 */
       
    18 #include <hbtextitem.h>
       
    19 #include <hbmessagebox.h>
       
    20 
       
    21 #include "iaupdatedialogutil.h"
       
    22 #include "iaupdatedialogobserver.h"
       
    23 #include "iaupdatedebug.h"
       
    24 
       
    25 
       
    26 
       
    27 IAUpdateDialogUtil::IAUpdateDialogUtil(QObject *parent, IAUpdateDialogObserver *observer)
       
    28 : QObject(parent),
       
    29   mObserver(observer)
       
    30 {
       
    31     IAUPDATE_TRACE("[IAUPDATE] IAUpdateDialogUtil::IAUpdateDialogUtil()");
       
    32 }
       
    33 
       
    34 IAUpdateDialogUtil::~IAUpdateDialogUtil()
       
    35 {
       
    36     IAUPDATE_TRACE("[IAUPDATE] IAUpdateDialogUtil::~IAUpdateDialogUtil()");
       
    37 }
       
    38 
       
    39 
       
    40 void IAUpdateDialogUtil::showInformation(const QString &text, HbAction *primaryAction)
       
    41 {    
       
    42     HbMessageBox *messageBox = new HbMessageBox(HbMessageBox::MessageTypeInformation); 
       
    43     messageBox->setText(text);
       
    44     int actionCount = messageBox->actions().count();
       
    45     for (int i=actionCount-1; i >= 0; i--)
       
    46     { 
       
    47         messageBox->removeAction(messageBox->actions().at(i));
       
    48     }
       
    49     if (primaryAction)
       
    50     {    
       
    51         messageBox->addAction(primaryAction);
       
    52     }  
       
    53     messageBox->setTimeout(HbPopup::NoTimeout); 
       
    54     messageBox->setAttribute(Qt::WA_DeleteOnClose);
       
    55     messageBox->open(this,SLOT(finished(HbAction*)));
       
    56 }
       
    57 
       
    58 
       
    59 void IAUpdateDialogUtil::showQuestion(const QString &text, HbAction *primaryAction, HbAction *secondaryAction)
       
    60 {
       
    61     HbMessageBox *messageBox = new HbMessageBox(HbMessageBox::MessageTypeQuestion); 
       
    62     messageBox->setIconVisible(false);
       
    63     messageBox->setText(text);
       
    64     int actionCount = messageBox->actions().count();
       
    65     for (int i=actionCount-1; i >= 0; i--)
       
    66     { 
       
    67         messageBox->removeAction(messageBox->actions().at(i));
       
    68     }
       
    69     if (primaryAction)
       
    70     {    
       
    71         messageBox->addAction(primaryAction);
       
    72     }
       
    73     if (secondaryAction)
       
    74     {    
       
    75         messageBox->addAction(secondaryAction);
       
    76     } 
       
    77     messageBox->setTimeout(HbPopup::NoTimeout); 
       
    78     messageBox->setAttribute(Qt::WA_DeleteOnClose);
       
    79     messageBox->open(this,SLOT(finished(HbAction*)));
       
    80 }
       
    81 
       
    82 
       
    83 void IAUpdateDialogUtil::showAgreement(HbAction *primaryAction, HbAction *secondaryAction)
       
    84 {
       
    85     HbMessageBox *agreementDialog = new HbMessageBox(HbMessageBox::MessageTypeQuestion); 
       
    86     agreementDialog->setIconVisible(false);
       
    87     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.\n\nUse of this application involves transmission of data. Contact your network service provider for information about data transmission charges.\n\n(c) 2007-2010 Nokia. All rights reserved.");
       
    88 
       
    89     int actionCount = agreementDialog->actions().count();
       
    90     for (int i=actionCount-1; i >= 0; i--)
       
    91     { 
       
    92         agreementDialog->removeAction(agreementDialog->actions().at(i));
       
    93     }
       
    94     if (primaryAction)
       
    95     {    
       
    96         agreementDialog->addAction(primaryAction);
       
    97     }    
       
    98     if (secondaryAction)
       
    99     {
       
   100         agreementDialog->addAction(secondaryAction);
       
   101     }
       
   102     agreementDialog->setTimeout(HbPopup::NoTimeout);
       
   103     agreementDialog->setAttribute(Qt::WA_DeleteOnClose);
       
   104     agreementDialog->open(this,SLOT(finished(HbAction*)));
       
   105 }
       
   106 
       
   107 
       
   108 
       
   109 void IAUpdateDialogUtil::finished(HbAction *action)
       
   110 {
       
   111     if (mObserver)
       
   112     {
       
   113         mObserver->dialogFinished(action);
       
   114     }
       
   115 }
       
   116 
       
   117 
       
   118 
       
   119 
       
   120 
       
   121