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