landmarksui/uicontrols/inc/CLmkSender.h
branchRCL_3
changeset 17 1fc85118c3ae
parent 16 8173571d354e
child 18 870918037e16
equal deleted inserted replaced
16:8173571d354e 17:1fc85118c3ae
     1 /*
       
     2 * Copyright (c) 2002 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:    LandmarksUi Content File -    This class wraps usage of CLmkEncoder and CSendAppUi
       
    15                  into one simple class.
       
    16 *
       
    17 */
       
    18 
       
    19 
       
    20 
       
    21 
       
    22 
       
    23 
       
    24 
       
    25 #ifndef CLMKSENDER_H
       
    26 #define CLMKSENDER_H
       
    27 
       
    28 //  INCLUDES
       
    29 #include "MLmkAOOperationObserver.h"
       
    30 #include "LmkConsts.h"
       
    31 #include <e32base.h>
       
    32 #include <EPos_Landmarks.h>
       
    33 #include <EPos_CPosLandmark.h>
       
    34 #include "CLmkLandmark.h"
       
    35 
       
    36 // FORWARD DECLARATIONS
       
    37 class CSendUi;
       
    38 class CLmkEncoder;
       
    39 class CPosLandmarkDatabase;
       
    40 class CAknWaitDialog;
       
    41 class CEikMenuPane;
       
    42 class RFile;
       
    43 class CMessageData;
       
    44 // CLASS DECLARATION
       
    45 
       
    46 /**
       
    47 *  This class wraps usage of CLmkEncoder and CSendAppUi into one simple class.
       
    48 *  This class relies on the fact that given database has been initialized.
       
    49 *  It also provides a couple of static helper functions for setting menu.
       
    50 *
       
    51 */
       
    52 class CLmkSender : public CBase, public MLmkAOOperationObserver
       
    53     {
       
    54     public:  // Constructors and destructor
       
    55 
       
    56         /**
       
    57         * Two-phased constructor.
       
    58         * @param aDb
       
    59         * @return
       
    60         */
       
    61         IMPORT_C static CLmkSender* NewL( CPosLandmarkDatabase& aDb );
       
    62 
       
    63         /**
       
    64         * Destructor.
       
    65         */
       
    66         virtual ~CLmkSender();
       
    67 
       
    68     public: // New functions
       
    69 
       
    70         /**
       
    71         * Displays "Send as..." option if SendUI allows and if
       
    72         * there are some visible items in the list.
       
    73         * Note: this function requires that command ELmkCmdSendDummy exists
       
    74         * in the menu pane, since it determines the position of "Send as...".
       
    75         * @param aMenuPane
       
    76         * @param aVisibleCount number of visible items in the list
       
    77         * @param aMenuTextResource customized "Send as..." substitute
       
    78         */
       
    79         IMPORT_C void DisplaySendMenuL(
       
    80                         CEikMenuPane& aMenuPane,
       
    81                         TInt aVisibleCount,
       
    82                         TInt aMenuTextResource = KZeroResourceId ) const;
       
    83 
       
    84         /**
       
    85         * Display send's cascade menu
       
    86         * @param aSendUi
       
    87         * @param aMenuPane
       
    88         */
       
    89         IMPORT_C void DisplaySendCascadeMenuL( CEikMenuPane& aMenuPane ) const;
       
    90 
       
    91         /**
       
    92         * This method wraps entire encoding and sending procedure.
       
    93         * It is done asynchronously but client doesn't observe it.
       
    94         * This class takes care of error handling etc.
       
    95         * @param aCommandId commmand id which determines the MTM
       
    96         * @aMarkedIds marked item ids
       
    97         * @aSelectedId current item, used if there aren't marked items
       
    98         */
       
    99         void CreateAndSendL( TInt aCommandId,
       
   100                              const RArray<TPosLmItemId>& aMarkedIds,
       
   101                              TPosLmItemId aSelectedId );
       
   102 
       
   103         /**
       
   104         * This method wraps entire encoding and sending multiple landmarks.
       
   105         * It is done asynchronously but client doesn't observe it.
       
   106         * This class takes care of error handling etc.
       
   107         * @param aCommandId commmand id which determines the MTM
       
   108         * @aLandmarks Array of CLmkLandmark,which wrap landmarks
       
   109         *             (CPosLandmark) & the respective categories.
       
   110         *
       
   111         */
       
   112         void SendLandmarksL( TInt aCommandId,
       
   113                                     const TDesC& aPackageName,
       
   114                                     const RPointerArray<CLmkLandmark>& aLandmarks );
       
   115 
       
   116         /**
       
   117         * This method wraps entire encoding and sending of single landmark.
       
   118         * It is done asynchronously but client doesn't observe it.
       
   119         * This class takes care of error handling etc.
       
   120         * @param aCommandId commmand id which determines the MTM
       
   121         * @param alandmark object CLmkLandmark,which wrap landmarks
       
   122         *             (CPosLandmark) & the respective categories.
       
   123         *
       
   124         */
       
   125         void SendSingleLandmarkL( TInt aCommandId,
       
   126                                       const CLmkLandmark& alandmark );
       
   127         /**
       
   128         * This method wraps entire encoding and sending of single landmark.
       
   129         * This is an overloaded method, which used only for the landmarks,
       
   130         * which exists in the database.
       
   131         * It is done asynchronously but client doesn't observe it.
       
   132         * This class takes care of error handling etc.
       
   133         * @param alandmark object CPosLandmark,which wrap landmarks
       
   134         */
       
   135 
       
   136         void SendSingleLandmarkL(const CPosLandmark& alandmark);
       
   137         /**
       
   138         * This method can be used to send a specific file.
       
   139         * It is used when forwarding an existing landmark package.
       
   140         * Note: if file should be deleted then it must be closed and not
       
   141         * read-only, otherwise leave occurs with a system wide error code.
       
   142         * @param aCommandId commmand id which determines the MTM
       
   143         * @aFile full file name to be sent as an attachment
       
   144         * @aDeleteSentFile if TBool then aFile is deleted after sending
       
   145         */
       
   146         void SendFileL( TInt aCommandId,
       
   147                         const TDesC& aFile,
       
   148                         TBool aDeleteSentFile );
       
   149 
       
   150 
       
   151         void SendFileL( TInt aCommandId,
       
   152                         RFile& aFile,
       
   153                         TBool aDeleteSentFile );
       
   154 
       
   155         /**
       
   156         * This method prepares the CLmkLandmark array, from the landmark id's passed.
       
   157         * @param[in/out] aLmkLandmark Array of CLmkLanmark
       
   158         * @param[in] 	 aMarkedIds   landmark ids.
       
   159         */
       
   160         void PrepareMultipleLandmarkForSendL(RPointerArray<CLmkLandmark>& aLmkLandmark,
       
   161         									const RArray<TPosLmItemId>& aMarkedIds);
       
   162        	/**
       
   163         * This method encapsulates CPosLandmark object in CLmkLandmark object
       
   164         * @param[in/out] aLmkLandmark object of CLmkLandmark returned
       
   165         * @param[in] 	 aPosLandmark   landmark object.
       
   166         */
       
   167         void LmkLandmarkFromPosLandmarkL(CLmkLandmark*& aLmkLandmark,
       
   168 								   const CPosLandmark& aPosLandmark);
       
   169 
       
   170 
       
   171 
       
   172     public: // From MLmkAOOperationObserver
       
   173 
       
   174         void HandleOperationL( TOperationTypes aType,
       
   175                                TReal32 aProgress,
       
   176                                TInt aStatus );
       
   177     private://new functions
       
   178 
       
   179     void PrepareSendFilePathL(HBufC*& aFilePath);
       
   180 
       
   181     private:
       
   182 
       
   183         /**
       
   184         * C++ default constructor.
       
   185         */
       
   186         CLmkSender(CPosLandmarkDatabase& aDb);
       
   187 
       
   188         /**
       
   189         * By default Symbian 2nd phase constructor is private.
       
   190         */
       
   191         void ConstructL( CPosLandmarkDatabase& aDb );
       
   192 
       
   193 
       
   194         void SendL(TDes& iFile, TInt aCommandId);
       
   195 
       
   196         TBool QueryNewPackageNameLC(const TDesC& aCurrentPckgName, HBufC*& aNewPackageName);
       
   197  
       
   198         void SendLandmarksPackageL(TInt aCommandId,const TDesC& aPackageName,const RPointerArray<CLmkLandmark>& aLandmarks );
       
   199 
       
   200     	void SendSingleLandmarkL(TInt aCommandId,const RPointerArray<CLmkLandmark>& aLandmarks);
       
   201 
       
   202     	void LoadFilteredSendListQueryL(const CMessageData* aMessageData);
       
   203 
       
   204         TPtr ReplaceSpecialCharactersL(TPtrC aText);
       
   205 
       
   206     private:    // Data
       
   207 
       
   208         // Completion code of last asynchronous operation
       
   209         TInt iLastOperationResult;
       
   210 
       
   211         ///Own: send ui
       
   212         //CSendAppUi* iSendUi;
       
   213 		CSendUi* iSendUi;
       
   214         ///Own: landmark package encoder
       
   215         CLmkEncoder* iEncoder;
       
   216 
       
   217         ///Own: wait note
       
   218         CAknWaitDialog* iWaitNote;
       
   219 
       
   220         //Added for Bug fix
       
   221         CPosLandmarkDatabase& iDb;
       
   222     };
       
   223 
       
   224 #endif      // CLMKSENDER_H
       
   225 
       
   226 // End of File