messagingfw/deprecate/senduiservices/inc/SendUiImpl.h
branchRCL_3
changeset 22 d2c4c66342f3
equal deleted inserted replaced
21:e5b3a2155e1a 22:d2c4c66342f3
       
     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 private:
       
   304 
       
   305     
       
   306     /**
       
   307     * 
       
   308     * @since Series 60 3.0
       
   309     * @param aListItems
       
   310     * @param aTitleText Title of the pop-up list query. If no title
       
   311     *        is defined, then the localised default title is used.
       
   312     * @return: User selection.
       
   313     */
       
   314     TUid ShowListQueryL(
       
   315         MDesCArray* aListItems,
       
   316         const CArrayFix<TUid>& aListItemUids,
       
   317         const TDesC& aTitleText,
       
   318         CSendUi::TSendUiMenuType aMenuType );
       
   319     
       
   320     /**
       
   321     * Filtering services by their content
       
   322     * 
       
   323     * @since Series 60 3.0
       
   324     * @param aServiceUid
       
   325     * @param aServiceProviderUid
       
   326     * @param aMessageData Message data, which is base of the content filtering.
       
   327     * @param aMimeType The mimetype of the first attachment.
       
   328     * @return: True, if given service can send specified content
       
   329     */
       
   330     TBool CanSendContentL( 
       
   331         TUid aServiceUid,
       
   332         TUid aServiceProviderUid,
       
   333         const CMessageData* aMessageData,
       
   334         TDataType* aMimeType );
       
   335     
       
   336     /**
       
   337     * 
       
   338     * @since Series 60 3.0
       
   339     * @param aListItemUids
       
   340     * @param aListItemUids
       
   341     * @param aRequiredCapabilities
       
   342     * @param aContentArray
       
   343     * @param aServicesToDim
       
   344     * @return: None.
       
   345     */
       
   346     void FilterServicesL(
       
   347         CDesCArrayFlat& aListItems,
       
   348         CArrayFix<TUid>& aListItemUids,
       
   349         TSendingCapabilities aRequiredCapabilities,
       
   350         const CMessageData* aMessageData,
       
   351         CSendUi::TSendUiMenuType aMenuType );
       
   352     
       
   353     /**
       
   354      * Sorts service lists
       
   355      *
       
   356      * @since S60 v3.0
       
   357      * @param aListItems Names of items in array
       
   358      * @param aListItemUids Uids of items in array
       
   359      * @return: Sorted array
       
   360      */
       
   361     void SortListL(
       
   362         CDesCArrayFlat& aListItems,
       
   363         CArrayFix<TUid>& aListItemUids );
       
   364     
       
   365     /**
       
   366     * Resets sending state flag.
       
   367     * @since Series 60 3.0
       
   368     * @return None.
       
   369     */        
       
   370     static void ResetIsSending( TAny* aAny );
       
   371     
       
   372     /**
       
   373     * Compares ECom service sending capabilities to required capabilities.
       
   374     * @since Series 60 3.0
       
   375     * @param aServiceUid Uid of the sending service.
       
   376     * @param aRequiredCapabilities Capabilities required for the sending
       
   377     *        service. 
       
   378     * @return: ETrue if service sending capabilities matches to
       
   379     *          required capabilities, otherwise EFalse.
       
   380     */
       
   381     TBool CheckServiceCapabilities(
       
   382         TUid aServiceUid,
       
   383         TSendingCapabilities aRequiredCapabilities );
       
   384         
       
   385     /**
       
   386     * Checks if the feature is supported by feature manager.
       
   387     * @since Series 60 3.2.3
       
   388     * @param aFeature Feature manager id of the sending service.
       
   389     * @param aNewFeatures To keep track of which feature is modified
       
   390     * @param aFeatureFlag Uid of the sending service used for central repository storage.
       
   391     * @return None
       
   392     */
       
   393     void FeatureStatus(
       
   394         TInt aFeature, 
       
   395         TInt &aNewFeatures, 
       
   396         TInt aFeatureFlag );
       
   397 private:
       
   398 
       
   399     CSendUiImpl();
       
   400     
       
   401     void ConstructL();
       
   402     
       
   403 private: // data
       
   404 
       
   405     /**
       
   406      * Pointer to Control environment
       
   407      * Not own.
       
   408      */
       
   409     CCoeEnv* iCoeEnv;
       
   410 
       
   411     /**
       
   412      * Pointer to File Server Session. Initialized from CCoeEnv->FsSession.
       
   413      * Not own.
       
   414      */
       
   415     RFs& iFs;
       
   416 
       
   417     /**
       
   418      * Pointer to CSendUiSingleton
       
   419      * Own.
       
   420      */
       
   421     CSendUiSingleton* iSingleton;
       
   422 
       
   423     /**
       
   424      * Indicates whether or not the sending process is in progress.
       
   425      */
       
   426     TBool iIsSending;
       
   427 
       
   428     /**
       
   429      * For UI resource loading
       
   430      * Own.
       
   431      */
       
   432     RConeResourceLoader iResourceLoader;
       
   433 
       
   434     /**
       
   435      * Services to be dimmed
       
   436      * Own.
       
   437      */
       
   438     CArrayFixFlat<TUid>* iServicesToDim;
       
   439 
       
   440     /**
       
   441      * Resource file name and path. 
       
   442      * Own.  
       
   443      */
       
   444     TFileName iResourceFileName;
       
   445     
       
   446     
       
   447     TBool iEmailClientIntegration;
       
   448     /**
       
   449      * Array of available sending service
       
   450      * Own. 
       
   451      */
       
   452     RPointerArray<CSendingServiceInfo> iSendingServices;
       
   453     
       
   454     /**
       
   455      * IPC client with SendUiLauncherApp
       
   456      * Own.  
       
   457      */
       
   458     RSendUiServiceClient* iSendUiClient;
       
   459     
       
   460     /**
       
   461      * The requested order of sending services in the menu.
       
   462      * Read from resources.
       
   463      * Own.  
       
   464      */
       
   465     CArrayFixFlat<TInt32>* iSendUiServicesOrderArray;
       
   466 
       
   467     TBool iServerAppLaunch; 
       
   468     
       
   469     CPropertyObserver* iPropertyObserver;
       
   470 
       
   471     };
       
   472 
       
   473 #endif // C_CSENDUIIMPL_H