cbs/cbsui/UiSrc/CCbsUiConfirmationNote.cpp
branchRCL_3
changeset 20 987c9837762f
parent 0 ff3b6d0fd310
equal deleted inserted replaced
19:7d48bed6ce0c 20:987c9837762f
       
     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: 
       
    15 *     Implementation for CCbsUiConfirmationNote.
       
    16 *
       
    17 *
       
    18 */
       
    19 
       
    20 
       
    21 // INCLUDES
       
    22 #include <AknGlobalConfirmationQuery.h>
       
    23 #include <StringLoader.h>
       
    24 #include <CbsUiApp.rsg>
       
    25 #include "CCbsUiConfirmationNote.h"
       
    26 
       
    27 
       
    28 // MODULE DATA STRUCTURES
       
    29 
       
    30 /**
       
    31  * Global Confirmation query observer. Doesn't do anything.
       
    32  */
       
    33 class CCbsUiConfirmationNote::CGlobalConfirmationQueryObserver : 
       
    34     public CActive
       
    35     {
       
    36     public: // constructor
       
    37 
       
    38         inline CGlobalConfirmationQueryObserver() : CActive(EPriorityIdle) 
       
    39             {
       
    40             }
       
    41 
       
    42         inline ~CGlobalConfirmationQueryObserver() 
       
    43             { 
       
    44             Cancel(); 
       
    45             }
       
    46 
       
    47         inline void ConstructL() 
       
    48             {
       
    49             CActiveScheduler::Add(this);
       
    50             SetActive();
       
    51             }
       
    52 
       
    53     public: // from CActive
       
    54 
       
    55     	void DoCancel() 
       
    56             { 
       
    57             }
       
    58 
       
    59 	    void RunL() 
       
    60             {
       
    61             Cancel(); 
       
    62             }
       
    63     };
       
    64 
       
    65 // ================= MEMBER FUNCTIONS =======================
       
    66 
       
    67 CCbsUiConfirmationNote::CCbsUiConfirmationNote()
       
    68     {
       
    69     }
       
    70 
       
    71 CCbsUiConfirmationNote::~CCbsUiConfirmationNote()
       
    72     {
       
    73     delete iConfQueryObserver;
       
    74     delete iGlobalConfirmationQuery;
       
    75     }
       
    76 
       
    77 
       
    78 // ---------------------------------------------------------
       
    79 // CCbsUiConfirmationNote::ShowGlobalConfirmationNoteL
       
    80 // 
       
    81 // (other items were commented in a header).
       
    82 // ---------------------------------------------------------
       
    83 //
       
    84 void CCbsUiConfirmationNote::ShowGlobalConfirmationNoteL( CCoeEnv& aCoeEnv )
       
    85     {
       
    86     // create active object
       
    87     CGlobalConfirmationQueryObserver* observer = 
       
    88         new (ELeave) CGlobalConfirmationQueryObserver();
       
    89 
       
    90     if (iConfQueryObserver)
       
    91         {
       
    92         delete iConfQueryObserver;
       
    93         iConfQueryObserver = NULL;
       
    94         }
       
    95     iConfQueryObserver = observer;
       
    96     iConfQueryObserver->ConstructL();
       
    97 
       
    98     // show critical level note
       
    99     CAknGlobalConfirmationQuery* dlg = CAknGlobalConfirmationQuery::NewL();
       
   100     if (iGlobalConfirmationQuery)
       
   101         {
       
   102         delete iGlobalConfirmationQuery;
       
   103         iGlobalConfirmationQuery = NULL;
       
   104         }
       
   105     iGlobalConfirmationQuery = dlg;
       
   106 
       
   107     HBufC* noteText = StringLoader::LoadLC(
       
   108         R_TEXT_NOTE_NOT_ENOUGH_MEMORY, &aCoeEnv);
       
   109     
       
   110     iGlobalConfirmationQuery->ShowConfirmationQueryL(
       
   111         iConfQueryObserver->iStatus,
       
   112         *noteText, 
       
   113         R_AVKON_SOFTKEYS_OK_EMPTY);
       
   114 
       
   115     CleanupStack::PopAndDestroy(noteText);
       
   116     }
       
   117 
       
   118 
       
   119 //  End of File