epoc32/include/mw/AknGlobalProgressDialog.h
branchSymbian3
changeset 4 837f303aceeb
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/epoc32/include/mw/AknGlobalProgressDialog.h	Wed Mar 31 12:33:34 2010 +0100
     1.3 @@ -0,0 +1,244 @@
     1.4 +/*
     1.5 +* Copyright (c) 2002-2007 Nokia Corporation and/or its subsidiary(-ies).
     1.6 +* All rights reserved.
     1.7 +* This component and the accompanying materials are made available
     1.8 +* under the terms of "Eclipse Public License v1.0"
     1.9 +* which accompanies this distribution, and is available
    1.10 +* at the URL "http://www.eclipse.org/legal/epl-v10.html".
    1.11 +*
    1.12 +* Initial Contributors:
    1.13 +* Nokia Corporation - initial contribution.
    1.14 +*
    1.15 +* Contributors:
    1.16 +*
    1.17 +* Description:  Uses notification framework to show a global progress dialog.
    1.18 +*
    1.19 +*/
    1.20 +
    1.21 +#ifndef __AKNGLOBALPROGRESSDIALOG_H__
    1.22 +#define __AKNGLOBALPROGRESSDIALOG_H__
    1.23 +
    1.24 +#include <AknNotify.h>
    1.25 +#include <AknNotifyStd.h>
    1.26 +#include <AknProgressDialog.h>
    1.27 +#include <AknsItemID.h>
    1.28 +
    1.29 +class CAknSDData;
    1.30 +
    1.31 +/**
    1.32 +* CAknGlobalProgressDialog
    1.33 +*   Uses notification framework to show a global progress dialog.
    1.34 +*   Usage:
    1.35 +*       Create an active object, start it and pass its TRequestStatus as a
    1.36 +*       parameter to ShowProgressDialogL. After the dialog gets dismissed,
    1.37 +*       the request status will hold the id of the pressed softkey. E.g. 
    1.38 +*       If the user selected Cancel, the request status will hold -1.
    1.39 +*
    1.40 +*   Example 1. Construct global progress dialog and set icon and image.
    1.41 +*
    1.42 +*        iGlobalProgressDialog = CAknGlobalProgressDialog::NewL();
    1.43 +*        iGlobalProgressDialog->SetIconL( 
    1.44 +*            iIconText, 
    1.45 +*            iIconFile, 
    1.46 +*            iIconId, 
    1.47 +*            iIconMaskId);
    1.48 +*
    1.49 +*        iGlobalProgressDialog->SetImageL( 
    1.50 +*            iImageFile, 
    1.51 +*            iImageId, 
    1.52 +*            iImageMaskId);
    1.53 +*
    1.54 +*   Example 2. Show the global progress dialog:
    1.55 +*
    1.56 +*        iGlobalProgressDialog->ShowMsgQueryL(
    1.57 +*            iObserver->iStatus, 
    1.58 +*            iPrompt, 
    1.59 +*            R_AVKON_SOFTKEYS_OK_CANCEL, 
    1.60 +*            iFinalValue, 
    1.61 +*            CAknQueryDialog::EConfirmationTone );
    1.62 +*
    1.63 +*   Example 3. Update the progress (current and final value of the process).
    1.64 +*
    1.65 +*        iGlobalProgressDialog->UpdateProgressDialog( 100, 500 );
    1.66 +*
    1.67 +*   Example 4. Finish the progress
    1.68 +*               Needs to be called everytime the process has finished.
    1.69 +*               Dismisses the dialog.
    1.70 +*
    1.71 +*        iGlobalProgressDialog->ProcessFinished();
    1.72 +*
    1.73 +*   Example 5. Get and handle the result in active object.
    1.74 +*
    1.75 +*        void CMyActiveObject::RunL() 
    1.76 +*            {
    1.77 +*            TBuf<120> msg = _L("Received: ");
    1.78 +*            // iStatus.Int() holds the return value
    1.79 +*            msg.AppendNum( iStatus.Int() ); 
    1.80 +*            iEnv->InfoMsg(msg); // Show infomsg
    1.81 +*            Cancel();
    1.82 +*            }
    1.83 +*
    1.84 +*   Example 6. Cancel the progress dialog
    1.85 +*
    1.86 +*        iGlobalProgressDialog->CancelProgressDialog();
    1.87 +*/
    1.88 +
    1.89 +NONSHARABLE_CLASS(CAknGlobalProgressDialog) : public CBase
    1.90 +    {
    1.91 +    public:
    1.92 +        IMPORT_C static CAknGlobalProgressDialog* NewL();
    1.93 +        IMPORT_C static CAknGlobalProgressDialog* NewLC();
    1.94 +        IMPORT_C ~CAknGlobalProgressDialog();
    1.95 +
    1.96 +        /**
    1.97 +        * Set icon for the progress dialog
    1.98 +        *   Must be called before ShowProgressDialogL.
    1.99 +        *
   1.100 +        * @param    aIconText       Icon text
   1.101 +        * @param    aIconFile       Icon file
   1.102 +        * @param    aIconId         Icon id
   1.103 +        * @param    aIconMaskId     Mask id for icon
   1.104 +        */
   1.105 +        IMPORT_C void SetIconL( const TDesC& aIconText,
   1.106 +                                const TDesC& aIconFile,
   1.107 +                                TInt aIconId = 0,
   1.108 +                                TInt aIconMaskId = -1 );
   1.109 +
   1.110 +        /**
   1.111 +        * Set image for the progress dialog
   1.112 +        *   Must be called before ShowProgressDialogL.
   1.113 +        *   If not set, default image will be used,
   1.114 +        *   i.e. EMbmAvkonQgn_note_progress
   1.115 +        *
   1.116 +        * @param    aImageFile       Image file
   1.117 +        * @param    aImageId         Image id
   1.118 +        * @param    aImageMaskId     Mask id for Image
   1.119 +        */
   1.120 +        IMPORT_C void SetImageL( 
   1.121 +            const TDesC& aImageFile,
   1.122 +            TInt aImageId = 0,
   1.123 +            TInt aImageMaskId = -1 );
   1.124 +
   1.125 +        /**
   1.126 +        * Shows global progress dialog asynchronously
   1.127 +        *
   1.128 +        * @param    aStatus         TRequestStatus which will be completed
   1.129 +        *                               when the dialog gets dismissed
   1.130 +        * @param    aPrompt         Prompt text
   1.131 +        * @param    aSoftkeys       Softkeys resource id
   1.132 +        *                               If not set default softkeys are used.
   1.133 +        *                               i.e. R_AVKON_SOFTKEYS_CANCEL
   1.134 +        * @param    aFinalValue     Final value of the process
   1.135 +        * @param    aTone           Tone to be played after completion
   1.136 +        */
   1.137 +        IMPORT_C void ShowProgressDialogL( 
   1.138 +            TRequestStatus& aStatus,
   1.139 +            const TDesC& aPrompt,
   1.140 +            TInt aSoftkeys = 0,
   1.141 +            TInt aFinalValue = 0,
   1.142 +            CAknNoteDialog::TTone aTone = CAknNoteDialog::ENoTone );
   1.143 +
   1.144 +        /**
   1.145 +        * Update Progress dialog with new progress values.
   1.146 +        *
   1.147 +        * @param    aValue      Current value of the process.
   1.148 +        * @param    aFinalValue Final value of the process. If not given the
   1.149 +        *                           existing value is used.
   1.150 +        */
   1.151 +        IMPORT_C void UpdateProgressDialog( 
   1.152 +            TInt aValue, 
   1.153 +            TInt aFinalValue = -1 );
   1.154 +
   1.155 +        /**
   1.156 +        * ProcessFinished.
   1.157 +        *   Dismisses the dialog. Needs to be called after the 
   1.158 +        *   process has finished.
   1.159 +        */
   1.160 +        IMPORT_C void ProcessFinished();
   1.161 +
   1.162 +        /**
   1.163 +        * Cancel the progress dialog.
   1.164 +        *   Cancels the request and deletes the dialog.
   1.165 +        */
   1.166 +        IMPORT_C void CancelProgressDialog();
   1.167 +
   1.168 +        /**
   1.169 +        * @since  S60 2.6
   1.170 +        * Set Skin ids for note image and icon. Must be called before ShowProgressDialogL in order 
   1.171 +        * to have effect. No need to use this method if image from avkon.mbm is used.
   1.172 +        *
   1.173 +        * @aparam aImageId      SkinId for image in query. If image not found from active skin, 
   1.174 +        *                       default image / SetImageL definitions used instead.
   1.175 +        *
   1.176 +        * @aparam aIconId       SkinId for icon in query. If image not found from active skin, 
   1.177 +        *                       default icon / SetIconL definitions used instead.
   1.178 +        */      
   1.179 +        IMPORT_C void SetImageSkinIds( TAknsItemID& aImageId, TAknsItemID& aIconId );
   1.180 +        
   1.181 +        /**
   1.182 +        * @since S60 3.1
   1.183 +        * Sets additional information to be sent to secondary display.
   1.184 +        * Takes ownership of object.
   1.185 +        * Must be called before sending data to notifier to have effect.
   1.186 +        * @internal to S60
   1.187 +        *
   1.188 +        * @aparam aData Data to be sent to cover UI.
   1.189 +        */        
   1.190 +        IMPORT_C void SetSecondaryDisplayData(CAknSDData* aData);
   1.191 +    
   1.192 +    private:
   1.193 +        /**
   1.194 +        * Default constructor.
   1.195 +        */
   1.196 +        CAknGlobalProgressDialog();
   1.197 +
   1.198 +        /**
   1.199 +        * ConstructL.
   1.200 +        */
   1.201 +        void ConstructL(); 
   1.202 +
   1.203 +        /**
   1.204 +        * Update notifier.
   1.205 +        */
   1.206 +        void UpdateNotifier();
   1.207 +
   1.208 +    private:
   1.209 +        // Command send to server.
   1.210 +        TAknGlobalQueryCmd iCmd;
   1.211 +        // Final value of the process.
   1.212 +        TInt iFinalValue;
   1.213 +        // Current value of the process.
   1.214 +        TInt iValue;
   1.215 +        // Handle to session with notify server.
   1.216 +        RNotifier iNotify;
   1.217 +        // Buffer used to pass parameters to server.
   1.218 +        CBufFlat *iBuffer;
   1.219 +        // Pointer to iBuffer
   1.220 +        TPtrC8 iBufferPtr;
   1.221 +
   1.222 +        // Id of the image.
   1.223 +        TInt iImageId;
   1.224 +        // Id of the image's mask.
   1.225 +        TInt iImageMaskId;
   1.226 +        // Id of the icon.
   1.227 +        TInt iIconId;
   1.228 +        // Id of the icon's mask.
   1.229 +        TInt iIconMaskId;
   1.230 +
   1.231 +        // Icon's text.
   1.232 +        HBufC* iIconText;
   1.233 +        // Icon file name.
   1.234 +        HBufC* iIconFile;
   1.235 +        // Image file name.
   1.236 +        HBufC* iImageFile;
   1.237 +
   1.238 +        TInt   iImageSkinsMajorId;
   1.239 +        TInt   iImageSkinsMinorId;
   1.240 +
   1.241 +        TInt   iIconSkinsMajorId;
   1.242 +        TInt   iIconSkinsMinorId;
   1.243 +        CAknSDData* iAknSDData;
   1.244 +        TBuf8<1> iResultBuf; // Not really used, but needed to prevent buffer handling errors.
   1.245 +    };
   1.246 +
   1.247 +#endif // __AKNGLOBALPROGRESSDIALOG_H__