phonesettings/cpphonesettingsplugins/cptelephonyutils/inc/cpphonenotes.h
changeset 50 377c906a8701
parent 46 bc5a64e5bc3c
child 52 a49bfe5190e4
equal deleted inserted replaced
46:bc5a64e5bc3c 50:377c906a8701
     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 class HbInputDialog;
       
    29 class QValidator;
       
    30 
       
    31 using namespace CpTelephonyUtils;
       
    32 
       
    33 class CPTELEPHONYUTILS_EXPORT CpPhoneNotes: public QObject
       
    34 {
       
    35     Q_OBJECT
       
    36     
       
    37 public:
       
    38 
       
    39     static CpPhoneNotes* instance();
       
    40     
       
    41 private: 
       
    42     
       
    43     CpPhoneNotes();
       
    44     
       
    45     ~CpPhoneNotes();
       
    46 
       
    47     Q_DISABLE_COPY(CpPhoneNotes)
       
    48     
       
    49 signals:
       
    50     
       
    51     /**
       
    52      This signal is emitted when the device progress dialog is cancelled by 
       
    53      user pressing the "cancel" button or by the application itself.
       
    54      @param     noteId      On return contains unique note identifier.
       
    55      */
       
    56     void progressNoteCanceled();
       
    57     
       
    58     /**
       
    59      This signal is emitted when the user coplete password query.
       
    60      @param password            On return contains user given password.
       
    61      @param ok                  True if the user pressed OK, false if the user 
       
    62                                 pressed Cancel.
       
    63      */
       
    64     void passwordQueryCompleted(
       
    65         QString password,
       
    66         bool okPressed);
       
    67     
       
    68 public slots: // Slots: 
       
    69     
       
    70     /**
       
    71      Shows global progress note. Note showing may be delayed if other note 
       
    72      showing is ongoing. 
       
    73      @param     noteId      On return contains unique note identifier.
       
    74      @param     text        Text to show on a note.
       
    75      */
       
    76     void showGlobalProgressNote(int &noteId, const QString& text);
       
    77     
       
    78     /**
       
    79      Shows global note. Note showing may be delayed if other note 
       
    80      showing is ongoing. 
       
    81      @param     noteId      On return contains unique note identifier.
       
    82      @param     text        Text to show on a note.
       
    83      @param     noteType    Note type.
       
    84      */
       
    85     void showGlobalNote(int &noteId, const QString& text, 
       
    86         HbMessageBox::MessageBoxType noteType);
       
    87     
       
    88     /**
       
    89      Shows global error note. Note showing may be delayed if other note 
       
    90      showing is ongoing. 
       
    91      @param     noteId      On return contains unique note identifier.
       
    92      @param     errorCode   Code specifying error situation. 
       
    93      */
       
    94     void showGlobalErrorNote(int &noteId, int errorCode);
       
    95     
       
    96     
       
    97     /**
       
    98      Shows detailed call divert information about the selected divert service
       
    99      group.
       
   100      @param     divertStatus    Divert status information.
       
   101      */
       
   102     void showCallDivertDetails(
       
   103         const PSCallDivertingStatus &divertStatus);
       
   104     
       
   105     /**
       
   106      Shows password query dialog with OK & Cancel buttons and returns user
       
   107      given password unless user has canceled query. Only valid password is
       
   108      accepted.
       
   109      @param title               Title for the query dialog.
       
   110      @param validator           Password validator.
       
   111      @param maxPasswordLength   Maximum length for the password.
       
   112      */
       
   113     void showPasswordQueryDialog(
       
   114         const QString &title,
       
   115         const QValidator &validator,
       
   116         int maxPasswordLength);
       
   117     
       
   118     /**
       
   119      Cancels specified note.
       
   120      @param     noteId      Note identifier.
       
   121      */
       
   122     void cancelNote(int noteId);
       
   123     
       
   124     /**
       
   125      Retuns true if note is currently shown.
       
   126      */
       
   127     bool noteShowing();
       
   128     
       
   129     /**
       
   130      Slot for HbDialog finished singal.
       
   131      */
       
   132     void finishedPasswordQueryDialog(HbAction* action);
       
   133 
       
   134     /**
       
   135      Shows notification dialog. 
       
   136      @param     text        Text to show on a dialog.
       
   137      */
       
   138     void showNotificationDialog(const QString& text);
       
   139 
       
   140 private:
       
   141     
       
   142     /**
       
   143      Formats phone number according to locale specific rules.
       
   144      @param     number          Unformatted phone number.
       
   145      @return    Formatted number.
       
   146      */
       
   147     QString formatPhoneNumber(QString number) const;
       
   148     
       
   149     /**
       
   150      Launches next note in the queue if not busy with showing other 
       
   151      note currently.
       
   152      */
       
   153     void launchNextNoteIfReady();
       
   154 
       
   155 private slots:
       
   156     
       
   157     /**
       
   158      Handler method for notes' about to close signal.
       
   159      */
       
   160     void activeNoteAboutToClose();
       
   161     
       
   162     /**
       
   163      Handler method for notes' canceled signal.
       
   164      */
       
   165     void handleProgressNoteCanceled();
       
   166     
       
   167     /**
       
   168      Used for dynamic enable/disable of password dialog's OK button according
       
   169      to validity of the currently inputted password.
       
   170      */
       
   171     void passwordTextChanged();
       
   172     
       
   173 private: // Data: 
       
   174 
       
   175     /**
       
   176       Cenrep settings wrapper.
       
   177      */
       
   178      CpSettingsWrapper *m_cpSettingsWrapper;
       
   179 
       
   180     /**
       
   181       Notes waiting to be shown.
       
   182      */
       
   183     QQueue<QObject*> *m_notesQueue;
       
   184     
       
   185     /**
       
   186       Indicates whether note controller is busy with some note showing.
       
   187      */
       
   188     bool m_isNoteShowingOngoing;
       
   189     
       
   190     /**
       
   191       Password query dialog. Own.
       
   192      */
       
   193     HbInputDialog *m_passwordDialog;
       
   194 
       
   195     /**
       
   196       Password validator. Not own.
       
   197      */
       
   198     const QValidator *m_passwordValidator;
       
   199 };
       
   200 #endif // CPPHONENOTES_H