securitysettings/eapqtdialogs/src/eapmschapv2pwdexpirednotedialog.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: EAP-MSCHAPv2 password expired note Dialog implementation
       
    15 *
       
    16 */
       
    17 
       
    18 /*
       
    19 * %version: 2 %
       
    20 */
       
    21 
       
    22 #include <HbAction>
       
    23 #include <HbTranslator>
       
    24 #include "eapmschapv2pwdexpirednotedialog.h"
       
    25 #include "OstTraceDefinitions.h"
       
    26 #ifdef OST_TRACE_COMPILER_IN_USE
       
    27 #endif
       
    28 
       
    29 // The index numbers of the button of the dialog
       
    30 const int okButtonIndex = 1;
       
    31 
       
    32 /**
       
    33  * The constructor
       
    34  */
       
    35 EapMschapv2PwdExpNoteDialog::EapMschapv2PwdExpNoteDialog(const QVariantMap &parameters)
       
    36 :HbMessageBox("default text...",HbMessageBox::MessageTypeInformation),    
       
    37 mTranslator(new HbTranslator("eapprompts")),
       
    38 mOkActionPressed(false)
       
    39 {
       
    40     OstTraceFunctionEntry0( EAPMSCHAPV2PWDEXPNOTEDIALOG_EAPMSCHAPV2PWDEXPNOTEDIALOG_ENTRY );
       
    41     qDebug("EapMschapv2PwdExpNoteDialog::EapMschapv2PwdExpNoteDialog ENTER");
       
    42 
       
    43     createDialog( parameters );
       
    44     
       
    45     OstTraceFunctionExit0( EAPMSCHAPV2PWDEXPNOTEDIALOG_EAPMSCHAPV2PWDEXPNOTEDIALOG_EXIT );
       
    46     qDebug("EapMschapv2PwdExpNoteDialog::EapMschapv2PwdExpNoteDialog EXIT");
       
    47 }
       
    48     
       
    49 /**
       
    50  * The construction of the dialog
       
    51  */ 
       
    52 void EapMschapv2PwdExpNoteDialog::createDialog(const QVariantMap &parameters )
       
    53 {
       
    54     OstTraceFunctionEntry0( EAPMSCHAPV2PWDEXPNOTEDIALOG_CREATEDIALOG_ENTRY );
       
    55     qDebug("EapMschapv2PwdExpNoteDialog::createDialog ENTER");
       
    56      
       
    57     QString text(hbTrId("txt_occ_info_eapmschapv2_password_has_expired_yo"));
       
    58     
       
    59     Q_UNUSED(parameters)
       
    60         
       
    61     //Set the dialog to be on the screen until user reacts
       
    62     //by pressing the Action button
       
    63     this->setModal(true);
       
    64     this->setTimeout(HbPopup::NoTimeout);
       
    65     this->setDismissPolicy(HbPopup::NoDismiss);
       
    66                    
       
    67     this->setText(text);    
       
    68     this->setIconVisible(true);
       
    69     
       
    70     //Remove all default actions from the dialog          
       
    71     QList<QAction*> action_list = this->actions();
       
    72     for ( int i = 0; i < action_list.count(); i++ ) {
       
    73         this->removeAction(action_list.at(i));
       
    74         }
       
    75     
       
    76     //Add a new Ok button action 
       
    77     HbAction* actionOk = new HbAction(hbTrId("txt_common_button_ok_single_dialog"),this); 
       
    78     this->addAction(actionOk);
       
    79     
       
    80     //Disconnect action Ok from the default SLOT and connect to 
       
    81     //a SLOT owned by this class  
       
    82     disconnect(actionOk, SIGNAL(triggered()),this, SLOT(close()));
       
    83     bool connected = connect(actionOk, SIGNAL(triggered()), this, SLOT(okPressed()));
       
    84     Q_ASSERT(connected == true);
       
    85         
       
    86     //Connect the about to close and hide signals, so that we are able to inform 
       
    87     //the caller that the dialog was closed    
       
    88     connected = connect(this, SIGNAL(aboutToClose()), this, SLOT(closingDialog()));
       
    89     Q_ASSERT(connected == true);
       
    90     connected = connect(this, SIGNAL(aboutToHide()), this, SLOT(closingDialog()));
       
    91     Q_ASSERT(connected == true);
       
    92    
       
    93     OstTraceFunctionExit0( DUP1_EAPMSCHAPV2PWDEXPNOTEDIALOG_CREATEDIALOG_EXIT );
       
    94     qDebug("EapMschapv2PwdExpNoteDialog::createDialog EXIT");
       
    95 }
       
    96 
       
    97 /**
       
    98  * Destructor
       
    99  */
       
   100 EapMschapv2PwdExpNoteDialog::~EapMschapv2PwdExpNoteDialog()
       
   101 {
       
   102     OstTraceFunctionEntry0( EAPMSCHAPV2PWDEXPNOTEDIALOG_DEAPMSCHAPV2PWDEXPNOTEDIALOG_ENTRY );
       
   103     
       
   104     // The dialog widgets are deleted as the dialog is deleted
       
   105     
       
   106     OstTraceFunctionExit0( EAPMSCHAPV2PWDEXPNOTEDIALOG_DEAPMSCHAPV2PWDEXPNOTEDIALOG_EXIT );
       
   107 }
       
   108 
       
   109 /**
       
   110  * Function is called when the Ok Action button is pressed
       
   111  */
       
   112 void EapMschapv2PwdExpNoteDialog::okPressed()
       
   113 {
       
   114     OstTraceFunctionEntry0( EAPMSCHAPV2PWDEXPNOTEDIALOG_OKBUTTONPRESSED_ENTRY );
       
   115     qDebug("EapMschapv2PwdExpNoteDialog::okPressed ENTER");
       
   116     
       
   117     if ( mOkActionPressed == false ) {
       
   118         
       
   119             mOkActionPressed = true;
       
   120             
       
   121             QVariantMap data;
       
   122             QVariant variant(okButtonIndex);
       
   123             data.insert("okbutton", variant);
       
   124             // emit the data of the selected button and close the dialog
       
   125             qDebug("EapMschapv2PwdExpNoteDialog::okPressed: emit deviceDialogData");
       
   126             emit deviceDialogData(data);
       
   127     
       
   128             closeDeviceDialog(true);
       
   129     }
       
   130     OstTraceFunctionExit0( EAPMSCHAPV2PWDEXPNOTEDIALOG_OKBUTTONPRESSED_EXIT );
       
   131     qDebug("EapMschapv2PwdExpNoteDialog::okPressed EXIT");
       
   132 }
       
   133 
       
   134 /**
       
   135  * Function is called when the dialog is about to close
       
   136  * 
       
   137  */
       
   138 void EapMschapv2PwdExpNoteDialog::closingDialog()
       
   139 {
       
   140     OstTraceFunctionEntry0( EAPMSCHAPV2PWDEXPNOTEDIALOG_CLOSINGDIALOG_ENTRY );
       
   141     qDebug("EapMschapv2PwdExpNoteDialog::closingDialog ENTER");
       
   142      
       
   143     qDebug("EapMschapv2PwdExpNoteDialog::closingDialog EXIT");
       
   144     OstTraceFunctionExit0( EAPMSCHAPV2PWDEXPNOTEDIALOG_CLOSINGDIALOG_EXIT );
       
   145 }
       
   146 
       
   147 /**
       
   148  * Updating the dialog during its showing is not allowed.
       
   149  */ 
       
   150 bool EapMschapv2PwdExpNoteDialog::setDeviceDialogParameters
       
   151                 (const QVariantMap &parameters)
       
   152 {
       
   153     OstTraceFunctionEntry0( EAPMSCHAPV2PWDEXPNOTEDIALOG_SETDEVICEDIALOGPARAMETERS_ENTRY );
       
   154     
       
   155     Q_UNUSED(parameters)
       
   156     // changing the dialog after presenting it is not supported.
       
   157     
       
   158     OstTraceFunctionExit0( EAPMSCHAPV2PWDEXPNOTEDIALOG_SETDEVICEDIALOGPARAMETERS_EXIT );
       
   159     return true;
       
   160 }
       
   161 
       
   162 /**
       
   163  * Not supported, 0 always returned
       
   164  */
       
   165 int EapMschapv2PwdExpNoteDialog::deviceDialogError() const
       
   166 {
       
   167     OstTraceFunctionEntry0( EAPMSCHAPV2PWDEXPNOTEDIALOG_DEVICEDIALOGERROR_ENTRY );
       
   168     OstTraceFunctionExit0( EAPMSCHAPV2PWDEXPNOTEDIALOG_DEVICEDIALOGERROR_EXIT);
       
   169     return 0;
       
   170 }
       
   171 
       
   172 /**
       
   173  * Dialog is closed and the signal about closing is emitted
       
   174  */
       
   175 void EapMschapv2PwdExpNoteDialog::closeDeviceDialog(bool byClient)
       
   176 {   
       
   177     OstTraceFunctionEntry0( EAPMSCHAPV2PWDEXPNOTEDIALOG_CLOSEDEVICEDIALOG_ENTRY );
       
   178     qDebug("EapMschapv2PwdExpNoteDialog::closeDeviceDialog ENTER");
       
   179         
       
   180     if ( byClient == true ) {
       
   181         qDebug("EapMschapv2PwdExpNoteDialog::closeDeviceDialog: emit deviceDialogClosed");  
       
   182         emit deviceDialogClosed(); 
       
   183         }
       
   184     
       
   185     qDebug("EapMschapv2PwdExpNoteDialog::closeDeviceDialog EXIT");
       
   186     OstTraceFunctionExit0( EAPMSCHAPV2PWDEXPNOTEDIALOG_CLOSEDEVICEDIALOG_EXIT );
       
   187 }
       
   188 
       
   189 /**
       
   190  * This dialog widget is returned to the caller
       
   191  */
       
   192 HbPopup *EapMschapv2PwdExpNoteDialog::deviceDialogWidget() const
       
   193 {
       
   194     OstTraceFunctionEntry0( EAPMSCHAPV2PWDEXPNOTEDIALOG_DEVICEDIALOGWIDGET_ENTRY );
       
   195     qDebug("EapMschapv2PwdExpNoteDialog::deviceDialogWidget ENTER");
       
   196     
       
   197     qDebug("EapMschapv2PwdExpNoteDialog::deviceDialogWidget EXIT");
       
   198     OstTraceFunctionExit0( EAPMSCHAPV2PWDEXPNOTEDIALOG_DEVICEDIALOGWIDGET_EXIT );
       
   199     
       
   200     return const_cast<EapMschapv2PwdExpNoteDialog*>(this);
       
   201 }
       
   202