pkiutilities/untrustedcertificatedialog/inc/untrustedcertificatedialog.h
changeset 26 aad866c37519
child 30 cc1cea6aabaf
equal deleted inserted replaced
22:6b63ca65093a 26:aad866c37519
       
     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:  Device dialog plugin that shows untrusted certificate
       
    15 *               dialog for TLS server authentication failure errors.
       
    16 *
       
    17 */
       
    18 
       
    19 #ifndef UNTRUSTEDCERTIFICATEDIALOG_H
       
    20 #define UNTRUSTEDCERTIFICATEDIALOG_H
       
    21 
       
    22 #include <hbdialog.h>
       
    23 #include <hbdevicedialoginterface.h>
       
    24 
       
    25 class UntrustedCertificateWidget;
       
    26 
       
    27 
       
    28 /**
       
    29  * Untrusted certificate dialog.
       
    30  * This dialog is displayed when a secure socket (CSecureSocket) is opened
       
    31  * using EDialogModeAttended mode, and the server sends untrusted certificate.
       
    32  * Untrusted certificate dialog shows the certificate details and prompts if
       
    33  * the secure connection is allowed to proceed.
       
    34  */
       
    35 class UntrustedCertificateDialog : public HbDialog, public HbDeviceDialogInterface
       
    36 {
       
    37     Q_OBJECT
       
    38 
       
    39 public:     // constructor and destructor
       
    40     UntrustedCertificateDialog(const QVariantMap &parameters);
       
    41     virtual ~UntrustedCertificateDialog();
       
    42 
       
    43 public:     // from HbDeviceDialogInterface
       
    44     bool setDeviceDialogParameters(const QVariantMap &parameters);
       
    45     int deviceDialogError() const;
       
    46     void closeDeviceDialog(bool byClient);
       
    47     HbDialog *deviceDialogWidget() const;
       
    48 
       
    49 signals:    // required by device dialog framework
       
    50     void deviceDialogClosed();
       
    51     void deviceDialogData(const QVariantMap &data);
       
    52 
       
    53 protected:  // from HbPopup (via HbDialog)
       
    54     void hideEvent(QHideEvent *event);
       
    55     void showEvent(QShowEvent *event);
       
    56 
       
    57 private:    // new functions
       
    58     bool isParametersValid(const QVariantMap &parameters);
       
    59     bool constructDialog(const QVariantMap &parameters);
       
    60     bool updateFromParameters(const QVariantMap &parameters);
       
    61     void sendResult(int result);
       
    62 
       
    63 private slots:  // new slots
       
    64     void handleAccepted();
       
    65     void handleRejected();
       
    66 
       
    67 private:    // new functions
       
    68     Q_DISABLE_COPY(UntrustedCertificateDialog)
       
    69 
       
    70 private:    // data
       
    71     int mLastError;
       
    72     bool mShowEventReceived;
       
    73     UntrustedCertificateWidget *mContent;
       
    74     QVariantMap mResultMap;
       
    75 };
       
    76 
       
    77 #endif // UNTRUSTEDCERTIFICATEDIALOG_H
       
    78