idlehomescreen/nativeuicontroller/src/aidialogrenderer.cpp
changeset 0 f72a12da539e
child 9 f966699dea19
equal deleted inserted replaced
-1:000000000000 0:f72a12da539e
       
     1 /*
       
     2 * Copyright (c) 2005-2007 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:  Dialog renderer.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #include <e32property.h>
       
    20 #include <activeidle2domainpskeys.h>
       
    21 #include <aipropertyextension.h>
       
    22 #include <aknnotedialog.h>
       
    23 #include <avkon.rsg>
       
    24 #include <StringLoader.h>
       
    25 #include <AiNativeUi.rsg>
       
    26 #include "aidialogrenderer.h"
       
    27 #include "ainativeuiplugins.h"
       
    28 #ifdef __COVER_DISPLAY
       
    29 #include "aisecondarydisplayapi.h"
       
    30 #endif
       
    31 
       
    32 using namespace AiNativeUiController;
       
    33 
       
    34 // ======== MEMBER FUNCTIONS ========
       
    35 
       
    36 CAiDialogRenderer* CAiDialogRenderer::NewLC()
       
    37     {
       
    38     CAiDialogRenderer* self = new( ELeave ) CAiDialogRenderer;
       
    39     CleanupStack::PushL( self );
       
    40     return self;
       
    41     }
       
    42 
       
    43 
       
    44 CAiDialogRenderer::~CAiDialogRenderer()
       
    45     {
       
    46     delete iDialog;
       
    47     delete iText;
       
    48     }
       
    49 
       
    50 
       
    51 CAiDialogRenderer::CAiDialogRenderer()
       
    52     {
       
    53     }
       
    54     
       
    55 
       
    56 void CAiDialogRenderer::DoPublishL( MAiPropertyExtension& aPlugin, 
       
    57                                     TInt aContent, 
       
    58                                     TInt aResource,
       
    59                                     TInt /*aIndex*/  )
       
    60     {
       
    61     if( aPlugin.PublisherInfoL()->iUid == KDeviceStatusPluginUid )
       
    62     	{
       
    63 	    switch( aContent )
       
    64 	        {
       
    65 	        case EAiDeviceStatusContentSIMRegStatus:
       
    66 	            {
       
    67 	            TInt idleState;
       
    68 	            if ( RProperty::Get(
       
    69 	                    KPSUidAiInformation,
       
    70 	                    KActiveIdleState,
       
    71 	                    idleState ) != KErrNone )
       
    72 	                {
       
    73 	                idleState = EPSAiBackground;
       
    74 	                }
       
    75                 if( aResource == EAiDeviceStatusResourceSIMRegFail )
       
    76                     {
       
    77     	            if( iShowDialog )
       
    78 	                    {
       
    79 	                    break;
       
    80 	                    }
       
    81 	                HBufC* temp = StringLoader::LoadL( 
       
    82 	                    R_ACTIVEIDLE_SIM_REGISTRATION_FAILED );
       
    83 	                delete iText;
       
    84 	                iText = temp;
       
    85 #ifdef __COVER_DISPLAY
       
    86 	                iDialogId = EAiSimRegistrationFailed;
       
    87 #endif
       
    88 	                iShowDialog = ETrue;
       
    89                     }
       
    90 	            if ( idleState == EPSAiForeground )
       
    91                     {
       
    92   	                ShowDialogL();	                    
       
    93                     }
       
    94 	            
       
    95 	            break;
       
    96 	            }
       
    97 	        default:
       
    98 	            {
       
    99 	            User::Leave( KErrNotFound );
       
   100 	            break;
       
   101 	            }
       
   102 	        };
       
   103     	}
       
   104     else
       
   105    		{
       
   106    		User::Leave( KErrNotFound );	
       
   107    		}
       
   108     }
       
   109 
       
   110 void CAiDialogRenderer::DoCleanL( MAiPropertyExtension& /*aPlugin*/, 
       
   111                                     TInt aContent )
       
   112     {
       
   113     switch( aContent )
       
   114         {
       
   115         case EAiDeviceStatusContentSIMRegStatus:
       
   116             {
       
   117             delete iDialog;
       
   118             iDialog = NULL;
       
   119             iShowDialog = EFalse;
       
   120             break;
       
   121             }
       
   122         default:
       
   123             {
       
   124             User::Leave( KErrNotFound );
       
   125             break;
       
   126             }
       
   127         };
       
   128 
       
   129     }
       
   130     
       
   131     
       
   132 void CAiDialogRenderer::ShowDialogL()
       
   133     {
       
   134     if ( iDialog )
       
   135         {
       
   136         return;
       
   137         }
       
   138 
       
   139     iDialog = 
       
   140         new (ELeave) CAknNoteDialog( 
       
   141             reinterpret_cast< CEikDialog** >( &iDialog ),
       
   142             CAknNoteDialog::EConfirmationTone,
       
   143             CAknNoteDialog::ENoTimeout );
       
   144 
       
   145 #ifdef __COVER_DISPLAY
       
   146     iDialog->PublishDialogL( iDialogId, KAICategory );
       
   147 #endif
       
   148 
       
   149     iDialog->PrepareLC( R_AKN_INFORMATION_NOTE_DIALOG );
       
   150 
       
   151     iDialog->ButtonGroupContainer().SetCommandSetL( R_AVKON_SOFTKEYS_OK_EMPTY );
       
   152     iDialog->SetTextL( *iText );
       
   153     iDialog->RunLD();
       
   154     }
       
   155     
       
   156     
       
   157 void CAiDialogRenderer::FocusObtainedL()
       
   158     {
       
   159     if( iShowDialog )
       
   160         {
       
   161         ShowDialogL();
       
   162         }
       
   163     }