messagingfw/senduiservices/inc/SendUiImpl.h
changeset 15 ff168ad79dda
parent 3 28ae839b4c09
child 17 d6ba66e59a81
equal deleted inserted replaced
3:28ae839b4c09 15:ff168ad79dda
     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:   SendUI API implementation
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 
       
    21 
       
    22 #ifndef C_CSENDUIIMPL_H
       
    23 #define C_CSENDUIIMPL_H
       
    24 
       
    25 #include <f32file.h>
       
    26 #include <e32base.h>
       
    27 #include <e32property.h>
       
    28 #include <badesca.h>
       
    29 #include <ConeResLoader.h>
       
    30 #include <apaserverapp.h>
       
    31 #include <msvapi.h>
       
    32 
       
    33 #include <TSendingCapabilities.h>
       
    34 #include <sendui.h>
       
    35 #include <SendUiConsts.h>
       
    36 
       
    37 class CEikMenuPane;
       
    38 class CSendNormalUi;
       
    39 class CMessageData;
       
    40 class CSendingServiceManager;
       
    41 class CSendingServiceInfo;
       
    42 class RSendUiServiceClient;
       
    43 class CPropertyObserver;
       
    44 class TDataType;
       
    45 class CSendUiSingleton;
       
    46 
       
    47 /**
       
    48  *  Implementation of SendUI API
       
    49  *
       
    50  *  Can be used to show "Send" list query and to create and send
       
    51  *  messages via available services. Sending services can be based
       
    52  *  on the MTM or ECom architecture. Created messages are sent
       
    53  *  directly or message editor is opened for editing, depending on
       
    54  *  the type of selected service.
       
    55  *  @lib sendui.lib
       
    56  *  @since S60 v3.0
       
    57  */
       
    58 class CSendUiImpl : public CBase
       
    59     {
       
    60     friend class UT_CSendUiImpl;
       
    61 public:
       
    62 
       
    63     static CSendUiImpl* NewL();
       
    64 
       
    65     virtual ~CSendUiImpl();
       
    66 
       
    67 public:
       
    68 
       
    69     /**
       
    70     * Adds menu item of given type to menupane.
       
    71     *
       
    72     * @since Series 60 3.0
       
    73     * @param aMenuType Type of the menu, e.g. "ESendMenu" or "EWriteMenu"
       
    74     * @param aMenuPane Menupane where the menu item should be added.
       
    75     * @param aIndex The place of the menu item in menupane.
       
    76     * @param aCommandId Command id for the menu item.
       
    77     * @param aRequiredCapabilities Capabilities required by services to be
       
    78     *        shown in "Send" list query. If no capabilities are required
       
    79     *        (KCapabilitiesForAllServices), all available services are
       
    80     *        shown in "Send" list query.
       
    81     * @return None.
       
    82     */
       
    83     void AddTypedMenuItemL(
       
    84         CSendUi::TSendUiMenuType aMenuType,
       
    85         CEikMenuPane& aMenuPane,
       
    86         TInt aIndex,
       
    87         TInt aCommandId,
       
    88         TSendingCapabilities aRequiredCapabilities = KCapabilitiesForAllServices );
       
    89     
       
    90     /**
       
    91     * First displays list query and then creates the message.
       
    92     * Editor is launched for editing the message or the message is sent
       
    93     * directly without opening the editor. Functionality depends on the
       
    94     * type of selected service.
       
    95     *
       
    96     * List query can be manipulated in three ways. All three methods can be
       
    97     * used or just some of those.
       
    98     *
       
    99     * The first option is to set the required capabilities for services.
       
   100     * Eg. attachments supported. Sending services not matching to required
       
   101     * capabilities are filtered away. Capabilities are defined in
       
   102     * TSendingCapabilities.h.
       
   103     *
       
   104     * The second option is content based filtering. Filtering is based on
       
   105     * the files intended to send. Those files can be set as part of message
       
   106     * data. Filtering is done according the predefined rules.
       
   107     *
       
   108     * The third option is to set the array of service uids not wanted to
       
   109     * be shown in list query. Uid can be the technology type, service provider or
       
   110     * service id. These sending services are filtered away
       
   111     * even if those match to required capabilities.
       
   112     *
       
   113     * @since Series 60 3.0
       
   114     * @param aMenuType Type of the menu, e.g. "ESendMenu" or "EWriteMenu"
       
   115     * @param aMessageData Data for the message.
       
   116     * @param aRequiredCapabilities Capabilities required by sending services
       
   117     *        to be shown in "Send" pop-up list query. If no capabilities are
       
   118     *        required (KCapabilitiesForAllServices), all available services
       
   119     *        are shown in "Send" pop-up list query.
       
   120     * @param aServicesToDim Array of service uids (service uid, service 
       
   121     *        provider's uid or service's TechnologyType) _NOT_ wanted to "Send" 
       
   122     *        list query. 
       
   123     *        See predefined sending service uids in SendUiConsts.h .
       
   124     * @param aLaunchEditorEmbedded ETrue if the editor should be launched
       
   125     *        embedded. Otherwise the editor is launched stand-alone.
       
   126     *        Note: some services sends the messages without launching the
       
   127     *        editor at all.
       
   128     * @param aTitleText Title of the list query. If no title is defined,
       
   129     *        then the localised default title is used, e.g. "Send" or 
       
   130     *        "Write".
       
   131     * @return None.
       
   132     */
       
   133     void ShowTypedQueryAndSendL(
       
   134         CSendUi::TSendUiMenuType aMenuType, 
       
   135         const CMessageData* aMessageData,
       
   136         TSendingCapabilities aRequiredCapabilities = KCapabilitiesForAllServices,
       
   137         CArrayFix<TUid>* aServicesToDim = NULL,
       
   138         TBool aLaunchEditorEmbedded = ETrue,
       
   139         const TDesC& aTitleText = KNullDesC );
       
   140     
       
   141     /**
       
   142     * Displays list query and returns the user selection.
       
   143     *
       
   144     * List query can be manipulated in three ways. All three methods can be
       
   145     * used or just some of those.
       
   146     *
       
   147     * The first option is to set the required capabilities for services.
       
   148     * Eg. attachments supported. Sending services not matching to required
       
   149     * capabilities are filtered away. Capabilities are defined in
       
   150     * TSendingCapabilities.h.
       
   151     *
       
   152     * The second option is content based filtering. Filtering is based on
       
   153     * the files intended to send. Those files can be set as part of message
       
   154     * data. Filtering is done according the predefined rules.
       
   155     *
       
   156     * The third option is to set the array of service uids not wanted to
       
   157     * be shown in list query. These sending services are filtered away
       
   158     * even if those match to required capabilities.
       
   159     * 
       
   160     * @since Series 60 3.0
       
   161     * @param aMenuType Type of the menu, e.g. "ESendMenu" or "EWriteMenu"
       
   162     * @param aMessageData Data for the message. Attachments are used for
       
   163     *        content based filtering.
       
   164     * @param aRequiredCapabilities Capabilities required by sending services
       
   165     *        to be shown in list query. If no capabilities are required
       
   166     *        (KCapabilitiesForAllServices), all available services are 
       
   167     *        shown in list query.
       
   168     * @param aServicesToDim Array of service uids (service uid, service 
       
   169     *        provider's uid or service's TechnologyType) _NOT_ wanted to "Send" 
       
   170     *        list query. 
       
   171     *        See predefined sending service uids in SendUiConsts.h .
       
   172     * @param aTitleText Title of the list query. If no title is defined,
       
   173     *        then the localised default title is used, e.g. "Send" or 
       
   174     *        "Write"
       
   175     * @return Uid of the selected service (MTM or ECom). 
       
   176     *        KNullId is returned if user selects cancel.
       
   177     */
       
   178     TUid ShowTypedQueryL(
       
   179         CSendUi::TSendUiMenuType aMenuType, 
       
   180         const CMessageData* aMessageData = NULL,
       
   181         TSendingCapabilities aRequiredCapabilities = KCapabilitiesForAllServices,
       
   182         CArrayFix<TUid>* aServicesToDim = NULL,
       
   183         const TDesC& aTitleText = KNullDesC );
       
   184     
       
   185     /**
       
   186     * Creates the message and launches the editor for editing the message
       
   187     * or sends the message directly without opening the editor. 
       
   188     * Functionality depends on the type of selected service.
       
   189     *
       
   190     * @since Series 60 3.2
       
   191     * @param aServiceUid Uid of the sending service.
       
   192     * @param aMessageData Data for the message.
       
   193     * @return None.
       
   194     */
       
   195     TInt SendMessageL( 
       
   196         TUid                    aServiceUid,
       
   197         const CMessageData*     aMessageData,
       
   198         TBool                   aLaunchEditorEmbedded );
       
   199 
       
   200     /**
       
   201     * Launches server application, which will eventually call SendMessageL
       
   202     * with the same parameters.
       
   203     *
       
   204     * @since Series 60 3.2
       
   205     * @param aServiceUid Uid of the sending service.
       
   206     * @param aMessageData Data for the message.
       
   207     * @return None.
       
   208     */
       
   209     void SendMessageViaServerL( 
       
   210         TUid                    aServiceUid,
       
   211         const CMessageData*     aMessageData,
       
   212         TBool                   aLaunchEditorEmbedded );
       
   213     /**
       
   214     * Creates the message and launches the editor for editing the message
       
   215     * or sends the message directly without opening the editor. 
       
   216     * Functionality depends on the type of selected service.
       
   217     *
       
   218     * @since Series 60 3.0
       
   219     * @param aServiceUid Uid of the sending service.
       
   220     * @param aMessageData Data for the message.
       
   221     * @return None.
       
   222     */
       
   223     void CreateAndSendMessageL(
       
   224         TUid aServiceUid,
       
   225         const CMessageData* aMessageData,
       
   226         TBool aLaunchEditorEmbedded = ETrue );
       
   227     
       
   228     /**
       
   229     * Returns sending capabilities of the sending service.
       
   230     * @since Series 60 3.0
       
   231     * @param aServiceUid Uid of the sending service.
       
   232     * @param aServiceCapabilities TSendingCapabilities of the sending
       
   233     *        service as a return value.        
       
   234     * @return Return KErrNone if successful, or one of the system wide
       
   235     *         errors if unsuccessful.
       
   236     */
       
   237     TInt ServiceCapabilities(
       
   238         TUid aServiceUid,
       
   239         TSendingCapabilities& aServiceCapabilities );       
       
   240     
       
   241     /**
       
   242     * Populates given list with the information about services
       
   243     * provided by specified ECom service provider.
       
   244     * Each service provider can provide 1..n services.
       
   245     * Ownership of the pointed objects are transfered to caller.
       
   246     *
       
   247     * Can be used for ex. when creating own "Send" menu, which needs to
       
   248     * include ECom based services.
       
   249     *
       
   250     * NOTE: Can be used only for ECom based services, also for MTMs
       
   251     *
       
   252     * @since Series 60 2.8
       
   253     * @param aServiceList Service list to be populated.
       
   254     * @param aServiceProvider Id of the specified service provider.
       
   255     *        KNullId means all service providers.
       
   256     *        Service providers are defined in SendUiConsts.h
       
   257     * @return none
       
   258     */
       
   259     void AvailableServicesL(
       
   260         RPointerArray<CSendingServiceInfo>& aServiceList,
       
   261         TUid aServiceProvider = KNullUid);
       
   262     
       
   263     /**
       
   264     *   Returns the technology type of a service
       
   265     *
       
   266     *   @since Series 60 3.0
       
   267     *   @param aServiceId Service of interest
       
   268     *   @return Technology type of the provided service. NULL if Mtm
       
   269     *           service doesn't exist or service is ECOM based.
       
   270     */
       
   271     TUid TechnologyType( TUid aServiceUid );
       
   272     
       
   273     /**
       
   274     *   Returns the index of the service in service array
       
   275     *
       
   276     *   @since Series 60 3.2
       
   277     *   @param aServiceId Service of interest
       
   278     *   @return Index of a found service. Otherwise KErrNotFound.
       
   279     */
       
   280     TInt ResolveServiceIndex( TUid aUid );
       
   281 
       
   282     /**
       
   283      * Compares service capabilities with the required capabilities
       
   284      *
       
   285      * @since S60 v3.2
       
   286      * @param aServiceIndex Index of the service
       
   287      * @param aRequiredCapabilities Required capabilities
       
   288      * @return ETrue, if service has required or more capabilities. 
       
   289      *         EFalse, if service does not have the required capabilities 
       
   290      *         or service does not exist.
       
   291      */    
       
   292     TBool QueryCapabilities( 
       
   293         TInt aServiceIndex, 
       
   294         TSendingCapabilities aCap );
       
   295     
       
   296     /**
       
   297      * Copies sending service information from Central Repository to local data
       
   298      *
       
   299      * @since S60 v3.2
       
   300      */
       
   301      void GetServicesL( );
       
   302  
       
   303 //Functions introduced for CMail changes
       
   304      
       
   305      /**
       
   306       * Checks if Device has any mailbox or not
       
   307       *
       
   308       * @since S60 v5.0
       
   309       * @param void
       
   310       * @return ETrue, if atleast one mailbox is available. 
       
   311       *         EFalse, if no mailbox are there
       
   312       */ 
       
   313      
       
   314      TBool IsMailboxAvailableL(void);
       
   315      
       
   316      /**
       
   317       * Checks if Device has any ThirdParty Mail Services or not
       
   318       *
       
   319       * @since S60 v5.0
       
   320       * @param void
       
   321       * @return ETrue, if atleast one Third Party Service is available. 
       
   322       *         EFalse, if Third Party Service are there
       
   323       */ 
       
   324      
       
   325      TBool IsThirdPartyMailService(TUid aUid );
       
   326      
       
   327      /**
       
   328       * Checks if Email entry is valid to be appended 
       
   329       *
       
   330       * @since S60 v5.0
       
   331       * @param void
       
   332       * @return ETrue, if it can be appended. 
       
   333       *         EFalse, if cannot be appended
       
   334       */ 
       
   335      
       
   336      TBool IsEmailAppendableL(TMsvEntry tentry);
       
   337      
       
   338      
       
   339 private:
       
   340 
       
   341     
       
   342     /**
       
   343     * 
       
   344     * @since Series 60 3.0
       
   345     * @param aListItems
       
   346     * @param aTitleText Title of the pop-up list query. If no title
       
   347     *        is defined, then the localised default title is used.
       
   348     * @return: User selection.
       
   349     */
       
   350     TUid ShowListQueryL(
       
   351         MDesCArray* aListItems,
       
   352         const CArrayFix<TUid>& aListItemUids,
       
   353         const TDesC& aTitleText,
       
   354         CSendUi::TSendUiMenuType aMenuType );
       
   355     
       
   356     /**
       
   357     * Filtering services by their content
       
   358     * 
       
   359     * @since Series 60 3.0
       
   360     * @param aServiceUid
       
   361     * @param aServiceProviderUid
       
   362     * @param aMessageData Message data, which is base of the content filtering.
       
   363     * @param aMimeType The mimetype of the first attachment.
       
   364     * @return: True, if given service can send specified content
       
   365     */
       
   366     TBool CanSendContentL( 
       
   367         TUid aServiceUid,
       
   368         TUid aServiceProviderUid,
       
   369         const CMessageData* aMessageData,
       
   370         TDataType* aMimeType );
       
   371     
       
   372     /**
       
   373     * 
       
   374     * @since Series 60 3.0
       
   375     * @param aListItemUids
       
   376     * @param aListItemUids
       
   377     * @param aRequiredCapabilities
       
   378     * @param aContentArray
       
   379     * @param aServicesToDim
       
   380     * @return: None.
       
   381     */
       
   382     void FilterServicesL(
       
   383         CDesCArrayFlat& aListItems,
       
   384         CArrayFix<TUid>& aListItemUids,
       
   385         TSendingCapabilities aRequiredCapabilities,
       
   386         const CMessageData* aMessageData,
       
   387         CSendUi::TSendUiMenuType aMenuType );
       
   388     
       
   389     /**
       
   390      * Sorts service lists
       
   391      *
       
   392      * @since S60 v3.0
       
   393      * @param aListItems Names of items in array
       
   394      * @param aListItemUids Uids of items in array
       
   395      * @return: Sorted array
       
   396      */
       
   397     void SortListL(
       
   398         CDesCArrayFlat& aListItems,
       
   399         CArrayFix<TUid>& aListItemUids );
       
   400     
       
   401     /**
       
   402     * Resets sending state flag.
       
   403     * @since Series 60 3.0
       
   404     * @return None.
       
   405     */        
       
   406     static void ResetIsSending( TAny* aAny );
       
   407     
       
   408     /**
       
   409     * Compares ECom service sending capabilities to required capabilities.
       
   410     * @since Series 60 3.0
       
   411     * @param aServiceUid Uid of the sending service.
       
   412     * @param aRequiredCapabilities Capabilities required for the sending
       
   413     *        service. 
       
   414     * @return: ETrue if service sending capabilities matches to
       
   415     *          required capabilities, otherwise EFalse.
       
   416     */
       
   417     TBool CheckServiceCapabilities(
       
   418         TUid aServiceUid,
       
   419         TSendingCapabilities aRequiredCapabilities );
       
   420         
       
   421     /**
       
   422     * Checks if the feature is supported by feature manager.
       
   423     * @since Series 60 3.2.3
       
   424     * @param aFeature Feature manager id of the sending service.
       
   425     * @param aNewFeatures To keep track of which feature is modified
       
   426     * @param aFeatureFlag Uid of the sending service used for central repository storage.
       
   427     * @return None
       
   428     */
       
   429     void FeatureStatus(
       
   430         TInt aFeature, 
       
   431         TInt &aNewFeatures, 
       
   432         TInt aFeatureFlag );
       
   433 private:
       
   434 
       
   435     CSendUiImpl();
       
   436     
       
   437     void ConstructL();
       
   438     
       
   439 private: // data
       
   440 
       
   441     /**
       
   442      * Pointer to Control environment
       
   443      * Not own.
       
   444      */
       
   445     CCoeEnv* iCoeEnv;
       
   446 
       
   447     /**
       
   448      * Pointer to File Server Session. Initialized from CCoeEnv->FsSession.
       
   449      * Not own.
       
   450      */
       
   451     RFs& iFs;
       
   452 
       
   453     /**
       
   454      * Pointer to CSendUiSingleton
       
   455      * Own.
       
   456      */
       
   457     CSendUiSingleton* iSingleton;
       
   458 
       
   459     /**
       
   460      * Indicates whether or not the sending process is in progress.
       
   461      */
       
   462     TBool iIsSending;
       
   463 
       
   464     /**
       
   465      * For UI resource loading
       
   466      * Own.
       
   467      */
       
   468     RConeResourceLoader iResourceLoader;
       
   469 
       
   470     /**
       
   471      * Services to be dimmed
       
   472      * Own.
       
   473      */
       
   474     CArrayFixFlat<TUid>* iServicesToDim;
       
   475 
       
   476     /**
       
   477      * Resource file name and path. 
       
   478      * Own.  
       
   479      */
       
   480     TFileName iResourceFileName;
       
   481     
       
   482     
       
   483     TBool iEmailClientIntegration;
       
   484     
       
   485     /**
       
   486      * Variable to know if Cmail  
       
   487      * Feature is on  
       
   488      */
       
   489     TBool iEmailFramework;
       
   490     
       
   491     /**
       
   492      * Array of available sending service
       
   493      * Own. 
       
   494      */
       
   495     RPointerArray<CSendingServiceInfo> iSendingServices;
       
   496     
       
   497     /**
       
   498      * IPC client with SendUiLauncherApp
       
   499      * Own.  
       
   500      */
       
   501     RSendUiServiceClient* iSendUiClient;
       
   502     
       
   503     /**
       
   504      * The requested order of sending services in the menu.
       
   505      * Read from resources.
       
   506      * Own.  
       
   507      */
       
   508     CArrayFixFlat<TInt32>* iSendUiServicesOrderArray;
       
   509 
       
   510     TBool iServerAppLaunch; 
       
   511     
       
   512     CPropertyObserver* iPropertyObserver;
       
   513 
       
   514     };
       
   515 
       
   516 #endif // C_CSENDUIIMPL_H