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