securitysettings/eapqtdialogs/src/eapfastprovwaitnotedialog.cpp
changeset 39 fe6b6762fccd
child 36 c98682f98478
equal deleted inserted replaced
38:7a0216d033ac 39:fe6b6762fccd
       
     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: Fast Provisioning Wait Notification Dialog implementation
       
    15 *
       
    16 */
       
    17 
       
    18 /*
       
    19 * %version: 2 %
       
    20 */
       
    21 
       
    22 #include <HbTranslator>
       
    23 #include "eapfastprovwaitnotedialog.h"
       
    24 #include "OstTraceDefinitions.h"
       
    25 #include <QGraphicsLinearLayout>
       
    26 #ifdef OST_TRACE_COMPILER_IN_USE
       
    27 #endif
       
    28 
       
    29 /**
       
    30  * The constructor
       
    31  */
       
    32 EapFastProvWaitNoteDialog::EapFastProvWaitNoteDialog(const QVariantMap &parameters)
       
    33 :mTranslator(new HbTranslator("eapprompts"))
       
    34 {
       
    35     OstTraceFunctionEntry0( EAPFASTPROVWAITNOTEDIALOG_EAPFASTPROVWAITNOTEDIALOG_ENTRY );
       
    36     qDebug("EapFastProvWaitNoteDialog::EapFastProvWaitNoteDialog ENTER");
       
    37 
       
    38     createDialog( parameters );
       
    39         
       
    40     OstTraceFunctionExit0( EAPFASTPROVWAITNOTEDIALOG_EAPFASTPROVWAITNOTEDIALOG_EXIT );
       
    41     qDebug("EapFastProvWaitNoteDialog::EapFastProvWaitNoteDialog EXIT");
       
    42 }
       
    43    
       
    44 /**
       
    45  * The construction of the dialog
       
    46  */ 
       
    47 void EapFastProvWaitNoteDialog::createDialog(const QVariantMap &parameters )
       
    48 {
       
    49     OstTraceFunctionEntry0( EAPFASTPROVWAITNOTEDIALOG_CREATEDIALOG_ENTRY );
       
    50     qDebug("EapFastProvWaitNoteDialog::createDialog ENTER");
       
    51     
       
    52     QString mainText;    
       
    53     QString key("notificationtxt");
       
    54     
       
    55     bool authProvWaitNote = false;
       
    56     
       
    57     //Get the needed information from parameters that indicates to type of the dialog
       
    58     //which is either a authenticated or a unauthenticated 
       
    59     if ( parameters.empty() == false ) {
       
    60         if ( parameters.contains(key) ) {
       
    61             QVariant variant = parameters.value(key);
       
    62             authProvWaitNote = variant.toBool();
       
    63             }
       
    64         }      
       
    65     
       
    66     if ( authProvWaitNote ) {
       
    67         mainText = QString(hbTrId("txt_occ_dpopinfo_authenticated_provisioning_in_pro"));       
       
    68     } else {
       
    69         mainText = QString(hbTrId("txt_occ_dpopinfo_unauthenticated_provisioning_in_p"));
       
    70     }
       
    71        
       
    72     // Set the dialog to be on the screen for 4 seconds.
       
    73     this->setTimeout(4000);
       
    74     this->setTitle(mainText);  
       
    75    
       
    76     // Connect the about to close and hide signals, so that we are able to inform 
       
    77     // the caller that the dialog was closed        
       
    78     bool connected = connect(this, SIGNAL(aboutToClose()), this, SLOT(closingDialog()));
       
    79     Q_ASSERT(connected == true);
       
    80     connected = connect(this, SIGNAL(aboutToHide()), this, SLOT(closingDialog()));
       
    81     Q_ASSERT(connected == true);
       
    82    
       
    83     OstTraceFunctionExit0( DUP1_EAPFASTPROVWAITNOTEDIALOG_CREATEDIALOG_EXIT );
       
    84     qDebug("EapFastProvWaitNoteDialog::createDialog EXIT");
       
    85 }
       
    86 
       
    87 /**
       
    88  * Destructor
       
    89  */
       
    90 EapFastProvWaitNoteDialog::~EapFastProvWaitNoteDialog()
       
    91 {
       
    92     OstTraceFunctionEntry0( EAPFASTPROVWAITNOTEDIALOG_DEAPFASTPROVWAITNOTEDIALOG_ENTRY );
       
    93     qDebug("EapFastProvWaitNoteDialog::~EapFastProvWaitNoteDialog ENTER");
       
    94     
       
    95     // The dialog widgets are deleted as the dialog is deleted
       
    96 
       
    97     qDebug("EapFastProvWaitNoteDialog::~EapFastProvWaitNoteDialog EXIT");
       
    98     OstTraceFunctionExit0( EAPFASTPROVWAITNOTEDIALOG_DEAPFASTPROVWAITNOTEDIALOG_EXIT );
       
    99 }
       
   100 
       
   101 /**
       
   102  * Function is called when the dialog is about to close
       
   103  * 
       
   104  */
       
   105 void EapFastProvWaitNoteDialog::closingDialog()
       
   106 {
       
   107     OstTraceFunctionEntry0( EAPFASTPROVWAITNOTEDIALOG_CLOSINGDIALOG_ENTRY );
       
   108     qDebug("EapFastProvWaitNoteDialog::closingDialog ENTER");
       
   109  
       
   110     closeDeviceDialog(false);
       
   111     
       
   112     qDebug("EapFastProvWaitNoteDialog::closingDialog EXIT");
       
   113     OstTraceFunctionExit0( EAPFASTPROVWAITNOTEDIALOG_CLOSINGDIALOG_EXIT );
       
   114 }
       
   115 
       
   116 /**
       
   117  * Updating the dialog during its showing is not allowed.
       
   118  */ 
       
   119 bool EapFastProvWaitNoteDialog::setDeviceDialogParameters
       
   120                 (const QVariantMap &parameters)
       
   121 {
       
   122     OstTraceFunctionEntry0( EAPFASTPROVWAITNOTEDIALOG_SETDEVICEDIALOGPARAMETERS_ENTRY );
       
   123     
       
   124     Q_UNUSED(parameters)
       
   125     // changing the dialog after presenting it is not supported.
       
   126     
       
   127     OstTraceFunctionExit0( EAPFASTPROVWAITNOTEDIALOG_SETDEVICEDIALOGPARAMETERS_EXIT );
       
   128     return true;
       
   129 }
       
   130 
       
   131 /**
       
   132  * Not supported, 0 always returned
       
   133  */
       
   134 int EapFastProvWaitNoteDialog::deviceDialogError() const
       
   135 {
       
   136     OstTraceFunctionEntry0( EAPFASTPROVWAITNOTEDIALOG_DEVICEDIALOGERROR_ENTRY );
       
   137     OstTraceFunctionExit0( EAPFASTPROVWAITNOTEDIALOG_DEVICEDIALOGERROR_EXIT);
       
   138     return 0;
       
   139 }
       
   140 
       
   141 /**
       
   142  * Dialog is closed and the signal about closing is emitted
       
   143  */
       
   144 void EapFastProvWaitNoteDialog::closeDeviceDialog(bool byClient)
       
   145 {   
       
   146     OstTraceFunctionEntry0( EAPFASTPROVWAITNOTEDIALOG_CLOSEDEVICEDIALOG_ENTRY );
       
   147     qDebug("EapFastProvWaitNoteDialog::closeDeviceDialog ENTER");
       
   148         
       
   149     Q_UNUSED(byClient)
       
   150     
       
   151     emit deviceDialogClosed();
       
   152     
       
   153     qDebug("EapFastProvWaitNoteDialog::closeDeviceDialog EXIT");
       
   154     OstTraceFunctionExit0( EAPFASTPROVWAITNOTEDIALOG_CLOSEDEVICEDIALOG_EXIT );
       
   155 }
       
   156 
       
   157 /**
       
   158  * This dialog widget is returned to the caller
       
   159  */
       
   160 HbPopup *EapFastProvWaitNoteDialog::deviceDialogWidget() const
       
   161 {
       
   162     OstTraceFunctionEntry0( EAPFASTPROVWAITNOTEDIALOG_DEVICEDIALOGWIDGET_ENTRY );
       
   163     qDebug("EapFastProvWaitNoteDialog::deviceDialogWidget ENTER");
       
   164     
       
   165     qDebug("EapFastProvWaitNoteDialog::deviceDialogWidget EXIT");
       
   166     OstTraceFunctionExit0( EAPFASTPROVWAITNOTEDIALOG_DEVICEDIALOGWIDGET_EXIT );
       
   167     
       
   168     return const_cast<EapFastProvWaitNoteDialog*>(this);
       
   169 }
       
   170