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