phonesettings/cpphonesettingsplugins/divertplugin/src/cpdivertplugingroup.h
changeset 21 92ab7f8d0eab
child 27 2f8f8080a020
equal deleted inserted replaced
4:c84cf270c54f 21:92ab7f8d0eab
       
     1 /*
       
     2  * Copyright (c) 2009 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 CPDIVERTPLUGINGROUP_H
       
    18 #define CPDIVERTPLUGINGROUP_H
       
    19 
       
    20 #include <QMap>
       
    21 #include <QString>
       
    22 #include <QQueue>
       
    23 #include <hbdevicemessagebox.h>
       
    24 #include <cpsettingformitemdata.h>
       
    25 #include <psetcalldivertingwrapper.h>
       
    26 #include "cptelephonyutilsdefs.h"
       
    27 #include "cppluginlogging.h"
       
    28 
       
    29 
       
    30 class HbDataFormViewItem; 
       
    31 class PSetWrapper;
       
    32 class SsSettingsWrapper;
       
    33 class HbComboBox;
       
    34 class PSCallDivertingCommand;
       
    35 class HbListWidget;
       
    36 class CpDivertItemData;
       
    37 
       
    38 using namespace CpTelephonyUtils;
       
    39 
       
    40 /*!
       
    41     \class CpDivertPluginGroup
       
    42     \brief The class CpDivertPluginGroup defines items shown on UI. 
       
    43  */
       
    44 class CpDivertPluginGroup : public CpSettingFormItemData
       
    45 {
       
    46     Q_OBJECT
       
    47 
       
    48     enum DivertRequest{
       
    49         ActivateDivert = 0, 
       
    50         DeactivateDivert, 
       
    51         CheckDivertStatus
       
    52     };  
       
    53 
       
    54     class CpDivertRequestQueueItem
       
    55     {
       
    56     public:
       
    57         DivertRequest request;
       
    58         CpDivertItemData *item;
       
    59     };
       
    60     
       
    61     
       
    62 public:
       
    63 
       
    64     explicit CpDivertPluginGroup(CpItemDataHelper &helper);
       
    65     
       
    66     ~CpDivertPluginGroup();
       
    67 
       
    68 public slots:
       
    69     
       
    70     // PSetCallDivertingWrapper signal handling
       
    71     /**
       
    72      Set info request results
       
    73      */
       
    74     void handleDivertingChanged(
       
    75             const PSCallDivertingCommand& aSetting, 
       
    76             bool aPlural);
       
    77     
       
    78     /**
       
    79      Get info request results
       
    80      */
       
    81     void handleDivertingStatus(
       
    82         QList<PSCallDivertingStatus*>& divertList, 
       
    83         bool plural);
       
    84     
       
    85     /**
       
    86      Request failed.
       
    87      */
       
    88     void handleDivertingError(int aReason);
       
    89 
       
    90     /**
       
    91      Adaptation has handled previous request.
       
    92      */
       
    93     void divertRequestProcessed();
       
    94     
       
    95     /**
       
    96      Slot which handles change requests according UI.
       
    97      */
       
    98     void changeDivertingStateRequested(CpDivertItemData &item);
       
    99 
       
   100     /**
       
   101      Slot which handles item updating when it is needed.
       
   102      */
       
   103     void itemShown(const QModelIndex& item);
       
   104 private:     
       
   105     
       
   106     /**
       
   107      Creates group items.
       
   108      */
       
   109     void createVoiceCallItems();
       
   110 
       
   111     /**
       
   112      Creates group items.
       
   113      */
       
   114     void createVideoCallItems();
       
   115     
       
   116     /**
       
   117      Creates group items.
       
   118      */
       
   119     void createVoIPCallItems();
       
   120     
       
   121     /**
       
   122      Show to user divert number query list.
       
   123      */
       
   124     bool popUpVoiceNumberListQuery(
       
   125             const QString& heading, QString& result);
       
   126     
       
   127     /**
       
   128      Show to user number query.
       
   129      */
       
   130     bool popUpNumberEditor(
       
   131             const QString& heading, QString& result);
       
   132     
       
   133     
       
   134     /**
       
   135      Send comand to psetwrappercalldiverting.
       
   136      */
       
   137     void setCallDiverting(PSCallDivertingCommand& command);
       
   138     
       
   139     /**
       
   140      Show to user divert time out query list.
       
   141      */
       
   142     bool popUpTimerQuery(int &timeout) const;
       
   143     
       
   144     /**
       
   145      Desides which bsc parameters to use.
       
   146      */
       
   147     int bscParam();
       
   148     
       
   149     /**
       
   150      Adds divert data item for wanted parent.
       
   151      */
       
   152     void addDivertDataItem(CpDivertItemData* item, CpSettingFormItemData *parent);
       
   153 
       
   154     /**
       
   155      Process next divert request.
       
   156      */
       
   157     void processDivertingRequestQueue();
       
   158 
       
   159     /**
       
   160      Add new request to divert queue.
       
   161      */
       
   162     void addToDivertingRequestQueue(
       
   163             DivertRequest request, 
       
   164             CpDivertItemData &item);
       
   165     
       
   166     /**
       
   167      Changes divertItemData data.
       
   168      */
       
   169     void changeItemData(
       
   170             PsCallDivertingCondition condition, 
       
   171             PsCallDivertingStatus status,
       
   172             const QString& number, 
       
   173             int timeout);
       
   174     
       
   175     /**
       
   176      Reverts divertItemData data to the last known valid values.
       
   177      */
       
   178     void revertItemData(PsCallDivertingCondition condition);
       
   179 
       
   180 private:
       
   181     
       
   182     /**
       
   183      Creates dialog with default parameters
       
   184      */
       
   185     HbDialog* createDialog( const QString& heading ) const;
       
   186 
       
   187     /**
       
   188      Adds item to given list widget
       
   189      */
       
   190     void addItemToListWidget(HbListWidget* w,
       
   191         const QString& item, const QString& data) const;
       
   192 
       
   193     /**
       
   194      Adds item to given list widget
       
   195      */
       
   196     void addItemToListWidget(HbListWidget* w,
       
   197         const QString& item, const int& data) const;
       
   198 
       
   199     /**
       
   200      Synchronizes content and status of divert options dependent from the 
       
   201      status of some other divert.
       
   202      */
       
   203     void updateDependentDivertOptions();
       
   204     
       
   205     /**
       
   206      Synchronizes content and status of not available divert option based on
       
   207      statuses of CFB, CFNry and CFNrc.
       
   208      */
       
   209     void updateNotAvailableDivertOption();
       
   210     
       
   211 private:   // data
       
   212 
       
   213     // Setting wrappers 
       
   214     PSetWrapper *m_pSetWrapper;
       
   215     SsSettingsWrapper *m_ssSettingsWrapper;
       
   216     
       
   217     // Not own
       
   218     PSetCallDivertingWrapper* m_callDivertingWrapper;
       
   219 
       
   220     // Not owned objects
       
   221     CpSettingFormItemData *m_csVoiceCallPage;
       
   222     CpDivertItemData *m_DataItemAllVoiceCalls;
       
   223     CpDivertItemData *m_DataItemIfBusy;
       
   224     CpDivertItemData *m_DataItemIfNotAnswered;
       
   225     CpDivertItemData *m_DataItemIfOutOfReach;
       
   226     CpDivertItemData *m_DataItemIfNotAvailable;
       
   227     int m_activeNoteId;
       
   228     int m_activeProgressNoteId;
       
   229 
       
   230     // To prevent adding vmbx number to defaultlist
       
   231     bool m_divertToVoiceMailBox;
       
   232 
       
   233     /**
       
   234      Divert request queue
       
   235      */
       
   236     QQueue<CpDivertRequestQueueItem> m_divertRequestQueue;
       
   237 
       
   238     CpItemDataHelper &m_helper;
       
   239 };
       
   240 
       
   241 #endif // CPDIVERTPLUGINGROUP_H
       
   242 
       
   243 // end of file