securitysettings/eapqtdialogs/src/eapmschapv2pwdexpirednotedialog.cpp
author hgs
Fri, 09 Jul 2010 10:14:51 +0300
changeset 36 c98682f98478
parent 34 ad1f037f1ac2
child 44 22d80358905b
permissions -rw-r--r--
201027
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
/*
36
hgs
parents: 34
diff changeset
    19
* %version: 3 %
34
hgs
parents:
diff changeset
    20
*/
hgs
parents:
diff changeset
    21
36
hgs
parents: 34
diff changeset
    22
// System includes
34
hgs
parents:
diff changeset
    23
#include <HbAction>
hgs
parents:
diff changeset
    24
#include <HbTranslator>
36
hgs
parents: 34
diff changeset
    25
hgs
parents: 34
diff changeset
    26
// User includes
34
hgs
parents:
diff changeset
    27
#include "eapmschapv2pwdexpirednotedialog.h"
hgs
parents:
diff changeset
    28
#include "OstTraceDefinitions.h"
hgs
parents:
diff changeset
    29
#ifdef OST_TRACE_COMPILER_IN_USE
hgs
parents:
diff changeset
    30
#endif
hgs
parents:
diff changeset
    31
36
hgs
parents: 34
diff changeset
    32
/*!
hgs
parents: 34
diff changeset
    33
 * \class EapMschapv2NewPwdDialog
hgs
parents: 34
diff changeset
    34
 * \brief Implements EAP-MSCHAPv2 New Password Input Dialog. 
hgs
parents: 34
diff changeset
    35
 */
hgs
parents: 34
diff changeset
    36
hgs
parents: 34
diff changeset
    37
// External function prototypes
hgs
parents: 34
diff changeset
    38
hgs
parents: 34
diff changeset
    39
// Local constants
34
hgs
parents:
diff changeset
    40
36
hgs
parents: 34
diff changeset
    41
//! The index numbers of the button of the dialog
hgs
parents: 34
diff changeset
    42
static const int okButtonIndex = 1;
hgs
parents: 34
diff changeset
    43
 
hgs
parents: 34
diff changeset
    44
// ======== LOCAL FUNCTIONS ========
hgs
parents: 34
diff changeset
    45
hgs
parents: 34
diff changeset
    46
// ======== MEMBER FUNCTIONS ========
hgs
parents: 34
diff changeset
    47
hgs
parents: 34
diff changeset
    48
/*!
hgs
parents: 34
diff changeset
    49
 * Constructor.
hgs
parents: 34
diff changeset
    50
 * 
hgs
parents: 34
diff changeset
    51
 * @param [in]  parameters Parameters for the Constructor.
34
hgs
parents:
diff changeset
    52
 */
hgs
parents:
diff changeset
    53
EapMschapv2PwdExpNoteDialog::EapMschapv2PwdExpNoteDialog(const QVariantMap &parameters)
hgs
parents:
diff changeset
    54
:HbMessageBox("default text...",HbMessageBox::MessageTypeInformation),    
hgs
parents:
diff changeset
    55
mTranslator(new HbTranslator("eapprompts")),
hgs
parents:
diff changeset
    56
mOkActionPressed(false)
hgs
parents:
diff changeset
    57
{
hgs
parents:
diff changeset
    58
    OstTraceFunctionEntry0( EAPMSCHAPV2PWDEXPNOTEDIALOG_EAPMSCHAPV2PWDEXPNOTEDIALOG_ENTRY );
hgs
parents:
diff changeset
    59
    qDebug("EapMschapv2PwdExpNoteDialog::EapMschapv2PwdExpNoteDialog ENTER");
36
hgs
parents: 34
diff changeset
    60
    
hgs
parents: 34
diff changeset
    61
    Q_UNUSED(parameters)
34
hgs
parents:
diff changeset
    62
36
hgs
parents: 34
diff changeset
    63
    createDialog();
34
hgs
parents:
diff changeset
    64
    
hgs
parents:
diff changeset
    65
    OstTraceFunctionExit0( EAPMSCHAPV2PWDEXPNOTEDIALOG_EAPMSCHAPV2PWDEXPNOTEDIALOG_EXIT );
hgs
parents:
diff changeset
    66
    qDebug("EapMschapv2PwdExpNoteDialog::EapMschapv2PwdExpNoteDialog EXIT");
hgs
parents:
diff changeset
    67
}
hgs
parents:
diff changeset
    68
    
36
hgs
parents: 34
diff changeset
    69
/*!
34
hgs
parents:
diff changeset
    70
 * The construction of the dialog
hgs
parents:
diff changeset
    71
 */ 
36
hgs
parents: 34
diff changeset
    72
void EapMschapv2PwdExpNoteDialog::createDialog()
34
hgs
parents:
diff changeset
    73
{
hgs
parents:
diff changeset
    74
    OstTraceFunctionEntry0( EAPMSCHAPV2PWDEXPNOTEDIALOG_CREATEDIALOG_ENTRY );
hgs
parents:
diff changeset
    75
    qDebug("EapMschapv2PwdExpNoteDialog::createDialog ENTER");
hgs
parents:
diff changeset
    76
     
hgs
parents:
diff changeset
    77
    QString text(hbTrId("txt_occ_info_eapmschapv2_password_has_expired_yo"));
hgs
parents:
diff changeset
    78
        
hgs
parents:
diff changeset
    79
    //Set the dialog to be on the screen until user reacts
hgs
parents:
diff changeset
    80
    //by pressing the Action button
hgs
parents:
diff changeset
    81
    this->setModal(true);
hgs
parents:
diff changeset
    82
    this->setTimeout(HbPopup::NoTimeout);
hgs
parents:
diff changeset
    83
    this->setDismissPolicy(HbPopup::NoDismiss);
hgs
parents:
diff changeset
    84
                   
hgs
parents:
diff changeset
    85
    this->setText(text);    
hgs
parents:
diff changeset
    86
    this->setIconVisible(true);
hgs
parents:
diff changeset
    87
    
hgs
parents:
diff changeset
    88
    //Remove all default actions from the dialog          
hgs
parents:
diff changeset
    89
    QList<QAction*> action_list = this->actions();
hgs
parents:
diff changeset
    90
    for ( int i = 0; i < action_list.count(); i++ ) {
hgs
parents:
diff changeset
    91
        this->removeAction(action_list.at(i));
hgs
parents:
diff changeset
    92
        }
hgs
parents:
diff changeset
    93
    
hgs
parents:
diff changeset
    94
    //Add a new Ok button action 
hgs
parents:
diff changeset
    95
    HbAction* actionOk = new HbAction(hbTrId("txt_common_button_ok_single_dialog"),this); 
hgs
parents:
diff changeset
    96
    this->addAction(actionOk);
hgs
parents:
diff changeset
    97
    
hgs
parents:
diff changeset
    98
    //Disconnect action Ok from the default SLOT and connect to 
hgs
parents:
diff changeset
    99
    //a SLOT owned by this class  
hgs
parents:
diff changeset
   100
    disconnect(actionOk, SIGNAL(triggered()),this, SLOT(close()));
hgs
parents:
diff changeset
   101
    bool connected = connect(actionOk, SIGNAL(triggered()), this, SLOT(okPressed()));
hgs
parents:
diff changeset
   102
    Q_ASSERT(connected == true);
hgs
parents:
diff changeset
   103
        
hgs
parents:
diff changeset
   104
    //Connect the about to close and hide signals, so that we are able to inform 
hgs
parents:
diff changeset
   105
    //the caller that the dialog was closed    
hgs
parents:
diff changeset
   106
    connected = connect(this, SIGNAL(aboutToClose()), this, SLOT(closingDialog()));
hgs
parents:
diff changeset
   107
    Q_ASSERT(connected == true);
hgs
parents:
diff changeset
   108
    connected = connect(this, SIGNAL(aboutToHide()), this, SLOT(closingDialog()));
hgs
parents:
diff changeset
   109
    Q_ASSERT(connected == true);
hgs
parents:
diff changeset
   110
   
hgs
parents:
diff changeset
   111
    OstTraceFunctionExit0( DUP1_EAPMSCHAPV2PWDEXPNOTEDIALOG_CREATEDIALOG_EXIT );
hgs
parents:
diff changeset
   112
    qDebug("EapMschapv2PwdExpNoteDialog::createDialog EXIT");
hgs
parents:
diff changeset
   113
}
hgs
parents:
diff changeset
   114
36
hgs
parents: 34
diff changeset
   115
/*!
34
hgs
parents:
diff changeset
   116
 * Destructor
hgs
parents:
diff changeset
   117
 */
hgs
parents:
diff changeset
   118
EapMschapv2PwdExpNoteDialog::~EapMschapv2PwdExpNoteDialog()
hgs
parents:
diff changeset
   119
{
hgs
parents:
diff changeset
   120
    OstTraceFunctionEntry0( EAPMSCHAPV2PWDEXPNOTEDIALOG_DEAPMSCHAPV2PWDEXPNOTEDIALOG_ENTRY );
hgs
parents:
diff changeset
   121
    
hgs
parents:
diff changeset
   122
    // The dialog widgets are deleted as the dialog is deleted
hgs
parents:
diff changeset
   123
    
hgs
parents:
diff changeset
   124
    OstTraceFunctionExit0( EAPMSCHAPV2PWDEXPNOTEDIALOG_DEAPMSCHAPV2PWDEXPNOTEDIALOG_EXIT );
hgs
parents:
diff changeset
   125
}
hgs
parents:
diff changeset
   126
36
hgs
parents: 34
diff changeset
   127
/*!
34
hgs
parents:
diff changeset
   128
 * Function is called when the Ok Action button is pressed
hgs
parents:
diff changeset
   129
 */
hgs
parents:
diff changeset
   130
void EapMschapv2PwdExpNoteDialog::okPressed()
hgs
parents:
diff changeset
   131
{
hgs
parents:
diff changeset
   132
    OstTraceFunctionEntry0( EAPMSCHAPV2PWDEXPNOTEDIALOG_OKBUTTONPRESSED_ENTRY );
hgs
parents:
diff changeset
   133
    qDebug("EapMschapv2PwdExpNoteDialog::okPressed ENTER");
hgs
parents:
diff changeset
   134
    
hgs
parents:
diff changeset
   135
    if ( mOkActionPressed == false ) {
hgs
parents:
diff changeset
   136
        
hgs
parents:
diff changeset
   137
            mOkActionPressed = true;
hgs
parents:
diff changeset
   138
            
hgs
parents:
diff changeset
   139
            QVariantMap data;
36
hgs
parents: 34
diff changeset
   140
            data["okbutton"] = okButtonIndex;    
hgs
parents: 34
diff changeset
   141
            
34
hgs
parents:
diff changeset
   142
            // emit the data of the selected button and close the dialog
hgs
parents:
diff changeset
   143
            qDebug("EapMschapv2PwdExpNoteDialog::okPressed: emit deviceDialogData");
hgs
parents:
diff changeset
   144
            emit deviceDialogData(data);
hgs
parents:
diff changeset
   145
    
hgs
parents:
diff changeset
   146
            closeDeviceDialog(true);
hgs
parents:
diff changeset
   147
    }
hgs
parents:
diff changeset
   148
    OstTraceFunctionExit0( EAPMSCHAPV2PWDEXPNOTEDIALOG_OKBUTTONPRESSED_EXIT );
hgs
parents:
diff changeset
   149
    qDebug("EapMschapv2PwdExpNoteDialog::okPressed EXIT");
hgs
parents:
diff changeset
   150
}
hgs
parents:
diff changeset
   151
36
hgs
parents: 34
diff changeset
   152
/*!
34
hgs
parents:
diff changeset
   153
 * Function is called when the dialog is about to close
hgs
parents:
diff changeset
   154
 * 
hgs
parents:
diff changeset
   155
 */
hgs
parents:
diff changeset
   156
void EapMschapv2PwdExpNoteDialog::closingDialog()
hgs
parents:
diff changeset
   157
{
hgs
parents:
diff changeset
   158
    OstTraceFunctionEntry0( EAPMSCHAPV2PWDEXPNOTEDIALOG_CLOSINGDIALOG_ENTRY );
hgs
parents:
diff changeset
   159
    qDebug("EapMschapv2PwdExpNoteDialog::closingDialog ENTER");
hgs
parents:
diff changeset
   160
     
hgs
parents:
diff changeset
   161
    qDebug("EapMschapv2PwdExpNoteDialog::closingDialog EXIT");
hgs
parents:
diff changeset
   162
    OstTraceFunctionExit0( EAPMSCHAPV2PWDEXPNOTEDIALOG_CLOSINGDIALOG_EXIT );
hgs
parents:
diff changeset
   163
}
hgs
parents:
diff changeset
   164
36
hgs
parents: 34
diff changeset
   165
/*!
hgs
parents: 34
diff changeset
   166
 * Device dialog parameters to be set while dialog is displayed.
hgs
parents: 34
diff changeset
   167
 * Not supported. 
hgs
parents: 34
diff changeset
   168
 *
hgs
parents: 34
diff changeset
   169
 * @param [in] parameters NOT USED
hgs
parents: 34
diff changeset
   170
 * @return true always.
hgs
parents: 34
diff changeset
   171
 */  
34
hgs
parents:
diff changeset
   172
bool EapMschapv2PwdExpNoteDialog::setDeviceDialogParameters
hgs
parents:
diff changeset
   173
                (const QVariantMap &parameters)
hgs
parents:
diff changeset
   174
{
hgs
parents:
diff changeset
   175
    OstTraceFunctionEntry0( EAPMSCHAPV2PWDEXPNOTEDIALOG_SETDEVICEDIALOGPARAMETERS_ENTRY );
hgs
parents:
diff changeset
   176
    
hgs
parents:
diff changeset
   177
    Q_UNUSED(parameters)
hgs
parents:
diff changeset
   178
    // changing the dialog after presenting it is not supported.
hgs
parents:
diff changeset
   179
    
hgs
parents:
diff changeset
   180
    OstTraceFunctionExit0( EAPMSCHAPV2PWDEXPNOTEDIALOG_SETDEVICEDIALOGPARAMETERS_EXIT );
hgs
parents:
diff changeset
   181
    return true;
hgs
parents:
diff changeset
   182
}
hgs
parents:
diff changeset
   183
36
hgs
parents: 34
diff changeset
   184
/*!
hgs
parents: 34
diff changeset
   185
 * Not supported
hgs
parents: 34
diff changeset
   186
 *
hgs
parents: 34
diff changeset
   187
 * @return 0 always returned.
34
hgs
parents:
diff changeset
   188
 */
hgs
parents:
diff changeset
   189
int EapMschapv2PwdExpNoteDialog::deviceDialogError() const
hgs
parents:
diff changeset
   190
{
hgs
parents:
diff changeset
   191
    OstTraceFunctionEntry0( EAPMSCHAPV2PWDEXPNOTEDIALOG_DEVICEDIALOGERROR_ENTRY );
hgs
parents:
diff changeset
   192
    OstTraceFunctionExit0( EAPMSCHAPV2PWDEXPNOTEDIALOG_DEVICEDIALOGERROR_EXIT);
hgs
parents:
diff changeset
   193
    return 0;
hgs
parents:
diff changeset
   194
}
hgs
parents:
diff changeset
   195
36
hgs
parents: 34
diff changeset
   196
/*!
34
hgs
parents:
diff changeset
   197
 * Dialog is closed and the signal about closing is emitted
36
hgs
parents: 34
diff changeset
   198
 *
hgs
parents: 34
diff changeset
   199
 * @param [in] byClient indicates when the user closes the dialog
34
hgs
parents:
diff changeset
   200
 */
hgs
parents:
diff changeset
   201
void EapMschapv2PwdExpNoteDialog::closeDeviceDialog(bool byClient)
hgs
parents:
diff changeset
   202
{   
hgs
parents:
diff changeset
   203
    OstTraceFunctionEntry0( EAPMSCHAPV2PWDEXPNOTEDIALOG_CLOSEDEVICEDIALOG_ENTRY );
hgs
parents:
diff changeset
   204
    qDebug("EapMschapv2PwdExpNoteDialog::closeDeviceDialog ENTER");
hgs
parents:
diff changeset
   205
        
hgs
parents:
diff changeset
   206
    if ( byClient == true ) {
hgs
parents:
diff changeset
   207
        qDebug("EapMschapv2PwdExpNoteDialog::closeDeviceDialog: emit deviceDialogClosed");  
hgs
parents:
diff changeset
   208
        emit deviceDialogClosed(); 
hgs
parents:
diff changeset
   209
        }
hgs
parents:
diff changeset
   210
    
hgs
parents:
diff changeset
   211
    qDebug("EapMschapv2PwdExpNoteDialog::closeDeviceDialog EXIT");
hgs
parents:
diff changeset
   212
    OstTraceFunctionExit0( EAPMSCHAPV2PWDEXPNOTEDIALOG_CLOSEDEVICEDIALOG_EXIT );
hgs
parents:
diff changeset
   213
}
hgs
parents:
diff changeset
   214
36
hgs
parents: 34
diff changeset
   215
/*!
34
hgs
parents:
diff changeset
   216
 * This dialog widget is returned to the caller
36
hgs
parents: 34
diff changeset
   217
 *
hgs
parents: 34
diff changeset
   218
 * @return this dialog widget
34
hgs
parents:
diff changeset
   219
 */
hgs
parents:
diff changeset
   220
HbPopup *EapMschapv2PwdExpNoteDialog::deviceDialogWidget() const
hgs
parents:
diff changeset
   221
{
hgs
parents:
diff changeset
   222
    OstTraceFunctionEntry0( EAPMSCHAPV2PWDEXPNOTEDIALOG_DEVICEDIALOGWIDGET_ENTRY );
hgs
parents:
diff changeset
   223
    qDebug("EapMschapv2PwdExpNoteDialog::deviceDialogWidget ENTER");
hgs
parents:
diff changeset
   224
    
hgs
parents:
diff changeset
   225
    qDebug("EapMschapv2PwdExpNoteDialog::deviceDialogWidget EXIT");
hgs
parents:
diff changeset
   226
    OstTraceFunctionExit0( EAPMSCHAPV2PWDEXPNOTEDIALOG_DEVICEDIALOGWIDGET_EXIT );
hgs
parents:
diff changeset
   227
    
hgs
parents:
diff changeset
   228
    return const_cast<EapMschapv2PwdExpNoteDialog*>(this);
hgs
parents:
diff changeset
   229
}
hgs
parents:
diff changeset
   230