ipsservices/ipssossettings/inc/ipssetuinotes.h
changeset 0 8466d47a6819
equal deleted inserted replaced
-1:000000000000 0:8466d47a6819
       
     1 /*
       
     2 * Copyright (c) 2007 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:  Defines class, which controls the note behavior.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef IPSSETUINOTES_H
       
    20 #define IPSSETUINOTES_H
       
    21 
       
    22 
       
    23 #include <AknQueryDialog.h>
       
    24 
       
    25 #include "ipssetutilsconsts.h"
       
    26 
       
    27 /**
       
    28  * Supported note types.
       
    29  */
       
    30 enum TIpsSetUiNotes
       
    31     {
       
    32     EIpsSetUiConfirmationNote = 0,
       
    33     EIpsSetUiInformationNote,
       
    34     EIpsSetUiErrorNote,
       
    35     EIpsSetUiWarningNote
       
    36     };
       
    37 
       
    38 class CIpsSetUi;
       
    39 class CIpsSetUiItem;
       
    40 
       
    41 /**
       
    42  *  Controller for notes in settings ui.
       
    43  *
       
    44  *  @lib IpsSosSettings.lib
       
    45  *  @since FS v1.0
       
    46  */
       
    47 class CIpsSetUiNotes : public CBase
       
    48     {
       
    49 public:  // Constructors and destructor
       
    50 
       
    51     /**
       
    52      * Creates object from CIpsSetUiNotes and leaves it to cleanup stack
       
    53      * @return, Constructed object
       
    54      */
       
    55     static CIpsSetUiNotes* NewLC();
       
    56 
       
    57     /**
       
    58      * Create object from CIpsSetUiNotes
       
    59      * @return, Constructed object
       
    60      */
       
    61     static CIpsSetUiNotes* NewL();
       
    62 
       
    63     /**
       
    64      * Destructor
       
    65      */
       
    66     virtual ~CIpsSetUiNotes();
       
    67 
       
    68 public: // New functions
       
    69 
       
    70     /**
       
    71      * Shows the query for user and waits for user answer.
       
    72      *
       
    73      * @param aTextResource Resource string, that shall be shown in note
       
    74      * @param aDialogResource ResourceId of dialog, which shall be used
       
    75      *        Locate the resource dialogs from emailutils.ra
       
    76      * @param aTone Tone to be played with query
       
    77      *        Class CAknQueryDialog defines the TTone type, which contains
       
    78      *        following enumerations:
       
    79      *           - ENoTone
       
    80      *           - EConfirmationTone
       
    81      *           - EWarningTone
       
    82      *           - EErrorTone
       
    83      *        Example usage: CAknQueryDialog::EConfirmationTone
       
    84      * @return Command returned from the query
       
    85      */
       
    86     static TInt ShowQueryL(
       
    87         const TUint aTextResource,
       
    88         const TInt  aDialogResource,
       
    89         const CAknQueryDialog::TTone aTone = CAknQueryDialog::ENoTone );
       
    90 
       
    91     static TInt ShowQueryL(
       
    92         const TDesC& aText,
       
    93         const TInt  aDialogResource,
       
    94         const CAknQueryDialog::TTone aTone = CAknQueryDialog::ENoTone );
       
    95 
       
    96     /**
       
    97      * This function fetches the text from given resource file and shows
       
    98      * the string found from it in small note box.
       
    99      * More info in file aknnotewrappers.h
       
   100      *
       
   101      * @param aNoteType Type of note to be shown
       
   102      *        Avkon offers several type of notes, which differs from each
       
   103      *        other. There are following types of notes available:
       
   104      *           - EMsvConfirmationNote
       
   105      *           - EMsvInformationNote
       
   106      *           - EMsvErrorNote
       
   107      *           - EMsvWarningNote
       
   108      * @param aNoteWaiting Parameter to create the note
       
   109      *        When parameter is TRUE, created note will be waitnote
       
   110      *        When parameter is FALSE, note is not waitnote
       
   111      * @param aResource Resource string, that shall be shown in note
       
   112      * @param aFile File, from the string shall be read
       
   113      */
       
   114     static void ShowNoteL(
       
   115         const TUint      aResource,
       
   116         const TIpsSetUiNotes& aNoteType = EIpsSetUiErrorNote,
       
   117         const TBool      aNoteWaiting = EFalse );
       
   118 
       
   119     static void ShowNoteL(
       
   120         const TDesC&      aText,
       
   121         const TIpsSetUiNotes& aNoteType = EIpsSetUiErrorNote,
       
   122         const TBool      aNoteWaiting = EFalse );
       
   123 
       
   124     /**
       
   125      * Creates a string from resource using string loader.
       
   126      *
       
   127      * @param aTextResource Resource which contains the text.
       
   128      * @return String allocated in heap. Caller owns.
       
   129      */
       
   130     static HBufC* MakeStringLC( const TUint aTextResource );
       
   131 
       
   132     /**
       
   133      * Creates string from resource and includes the value in to the text.
       
   134      *
       
   135      * @param aTextResource Resource which contains the text.
       
   136      * @param aValue which contains the number.
       
   137      * @return Formatted string.
       
   138      */
       
   139     static TIpsSetUtilsTextPlain MakeString(
       
   140         const TUint aTextResource,
       
   141         const TInt aValue );
       
   142 
       
   143     /**
       
   144      * Creates string from resource and includes the string in to the text.
       
   145      *
       
   146      * @param aTextResource Resource which contains the text.
       
   147      * @param aText Text to be included in the string.
       
   148      * @return Formatted string.
       
   149      */
       
   150     static TIpsSetUtilsTextPlain MakeString(
       
   151         const TUint aTextResource,
       
   152         const TDesC& aText );
       
   153 
       
   154     /**
       
   155      * Shows the dialog to user.
       
   156      *
       
   157      * @param aBaseItem Item being edited.
       
   158      * @param aError Error identified from the user input.
       
   159      * @param Text that should be shown.
       
   160      * @return User input to dialog.
       
   161      */
       
   162     TIpsSetUiEventResult ShowDialog(
       
   163         const CIpsSetUiItem& aBaseItem,
       
   164         const TIpsSetUiNoteErrors aError,
       
   165         const TDesC& aNewText );
       
   166 
       
   167 protected:  // Constructors
       
   168 
       
   169     /**
       
   170      * Default constructor for classCIpsSetUiNotes
       
   171      *
       
   172      * @return, Constructed object
       
   173      */
       
   174     CIpsSetUiNotes();
       
   175 
       
   176     /**
       
   177      * Symbian 2-phase constructor
       
   178      */
       
   179     void ConstructL();
       
   180 
       
   181 private:  // New functions
       
   182 
       
   183     /**
       
   184      * Displays email address error note on screen.
       
   185      *
       
   186      * @param aError Type of error.
       
   187      * @return User action.
       
   188      */
       
   189     TIpsSetUiEventResult ShowEmailAddressErrorNoteL(
       
   190         const TIpsSetUiNoteErrors aError );
       
   191 
       
   192     /**
       
   193      * Displays server address error note on screen.
       
   194      *
       
   195      * @param aError Type of error.
       
   196      * @return User action.
       
   197      */
       
   198     TIpsSetUiEventResult ShowServerErrorNoteL(
       
   199         const TIpsSetUiNoteErrors aError );
       
   200 
       
   201     };
       
   202 
       
   203 #endif /* IPSSETUINOTES_H */