messagingappbase/smartmessaging/msgeditorutils/inc/MsgBioUtils.h
changeset 0 72b543305e3a
equal deleted inserted replaced
-1:000000000000 0:72b543305e3a
       
     1 /*
       
     2 * Copyright (c) 2002-2006 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:   Class offers helper methods for BIO controls
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 #ifndef MSGBIOUTILS_H
       
    21 #define MSGBIOUTILS_H
       
    22 
       
    23 #include <e32std.h>
       
    24 
       
    25 /**
       
    26 * Class offers static helper methods for all the biocontrols.
       
    27 */
       
    28 class MsgBioUtils
       
    29     {
       
    30     public:
       
    31 
       
    32         /**
       
    33          * Pops a CAknTextQueryDialog. It will leave with KLeaveWithoutAlert
       
    34          * if the user cancels the query.
       
    35          * Your resource must be loaded first.
       
    36          * @param aResource The query resource ID.
       
    37          * @param aText Reference to a descriptor which will get the input.
       
    38          * @exception Cancelling the query results in a leave.
       
    39          */
       
    40         IMPORT_C static void TextQueryL(TInt aQueryResource, TDes& aText);
       
    41 
       
    42         /**
       
    43          * An error note is popped.
       
    44          * The standard resource must have been loaded using
       
    45          * LoadStandardBioResourceL().
       
    46          * @param aText The error text.
       
    47          */
       
    48         IMPORT_C static void ErrorNoteL(const TDesC& aText);
       
    49 
       
    50         /**
       
    51          * An error note is popped.
       
    52          * The standard resource must have been loaded using
       
    53          * LoadStandardBioResourceL(). Your resource must also be loaded, for
       
    54          * eg. with LoadResourceL().
       
    55          * @param aStringResource The string resource id.
       
    56          */
       
    57         IMPORT_C static void ErrorNoteL(TInt aStringResource);
       
    58 
       
    59         /**
       
    60          * A confirmation note is popped.
       
    61          * @param aText The confirmation text.
       
    62          */
       
    63         IMPORT_C static void ConfirmationNoteL(const TDesC& aText);
       
    64 
       
    65         /**
       
    66          * A confirmation note is popped.
       
    67          * Your resource must be loaded, for eg. with LoadResourceL().
       
    68          * CCoeEnv must exist.
       
    69          * @param aStringResource The string resource id.
       
    70          */
       
    71         IMPORT_C static void ConfirmationNoteL(TInt aStringResource);
       
    72 
       
    73         /**
       
    74          * An information note is popped.
       
    75          * The standard resource must have been loaded using
       
    76          * LoadStandardBioResourceL().
       
    77          * @param aText The information text.
       
    78          */
       
    79         IMPORT_C static void InformationNoteL(const TDesC& aText);
       
    80 
       
    81         /**
       
    82          * An information note is popped.
       
    83          * The standard resource must have been loaded using
       
    84          * LoadStandardBioResourceL(). Your resource must also be loaded, for
       
    85          * eg. with LoadResourceL().
       
    86          * @param aStringResource The string resource id.
       
    87          */
       
    88         IMPORT_C static void InformationNoteL(TInt aStringResource);
       
    89 
       
    90         /**
       
    91          * This helper function increments the number at the end of the
       
    92          * string according to the standard way (Folders).
       
    93          * If the descriptors max length is not enough, text is clipped away
       
    94          * from the end before adding the number.
       
    95          * The max length is given as the second parameter
       
    96          * @param aText Reference to the descriptor which is to be modified.
       
    97          * @param aMaxLength Maximum length that this descriptor can grow to
       
    98          * @exception Panics if the descriptor length is zero.
       
    99          */
       
   100         IMPORT_C static void IncrementNameL(TDes& aText, TInt aMaxLength);
       
   101 
       
   102         /**
       
   103         * Checks the given ip address validity.
       
   104         * @param aIP String to be checked.
       
   105         * @return ETrue if the string is a valid IP address, EFalse otherwise.
       
   106         */
       
   107         IMPORT_C static TBool CheckIP( const TDesC& aIP );
       
   108 
       
   109         /**
       
   110         * Checks the given URL validity.
       
   111         * @param aUrl String to be checked.
       
   112         * @return ETrue if the string is a valid URL, EFalse otherwise.
       
   113         */
       
   114         IMPORT_C static TBool CheckURL( const TDesC& aUrl );
       
   115         
       
   116         /**
       
   117          * Pops a confirmation query. The result is given by the return value.
       
   118          * The msgeditorutils.rsc resource must be loaded, for eg. using
       
   119          * LoadStandardBioResourceL().
       
   120          * @param aText The text that is to be used in the query.
       
   121          * @return A user confirmation results in ETrue, and vice versa.
       
   122          */
       
   123         IMPORT_C static TBool ConfirmationQueryOkCancelL(const TDesC& aText);
       
   124 
       
   125         /**
       
   126          * Pops a confirmation query. The result is given by the return value.
       
   127          * The msgeditorutils.rsc resource must be loaded, for eg. using
       
   128          * LoadStandardBioResourceL().
       
   129          * @param aStringResource The string resource id.
       
   130          * @return A user confirmation results in ETrue, and vice versa.
       
   131          */
       
   132         IMPORT_C static TBool ConfirmationQueryOkCancelL(TInt aStringResource);
       
   133 
       
   134     private:
       
   135 
       
   136         /**
       
   137         * Get the tokenized value from the given string.
       
   138         * @param aIP string where the value is searched.
       
   139         * @param aDelimiter character, which separates the values.
       
   140         * @param aStartIndex defines the position from where the value is checked.
       
   141         * @param aValue the found value is converted to the numeric form 
       
   142         * and set to this value.
       
   143         * @return ETrue if tokenized value was found and conversion to the numeric value
       
   144         * was successfull.
       
   145         */
       
   146         static TBool GetTokenizedValue( const TDesC& aIP, 
       
   147             const TChar aDelimiter,
       
   148             TInt& aStartIndex, 
       
   149             TInt& aValue );
       
   150 
       
   151     private:
       
   152         friend class T_MsgEditorUtilsGeneralTests;
       
   153     };
       
   154 
       
   155 #endif // MSGBIOCONTROL_H
       
   156 
       
   157 // End of file