uifw/AvKon/inc/akndiscreetpopupserverhandler.h
changeset 0 2f259fa3e83a
equal deleted inserted replaced
-1:000000000000 0:2f259fa3e83a
       
     1 /*
       
     2 * Copyright (c) 2009 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:  Avkon discreet popup ui server handler.
       
    15 *
       
    16 */
       
    17 
       
    18 #ifndef C_AKNDISCREETPOPUPSERVERHANDLER_H
       
    19 #define C_AKNDISCREETPOPUPSERVERHANDLER_H
       
    20 
       
    21 #include <AknCapServerClient.h>
       
    22 #include "akndiscreetpopupdata.h"
       
    23 
       
    24 class MEikCommandObserver;
       
    25 class CAknDiscreetPopup;
       
    26 class CAknDiscreetPopupInfoHandler;
       
    27 class CAknDiscreetPopupGlobalLauncher;
       
    28 
       
    29 /**
       
    30  *  Akn Discreet Popup UI server handler.
       
    31  *
       
    32  *  @lib avkon
       
    33  *  @since S60 v5.2
       
    34  */
       
    35 NONSHARABLE_CLASS( CAknDiscreetPopupServerHandler ) : public CBase
       
    36     {
       
    37 
       
    38 public:
       
    39 
       
    40     /**
       
    41      * Two-phased constructor.
       
    42      */
       
    43     static CAknDiscreetPopupServerHandler* NewL();
       
    44 
       
    45     /**
       
    46      * Two-phased constructor.
       
    47      */
       
    48     static CAknDiscreetPopupServerHandler* NewLC();
       
    49 
       
    50     /**
       
    51      * Destructor.
       
    52      */
       
    53     virtual ~CAknDiscreetPopupServerHandler();
       
    54 
       
    55     /**
       
    56      * Launches global discreet popup via cap server.
       
    57      * 
       
    58      * @param aTitle First line of text. 
       
    59      * @param aText Second line of text.
       
    60      * @param aSkinId Icon skin item id.
       
    61      * @param aBitmapFile Icon bitmap file.
       
    62      * @param aBitmapId Icon bitmap id.
       
    63      * @param aMaskId Icon mask id.
       
    64      * @param aFlags Popup flags.
       
    65      * @param aCommand Popup command id.
       
    66      * @param aPopupId Popup id.
       
    67      * @param aCommandObserver Popup command observer.
       
    68      * @param aAppUid Application uid to be launched.
       
    69      * @param aViewUid Application view uid to be activated.
       
    70      * @param aPopupIdData Popupdata containing id for popup.
       
    71      */
       
    72     void LaunchGlobalPopupL(
       
    73             const TDesC& aTitle,
       
    74             const TDesC& aText,
       
    75             const TAknsItemID& aSkinId,
       
    76             const TDesC& aBitmapFile,
       
    77             const TInt& aBitmapId,
       
    78             const TInt& aMaskId,
       
    79             const TInt& aFlags,
       
    80             const TInt& aCommandId,
       
    81             const TInt& aPopupId,
       
    82             MEikCommandObserver* aCommandObserver,
       
    83             const TUid& aAppUid,
       
    84             const TUid& aViewUid );
       
    85 
       
    86     /**
       
    87      * Launches global discreet popup via cap server.
       
    88      * 
       
    89      * @param aResourceId Discreet popup resource id.
       
    90      * @param aResourceFile Discreet popup resource file path.
       
    91      * @param aCommand Popup command id.
       
    92      * @param aPopupId Popup id.
       
    93      * @param aCommandObserver Popup command observer.
       
    94      * @param aAppUid Application uid to be launched.
       
    95      * @param aViewUid Application view uid to be activated.
       
    96      */
       
    97     void LaunchGlobalPopupL(
       
    98             const TInt aResourceId,
       
    99             const TDesC& aResourceFile,
       
   100             const TInt& aCommandId,
       
   101             const TInt& aPopupId,
       
   102             MEikCommandObserver* aCommandObserver,
       
   103             const TUid& aAppUid,
       
   104             const TUid& aViewUid );
       
   105 
       
   106     /**
       
   107      * Requests permission to launch local popup from cap server.
       
   108      * 
       
   109      * @param aDiscreetPopup Discreet popup instance requesting the permission.
       
   110      */
       
   111     void RequestForLocalLaunch( CAknDiscreetPopup* aDiscreetPopup );
       
   112 
       
   113     /**
       
   114      * Informs handler that ui server has closed a popup.
       
   115      * 
       
   116      * @param aLauncher Popup launcher.
       
   117      */
       
   118     void PopupClosed( CAknDiscreetPopupGlobalLauncher* aLauncher );
       
   119 
       
   120     /**
       
   121      * Checks if popup id is already in use among global popups.
       
   122      * 
       
   123      * @return Next available popup id.
       
   124      */
       
   125     TInt CheckPopupId( const TInt& aPopupId );
       
   126 
       
   127     /**
       
   128      * Provides access to uiserver.
       
   129      * 
       
   130      * @return Pointer to RAknUiServer.
       
   131      */
       
   132     RAknUiServer* UiServer();
       
   133 
       
   134 private:
       
   135     
       
   136     /**
       
   137      * C++ constructor.
       
   138      */
       
   139     CAknDiscreetPopupServerHandler();
       
   140 
       
   141     /**
       
   142      * Symbian second-phase constructor.
       
   143      */
       
   144     void ConstructL();
       
   145 
       
   146     /**
       
   147      * Checks if popup id is already in use among global popups.
       
   148      * 
       
   149      * @return ETrue if popup id is already in use.
       
   150      */
       
   151     TBool PopupIdInUse( const TInt& aPopupId );
       
   152 
       
   153 private: // data
       
   154     
       
   155     /**
       
   156      * Global popup launcher array.
       
   157      */
       
   158     RPointerArray<CAknDiscreetPopupGlobalLauncher> iLaunchers;
       
   159 
       
   160     /**
       
   161      * Cap server session.
       
   162      */
       
   163     RAknUiServer iUiServer;
       
   164 
       
   165     };
       
   166 
       
   167 /**
       
   168  *  Akn Discreet Popup global launch handler.
       
   169  *
       
   170  *  @lib avkon
       
   171  *  @since S60 v5.2
       
   172  */
       
   173 NONSHARABLE_CLASS( CAknDiscreetPopupGlobalLauncher ) 
       
   174     : public CActive
       
   175     {
       
   176 
       
   177 public:
       
   178 
       
   179     /**
       
   180      * Destructor.
       
   181      */
       
   182     virtual ~CAknDiscreetPopupGlobalLauncher();
       
   183 
       
   184     /**
       
   185      * Returns stored popup data.
       
   186      * 
       
   187      * @return Pointer to stored popup data instance.
       
   188      */
       
   189     virtual TAknDiscreetPopupData* PopupData() = 0;
       
   190 
       
   191     /**
       
   192      * Launches global discreet popup via cap server.
       
   193      */
       
   194     void LaunchDiscreetPopup();
       
   195 
       
   196 // from base class CActive
       
   197     
       
   198     /**
       
   199      * Handles an active object's request completion event.
       
   200      */
       
   201     void RunL();
       
   202 
       
   203     /** 
       
   204      * Implements cancellation of an outstanding request.
       
   205      */
       
   206     void DoCancel();
       
   207 
       
   208 protected:
       
   209 
       
   210     /**
       
   211      * C++ constructor.
       
   212      * 
       
   213      * @param aHandler Popup server handler.
       
   214      * @param aObserver Command observer.
       
   215      * @param aCommandId Command id.
       
   216      */
       
   217     CAknDiscreetPopupGlobalLauncher(
       
   218             CAknDiscreetPopupServerHandler* aHandler, 
       
   219             MEikCommandObserver* aObserver,
       
   220             const TInt& aCommandId );
       
   221 
       
   222     /**
       
   223      * 2-phase constructor.
       
   224      */
       
   225     void ConstructL();
       
   226 
       
   227     /**
       
   228      * Renews the request.
       
   229      */
       
   230     void RenewRequest();
       
   231 
       
   232 private: // data
       
   233     
       
   234     /**
       
   235      * Popup command observer.
       
   236      * Not own.
       
   237      */
       
   238     MEikCommandObserver* iCommandObserver;
       
   239 
       
   240     /**
       
   241      * Popup command id.
       
   242      */
       
   243     TInt iCommandId;
       
   244 
       
   245     /**
       
   246      * Pointer to server handler.
       
   247      * Not own.
       
   248      */
       
   249     CAknDiscreetPopupServerHandler* iHandler;
       
   250 
       
   251     };
       
   252 
       
   253 /**
       
   254  *  Akn Discreet Popup global param launch handler.
       
   255  *
       
   256  *  @lib avkon
       
   257  *  @since S60 v5.2
       
   258  */
       
   259 NONSHARABLE_CLASS( CAknDiscreetPopupGlobalParamLauncher ) : public CAknDiscreetPopupGlobalLauncher
       
   260     {
       
   261 
       
   262 public:
       
   263 
       
   264     /**
       
   265      * Two-phased constructor.
       
   266      *
       
   267      * @param aHandler Popup server handler.
       
   268      * @param aObserver Command observer.
       
   269      * @param aCommandId Command id.
       
   270      */
       
   271     static CAknDiscreetPopupGlobalParamLauncher* NewL(
       
   272             CAknDiscreetPopupServerHandler* aHandler, 
       
   273             MEikCommandObserver* aObserver,
       
   274             const TInt& aCommandId,
       
   275             const TInt& aPopupId,
       
   276             const TUid& aAppUid,
       
   277             const TUid& aViewUid );
       
   278 
       
   279     /**
       
   280      * Destructor.
       
   281      */
       
   282     virtual ~CAknDiscreetPopupGlobalParamLauncher();
       
   283     
       
   284     /**
       
   285      * Sets launcher data.
       
   286      * 
       
   287      * @param aTitle First line of text. 
       
   288      * @param aText Second line of text.
       
   289      * @param aSkinId Icon skin item id.
       
   290      * @param aBitmapFile Icon bitmap file.
       
   291      * @param aBitmapId Icon bitmap id.
       
   292      * @param aMaskId Icon mask id.
       
   293      * @param aFlags Popup flags.
       
   294      * @param aCommand Popup command id.
       
   295      * @param aCommandObserver Popup command observer.
       
   296      */
       
   297     void SetData(
       
   298             const TDesC& aTitle,
       
   299             const TDesC& aText,
       
   300             const TAknsItemID& aSkinId,
       
   301             const TDesC& aBitmapFile,
       
   302             const TInt& aBitmapId,
       
   303             const TInt& aMaskId,
       
   304             const TInt& aFlags );
       
   305 
       
   306 private:
       
   307 
       
   308     /**
       
   309      * C++ constructor.
       
   310      *
       
   311      * @param aHandler Popup server handler.
       
   312      * @param aObserver Command observer.
       
   313      * @param aCommandId Command id.
       
   314      * @param aPopupId Popup id.
       
   315      * @param aAppUid Application uid to be launched.
       
   316      * @param aViewUid Application view uid to be activated.
       
   317      */
       
   318     CAknDiscreetPopupGlobalParamLauncher(
       
   319             CAknDiscreetPopupServerHandler* aHandler,
       
   320             MEikCommandObserver* aObserver,
       
   321             const TInt& aCommandId,
       
   322             const TInt& aPopupId,
       
   323             const TUid& aAppUid,
       
   324             const TUid& aViewUid );
       
   325 
       
   326     /**
       
   327      * Returns stored popup data.
       
   328      * 
       
   329      * @return Pointer to stored popup data instance.
       
   330      */
       
   331     TAknDiscreetPopupData* PopupData();
       
   332 
       
   333 private: // data
       
   334     
       
   335     /**
       
   336      * Popup data.
       
   337      */
       
   338     TAknDiscreetPopupParamData iPopupData;
       
   339     
       
   340     };
       
   341 
       
   342 /**
       
   343  *  Akn Discreet Popup global resource launch handler.
       
   344  *
       
   345  *  @lib avkon
       
   346  *  @since S60 v5.2
       
   347  */
       
   348 NONSHARABLE_CLASS( CAknDiscreetPopupGlobalResourceLauncher ) : 
       
   349     public CAknDiscreetPopupGlobalLauncher
       
   350     {
       
   351 
       
   352 public:
       
   353     
       
   354     /**
       
   355      * Two-phased constructor.
       
   356      *
       
   357      * @param aHandler Popup server handler.
       
   358      * @param aObserver Command observer.
       
   359      * @param aCommandId Command id.
       
   360      * @param aPopupId Popup id.
       
   361      * @param aAppUid Application uid to be launched.
       
   362      * @param aViewUid Application view uid to be activated.
       
   363      */
       
   364     static CAknDiscreetPopupGlobalResourceLauncher* NewL(
       
   365             CAknDiscreetPopupServerHandler* aHandler, 
       
   366             MEikCommandObserver* aObserver,
       
   367             const TInt& aCommandId,
       
   368             const TInt& aPopupId,
       
   369             const TUid& aAppUid,
       
   370             const TUid& aViewUid );
       
   371 
       
   372     /**
       
   373      * Destructor.
       
   374      */
       
   375     virtual ~CAknDiscreetPopupGlobalResourceLauncher();
       
   376     
       
   377     /**
       
   378      * Sets launcher data.
       
   379      * 
       
   380      * @param aResourceId Discreet popup resource id.
       
   381      * @param aResourceFile Discreet popup resource file path.
       
   382      */
       
   383     void SetData(
       
   384             const TInt aResourceId,
       
   385             const TDesC& aResourceFile );
       
   386 
       
   387 private:
       
   388 
       
   389     /**
       
   390      * C++ constructor.
       
   391      *
       
   392      * @param aHandler Popup server handler.
       
   393      * @param aObserver Command observer.
       
   394      * @param aCommandId Command id.
       
   395      * @param aPopupId Popup id.
       
   396      * @param aAppUid Application uid to be launched.
       
   397      * @param aViewUid Application view uid to be activated.
       
   398      */
       
   399     CAknDiscreetPopupGlobalResourceLauncher(
       
   400             CAknDiscreetPopupServerHandler* aHandler,
       
   401             MEikCommandObserver* aObserver,
       
   402             const TInt& aCommandId,
       
   403             const TInt& aPopupId,
       
   404             const TUid& aAppUid,
       
   405             const TUid& aViewUid );
       
   406 
       
   407     /**
       
   408      * Returns stored popup data.
       
   409      * 
       
   410      * @return Pointer to stored popup data instance.
       
   411      */
       
   412     TAknDiscreetPopupData* PopupData();
       
   413 
       
   414 private: // data
       
   415     
       
   416     /**
       
   417      * Popup data.
       
   418      */
       
   419     TAknDiscreetPopupResourceData iPopupData;
       
   420     
       
   421     };
       
   422 
       
   423 #endif // C_AKNDISCREETPOPUPSERVERHANDLER_H