vmbx/vmbxengine/inc/voicemailboximpl.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-2010 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:  Implementation class for voice mailbox
       
    15 *  Interface   : Private, CVoiceMailboxImpl
       
    16 *
       
    17 */
       
    18 
       
    19 #ifndef C_VOICEMAILBOXIMPL_H
       
    20 #define C_VOICEMAILBOXIMPL_H
       
    21 
       
    22 
       
    23 // INCLUDES
       
    24 #include <e32base.h>
       
    25 #include <cvoicemailbox.h>
       
    26 #include "mvmbxchangeobserver.h"
       
    27 #include "mvoicemailboxobserver.h"
       
    28 #include "mvmbxresourceprovider.h"
       
    29 #include "mvmbxuiutilities.h"
       
    30 #include "mvmbxcenrephandler.h"
       
    31 
       
    32 // FORWARD DECLARATIONS
       
    33 class CVmbxUiUtilities;
       
    34 class CVmbxEngineFactory;
       
    35 class CVmbxObserver;
       
    36 class CVmbxCenRepHandler;
       
    37 
       
    38 // CLASS DECLARATION
       
    39 
       
    40 /**
       
    41 *  Implemets mailbox entry base class functionality
       
    42 *
       
    43 *  @lib vmbxengine.lib
       
    44 */
       
    45 NONSHARABLE_CLASS( CVoiceMailboxImpl ) : public CBase,
       
    46                          public MVmbxChangeObserver,
       
    47                          public MVmbxResourceProvider
       
    48     {
       
    49 
       
    50 public:  // Constructors and destructor
       
    51 
       
    52     /**
       
    53      * Two-phased constructor
       
    54      */
       
    55     static CVoiceMailboxImpl* NewL();
       
    56 
       
    57     /**
       
    58      * Two-phased constructor
       
    59      */
       
    60     static CVoiceMailboxImpl* NewLC();
       
    61 
       
    62     /**
       
    63      * Destructor.
       
    64      */
       
    65     virtual ~CVoiceMailboxImpl();
       
    66 
       
    67 public: // New functions
       
    68 
       
    69     /**
       
    70      * see CVoiceMailbox::GetStoredEntry
       
    71      * 
       
    72      */
       
    73     TInt GetStoredEntry( const TVoiceMailboxParams& aParams,
       
    74                                     CVoiceMailboxEntry*& aEntry ) const;
       
    75 
       
    76     /**
       
    77      * see CVoiceMailbox::SaveEntry
       
    78      * 
       
    79      */
       
    80     TInt SaveEntry( const CVoiceMailboxEntry& aEntry );
       
    81 
       
    82     /**
       
    83      * see CVoiceMailbox::QueryNewEntry
       
    84      * 
       
    85      */
       
    86     TInt QueryNewEntry( const TVoiceMailboxParams& aParams,
       
    87                                         CVoiceMailboxEntry*& aEntry );
       
    88 
       
    89     /**
       
    90      * see CVoiceMailbox::QueryChangeEntry
       
    91      * 
       
    92      */
       
    93     TInt QueryChangeEntry( const TVoiceMailboxParams& aParams,
       
    94                                     CVoiceMailboxEntry*& aEntry);
       
    95 
       
    96     /**
       
    97      * see CVoiceMailbox::QueryVmbxType
       
    98      * 
       
    99      */
       
   100     TInt QueryVmbxType( TVoiceMailboxParams& aParams );
       
   101 
       
   102     /**
       
   103      * see CVoiceMailbox::NotifyVmbxNumberChangeL
       
   104      * 
       
   105      */
       
   106     void NotifyVmbxNumberChangeL( MVoiceMailboxObserver& aObserver,
       
   107                                      const TBool aNotifyOnActiveLineOnly );
       
   108 
       
   109     /**
       
   110      * see CVoiceMailbox::NotifyVmbxNumberChangeCancel
       
   111      * 
       
   112      */
       
   113     void NotifyVmbxNumberChangeCancel();
       
   114 
       
   115     /**
       
   116      * see CVoiceMailbox::CheckConfiguration
       
   117      * 
       
   118      * @since S60 v5.2
       
   119      */
       
   120     TBool CheckConfiguration( const TVoiceMailboxParams& aParams,
       
   121                                  const TInt aFlags );
       
   122 
       
   123     /**
       
   124      * see CVoiceMailbox::GetServiceIds
       
   125      * 
       
   126      */
       
   127     TInt GetServiceIds( RIdArray& aProfileIds );
       
   128 
       
   129     /**
       
   130      * see CVoiceMailbox::GetVmbxImage
       
   131      * 
       
   132      */
       
   133     //CGulIcon* GetVmbxImage( const TVoiceMailboxParams& aParams );
       
   134 
       
   135     /**
       
   136      * see CVoiceMailbox::GetVmbxImages
       
   137      * 
       
   138      */
       
   139     //CArrayPtr<CGulIcon>* GetVmbxImages(
       
   140     //                        RArray<TVoiceMailboxParams>& aParams );
       
   141 
       
   142     /**
       
   143      * see CVoiceMailbox::SaveProvisionedEntry
       
   144      * 
       
   145      */
       
   146     TInt SaveProvisionedEntry( const CVoiceMailboxEntry& aEntry );
       
   147 
       
   148 
       
   149 public:  // From MVmbxChangeObserver
       
   150 
       
   151     /**
       
   152      * see MVmbxChangeObserver::SatRefreshL
       
   153      * 
       
   154      */
       
   155     void SatRefreshL();
       
   156 
       
   157     /**
       
   158      * see MVmbxChangeObserver::CenRepChangedL
       
   159      * 
       
   160      */
       
   161     void CenRepChangedL( TVmbxCenRepKey aId );
       
   162 
       
   163     /**
       
   164      * see MVmbxChangeObserver::SimStoreChangedL
       
   165      * 
       
   166      */
       
   167     void SimStoreChangedL();
       
   168 
       
   169 public:  // From MVmbxChangeObserver
       
   170 
       
   171     /**
       
   172      * Get Handler of VmbxUiUtilities
       
   173      *
       
   174      * @return Refereance of MVmbxUiUtilities
       
   175      */
       
   176     MVmbxUiUtilities& VmbxUiUtilities();
       
   177 
       
   178     /**
       
   179      * Get Handler of VmbxCenrepHandler
       
   180      *
       
   181      * @return Refereance of MVmbxCenrepHandler
       
   182      */
       
   183     MVmbxCenrepHandler& VmbxCenRepHandler();
       
   184 
       
   185 
       
   186 private: //New method
       
   187 
       
   188     /**
       
   189      * C++ default constructor.
       
   190      * 
       
   191      */
       
   192     CVoiceMailboxImpl();
       
   193 
       
   194     /**
       
   195      * ConstructL
       
   196      *
       
   197      */
       
   198     void ConstructL();
       
   199 
       
   200     /**
       
   201      * Retrieves voice mailbox entry for the specified service.
       
   202      * Leave - KErrNotFound if no entry available 
       
   203      *       - KErrArgument when illegal argument
       
   204      *       - Other system wide errors.
       
   205      *
       
   206      * @param in Params Service id and type of the mailbox for which
       
   207      *          a number/address should be defined.
       
   208      * @param out aEntry If successful, a new result container is
       
   209      *  created and ownership passed to the caller.
       
   210      */
       
   211     void GetStoredEntryL( const TVoiceMailboxParams& aParams,
       
   212                                     CVoiceMailboxEntry*& aEntry ) const;
       
   213 
       
   214     /**
       
   215      * Displays a query asking the user to define a mailbox number/address.
       
   216      * Returns the input which the user entered, but does not save it.
       
   217      * For that caller has to use SaveEntry().
       
   218      * This method may display related UI notes or queries.
       
   219      *
       
   220      * If editing for the specified mailbox service is not allowed, 
       
   221      * this method displays an error note and returns an error.
       
   222      * If client is interested, CheckConfiguration()
       
   223      * can be used to check permissions.
       
   224      *
       
   225      *  Leave  - KErrNotFound if the number is not defined
       
   226      *                        (user entered no number or selected Cancel)
       
   227      *         - KErrArgument When illegal argument.
       
   228      *         - KErrNotSupported if not capable or allowed to execute this
       
   229      *              for the specified mailbox.
       
   230      *         - Other system wide errors.
       
   231      *
       
   232      * @param in aParams Service id and type of the mailbox for which
       
   233      *          a number/address should be defined.
       
   234      * @param out aEntry If successful, a new result container is
       
   235      *  created and ownership passed to the caller.
       
   236      */
       
   237     void QueryNewEntryL( const TVoiceMailboxParams& aParams,
       
   238                                         CVoiceMailboxEntry*& aEntry );
       
   239 
       
   240     /**
       
   241      * Saves the vmbx entry to its storage.
       
   242      * Leave - KErrNotSupported if not capable or allowed to execute this
       
   243      *              for the specified mailbox service.
       
   244      *       - KErrArgument When illegal argument was passed.
       
   245      *       - Other system wide errors.
       
   246      *
       
   247      * Some mailbox types may not support saving all arguments.
       
   248      * In that case unsupported arguments are ignored.
       
   249      * This method may display related UI notes or queries.
       
   250      *
       
   251      * @param in aEntry The vmbx entry to save.
       
   252      */
       
   253     void SaveEntryL( const CVoiceMailboxEntry& aEntry );
       
   254 
       
   255     /**
       
   256      * Displays a query asking the user to change a mailbox number/address.
       
   257      * Returns the input from user, but does not save it.
       
   258      * For that caller has to use SaveEntry().
       
   259      *
       
   260      * If editing for the specified mailbox service is not allowed, 
       
   261      * this method displays an error note and returns an error.
       
   262      * If client is interested, CheckConfiguration()
       
   263      * can be used to check permissions.
       
   264      *
       
   265      *  created and ownership passed to the caller.
       
   266      *           aNumber will contain the vmbx number.
       
   267      *  Leave  - KErrCancel If the user selected Cancel.
       
   268      *         - KErrArgument When illegal argument.
       
   269      *         - KErrNotSupported if not capable or allowed to execute this
       
   270      *              for the specified mailbox.
       
   271      *         - Other system wide errors.
       
   272      *
       
   273      * @param in aParams Service id and type of the mailbox.
       
   274      * @param out aEntry If successful, a new result container is
       
   275      */
       
   276     void QueryChangeEntryL( const TVoiceMailboxParams& aParams,
       
   277                                     CVoiceMailboxEntry*& aEntry);
       
   278 
       
   279     /**
       
   280      * Displays a query on the screen asking the user to select a
       
   281      * Voice Mailbox service.
       
   282      *
       
   283      *  Leave  - KErrCancel if user selected Cancel
       
   284      *         - KErrNotFound if there is no defined voice number and
       
   285      *             user have selected the type to define or the default
       
   286      *             type given.
       
   287      *         - Other system wide errors.
       
   288      *
       
   289      * @param out aParams If successful,
       
   290      *          contains selected mailbox info.
       
   291      */
       
   292     void QueryVmbxTypeL( TVoiceMailboxParams& aParams );
       
   293 
       
   294     /**
       
   295      * Get defined entries via an array
       
   296      * Leave with symbian OS error code except KErrNotFound and KErrSupported.
       
   297      *
       
   298      * @param out aArray array contains the defined entries
       
   299      */
       
   300     void GetDefinedEntriesL( RPointerArray<CVoiceMailboxEntry>& aArray );
       
   301 
       
   302     /**
       
   303      * Get defined voice entry via an array
       
   304      *  Leave with symbian OS error code except KErrSupported.
       
   305      *
       
   306      * @param out aArray array contains the defined entries
       
   307      */
       
   308     void GetDefinedVoiceEntryL( 
       
   309                             RPointerArray<CVoiceMailboxEntry>& aArray );
       
   310 
       
   311     /**
       
   312      * Get defined video entry via an array
       
   313      * Leave with symbian OS error code except KErrNotFound and KErrSupported.
       
   314      *
       
   315      * @param out ay array contains the defined entries
       
   316      */
       
   317     void GetDefinedVideoEntryL( 
       
   318                             RPointerArray<CVoiceMailboxEntry>& aArray );
       
   319 
       
   320     /**
       
   321      * Get defined voip entries via an array
       
   322      * Leave with symbian OS error code except KErrNotFound and KErrSupported.
       
   323      *
       
   324      * @param out aArray array contains the defined entries
       
   325      */
       
   326     void GetDefinedVoipEntriesL( 
       
   327                             RPointerArray<CVoiceMailboxEntry>& aArray );
       
   328 
       
   329     /**
       
   330      * Checks the Voice Mailbox how many VoIP service Ids
       
   331      * Leave with symbian OS error code
       
   332      *
       
   333      * @param out aProfileIds
       
   334      * @return KErrNone if get service Ids successfully.
       
   335      */
       
   336     void GetServiceIdsL( RIdArray& aProfileIds );
       
   337 
       
   338     /**
       
   339      * Retrieves an image associated with the specified mailbox,
       
   340      * if an image is available.
       
   341      * Image can be displayed e.g. in a selection list.
       
   342      * Leave with symbian OS error code.
       
   343      *
       
   344      * @param in aParams Mailbox service id and type for which image is needed.
       
   345      * @return aImage New image. Ownership is transferred.
       
   346      */
       
   347     //CGulIcon* GetVmbxImageL( const TVoiceMailboxParams& aParams );
       
   348 
       
   349     /**
       
   350      * Retrieves images for the specified mailboxes.
       
   351      * Image can be displayed e.g. in a selection list.
       
   352      * Leave with symbian OS error code.
       
   353      *
       
   354      * If an image for a service is not available,
       
   355      * then a NULL pointer is appended to the returned array, to an index
       
   356      * corresponding to the index of the service id in the input
       
   357      * array aMailboxServices.
       
   358      * NULL array pointer is returned if not a signle icon was retrieved
       
   359      * successfully.
       
   360      *
       
   361      * @param in aParams Mailboxes (id and type) for which an image is needed.
       
   362      * @return aImage Icons for the specified mailboxes.
       
   363      *          Index of an image in the returned array corresponds to the
       
   364      *          index of the service id in the input array.
       
   365      *          Array and icon ownerships are transferred to caller.
       
   366      *          A NULL array pointer is returned if not a single icon was
       
   367      *          retrieved successfully.
       
   368      */
       
   369     //CArrayPtr<CGulIcon>* GetVmbxImagesL(
       
   370     //                        RArray<TVoiceMailboxParams>& aParams );
       
   371 
       
   372     /**
       
   373      * Notify entry changed
       
   374      * Leave with symbian OS error code.
       
   375      *
       
   376      * @param in aType Type of TVmbxType
       
   377      */
       
   378     void NotifyChangedL( TVmbxType aType);
       
   379 
       
   380     /**
       
   381      * Saves provisioned entry to corresponding storage.
       
   382      *
       
   383      * Leave   - KErrNotSupported if not capable or allowed to execute this
       
   384      *              for the specified mailbox service.
       
   385      *         - KErrArgument When illegal argument was passed.
       
   386      *         - Other system wide errors.
       
   387      *
       
   388      * Some mailbox types may not support saving all arguments.
       
   389      * In that case unsupported arguments are ignored.
       
   390      *
       
   391      * @param in aEntry The provisioned vmbx entry to save.
       
   392      */
       
   393     void SaveProvisionedEntryL( const CVoiceMailboxEntry& aEntry );
       
   394 
       
   395     /**
       
   396      * Check number provisioned or not
       
   397      * Leave if systrm wide errors
       
   398      *
       
   399      * @param in aParams params of TVoiceMailboxParams
       
   400      */
       
   401     void CheckNumberProvisionedL( const TVoiceMailboxParams& aParams );
       
   402 
       
   403 protected: // data
       
   404 
       
   405     /**
       
   406      * Pointer to CVmbxUiUtilities
       
   407      * Own.
       
   408      */
       
   409     CVmbxUiUtilities* iUiUtilities;
       
   410 
       
   411     /**
       
   412      * Pointer to CVmbxEngineFactory
       
   413      * Own.
       
   414      */
       
   415     CVmbxEngineFactory* iVmbxFactory;
       
   416 
       
   417     /**
       
   418      * Observer for user action for saved vmbx number
       
   419      * Own.
       
   420      */
       
   421     MVoiceMailboxObserver* iNotifyCallBack;
       
   422 
       
   423     /**
       
   424      * Observer for user action for saved vmbx number
       
   425      * Own.
       
   426      */
       
   427     CVmbxObserver* iVmbxObserver;
       
   428 
       
   429     /**
       
   430      * CVmbxCenRepHandler
       
   431      * Own.
       
   432      */
       
   433     CVmbxCenRepHandler* iCenRepHandler;
       
   434     };
       
   435 
       
   436 #endif  // C_VOICEMAILBOXIMPL_H