uifw/AknGlobalUI/OldStyleNotif/Inc/AknSystemPopup.h
changeset 0 2f259fa3e83a
child 14 3320e4e6e8bb
equal deleted inserted replaced
-1:000000000000 0:2f259fa3e83a
       
     1 /*
       
     2 * Copyright (c) 2002-2008 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:  System soft notifications.
       
    15 *
       
    16 */
       
    17 
       
    18 #ifndef __AKNSYSTEMPOPUP_H__
       
    19 #define __AKNSYSTEMPOPUP_H__
       
    20 
       
    21 #include <e32std.h>
       
    22 #include <e32base.h>
       
    23 #include <eiknotapi.h>
       
    24 #include <eikcmobs.h>
       
    25 #include <aknnotedialog.h>
       
    26 #include <aknstaticnotedialog.h>
       
    27 #include <AknNotifyStd.h>
       
    28 #include <AknEcs.h>
       
    29 #include "AknNotifierControllerPlugin.h"
       
    30 #include "AknPrivateImageLoader.h"
       
    31 #include <aknSDData.h>
       
    32 #include <akndialogcontroller.h>
       
    33 #include <e32property.h>
       
    34 
       
    35 class CAknMessageReaderLongPressDetector;
       
    36 class MAknMessageNotifierObserver;
       
    37 
       
    38 const TInt KGlobalNoteTextLength = 256;
       
    39 const TInt KMinimumSoftNotePriority = 1000;
       
    40 
       
    41 NONSHARABLE_CLASS( CGlobalNoteInfo ) : public CBase
       
    42     {
       
    43 public: // Constructor and destructor.
       
    44 
       
    45     /**
       
    46      * Default constructor.
       
    47      */
       
    48     CGlobalNoteInfo();
       
    49         
       
    50     /**
       
    51      * Destructor.
       
    52      */
       
    53     ~CGlobalNoteInfo();
       
    54         
       
    55 public:
       
    56     TInt iNoteId;
       
    57     TInt iResourceId;
       
    58     CAknNoteDialog::TTimeout iTimeOut;
       
    59     CAknNoteDialog::TTone iTone;
       
    60     TBuf<KGlobalNoteTextLength> iText;
       
    61     TInt iPriority;
       
    62     TInt iSoftkeys;
       
    63     TInt iGraphic;
       
    64     TInt iGraphicMask;
       
    65     TInt iAnimation;
       
    66     TInt iPlural;
       
    67     RMessagePtr2 iMessage;
       
    68     TBool iAsync;
       
    69     TBool iTextProcessing;
       
    70     TBool iIsFromAdapter; // Indicates that global note was shown by adapter.
       
    71                           // We need this information to return correct softkey
       
    72                           // enumeration in TRequestStatus.
       
    73     CAknSDData* iSDData;
       
    74     TInt iGlobalPopupPriority;	// used to set AknGlobalPopupPriorityController priority
       
    75     
       
    76     /// Raw image data for dialog.
       
    77     TPtrC8 iImage;
       
    78     /// Custom right softkey for dialog.
       
    79     TPtrC  iRightSK;
       
    80     /// Custom left softkey for dialog.
       
    81     TPtrC  iLeftSK;
       
    82     
       
    83     TInt iAlmFlag;
       
    84     };
       
    85 
       
    86 
       
    87 struct SAknAlarmPSInfo;
       
    88 
       
    89 class MGlobalNoteObserver
       
    90     {
       
    91 public:
       
    92     virtual void GlobalNoteCompleted(TInt aCommandId) = 0;
       
    93     virtual TBool NoteWaiting() = 0;
       
    94     virtual SAknAlarmPSInfo* AlarmData() = 0;
       
    95 	virtual TBool IsAppsKeyLocked() = 0;
       
    96     virtual void SetAppsKeyLocked( TBool aLocked ) = 0;
       
    97     };
       
    98 
       
    99 
       
   100 NONSHARABLE_CLASS(CAknGlobalNoteDialog) : 
       
   101     public CAknStaticNoteDialog,
       
   102     public MAknPrivateImageLoaderObserver
       
   103     {
       
   104 public:
       
   105     CAknGlobalNoteDialog(MGlobalNoteObserver* aObserver);
       
   106     ~CAknGlobalNoteDialog();
       
   107     void UpdateNoteAndDisplayL( CGlobalNoteInfo* aInfo );
       
   108     void ConstructL();
       
   109     void NextNoteOrExit(TBool aDirectExit = EFalse);
       
   110     void SetAutoLock(TBool aAutoLock);
       
   111     /**
       
   112      * Returns reference to current grouped note window
       
   113      *
       
   114      * @return RWindow of the dialog
       
   115      */  
       
   116     RWindow& GlobalNoteWindow();
       
   117         
       
   118     void RemoveCurrentNote();
       
   119 
       
   120 private: // From MAknPrivateImageLoaderObserver
       
   121     void ImageLoadSuccess( CEikImage* aImage );
       
   122     void ImageLoadError( TInt aError );    
       
   123     
       
   124 private:
       
   125     TKeyResponse OfferKeyEventL(const TKeyEvent& aKeyEvent,TEventCode aType);
       
   126     void PreLayoutDynInitL();
       
   127     void PostLayoutDynInitL();
       
   128     TBool OkToExitL(TInt aButtonId);
       
   129     static TBool CallNextNoteOrExit(TAny* aThis);
       
   130     void HandleResourceChange(TInt aType);
       
   131     virtual void CEikDialog_Reserved_1();
       
   132     virtual void CEikDialog_Reserved_2();
       
   133     virtual void CAknNoteDialog_Reserved();
       
   134     virtual void CAknStaticNoteDialog_Reserved();
       
   135     void HandlePointerEventL(const TPointerEvent& aPointerEvent);
       
   136 
       
   137 private:
       
   138     MGlobalNoteObserver* iObserver;
       
   139     TInt iSoftkeys;
       
   140     TInt iCommand;
       
   141     TInt iControlType;
       
   142     TBool iIsSoftNotification;
       
   143     TBool iAutoLock;
       
   144     TBool iIsAlarm;
       
   145     TBool iIsAlarmWakeup;
       
   146     TInt iPreviousAnimation; // For optimizing animation usage.
       
   147     /// Flag whether dialog should be visible at the moment. Used for
       
   148     /// asynchronous image loading. 
       
   149     TBool iDialogActive;
       
   150     /// Own. Creates usable images from raw image data.
       
   151     CAknPrivateImageLoader* iImageLoader; 
       
   152     /// Previously active note. Used for optimizing image loading. 
       
   153     TInt  iPreviousNoteId; 
       
   154     /// Custom text for left softkey.
       
   155     TPtrC iSoftkeyLeft;
       
   156     /// Custom text for right softkey. 
       
   157     TPtrC iSoftkeyRight;
       
   158     };
       
   159 
       
   160 
       
   161 NONSHARABLE_CLASS(CAknGlobalNoteSubject) :
       
   162     public CBase,
       
   163     public MAknUINotifierBase,
       
   164     public MGlobalNoteObserver,
       
   165     public MAknKeyLockObserver,
       
   166     public MAknGlobalNoteController
       
   167     {
       
   168 public:
       
   169     static CAknGlobalNoteSubject* NewL(MAknKeyLockController* aKeyLockController);
       
   170     ~CAknGlobalNoteSubject();
       
   171     void ConstructL();
       
   172     
       
   173 public: // From MAknGlobalNoteController
       
   174     TInt AddSoftNotificationL(
       
   175         const TDesC& aText, 
       
   176         TInt aResource, 
       
   177         TInt aCount, 
       
   178         TInt aPriority, 
       
   179         TInt aSoftkeys, 
       
   180         TInt aTone = 0);
       
   181 
       
   182     TInt AddNoteToQueueL(
       
   183         TInt aResourceId, 
       
   184         const TDesC& aText, 
       
   185         TInt aPriority, 
       
   186         CAknNoteDialog::TTimeout aTimeout, 
       
   187         CAknNoteDialog::TTone aDefaultTone, 
       
   188         TInt aUserTone, 
       
   189         TInt aGraphic, 
       
   190         TInt aGraphicMask, 
       
   191         TInt aAnimation, 
       
   192         TInt aSoftkeys = 0);
       
   193         
       
   194     void CancelNote(TInt aNoteId, TBool aShowNext = ETrue);
       
   195 
       
   196     void TryDisplayNextNoteL(TBool aShowAsynch = EFalse);
       
   197 
       
   198     // The variable aTime is deprecated, the alarm note content should be 
       
   199     // described in the descriptor aDescription.
       
   200     TInt DisplayAlarmL(TInt aType,const TDesC& aDescription, const TDesC& aTime);
       
   201 
       
   202     // The variable aTime is deprecated, the alarm note content should be 
       
   203     // described in the descriptor aDescription.
       
   204     void AddAlarmAdditionalInfo( 
       
   205         TInt aType,
       
   206         const TDesC& aTime,
       
   207         const TDesC& aDate,
       
   208         const TDesC& aSubject,
       
   209         const TDesC& aLocation);
       
   210 
       
   211 public: // New methods
       
   212     /**
       
   213      * Adds new soft notification to queue.
       
   214      * 
       
   215      * @param aText Text of the soft notification.
       
   216      * @param aCount Count of items in the soft notification.
       
   217      * @param aPriority Visibility priority of the soft notification.
       
   218      * @param aTone Tone played when soft notification is shown.
       
   219      * @param aLeftSk Custom left softkey. 
       
   220      * @param aRightSk Custom right softkey.
       
   221      * @param aImage Raw image data for soft notification dialog. 
       
   222      */
       
   223     TInt AddSoftNotificationL( 
       
   224         const TDesC& aText, 
       
   225         TInt aCount,
       
   226         TInt aPriority, 
       
   227         TInt aTone,
       
   228         const TDesC& aLeftSK,
       
   229         const TDesC& aRightSK,
       
   230         const TDesC8& aImage );
       
   231     
       
   232     void DisplayNextNoteL();
       
   233 
       
   234     void SetSoftNoteObserver(MSoftNotificationObserver* aObserver);
       
   235     void SetNotificationDialogObserver(MSoftNotificationObserver* aObserver);
       
   236     TInt NotePlural(TInt aNoteId);
       
   237     const TDesC& NoteText(TInt aNoteId);
       
   238     void SetMaxDisplayPriorityL(TInt aPriority, TInt aDelay = 0);
       
   239     TInt StackCount();
       
   240     static TInt CallDisplayNextNote(TAny* aThis);
       
   241     
       
   242     void SetMessageNotifierObserver( MAknMessageNotifierObserver* aMessageNotifierObserver );
       
   243     TBool SetSDData(TInt aNoteId, CAknSDData* aData);                                      
       
   244 
       
   245 private:
       
   246     // RProperty listener for autolock status.
       
   247     NONSHARABLE_CLASS(CSubscriber) : public CActive
       
   248         {
       
   249     public: // New functions.
       
   250         CSubscriber(TCallBack aCallBack, RProperty& aProperty);
       
   251         ~CSubscriber();
       
   252         void Subscribe();
       
   253         void StopSubscribe();
       
   254     private: // From CActive.
       
   255         void RunL();
       
   256         void DoCancel();
       
   257     private:
       
   258         TCallBack iCallBack;
       
   259         RProperty& iProperty;
       
   260         };    
       
   261 
       
   262 private:
       
   263     CAknGlobalNoteSubject(MAknKeyLockController* aKeyLockController);
       
   264 
       
   265     //From MEikSrvNotifierBase
       
   266     virtual void Release();
       
   267     virtual TNotifierInfo RegisterL();
       
   268     virtual TNotifierInfo Info() const;
       
   269     virtual TPtrC8 StartL(const TDesC8& aBuffer);
       
   270     virtual void StartL(const TDesC8& aBuffer, TInt aReplySlot, const RMessagePtr2& aMessage);
       
   271     virtual void Cancel();
       
   272     virtual TPtrC8 UpdateL(const TDesC8& aBuffer);
       
   273 
       
   274     virtual void KeyPressed(const TKeyEvent& aKeyEvent, TEventCode aType);
       
   275 
       
   276     TInt AddNoteToQueueL(TInt aResourceId, TInt aPriority, TInt aTone, TInt aPreallocatedNoteId = 0);
       
   277     void CancelOustandingRequests();
       
   278     
       
   279     // From MGlobalNoteObserver
       
   280     virtual void GlobalNoteCompleted(TInt aCommandId);
       
   281     virtual TBool NoteWaiting();
       
   282 	virtual TBool IsAppsKeyLocked();
       
   283     virtual void SetAppsKeyLocked( TBool aLocked );
       
   284 
       
   285     void HighestPriorityNote(TInt& aIndex, TInt& aPriority);
       
   286     CGlobalNoteInfo* Note( TInt aNoteId );
       
   287     TInt NoteIndex(TInt aNoteId);
       
   288     TInt PermanentNotesCount() const;
       
   289 
       
   290     // From MAknKeyLockObserver
       
   291     void KeyLockStatusChange(TKeyLockStatus aStatus);
       
   292 	void CancelNote( TInt aNoteId, TBool aShowNext, TBool aDeleteNoteInfo );
       
   293     // Handles changes in autolock status.
       
   294     static TInt AutolockStatusNotificationL(TAny* aObj);  
       
   295     void HandleAutolockStatusNotificationL(); 
       
   296     
       
   297     TInt AddNoteToQueueL(
       
   298         TInt aResourceId, 
       
   299         const TDesC& aText, 
       
   300         TInt aPriority, 
       
   301         CAknNoteDialog::TTimeout aTimeout, 
       
   302         CAknNoteDialog::TTone aDefaultTone, 
       
   303         TInt aUserTone, 
       
   304         TInt aGraphic, 
       
   305         TInt aGraphicMask, 
       
   306         TInt aAnimation, 
       
   307         TInt aSoftkeys,
       
   308         TInt aPreallocatedNoteId);
       
   309 
       
   310     TBool IsPreallocatedNoteIdValid(const TInt aPreallocatedNoteId);
       
   311 
       
   312 private:
       
   313     TPckgBuf<SAknGlobalNoteReturnParams> iRetPckg;
       
   314     TNotifierInfo iInfo;
       
   315     MAknKeyLockController* iKeyLockController;
       
   316     CArrayFixFlat<CGlobalNoteInfo*>* iGlobalNoteList;
       
   317     TInt iDisplayingNoteId;
       
   318     TInt iNoteId;
       
   319     CAknGlobalNoteDialog* iGlobalNote;
       
   320     MSoftNotificationObserver* iSoftNoteObserver;
       
   321     MSoftNotificationObserver* iNotificationDialogObserver;
       
   322     TInt iMaxDisplayPriority;
       
   323     TInt iMaxDisplayPriorityLimit;
       
   324     CAknEcsDetector* iEcsDetector;
       
   325     TBool iNotesDisabled;
       
   326     TInt iPreviousDisplayPriority;
       
   327     CAsyncCallBack* iDisplayCallback;
       
   328     CNotifierDialogController* iDialogController;
       
   329 
       
   330     TInt iAutoLock;
       
   331     TInt iCurrentPriority;
       
   332 
       
   333     friend class CAknGlobalNoteDialog;
       
   334 
       
   335     CIdle* iIdle;
       
   336     static TInt EnableAutolockEmulation(TAny* aThis);
       
   337 
       
   338     virtual SAknAlarmPSInfo* AlarmData() {return iAlarmData;}
       
   339     SAknAlarmPSInfo* iAlarmData;
       
   340     
       
   341     TBool iAppsKeyLocked;
       
   342 
       
   343     CAknMessageReaderLongPressDetector* iMessageReaderLongPressDetector;
       
   344 
       
   345     CSubscriber*            iAutolockStatusSubscriber;
       
   346     RProperty               iAutolockStatusProperty;
       
   347     };
       
   348 
       
   349 #endif // __AKNSYSTEMPOPUP_H__
       
   350 
       
   351 // End of File