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