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