locationsystemui/locationsysui/locverifier/inc/lpdquerylauncherbase.h
branchRCL_3
changeset 44 2b4ea9893b66
parent 42 02ba3f1733c6
child 45 6b6920c56e2f
equal deleted inserted replaced
42:02ba3f1733c6 44:2b4ea9893b66
     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:  Abstract base class for queries.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef CLPDQUERYLAUNCHERBASE_H
       
    20 #define CLPDQUERYLAUNCHERBASE_H
       
    21 
       
    22 //  INCLUDES
       
    23 #include <e32base.h>
       
    24 #include <badesca.h>
       
    25 #include <coemain.h>
       
    26 #include <AknsItemID.h>
       
    27 #include <AknQueryDialog.h>
       
    28 #include <EPos_CPosPrivacyNotifier.h>
       
    29 
       
    30 
       
    31 // SYSTEM INCLUDE
       
    32 
       
    33 #include "lpddlgobserver.h"
       
    34 // FORWARD DECLARATIONS
       
    35 class CLpdGlobalPluginDialog;
       
    36 class CLpdMessagePluginDialog;
       
    37 class MLpdResultHandler;
       
    38 class CEikFormattedCellListBox;
       
    39 class CEikonEnv;
       
    40 
       
    41     
       
    42 // CLASS DECLARATION
       
    43 
       
    44 /**
       
    45 *  Base class which handles the dialog and expiration timer.
       
    46 *  Expiration timer can be used to ensure that if the user doesn't handle
       
    47 *  a dialog in certain time the dialog is closed. NOTE: In current
       
    48 *  implementation the timer is not started, i.e. dialogs never expire.
       
    49 *  Implementations of this class should notify a result handler
       
    50 *  when dialog result is available. This base class takes care of
       
    51 *  notifying possible timeout with KErrTimedOut.
       
    52 *
       
    53 *  @lib locverifierdlg.lib
       
    54 *  @since 2.1
       
    55 */
       
    56 class CLpdQueryLauncherBase : public CBase, public MLpdDlgObserver
       
    57     {
       
    58     public:  // Constructors and destructor
       
    59                 
       
    60         /**
       
    61         * Destructor. Exits possibly running dialog without callback.
       
    62         */
       
    63         virtual ~CLpdQueryLauncherBase();
       
    64 
       
    65     public: // New functions, query setup and launching
       
    66 
       
    67         /**
       
    68         * Method for creating a query dialog object and reading its
       
    69         * resources. Can and must be called once before launching.
       
    70         * @param aResourceId
       
    71         * @param aSuplNotifRequest Specifies if periodic notification request or not
       
    72         */
       
    73         virtual void PrepareQueryResourcesL( TInt aResourceId, TInt aSuplNotifRequest );
       
    74 
       
    75         /**
       
    76         * Method for setting text array.
       
    77         * @param aArray listbox array, ownership is transferred
       
    78         */
       
    79         virtual void SetQueryTextArray( MDesCArray* aArray );
       
    80 
       
    81         /**
       
    82         * Method for setting message text for Message Query dialog.
       
    83         */
       
    84 		virtual void SetMessageQueryTextL( const TDesC& aString, TCallBack aCallBack );
       
    85 		
       
    86         /**
       
    87         * Method for launching query, note that it must have been
       
    88         * correctly prepared first.
       
    89         */
       
    90         virtual void StartQueryL();
       
    91 
       
    92        /**
       
    93         * Method for launching query for supl periodic request
       
    94         * note that it must have been correctly prepared first.
       
    95         */
       
    96         virtual void StartSuplPeriodicQueryL();
       
    97 
       
    98     public: // Other new functions
       
    99 
       
   100         /**
       
   101         * This method returns indexes of selected listbox items.
       
   102         * Return value is valid after dialog has been finished
       
   103         * (not cancelled) and new one has not yet been started.
       
   104         * @return selected item indexes, ownership is not transferred
       
   105         */
       
   106         const CListBoxView::CSelectionIndexArray* SelectionIndexes() const;
       
   107 
       
   108         /**
       
   109         * Static timeout callback needed by the expiration timer.
       
   110         * @param aThis, see TCallBack documentation
       
   111         * @return always KErrNone
       
   112         */
       
   113         static TInt HandleTimeoutCallback( TAny* aThis );
       
   114         
       
   115 
       
   116         /**
       
   117         * Method for cancelling query. Client classes can call this
       
   118         * method if query canceling is needed.
       
   119         */
       
   120         void Cancel();
       
   121         
       
   122   
       
   123         void CancelQuietly();
       
   124 
       
   125         /**
       
   126         * Returns a reference to the listbox (for formatting purposes).
       
   127         * Leaves if listbox is NULL.
       
   128         * @return listbox reference
       
   129         */
       
   130         CEikFormattedCellListBox& ListBoxL();
       
   131  
       
   132         /**
       
   133          * Sets the requestor buffer array that needs to be published to
       
   134          * Cover UI
       
   135          * @param aRequestorBuffer Flat buffer containing the list of requestors
       
   136          */
       
   137         void SetRequestorBuffer( TDes8&     aRequestorBuffer );
       
   138      
       
   139         /**
       
   140          * Sets the Cover UI Command ID
       
   141          * @param aCommandId Cover UI Command
       
   142          */
       
   143         void SetCoverUICommand( TInt        aCommand );
       
   144         
       
   145 
       
   146     public: // Functions from base classes
       
   147 
       
   148         /**
       
   149         * From MLpdDlgObserver, called when dialog is dismissed.
       
   150         * This method calls also pure virtual method
       
   151         * ExtendedHandleDlgDismissedL().
       
   152         * @param aResult code of the query
       
   153         * @param aCurrentIndex current item index
       
   154         */
       
   155         void HandleDlgDismissedL( TInt aResult, TInt aCurrentIndex);
       
   156 
       
   157     protected: // Constructors and destructors
       
   158 
       
   159         /**
       
   160         * C++ constructor.
       
   161         * @param aHandler of the query result
       
   162         */
       
   163         CLpdQueryLauncherBase( MLpdResultHandler& aHandler );
       
   164 
       
   165         /**
       
   166         * Symbian 2nd phase constructor.
       
   167         */
       
   168         void BaseConstructL();
       
   169 
       
   170     protected: // New functions
       
   171 
       
   172         /**
       
   173         * This pure virtual method must be implemented
       
   174         * by the derived class to handle the result code
       
   175         * appropriately and to notify the observer of this
       
   176         * class.
       
   177         */
       
   178         virtual void ExtendedHandleDlgDismissedL() = 0;
       
   179 
       
   180     private: // New functions
       
   181 
       
   182         /**
       
   183         * Internal method for handling timeout, called from static
       
   184         * TCallBack method.
       
   185         */
       
   186         void HandleTimeout();
       
   187         
       
   188         /**
       
   189         * General internal method for exiting query, called by Cancel() or
       
   190         * HandleTimeout(), or from the destructor.
       
   191         * @param aCallback ETrue if callback from the dialog is wanted.
       
   192         */
       
   193         void ExitQuery( TBool aCallback );
       
   194    
       
   195      
       
   196         /**
       
   197          * Prepare the requestor buffers and Publish the dialog to the 
       
   198          * Cover UI
       
   199          *
       
   200          */
       
   201         void PublishDialogtoCoverL();
       
   202 
       
   203 
       
   204     protected: // Data
       
   205 
       
   206         // Reference to the result handler
       
   207         MLpdResultHandler& iHandler;
       
   208 
       
   209         // Result code from the dialog
       
   210         TInt iResult;
       
   211 
       
   212         // Current listbox item when dialog dismiss occurred
       
   213         TInt iCurrentIndex;
       
   214 
       
   215         // Selected listbox items when dialog dismiss occurred
       
   216         CListBoxView::CSelectionIndexArray* iSelectionIndex; // owns
       
   217         
       
   218         // Exit reason in case of result code EAknSoftkeyExit
       
   219         TInt iExitReason;
       
   220 
       
   221         // Indicates whether this object owns the QueryDlg or
       
   222         // whether it is given away
       
   223         TBool iOwnsQueryDlg;
       
   224        
       
   225         // Indicates whether this object owns the msgQueryDlg or
       
   226         // whether it is given away 
       
   227         TBool iOwnsMsgQueryDlg;
       
   228 
       
   229         // Pointer to the list query dialog
       
   230         CLpdGlobalPluginDialog* iQueryDlg; // owns untils RunLD() called
       
   231         
       
   232         // Pointer to the message query dialog
       
   233         CLpdMessagePluginDialog* iMsgQueryDlg;
       
   234 
       
   235         // Expiration timer, not started in current implementation
       
   236         CPeriodic* iTimer; // owns
       
   237         
       
   238         TPtrC8     iRequestorBuffer;
       
   239         
       
   240         TInt       iCoverUiCommand;                        
       
   241         
       
   242     };
       
   243 
       
   244 #endif      // CLPDQUERYLAUNCHERBASE_H   
       
   245             
       
   246 // End of File