phonesettings/cpphonesettingsplugins/barringplugin/inc/cpbarringplugingroup.h
changeset 37 ba76fc04e6c2
child 45 6b911d05207e
equal deleted inserted replaced
36:2eacb6118286 37:ba76fc04e6c2
       
     1 /*
       
     2  * Copyright (c) 2009-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:  
       
    15  *
       
    16  */
       
    17 #ifndef CPBARRINGPLUGINGROUP_H
       
    18 #define CPBARRINGPLUGINGROUP_H
       
    19 
       
    20 #include <QQueue>
       
    21 #include <cpsettingformitemdata.h>
       
    22 #include <psetcallbarringwrapper.h>
       
    23 
       
    24 class PSetWrapper;
       
    25 class QModelIndex;
       
    26 class CpPhoneNotes;
       
    27 class QValidator;
       
    28 class HbDataFormModel;
       
    29 
       
    30     
       
    31 /*!
       
    32     \class CpBarringPluginGroup
       
    33     \brief The class CpBarringPluginGroup defines barring items shown on UI. 
       
    34  */
       
    35 class CpBarringPluginGroup : public CpSettingFormItemData
       
    36 {
       
    37     Q_OBJECT
       
    38     
       
    39 public:
       
    40     
       
    41     // Change barring password operation phases
       
    42     enum ChangeBarringPasswordPhase
       
    43     {
       
    44         NonePhase,
       
    45         CurrentPasswordPhase,
       
    46         NewPasswordPhase,
       
    47         VerifyNewPasswordPhase
       
    48     };
       
    49 
       
    50     explicit CpBarringPluginGroup(CpItemDataHelper &helper);
       
    51     ~CpBarringPluginGroup();
       
    52 
       
    53 public slots:
       
    54     
       
    55     void itemShown(const QModelIndex& item);
       
    56     
       
    57 private:
       
    58     
       
    59     void setupConnectionsToWrapper();
       
    60     
       
    61     void createBarringItems();
       
    62     CpSettingFormItemData *createBarringItem(
       
    63         const HbDataFormModelItem::DataItemType &itemType,
       
    64         const QString &label,
       
    65         const QString &widgetTextData,
       
    66         const PSetCallBarringWrapper::BarringType &barringType);
       
    67     
       
    68     void processBarringStatusRequestQueue();
       
    69     bool updateDependentBarringProgramStatuses(
       
    70         const CpSettingFormItemData &changedBarringItem);
       
    71     CpSettingFormItemData &barringItemByProgram(
       
    72         const PSetCallBarringWrapper::BarringType &barringProgram);
       
    73     void revertCheckStateOfItem(
       
    74         CpSettingFormItemData *barringItem);
       
    75     void updateCheckStateOfItem(
       
    76         CpSettingFormItemData &barringItem, 
       
    77         const Qt::CheckState &newState);
       
    78     
       
    79 private slots:
       
    80 
       
    81     void barringStatusRequestCompleted(
       
    82         int result,
       
    83         const QList<unsigned char> & basicServiceGroupIds,
       
    84         PSetCallBarringWrapper::BarringStatus status);
       
    85     
       
    86     void enableBarringRequestCompleted(
       
    87         int result,
       
    88         PSetCallBarringWrapper::BarringType barringType,
       
    89         PSetCallBarringWrapper::BarringStatus barringStatus, 
       
    90         bool plural);
       
    91 
       
    92     void disableBarringRequestCompleted(
       
    93         int result,
       
    94         PSetCallBarringWrapper::BarringType barringType,
       
    95         PSetCallBarringWrapper::BarringStatus barringStatus, 
       
    96         bool plural);
       
    97     
       
    98     void barringPasswordChangeRequestCompleted(int result);
       
    99     
       
   100     void changeBarringStateRequested(int checkState);
       
   101     
       
   102     void changeBarringPasswordRequested(bool checked = false);
       
   103     
       
   104     void completeBarringStateChangeRequestHandling(
       
   105             QString barringPassword,
       
   106             bool okPressed);
       
   107     
       
   108     void changeBarringPasswordPhasesHandling(
       
   109             QString barringPassword,
       
   110             bool okPressed);
       
   111     
       
   112 private: 
       
   113     
       
   114     CpItemDataHelper &m_helper;
       
   115     QScopedPointer<PSetWrapper> m_pSetWrapper;
       
   116     PSetCallBarringWrapper *m_barringWrapper;
       
   117     CpSettingFormItemData *m_editBarringPasswordItem;
       
   118     QQueue<CpSettingFormItemData *> m_barringRequestQueue;
       
   119     bool m_barringStatusRequestOngoing;
       
   120     int m_activeNoteId;
       
   121     CpPhoneNotes* m_phoneNotes;
       
   122     QValidator *m_barringPasswordValidator;
       
   123     bool m_delayedBarringActivationNote;
       
   124     CpSettingFormItemData* m_clickedBarringItem; // Not own.
       
   125     ChangeBarringPasswordPhase m_changeBarringPasswordPhase;
       
   126     QString m_currentPassword;
       
   127     QString m_newPassword;
       
   128     QString m_newPasswordVerified;
       
   129     QValidator* m_verifyPasswordValidator; // Own.
       
   130     HbDataFormModel* m_model;
       
   131 };
       
   132 
       
   133 #endif // CPBARRINGPLUGINGROUP_H