cpsecplugins/cpadvancedsecplugin/inc/advsecsettingssecuritymodulemodel.h
changeset 63 989397f9511c
equal deleted inserted replaced
62:3255e7d5bd67 63:989397f9511c
       
     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:  Security module model in advanced security settings
       
    15 *
       
    16 */
       
    17 
       
    18 #ifndef ADVSECSETTINGSSECURITYMODULEMODEL_H
       
    19 #define ADVSECSETTINGSSECURITYMODULEMODEL_H
       
    20 
       
    21 #include <QObject>
       
    22 #include <QMap>
       
    23 
       
    24 class AdvSecSettingsSecurityModule;
       
    25 class AdvSecSettingsSecurityModuleModelPrivate;
       
    26 
       
    27 
       
    28 /**
       
    29  * Security module model in advanced security settings.
       
    30  */
       
    31 class AdvSecSettingsSecurityModuleModel : public QObject
       
    32 {
       
    33     Q_OBJECT
       
    34 
       
    35 public:     // constructor and destructor
       
    36     explicit AdvSecSettingsSecurityModuleModel(QObject *parent = 0);
       
    37     virtual ~AdvSecSettingsSecurityModuleModel();
       
    38 
       
    39 public:     // new definitions
       
    40     enum SecurityModuleDetailsField {
       
    41         Label,
       
    42         Version,
       
    43         Location,
       
    44         SerialNumber,
       
    45         Manufacturer
       
    46     };
       
    47     enum AuthenticationStatus {
       
    48         EPinEntered         = 0x01, // Set if the module is open, PIN already entered
       
    49         EPinRequested       = 0x02, // Set if PIN code required to open the module
       
    50         EPinChangeAllowed   = 0x04, // Set if PIN code change is allowed
       
    51         EPinBlocked         = 0x10, // Set if PIN code is blocked, requires unblocking PIN
       
    52         EBlockedPermanently = 0x20, // Set if PIN code blocked and cannot be unblocked
       
    53     };
       
    54 
       
    55 public:     // new functions
       
    56     void initialize();
       
    57     int moduleCount() const;
       
    58     QMap<QString,QString> moduleLabelsAndLocations() const;
       
    59     void getModuleDetails(int moduleIndex);
       
    60     void getModuleStatus(int moduleIndex);
       
    61     // Functions related to PIN-G (aka access PIN, login PIN)
       
    62     void setPinCodeRequestState(int moduleIndex, bool isRequested);
       
    63     void changePinCode(int moduleIndex);  // unblocks PIN code if EPinBlocked
       
    64     void closeModule(int moduleIndex);
       
    65     // Functions related to PIN-NR (aka signature PIN, signing PIN)
       
    66     bool isSigningPinSupported(int moduleIndex) const;
       
    67     void changeSigningPinCode(int moduleIndex);
       
    68     bool isDeletable(int moduleIndex) const;
       
    69     void deleteModule(int moduleIndex);
       
    70 
       
    71 signals:
       
    72     void initializeCompleted();
       
    73     void detailsCompleted(QMap<int,QString> details);
       
    74     void statusCompleted(int authenticationStatus);
       
    75     void statusChanged(int moduleIndex, int authenticationStatus);
       
    76     void pinCodeRequestStateCompleted();
       
    77     void pinCodeChangeCompleted();
       
    78     void closeCompleted();
       
    79     void signingPinCodeChangeCompleted();
       
    80     void deleteCompleted();
       
    81     void errorOccurred(int error);
       
    82 
       
    83 private:    // new functions
       
    84     void handleInitializeCompleted();
       
    85     void handleStatusCompleted(int authenticationStatus);
       
    86     void handleStatusChanged(int moduleIndex, int authenticationStatus);
       
    87     void handlePinCodeRequestSet();
       
    88     void handlePinCodeChanged();
       
    89     void handleModuleClosed();
       
    90     void handleSigningPinCodeChanged();
       
    91     void handleModuleDeleted();
       
    92     void handleError(int error);
       
    93 
       
    94 private:    // data
       
    95     Q_DISABLE_COPY(AdvSecSettingsSecurityModuleModel)
       
    96     friend class AdvSecSettingsSecurityModuleModelPrivate;
       
    97     AdvSecSettingsSecurityModuleModelPrivate *d_ptr;
       
    98 };
       
    99 
       
   100 #endif // ADVSECSETTINGSSECURITYMODULEMODEL_H