phonesettings/cpphonesettingsplugins/cptelephonyutils/inc/cpphonenotes.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 CPPHONENOTES_H
       
    18 #define CPPHONENOTES_H
       
    19 
       
    20 #include <QObject>
       
    21 #include <QString>
       
    22 #include <QQueue>
       
    23 #include <hbmessagebox.h>
       
    24 #include <psetcalldivertingwrapper.h>
       
    25 #include "cptelephonyutilsdefs.h"
       
    26 
       
    27 class CpSettingsWrapper;
       
    28 
       
    29 using namespace CpTelephonyUtils;
       
    30 
       
    31 class CPTELEPHONYUTILS_EXPORT CpPhoneNotes: public QObject
       
    32 {
       
    33     Q_OBJECT
       
    34     
       
    35 public:
       
    36 
       
    37     static CpPhoneNotes* instance();
       
    38     
       
    39 private: 
       
    40     
       
    41     CpPhoneNotes();
       
    42     
       
    43     ~CpPhoneNotes();
       
    44 
       
    45     Q_DISABLE_COPY(CpPhoneNotes)
       
    46     
       
    47 signals:
       
    48     
       
    49     /**
       
    50      This signal is emitted when the device progress dialog is cancelled by 
       
    51      user pressing the "cancel" button or by the application itself.
       
    52      @param     noteId      On return contains unique note identifier.
       
    53      */
       
    54     void progressNoteCanceled();
       
    55     
       
    56 public slots: // Slots: 
       
    57     
       
    58     /**
       
    59      Shows global progress note. Note showing may be delayed if other note 
       
    60      showing is ongoing. 
       
    61      @param     noteId      On return contains unique note identifier.
       
    62      @param     text        Text to show on a note.
       
    63      */
       
    64     void showGlobalProgressNote(int &noteId, const QString& text);
       
    65     
       
    66     /**
       
    67      Shows global note. Note showing may be delayed if other note 
       
    68      showing is ongoing. 
       
    69      @param     noteId      On return contains unique note identifier.
       
    70      @param     text        Text to show on a note.
       
    71      @param     noteType    Note type.
       
    72      */
       
    73     void showGlobalNote(int &noteId, const QString& text, 
       
    74         HbMessageBox::MessageBoxType noteType);
       
    75     
       
    76     /**
       
    77      Shows global error note. Note showing may be delayed if other note 
       
    78      showing is ongoing. 
       
    79      @param     noteId      On return contains unique note identifier.
       
    80      @param     errorCode   Code specifying error situation. 
       
    81      */
       
    82     void showGlobalErrorNote(int &noteId, int errorCode);
       
    83     
       
    84     /**
       
    85      Shows the basic service list.
       
    86      @param     title                   Heading to be used for the list.
       
    87      @param     basicServiceGroupIds    Basic services to be listed. 
       
    88      */
       
    89     void showBasicServiceList(
       
    90         const QString &title, 
       
    91         const QList<unsigned char> &basicServiceGroupIds);
       
    92     
       
    93     /**
       
    94      Shows the basic service list associated with the call divert status check.
       
    95      @param     title               Heading for the service list.
       
    96      @param     divertStatuses      Divert status information to show.
       
    97      @param     selectionIndex      User selected item on divert statuses list.
       
    98      @param     divertType          Divert type specifying what kind of 
       
    99      divert details user is able to request on divert service group.
       
   100      @param     divertDetailType    On return contains info about what kind
       
   101      of call divert detail user wants to know about selected divert service 
       
   102      group. 
       
   103      */
       
   104     void showBasicServiceCallDivertList(
       
   105         const QString &title, 
       
   106         const QList<PSCallDivertingStatus*> &divertStatuses,
       
   107         int &selectionIndex,
       
   108         CallDivertType divertType,
       
   109         CallDivertType &divertDetailType);
       
   110     
       
   111     /**
       
   112      Shows detailed call divert information about the selected divert service
       
   113      group.
       
   114      @param     divertStatus    Divert status information.
       
   115      */
       
   116     void showCallDivertDetails(
       
   117         const PSCallDivertingStatus &divertStatus);
       
   118     
       
   119     /**
       
   120      Cancels specified note.
       
   121      @param     noteId      Note identifier.
       
   122      */
       
   123     void cancelNote(int noteId);
       
   124     
       
   125     /**
       
   126      Retuns true if note is currently shown.
       
   127      */
       
   128     bool noteShowing();
       
   129     
       
   130 private slots:
       
   131     
       
   132     /**
       
   133      Handler method for notes' about to close signal.
       
   134      */
       
   135     void activeNoteAboutToClose();
       
   136     
       
   137     /**
       
   138      Handler method for notes' canceled signal.
       
   139      */
       
   140     void handleProgressNoteCanceled();
       
   141 
       
   142 private:
       
   143     
       
   144     /**
       
   145      Resolves basic service group name by identifier.
       
   146      @param     basicServiceGroupId     Group identifier.
       
   147      @return    Group name.
       
   148      */
       
   149     QString basicServiceGroupName(BasicServiceGroups basicServiceGroupId) const;
       
   150     
       
   151     /**
       
   152      Converts etel mobile service code into basic service group enumeration.
       
   153      @param     serviceCode     Etel mobilde service code.
       
   154      */
       
   155     BasicServiceGroups convertEtelMobileServiceCode(int serviceCode) const;
       
   156     
       
   157     /**
       
   158      Formats phone number according to locale specific rules.
       
   159      @param     number          Unformatted phone number.
       
   160      @return    Formatted number.
       
   161      */
       
   162     QString formatPhoneNumber(QString number) const;
       
   163     
       
   164     /**
       
   165      Launches next note in the queue if not busy with showing other 
       
   166      note currently.
       
   167      */
       
   168     void launchNextNoteIfReady();
       
   169     
       
   170 private: // Data: 
       
   171 
       
   172     /**
       
   173       Cenrep settings wrapper.
       
   174      */
       
   175      CpSettingsWrapper *m_cpSettingsWrapper;
       
   176 
       
   177     /**
       
   178       Notes waiting to be shown.
       
   179      */
       
   180     QQueue<QObject*> *m_notesQueue;
       
   181     
       
   182     /**
       
   183       Indicates whether note controller is busy with some note showing.
       
   184      */
       
   185     bool m_isNoteShowingOngoing;
       
   186 
       
   187 };
       
   188 #endif // CPPHONENOTES_H